query
stringlengths
7
9.55k
document
stringlengths
10
363k
metadata
dict
negatives
sequencelengths
0
101
negative_scores
sequencelengths
0
101
document_score
stringlengths
3
10
document_rank
stringclasses
102 values
Never trust parameters from the scary internet, only allow the white list through.
def event_params params[:event].permit(:when, :body, :source, :image) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
To exclude classes that have invalid class name, e.g. primary::SchemaMigration from Rails test
def invalid_class_name?(model_class) model_class.name.constantize false rescue NameError true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sanitize_class_name(name)\n name.gsub(/[^_0-9A-Za-z:]/, '')\n end", "def stripped_class_name\n name.demodulize\n end", "def to_class\n @migration_class ||= migration_class_name.constantize\n rescue NameError => e\n @name_error = true\n\n raise e unless e.missing_name.eql?(migration_class_name)\n\n puts \"WARNING: Migration-Class not found '#{migration_class_name}'\"\n end", "def skip_class?(klass)\n (klass.class.name != klass.base_class.class.name) || klass.abstract_class? ||\n (printed_tables.include? klass.table_name) || (DatabaseDocumenter.configuration.skipped_modules.include? klass.parent.name)\n end", "def check_class_support\n klass = self.class.name.demodulize\n\n if classes_supported_by_rest_api.exclude? klass\n raise \"The #{klass} is unsupported for the REST API. \" \\\n \"Only the following are supported: #{classes_supported_by_rest_api.join(',')}\"\n end\n end", "def sanitize_model_class( model )\n model.name.split(\"::\").last\n end", "def safe_class_name()\n self.class.name.downcase.gsub(/[^\\d\\w]/, '_')\n end", "def validate_class_name(name)\n only_basic_type(name) || name.gsub(/-/, \"_\").camelcase\n end", "def use_with_class_names\n (\n DynamicModel.model_names +\n ExternalIdentifier.model_names +\n ActivityLog.model_names +\n Master::PrimaryAssociations\n )\n .map { |m| m.to_s.singularize }\n .select { |m| m != 'master' }\n end", "def ignored_classes\n Set.new [\n # 'Vedeu::API',\n # 'Vedeu::Application',\n # 'Vedeu::Background',\n # 'Vedeu::Buffers',\n # 'Vedeu::Clear',\n 'Vedeu::Coercions',\n 'Vedeu::Colour',\n 'Vedeu::ColourTranslator',\n 'Vedeu::Common',\n # 'Vedeu::Composition',\n # 'Vedeu::Compositor',\n 'Vedeu::Configuration',\n # 'Vedeu::Cursor',\n # 'Vedeu::Cursors',\n 'Vedeu::Esc',\n 'Vedeu::Event',\n # 'Vedeu::Events',\n # 'Vedeu::Focus',\n # 'Vedeu::Foreground',\n 'Vedeu::Geometry',\n # 'Vedeu::Grid',\n # 'Vedeu::Groups',\n # 'Vedeu::Input',\n # 'Vedeu::Interface',\n # 'Vedeu::Interfaces',\n # 'Vedeu::Keymap',\n # 'Vedeu::Keymaps',\n # 'Vedeu::KeymapValidator',\n # 'Vedeu::Launcher',\n # 'Vedeu::Line',\n 'Vedeu::Log',\n # 'Vedeu::Menu',\n # 'Vedeu::Menus',\n 'Vedeu::MonoLogger',\n # 'Vedeu::Offset',\n # 'Vedeu::Offsets',\n 'Vedeu::Position',\n 'Vedeu::Presentation',\n # 'Vedeu::Refresh',\n # 'Vedeu::Registrar',\n # 'Vedeu::Render',\n 'Vedeu::Repository',\n 'Vedeu::Stream',\n 'Vedeu::Style',\n 'Vedeu::Terminal',\n 'Vedeu::Trace',\n # 'Vedeu::View',\n # 'Vedeu::Viewport',\n ]\n end", "def grep_model_files_for_classes\n re = /class (?<klass>\\w+)/\n\n Dir.glob(Rails.root.join('app/models/*.rb')).\n map { |f| File.readlines(f).grep(/\\bclass /) }.flatten.\n map { |s| re.match(s)[:klass] }.map(&:constantize).\n reject do |klass|\n klass.respond_to?(:abstract_class?) && klass.abstract_class?\n end\nend", "def skipped?\n !klass || !klass.ancestors.include?(ActiveRecord::Base) || @nodoc\n end", "def validate_class_names\n bpmn_xml.modularized_class_names.each do |class_name|\n validate_constant_name(class_name.demodulize, module_name)\n end\n puts set_color(\"External tasks with the same topic name as the BPMN id will be created.\", :bold)\n colorized_class_names = bpmn_xml.modularized_class_names.map! { |class_name| set_color class_name, :red }\n puts colorized_class_names.join(\"\\n\")\n end", "def makena_classes\n Rails.application.eager_load!\n pass = ActiveRecord::Base.descendants.map{|a| a.to_s}\n pass.shift\n pass\n end", "def ignored_for(klass)\n klass.to_s.classify.constantize.find ignores_for(klass).map(&:ignoreable_id)\n end", "def destroy_model_class(name)\n if name.is_a?(Hash) && name.size == 1\n class_name, superclass_name = *name.to_a.flatten\n else\n class_name, superclass_name = name, 'ActiveRecord::Base'\n end\n need_table = superclass_name.to_s == 'ActiveRecord::Base'\n\n table_name = class_name.to_s.underscore.pluralize\n ActiveRecord::Base.connection.drop_table(table_name) if need_table\n Object.send(:remove_const, class_name)\n end", "def slideClasses\n blacklist = ['bigtext']\n @classes.reject { |klass| blacklist.include? klass }\n end", "def trim_classes\n deletions = 1\n while deletions > 0 do\n deletions = 0\n @classes.each do |cls, value|\n next unless value.fetch(:sub_classes, {}).empty? && !value.has_key?(:examples)\n deletions += 1\n @classes.delete(cls)\n sc = value[:super_class]\n next unless sc\n puts \"trim class #{cls}, super-class #{sc}\"\n @classes[sc][:sub_classes].delete(cls) if @classes.fetch(sc, {})[:sub_classes]\n end\n end\n end", "def class_unqualified_name(clazz)\n name = clazz.name\n if name =~ /::([^:]+)$/\n $1\n else\n name\n end\n end", "def without_class?(name)\n a = []\n \n each do |e|\n if !e.get(\"className\").split(\" \").index(name)\n a << e\n end\n end\n \n JS::Collection.new(a)\n end", "def filter_invalid_changesets\n self.changeset_class.exists?(self.changeset_id)\n end", "def assert_skipped_migration(name)\n migration_file = \"#{RAILS_ROOT}/db/migrate/001_#{name.to_s.underscore}.rb\"\n assert !File.exist?(migration_file), \"should not create migration #{migration_file}\"\n end", "def prune_dependencies\n class_names = @classes.map {|klass| klass.name}\n @classes.each do |klass|\n klass.dependencies = klass.dependencies.uniq.keep_if {|dep| class_names.include?(dep)}\n end\n end", "def has_any? klass\n not find_all(\"class\", klass).empty?\n end", "def remove_class(names = T.unsafe(nil)); end", "def classes\n @_classes ||= vedeu_classes - vedeu_exceptions - ignored_classes\n end", "def ensure_mappings_define_klass\n klassless_mappings = @columns.\n select { |mapping| mapping.nil? || mapping['klass'].nil? }.\n reject { |mapping| mapping['do_not_capture'] }.\n map { |mapping| mapping['column'] || mapping['standard_mapping'] }\n\n return if klassless_mappings.empty?\n\n # All column mappings for the single item file require a klass definition.\n fail \"Missing klass for column(s): #{klassless_mappings.to_sentence}\"\n end", "def migration_class_name\n migration_name.camelize\n end", "def all_from_class\n begin\n class_name.all\n rescue\n @errors << {message: \"Unable to find this class in the database.\", variable: \"class_name\"}\n []\n end \n end", "def prevent_regenerate_model\n return if force_regenerate || !ready_to_generate?\n\n got_class = begin\n full_implementation_class_name.constantize\n rescue StandardError\n nil\n end\n return unless got_class&.to_s&.start_with?(self.class.implementation_prefix)\n\n return unless fields_match_columns?\n\n table_changed = got_class.table_name != table_name\n if table_changed\n msg = \"Table name changed in definition #{self}: \" \\\n \"current #{got_class.table_name} != #{table_name}\"\n Rails.logger.warn msg\n puts msg if Rails.env.test?\n return\n end\n\n got_class\n end", "def new_classes(snapshot)\n self.classes do |klass|\n if !snapshot.include?(klass)\n klass\n end\n end\n end", "def list_known_classes\n end", "def classes\n raise CapabilitiesExceeded\n end", "def classnames_to_check(object)\n names = []\n clazz = object.getClass\n while clazz\n names << clazz.getName\n clazz.getInterfaces.each {|i| names << i.getName}\n clazz = clazz.getSuperclass\n end\n \n names.uniq\n end", "def lookup_class\r\n ObjectSpace.each_object(Class) do |obj|\r\n return obj if obj.ancestors.include?(Rails::Generator::Base) and\r\n obj.name.split('::').last == class_name\r\n end\r\n raise NameError, \"Missing #{class_name} class in #{class_file}\"\r\n end", "def retrieve_models_exclude(env)\n env['MODELS_EXCLUDE'].to_s\n .split(',')\n .collect { |x| x.strip.underscore.singularize.camelize.constantize }\n end", "def clean_table_name(table_name)\n class_from_table_name(table_name)&.table_name\n end", "def ignored_translation_table_colums(klass); end", "def remove_class c\n each do |q|\n str = q.get_attribute(\"class\")\n\n str = str.split(\" \").find_all do |n|\n n != c.to_s\n end.join(\" \")\n \n q.set_attribute(\"class\",str)\n end\n end", "def custom_class_present?(cls)\n custom_class.to_s.split.include?(cls)\n end", "def database_classes system_classes: nil\n\t\t@actual_class_hash = get_classes('name', 'superClass') \n all_classes = get_classes('name').map(&:values).sort.flatten\n all_user_classes = all_classes - system_classes()\n\n all_user_classes.each{|x| ActiveOrient.database_classes[x] = \"unset\" unless ActiveOrient.database_classes.has_key?(x) }\n \n ActiveOrient.database_classes.keys # return an array of database-classnames\n end", "def excluded_models; %w[Tenant] end", "def validate!\n validations.each do |name, attributes|\n valid = instance_variable_get(name)\n case attributes[0]\n when :presence\n raise \"Class object didn't create.\" if valid !~ /^.{1}+/.freeze\n when :format\n raise \"Class object didn't create.\" if valid !~ attributes[1]\n when :type\n raise \"Class object didn't create.\" unless valid.is_a? attributes[1]\n end\n end\n end", "def should_create?(klass)\n table_name = klass.to_s.tableize\n ActiveRecord::Base.connection.table_exists?(table_name) && !klass.any?\n end", "def crazy_model_classes\n [:Task, :Subtask, :TaskConnection, :Photo]\nend", "def ensure_class_name_security(field)\n if field.class_name =~ /^Locomotive::ContentEntry([a-z0-9]+)$/\n # if the content type does not exist (anymore), bypass the security checking\n content_type = Locomotive::ContentType.find($1) rescue return\n\n if content_type.site_id != self.site_id\n field.errors.add :class_name, :security\n end\n else\n # for now, does not allow external classes\n field.errors.add :class_name, :security\n end\n end", "def klass\n name.gsub(module_name+\"::\",\"\")\n end", "def list_known_classes names = []\n classes = []\n stores.each do |store|\n classes << store.modules\n end\n classes = classes.flatten.uniq.sort\n unless names.empty? then\n filter = Regexp.union names.map { |name| /^#{name}/ }\n classes = classes.grep filter\n end\n puts classes.join(\"\\n\")\n end", "def ensure_correct_class!(model_instance)\n unless model_instance.kind_of?(model_class)\n raise %{Whoa! The LowCardAssociation '#{association_name}' for class #{model_class} somehow\nwas passed a model of class #{model_instance.class} (model: #{model_instance}),\nwhich is not of the correct class.}\n end\n end", "def remove_subclasses\n\t\tself.subclasses.each do |klass|\n\t\t\tfront = klass.name\n\t\t\tif /::/.match(front)\n\t\t\t\tfront,back = parts(klass.name)\n\t\t\t\tfront_class = front.split('::').inject(Object) { |o,n| o.const_get n }\n\t\t\t\tfront_class.__send__(:remove_const, back)\n\t\t\telse\n\t\t\t\tObject.__send__(:remove_const, front)\n\t\t\tend\n\t\tend\n\t\tnil\n\tend", "def class_names\n classes.map &:name\n end", "def types_that_skip_validation_and_callbacks\n @types_that_skip_validation_and_callbacks ||= [Task, *Task.descendants, Hearing, CavcRemand]\n end", "def can_create_pluralized_model_for?(klass)\n !klass.to_s.match(/^\\#/)\n end", "def safe_constantize\n ActiveSupport::Inflector.safe_constantize(self)\n end", "def demodulize(class_name_in_module)\n class_name_in_module.to_s.gsub(/^.*::/, '')\n end", "def demodulize(class_name_in_module)\n class_name_in_module.to_s.gsub(/^.*::/, '')\n end", "def list_known_classes(classes)\n raise NotImplementedError\n end", "def class_name\n Jaspion::Kilza::Class.normalize(@original_name)\n end", "def validate_reader_class\n begin\n reader_class\n rescue\n errors.add(:importer_class, 'not found, see docs for supported classes')\n end\n end", "def demodulize(class_name_in_module)\n class_name_in_module.to_s.gsub(/^.*::/, '')\n end", "def not_reserved\n errors.add(:name, 'is reserved') if self.name.downcase.in?(self.class.reserved_names)\n end", "def safe_constantize\n MotionSupport::Inflector.safe_constantize(self)\n end", "def findExactClassMatch(name)\n fname = name.tr(':', '_')\n return ClassIndex.classExists?(fname)\n end", "def underscorized_classname\n self.class.name.split(\"::\").last.\n gsub( /([A-Z]+)([A-Z][a-z])/, '\\1_\\2' ).\n gsub( /([a-z\\d])([A-Z])/, '\\1_\\2' ).downcase\n end", "def defined_classes\n # TODO: check content type before scanning\n content.scan(/\\s*class\\s+([A-Za-z0-9_\\.]*)/).flatten\n end", "def retain_class_name\n @retain_class_name ||= \"Retain::\" + my_class_name.to_s.sub(/.*::/, \"\")\n end", "def full_class_name\n @class_names.join(\"::\")\n end", "def remove_class(name = T.unsafe(nil)); end", "def remove_class(name = T.unsafe(nil)); end", "def _class\n special_attribute('@class'.freeze) || self.class.name.demodulize\n end", "def model_class\n self.name.gsub(/Test$/, '').constantize\n end", "def hide(*classOrModules)\n\t\tclassOrModules.each do |classOrModule|\n\t\t\t@ignored[classOrModule] = true\n\t\tend\n\tend", "def class_delete class_name\n\t\t\t\t@monitor.synchronize do\n\t\t\t\t\tproviders.each{|p| p.class_delete class_name}\n\t\t\t\tend\n\t\t\tend", "def migrate_is_a_class_method?\n (::ActiveRecord::VERSION::MAJOR <= 3 && ::ActiveRecord::VERSION::MINOR == 0)\n end", "def remove_table_not_exist_foreign_keys\n @foreign_keys.each do |table, foreign_keys|\n foreign_keys.delete_if do |key|\n if key.is_a?(String) && key =~ /_id$/\n class_name = Prepares.model_associations.get_association_class_name(table, key[0..-4])\n class_name ? !@table_nodes[class_name.gsub('::', '').tableize] : !@table_nodes[key[0..-4].pluralize]\n end\n end\n end\n end", "def ensure_class_name_security(field)\n if field.class_name =~ /^Locomotive::ContentEntry([a-z0-9]+)$/\n # if the content type does not exist (anymore), bypass the security checking\n content_type = Locomotive::ContentType.find($1) rescue nil\n\n return if content_type.nil?\n\n if content_type.site_id != self.site_id\n field.errors.add :class_name, :security\n end\n else\n # for now, does not allow external classes\n field.errors.add :class_name, :security\n end\n end", "def remove_classes(*args)\n args.each {|x| self.remove_class(x) }\n return self\n end", "def deconstantize\n ActiveSupport::Inflector.deconstantize(self)\n end", "def deconstantize\n ActiveSupport::Inflector.deconstantize(self)\n end", "def assert_generated_class(name,parent=nil)\n parts = name.split('.')\n path = parts.join(File::SEPARATOR)\n path << '.as'\n if(parent)\n path = File.join(parent, path)\n end\n # class_name=$2.camelize\n path = \"#{Sprout::Sprout.project_path}/#{path}\"\n class_name = parts.pop\n package_name = parts.join('.')\n assert_generated_file(path) do |body|\n assert(body=~ /package #{package_name}/, \"Generated class #{name} does not have expected package definition\")\n assert(body=~ /public class #{class_name}/, \"Generated class #{name} does not have expected class defintion\")\n\n# assert body=~/class #{class_name}#{parent.nil? ? '':\" < #{parent}\"}/,\"the file '#{path}.as' should be a class\"\n yield body if block_given?\n end\n end", "def invalid_field_error_class\n (\"Invalid\" + self.field_name.split(\"_\").map(&:capitalize).join + \\\n \"FieldError\").classify.safe_constantize\n end", "def remove_class_variable(sym) end", "def findClassesThatMatch(name)\n fname = name.tr(':', '_')\n return ClassIndex.findClasses(fname)\n end", "def deconstantize\n MotionSupport::Inflector.deconstantize(self)\n end", "def classes\n return [] unless classes = self[\"class\"]\n classes.strip.split(/\\s+/)\n end", "def makena_classes_u\n passsingles = makena_classes.map{|a| a.to_s.underscore}\n passsingles - makena_classes_doubled\n end", "def wont_be_instance_of(cls, msg=nil)\n InstanceAssay.refute!(self, cls, :message=>msg, :backtrace=>caller)\n end", "def safe_class?\n true\n end", "def class_names\n return if @class_names.empty?\n @class_names.uniq.sort\n end", "def schema?(model_class)\n model_class.name == 'ActiveRecord::SchemaMigration'\n end", "def test_case_classes\n classes = self.test_cases.dup\n classes.collect do |file|\n actionscript_file_to_class_name(file)\n end\n end", "def remove_class(names = nil)\n kwattr_remove(\"class\", names)\n end", "def ensure_klass_exists!\n klass\n end", "def class_names\n descendants.map(&:name)\n end", "def ignore_exts\n @ext_rules.reject\n end", "def exclude\n [exceptions, self.class.exclude_always, foreign_key, polymorphic_type].flatten.uniq\n end", "def validate_whitelisted_class_names(kd_el)\n # TODO: flesh out :block vs. :span context detection. This is very crude.\n context = case kd_el.type\n when :p, :record_mark, :header, :hr\n :block\n when :em, :strong\n :span\n when :gap_mark, :root, :subtitle_mark, :text\n # These don't have classes\n return true\n else\n raise \"Handle this element type: #{ kd_el.type.inspect }\"\n end\n whitelisted_class_names = ::Repositext::Validation::Validator::KramdownSyntaxAt.whitelisted_class_names.find_all { |e|\n e[:allowed_contexts].include?(context)\n }.map { |e| e[:name] }\n if (\n (klasses = kd_el.attr['class']) &&\n klasses.split(' ').any? { |k| !whitelisted_class_names.include?(k) }\n )\n st, li = (lo = kd_el.options[:location]) && lo.values_at(:story, :line)\n @validation_errors << ::Repositext::Validation::Reportable.error(\n {\n filename: @validation_file_descriptor,\n line: li,\n context: sprintf(\"story %5s\", st),\n },\n ['Invalid class name', \"#{ klasses }\", \"on element #{ kd_el.type}\"]\n )\n end\n end", "def add_class(name)\n @catalog.add_class(name) unless name == \"\"\n end", "def excluded; end", "def remove_name_classifications(proto_record)\n proto_record[:full_name] = proto_record[:full_name].sub(/\\s-\\s[A-Z\\s]*/, '')\n end" ]
[ "0.63559544", "0.6169546", "0.61659116", "0.6155963", "0.61371636", "0.6052975", "0.5959054", "0.59319746", "0.58163273", "0.57912296", "0.575814", "0.57039446", "0.5702761", "0.5694757", "0.56555057", "0.56418437", "0.56184244", "0.5617235", "0.55745715", "0.5560626", "0.5555429", "0.5555263", "0.55386335", "0.55227005", "0.5489363", "0.5475697", "0.5460264", "0.545899", "0.5443318", "0.5434784", "0.54116565", "0.5367228", "0.5346991", "0.5338353", "0.5336388", "0.5327674", "0.5316899", "0.52993536", "0.5291154", "0.5291132", "0.52907836", "0.5274175", "0.5244891", "0.52378625", "0.522885", "0.521994", "0.521651", "0.5211534", "0.5206665", "0.5201318", "0.51887435", "0.51878965", "0.5181746", "0.51766944", "0.51721555", "0.51721555", "0.5167223", "0.5164828", "0.51537544", "0.5153215", "0.5145485", "0.51395774", "0.5132715", "0.5130847", "0.5127605", "0.51239586", "0.5120022", "0.5118518", "0.5118518", "0.51030016", "0.5096271", "0.5095444", "0.5090461", "0.5086401", "0.5075634", "0.50731546", "0.5067294", "0.5065755", "0.5065755", "0.5064394", "0.50534755", "0.5052165", "0.5051452", "0.50420606", "0.50349283", "0.50299454", "0.5026688", "0.50258774", "0.5023352", "0.50205445", "0.50124955", "0.50054073", "0.500342", "0.49967888", "0.49936578", "0.49933416", "0.4988967", "0.49873888", "0.49868467", "0.49830887" ]
0.61428607
4
before_action :configure_account_update_params, only: [:update] GET /resource/sign_up
def new super do @token = params[:invite_token] @errors_service = [] return healthcheck_service unless @token.nil? end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def configure_account_update_params\n devise_parameter_sanitizer.permit(\n :account_update, keys: authentication_params(type: :sign_up)\n )\n end", "def configure_sign_up_params\n devise_parameter_sanitizer.permit(:sign_up, keys: [:email,:password, :password_confirmation, :first_name, :last_name, :circonscription])\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :email, :password, :password_confirmation, :circonscription])\n end", "def configure_update_params\n allow_params(:account_update)\n 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 configure_sign_up_params\n #devise_parameter_sanitizer.for(:sign_up) << :email, :password, :password_confirmation\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(:email, :password, :password_confirmation, :picture, :bio, :username ) }\n\n devise_parameter_sanitizer.for(:account_update) << :bio\n devise_parameter_sanitizer.for(:account_update) << :role\n devise_parameter_sanitizer.for(:account_update) << :type\n devise_parameter_sanitizer.for(:account_update) << :picture\n devise_parameter_sanitizer.for(:account_update) << :username\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:email,\n :password, :username, :first_name, :last_name])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :email, :password, :password_confirmation, :about, :profile_pic, :role, :display_title, :skype_id, :linkedin_url, :github_url])\n end", "def update\n set_action(:update)\n set_account_type\n validate_account_type!\n assign_params\n set_affiliate\n set_updated_by\n\n after_update\n account\n end", "def configure_account_update_params\n if request.content_type == 'application/json' || request.content_type == 'text/plain'\n params[:registration].permit(:email, :password, :birth_date, :first_name, :last_name, :alias, :current_password, :password, :mobile)\n else\n params[:user].permit(:email, :password, :birth_date, :first_name, :last_name, :alias, :current_password, :password, :mobile)\n end\n end", "def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << [\n :name, :current_profession, :years_experience,\n :desired_profession, :desired_location, :work_status\n ]\n end", "def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << [:attribute , :first_name , :last_name, :profile_image]\n end", "def account_update_params\n\t\tparams.require(:user).permit(:email, :password, :password_confirmation, :username, :current_password, :age, :bio, :gender)\n\tend", "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 configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :email, :phone_number, :current_password, :password, :password_confirmation, :place, :zip_code, :city, :sector])\n end", "def sign_up_params\n params.require(resource_name).permit(\n :name,\n :email,\n :profile,\n :password,\n :password_confirmation\n )\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update) do |user_params|\n user_params.permit(:email, :password, :password_confirmation, :current_password, :names, :surnames, :area_of_residence_id, :area_of_interest_id)\n end\n end", "def configure_params_update\n devise_parameter_sanitizer.permit(:account_update, keys: [:name, :email])\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 configure_account_update_params\n devise_params_sanitizer.permit(:account_update, keys: [:name, :description, :password, :email, :password_confirmation, :avatar])\n end", "def configure_perimitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys:[:fname, :lname, :username, :seller])\n devise_parameter_sanitizer.permit(:account_update, keys:[:fname, :lname, :username, :seller])\n end", "def configure_account_update_params\n\n devise_parameter_sanitizer.permit(:account_update, keys: [:name, :cpf])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << [:email]\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :email, :password])\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_account_update_params\n devise_parameter_sanitizer.for(:account_update) << :username\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [\n :username, :profilename, :avatar, :cover, :birthday, :birthday_visibility,\n :country, :language\n ])\n end", "def configure_account_update_params\n # devise_parameter_sanitizer.permit(:account_update, :keys => [:username])\n devise_parameter_sanitizer.for(:account_update) << :username\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: UPDATE_KEYS)\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: %i[first_name last_name organization admin])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:username])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:username])\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) do |user|\n user.permit(:name, :email, :user_avatar, :password, :password_confirmation)\n end\n devise_parameter_sanitizer.for(:account_update) do |user|\n user.permit(:name, :email, :user_avatar, :password, :password_confirmation, :current_password, :commit)\n end\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:email, :name])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :middle_name, :last_name, :phone, \n :gender, :birthday, :graduation_date, :school, :organization, :email])\n end", "def configure_account_update_params\n # devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n params.require(:user).permit(:firstname,:lastname ,:email, :password,:password_confirmation,:current_password,:phone,:address,:avatar)\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:name, :phone, :real_estate_company, :real_estate_company_id])\n end", "def configure_account_update_params\n devise_parameter_sanitizer\n .permit(:account_update,\n keys:\n %i[first_name\n last_name\n affiliation\n training_status_id\n timezone])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:firstname, :lastname, :username ])\n devise_parameter_sanitizer.permit(:account_update, keys: [:firstname, :lastname, :username])\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [\n :first_name,\n :last_name,\n :street,\n :apartment_number,\n :city,\n :state,\n :zip_code,\n :phone,\n :email,\n :password])\n devise_parameter_sanitizer.permit(:account_update, keys: [\n :first_name,\n :last_name,\n :street,\n :apartment_number,\n :city,\n :state,\n :zip_code,\n :phone,\n :email,\n :password,\n :current_password])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << :shopname << :address\n end", "def configure_permitted_parameters\n added_attrs = [:email, :first_name, :last_name, :account_type]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :membership_number, :authorized_for_app])\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name, :membership_number, :authorized_for_app])\n end", "def account_update_params \n params.require(:user).permit(:username, :email, :password, :password_confirmation, :current_password)\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name])\n end", "def configure_account_update_params\n update_attrs = [:password, :password_confirmation, :current_password]\n devise_parameter_sanitizer.permit :account_update, keys: update_attrs\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: custom_parameters)\n end", "def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) {\n |u| u.permit( :email, :password,\n :first_name, :last_name, :company_name, roles: [])}\n end", "def account_update_params\n params.require(:user).permit(:email, :password, :password_confirmation, :current_password)\n end", "def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << :first_name << :last_name << :phone_number\n end", "def configure_account_update_params\n\n devise_parameter_sanitizer.permit(:update_user, keys: [:email, :password, :password_confirmation, :current_password, :prenom, :nom])\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username, :first_name, :last_name])\n devise_parameter_sanitizer.permit(:account_update, keys: [:username, :first_name, :last_name])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:nickname])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << [:password, :password_confirmation,\n :current_password, :global_email_notifications]\n end", "def account_update_params\n params.require(:user).permit(:is_active)\n # devise_parameter_sanitizer.permit(:account_update, keys: [:is_active])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:name])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, \\\n keys: %i[name date_of_birth username])\n end", "def account_update\n #define our custom strong parameters by monkey patching Devise's account_update method which controls\n #which fields/props are mass assigned in the RegistrationController during /users/edit PUT\n default_params.permit(:first_name, :last_name, :email, :password, :password_confirmation, :current_password)\n end", "def configure_account_update_params\n # devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n params.require(:user).permit(:firstname,:lastname ,:email, :gender, :phone,:address)\nend", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << :first_name << :last_name\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name, :role])\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:username]) \n devise_parameter_sanitizer.permit(:account_update, keys: [:username])\nend", "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) do |u|\n u.permit(:username, :first_name, :last_name,\n :email, :postcode, :city, :rating, :password, :phone_number, :password_confirmation)\n end\n devise_parameter_sanitizer.for(:account_update) do |u|\n u.permit(:username, :first_name, :last_name,\n :email, :postcode, :city, :rating, :password, :phone_number, :password_confirmation, :current_password)\n end\n end", "def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(:nick_name,:mobile_phone, :location, :password, :password_confirmation, :current_password) }\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:name, :phone, :workgroup, :timezone])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:nickname, :major_id])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:name, :company_id, :birthday, :admin])\n end", "def account_update_params\n params.fetch(:user).permit(:title, :email, :password, :password_confirmation, :thumbnail, :description, :current_password)\n end", "def account_update_params\n params.require(:user).permit(:username, :bio, :email, :password, :password_confirmation, :current_password, :full_name, :profile_image_datafile)\n end", "def account_update_params\n params.require(:user).permit(\n :first_name,\n :last_name,\n :company_name,\n :location,\n :email,\n :password,\n :password_confirmation,\n :current_password,\n :description,\n :business,\n :birth_date,\n :gender,\n :education,\n :field,\n :pay_rate,\n :availability,\n :description\n )\n end", "def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << :nickname\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.for(:sign_up) do |u|\n u.permit(:first_name, :last_name, :zipcode, :money_transfer_destination_id,\n :email, :password, :password_confirmation, :accept_emails, :accept_terms)\n end\n devise_parameter_sanitizer.for(:account_update) do |u|\n u.permit(:first_name, :last_name, :zipcode, :money_transfer_destination_id,\n :email, :password, :password_confirmation, :current_password)\n end\n end", "def account_update_params\n params.require(:user).permit(:email, :password, :password_confirmation, :gender, :bio)\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up) do |u|\n u.permit(:name, :last_name,\n :email, :password, :password_confirmation)\n end\n devise_parameter_sanitizer.permit(:account_update) do |u|\n u.permit(:name, :last_name,\n :email, :password, :password_confirmation, :current_password)\n end\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up, keys: [:first_name, :last_name])#Permits first & last name for sign_up.\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name])#Permits first & last name for account_update(user profile edit).\n end", "def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << [:role_id,\n :store_name,\n :avatar,\n :name,\n :passport,\n :birthdate]\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:firstname,:middlename,:lastname,:contact,:birthday,:gender, :bio, :username])\n end", "def configure_permitted_parameters\n devise_parameter_sanitizer.permit(:sign_up) do |u|\n u.permit(:email, :password, :password_confirmation, :first_name, :last_name, :sex, :date_of_birth, :contact_no, :address)\n end\n devise_parameter_sanitizer.permit(:account_update) do |u|\n u.permit(:password, :password_confirmation, :first_name, :last_name, :sex, :date_of_birth, :contact_no, :address)\n end\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:first_name, :last_name,:avatar, :nickname])\n end", "def configure_permitted_parameters\n added_attrs = [:email, :first_name, :last_name]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end", "def configure_permitted_parameters\n added_attrs = [:email, :first_name, :last_name]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end", "def configure_permitted_parameters\n added_attrs = [:email, :first_name, :last_name]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\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 account_update_params\n params.require(:user).permit(:name, :last_name, :email, :password, :password_confirmation, :current_password)\n end", "def configure_permitted_parameters\n\t \tattributes = [:name, :email, :password, :password_confirmation, :remember_me]\n \tdevise_parameter_sanitizer.permit(:sign_up, keys: attributes)\n \tdevise_parameter_sanitizer.permit(:account_update, keys: attributes)\n\t end", "def configure_permitted_parameters\n added_attrs = %i[username email password password_confirmation]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end", "def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << :attribute\n end", "def account_update_params\n params.require(:user).permit(:password, :password_confirmation, :name, :dob, :sex, :location, :about, :art_style, :avatar)\n end", "def configure_permitted_parameters\n added_attrs = [:username, :email, :password, :password_confirmation]\n devise_parameter_sanitizer.permit :sign_up, keys: added_attrs\n devise_parameter_sanitizer.permit :account_update, keys: added_attrs\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:name, :email, :password, :password_confirmation, :tag_name])\n end", "def configure_permitted_parameters\n \t\n devise_parameter_sanitizer.permit(:sign_up, keys: [:name, :email, :role, :year, :password])\n devise_parameter_sanitizer.permit(:account_update, keys: [:name, :email, :role, :year, :password, :current_password])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.permit(:account_update, keys: [:attribute])\n end", "def configure_account_update_params\n devise_parameter_sanitizer.for(:account_update) << [:first_name, :last_name, :time_zone, :stripe_id, photo_attributes: [:file, :remote_file_url]]\n end" ]
[ "0.7500589", "0.71697116", "0.7042744", "0.70023584", "0.6949216", "0.6949111", "0.69118834", "0.6850353", "0.6848748", "0.683178", "0.6811191", "0.67840844", "0.67645425", "0.6759307", "0.6754943", "0.6753964", "0.67464745", "0.67343247", "0.6732895", "0.67192256", "0.6718757", "0.6718203", "0.6707005", "0.6705677", "0.670285", "0.6700696", "0.66896623", "0.6677691", "0.6677291", "0.66761297", "0.66761297", "0.66645783", "0.6655239", "0.66525334", "0.6648285", "0.66470736", "0.6643339", "0.66401714", "0.66244924", "0.66237795", "0.6617508", "0.66172856", "0.66125596", "0.6611412", "0.66084355", "0.6607689", "0.6606477", "0.66060007", "0.66039854", "0.65948373", "0.6593824", "0.65915614", "0.6588296", "0.65851897", "0.6584607", "0.6583836", "0.65809566", "0.6580738", "0.65777403", "0.6577203", "0.6577203", "0.6575859", "0.657446", "0.6568708", "0.6556083", "0.65554786", "0.65543735", "0.6551097", "0.6550737", "0.6550102", "0.65474546", "0.65456736", "0.6544325", "0.6544269", "0.65430164", "0.6541672", "0.6536929", "0.6535518", "0.65350664", "0.65339005", "0.6533683", "0.65296876", "0.65296876", "0.65296876", "0.6522591", "0.6522455", "0.65223306", "0.65214735", "0.65195394", "0.65180725", "0.6516109", "0.6514533", "0.6513722", "0.6513331", "0.6513331", "0.6513331", "0.6513331", "0.6513331", "0.6513331", "0.6513331", "0.6512709" ]
0.0
-1
If you have extra params to permit, append them to the sanitizer.
def configure_sign_up_params devise_parameter_sanitizer().permit(:sign_up, keys: [:name, :surname, :picture, :invite_token, :organization_name]) 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
Baseline implementation for the disable_xpn_host REST call
def disable_xpn_host request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, query_string_params = transcode_disable_xpn_host_request request_pb response = @client_stub.make_post_request( uri: uri, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_xpn_host request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/disableXpnHost\"\n\n query_string_params = {}\n query_string_params[\"requestId\"] = request_pb.request_id.to_s if request_pb.request_id && request_pb.request_id != \"\"\n\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def disable_xpn_resource request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_disable_xpn_resource_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def disable_xpn_resource request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/disableXpnResource\"\n body = request_pb.projects_disable_xpn_resource_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def disable_host(host)\n if @live_hosts.size <= @min_hosts\n puts \"Will not take #{host} down, alreay at lower limit #{@min_hosts}\"\n return\n end\n\n #puts \"Disabling host '#{host}'\"\n get_balancer_manager.disable_host(host)\n end", "def skip_all(hostname)\n # TODO\nend", "def unmanage_host(host)\n curl = setup_curl(\"#{@foreman_url}/api/hosts/#{host}\", true)\n curl.headers['Accept'] = 'application/json,version=2'\n curl.headers['Content-Type'] = 'application/json'\n host_settings = {}\n host_settings[:host] = {}\n host_settings[:managed] = false\n host_settings_json = host_settings.to_json\n curl.http_post(host_settings_json)\n result = JSON.parse(curl.body_str)\n raise result['message'] if result['message'] =~ /^ERF51/\n result\n end", "def disable_smart_proxy\n params = {:enabled => false}\n smart_proxy(params)\n end", "def intelligent_disable(pks)\n todisable = intelligent_nodeps(pks, :disable, :cant_disable, true)\n logger.info 'COMPONENTS WITHOUT DEPENDENCIES: ' + todisable.to_s\n not_found_vnfds = set_vnfds_status(todisable[:disable][:vnfds], 'inactive')\n not_found_nsds = set_nsds_status(todisable[:disable][:nsds], 'inactive')\n set_pd_status(pks, 'inactive')\n if ( not_found_vnfds.length == 0 ) and ( not_found_nsds.length == 0 )\n logger.debug \"Catalogue: leaving DISABLE /api/v2/packages?#{query_string}\\\" with PD #{pks}\"\n halt 200, JSON.generate(result: todisable)\n else\n logger.debug \"Catalogue: leaving DISABLE /api/v2/packages?#{query_string}\\\" with PD #{pks}\"\n logger.info \"Some descriptors where not found \"\n logger.info \"Vnfds not found: \" + not_found_vnfds.to_s\n logger.info \"Nsds not found: \" + not_found_nsds.to_s\n halt 404, JSON.generate(result: todisable,\n not_found: { vnfds: not_found_vnfds, nsds: not_found_nsds })\n end\n end", "def disable\n debug \"Call 'disable' for Pacemaker service '#{name}' on node '#{hostname}'\"\n unmanage_primitive name\n end", "def enable_xpn_host request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_enable_xpn_host_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::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def disable_pxe\n delegate(provider, :disable_pxe)\n end", "def skip_one(hostname)\n # TODO\nend", "def disable\n request = Net::HTTP::Post.new(\"/proxies/#{name}\")\n request[\"Content-Type\"] = \"application/json\"\n\n hash = { enabled: false }\n request.body = hash.to_json\n\n response = http_request(request)\n assert_response(response)\n self\n end", "def enable_xpn_host request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/enableXpnHost\"\n\n query_string_params = {}\n query_string_params[\"requestId\"] = request_pb.request_id.to_s if request_pb.request_id && request_pb.request_id != \"\"\n\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def disabled?\n host.nil?\n end", "def disable_nat(ip_addr)\n raise 'not implemented'\n end", "def disable\n end", "def remove_global_proxy_exclusion(opts)\n opts = check_params(opts,[:addresses])\n super(opts)\n end", "def disable\n {\n method: \"HeadlessExperimental.disable\"\n }\n end", "def cmd_noop(param)\n send_response \"200\"\n end", "def disable\n run \"#{try_sudo} /sbin/chkconfig puppet off\"\n end", "def host_down(host)\n end", "def disable_alert_feature \n put(\"/globalsettings.json/alerts/disable\")\nend", "def ignore_hosts\n @host_rules.reject\n end", "def remove_proxy_exclusion(opts)\n opts = check_params(opts,[:addresses])\n super(opts)\n end", "def http_check_disable_on_404\n if @name_index\n @conf.insert(@name_index + @conf.length, \" \" + \"http-check disable-on-404 \" + \"\\n\")\n else\n puts \"no #{@proxy_type} name assigned\"\n return false\n end\n end", "def delete_unused_host_only_networks\n end", "def add_global_proxy_exclusion(opts)\n opts = check_params(opts,[:addresses])\n super(opts)\n end", "def disabled=(_arg0); end", "def disable_proxy\n if `networksetup -getsecurewebproxy 'Wi-Fi' | grep '^Enabled:' | cut -d' ' -f2 | tr -d $'\\n'` == \"Yes\"\n `networksetup -setsecurewebproxystate 'Wi-Fi' off`\n end\n if `networksetup -getwebproxy 'Wi-Fi' | grep '^Enabled:' | cut -d' ' -f2 | tr -d $'\\n'` == \"Yes\"\n ` networksetup -setwebproxystate 'Wi-Fi' off`\n end\nend", "def payload_disable_nops(explicit_target = nil)\n explicit_target ||= target\n\n if (explicit_target and explicit_target.payload_disable_nops)\n explicit_target.payload_disable_nops\n else\n payload_info['DisableNops']\n end\n end", "def disable_proxy!\n @proxy = Spidr::Proxy.new\n return true\n end", "def allowHost\n end", "def disable\n {\n method: \"WebAuthn.disable\"\n }\n end", "def disable(patch)\n @socket.disable\n end", "def disable\n Puppet.notice \"Disabling Puppet.\"\n lockfile.lock(:anonymous => true)\n end", "def receive_disabled\n\n wrap_reply('disable' => Flor.true?(payload['ret']))\n end", "def service_unavailable\n\n end", "def disable\n run \"#{try_sudo} /sbin/chkconfig httpd off\"\n end", "def disable_telnet\n info 'Disabling Telnet'\n \n @session.configuration(:enforce_save) do\n lines('vty 0 4') { set 'transport input', 'ssh' }\n # lines('vty 5 15') { set 'transport input', 'ssh' }\n end\n end", "def disable!\n @enabled = false\n end", "def disable\n self.stop if self.status == :running\n output = supervisorctl(:remove, @resource[:name])\n rescue Puppet::ExecutionFailure\n raise Puppet::Error, \"Could not disable #{self.name}: #{output}\"\n end", "def add_proxy_exclusion(opts)\n opts = check_params(opts,[:addresses])\n super(opts)\n end", "def toggle_host_status\n if !self.host.listings.empty?\n self.host.update(host: true)\n else\n self.host.update(host: false)\n end\n end", "def payload_disable_nops\n opts['Payload'] ? opts['Payload']['DisableNops'] : nil\n end", "def disable_updates hosts, opts\n logger = opts[:logger]\n hosts.each do |host|\n next if host['platform'].include?('netscaler')\n\n logger.notify \"Disabling updates.puppetlabs.com by modifying hosts file to resolve updates to 127.0.0.1 on #{host}\"\n set_etc_hosts(host, \"127.0.0.1\\tupdates.puppetlabs.com\\n\")\n end\n end", "def disable\n @service.disabled = true\n end", "def host_only=(value)\n @host_only = value\n end", "def delete_host(fqdn, url, cookie)\n begin\n # set the headers\n headers = {\n :content_type => :json,\n :accept => :json,\n 'Cookie' => cookie,\n 'Referer' => url\n }\n\n # set the payload\n payload = {\n :method => 'host_del',\n :params => [\n [ fqdn ],\n {\n :continue => false,\n :updatedns => true\n }\n ]\n }\n\n # get response and convert to json\n response = call_rest(:post, url, headers, 'session/json', JSON.generate(payload))\n\n # validate response and return system object\n if response\n log(:info, \"delete_host: Response body: #{response.body}\") if @debug\n if response.code == DELETE_HOST_SUCCESS_CODE\n errors = JSON.parse(response.body)['error']\n log(:info, \"delete_host: The following errors were logged during the previous REST call: #{errors.inspect}\")\n\n # NOTE: success code 4001 indicate the host didn't exist\n if errors.nil? || errors['code'].to_i == 4001\n log(:info, \"delete_host: Successfully deleted host object for system: #{fqdn}\")\n return true\n else\n log(:warn, \"delete_host: Unable to delete system: #{fqdn} from IDM\")\n raise \"Please review the following errors: #{errors.inspect}\"\n end\n else\n log(:warn, \"delete_host: Unable to retrieve node object from PuppetDB for system: #{fqdn}. Returning false\")\n return false\n end\n else\n raise \"Invalid Response: #{response.inspect}\"\n end\n rescue => err\n # log and backtrace the error\n log(:error, \"[#{err}]\\n#{err.backtrace.join(\"\\n\")}\")\n log(:error, \"delete_host: #{err}. Returning false\")\n return false\n end\nend", "def disable_pending_cops; end", "def disable(params)\n node_ip = get_ip(params)\n if params.has_key?(:pool)\n pool_name = params[:pool]\n node_port = (params[:port] || 80).to_i\n if @environment.in_dry_run_mode\n notify(:msg => \"[#{@name}] Would disable member #{node_ip}:#{node_port} in pool #{pool_name} on load balancer #{@config[:host]}\",\n :tags => [:f5, :dryrun])\n get_member(params)\n else\n notify(:msg => \"[#{@name}] Disabling member #{node_ip}:#{node_port} in pool #{pool_name} on load balancer #{@config[:host]}\",\n :tags => [:f5, :trace])\n set_pool_member_status(pool_name,\n 'member' => { 'address' => node_ip, 'port' => node_port },\n 'session_state' => 'STATE_DISABLED')\n end\n else\n if @environment.in_dry_run_mode\n node = get_node(params)\n notify(:msg => \"[#{@name}] Would disable member #{node_ip} on load balancer #{@config[:host]}\",\n :tags => [:f5, :dryrun])\n node\n else\n notify(:msg => \"[#{@name}] Disabling node #{node_ip} on load balancer #{@config[:host]}\",\n :tags => [:f5, :trace])\n set_node_status(node_ip, 'STATE_DISABLED')\n end\n end\n end", "def disable_pending_cops=(_arg0); end", "def kvm_disable(handle:, server_id: 1)\n kvm_mo = CommKvm.new(parent_mo_or_dn: _get_comm_mo_dn(handle, server_id))\n kvm_mo.set_prop(:admin_state, \"disabled\")\n handle.set_mo(mo: kvm_mo)\nend", "def enable_ssh(s1_ip,logger)\n\n uri = URI.parse(\"https://#{s1_ip}/protected/sshservice.html\") #common url for all release\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth(\"Nemuadmin\", \"nemuuser\")\n \n ssh_service_status_response=\"\"\n\n client=RestClient::Resource.new(\"https://#{s1_ip}/protected/sshservice.html\",:user=>\"Nemuadmin\",:password=>\"nemuuser\",:verify_ssl => OpenSSL::SSL::VERIFY_NONE)\n\n # response_body\n\n begin\n #Timeout.timeout(2){\n #ssh_service_status_response = http.request(request)\n response=client.get\n #puts \"response=#{response}\" \n #delete those fake bts\n if not response.match(/SSH\\sService\\sStatus/)\n LiveStatus.where(:s1_ip=>s1_ip).delete_all\n # puts \"#{s1_ip} deleted!\"\n logger.error \"#{s1_ip} deleted! \"\n return false\n end\n\n rescue\n live_status=LiveStatus.where(:s1_ip=>s1_ip).first\n logger.error \"#{s1_ip} is not a BTS \"\n return false if live_status.nil?\n\n # if live_status.ssh_pass.nil? ||live_status.ssh_pass<=1\n # puts \"#{s1_ip} deleted!\"\n # LiveStatus.where(:s1_ip=>s1_ip).delete_all\n # end\n\n return false\n end\n\n\n#check need token or not\n\n if response.match(\"token\") #this is a site version bigger >RL55\n result=enable_ssh_with_token(s1_ip,response)\n else\n #enable_ssh_without_token(s1_ip)\n result= enable_ssh_without_token_2(s1_ip)\n end\n\n if result==true\n logger.info \"#{s1_ip} enable ssh succsefully !\"\n return true\n else\n logger.error \"#{s1_ip} enable ssh fail !\"\n return false\n end\n \n return nil\nend", "def proxy_forget\n execute(:proxy, :forget)\n end", "def disabled; end", "def send_noop(resID = nil)\n target = resID ? resID : \"*\"\n addr = create_address(:sliceID => @@sliceID, :expID => @@expID, :domain => @@domain,\n :name => resID)\n cmd = create_message(:cmdtype => :NOOP, :target => \"#{target}\")\n send_message(addr, cmd)\n end", "def disable\n @enabled = false\n end", "def host!(_arg0); end", "def disable!\n @enabled = false\n end", "def no_ripple_check opts={}\n params = {\n account: opts.delete(:account) || client_account,\n role: \"gateway\",\n limit: 2,\n ledger_index: \"validated\"\n }.merge!(opts)\n post(:no_ripple_check, params)\n end", "def unknown_host\n update_code(:unknown_host, %i(unknown redirected))\n end", "def disable_private_who_is(domain)\n validate_list([ [\"Domain\", domain, :domain_format] ])\n options = { \"Domain\" => domain }\n\n connection = Connection.new\n connection.post(\"Domain/PrivateWhois/Disable\", options)\n end", "def reset_port_protection\n response = @client.rest_put(@data['uri'] + '/resetportprotection')\n @client.response_handler(response)\n end", "def enable_ssh_without_token_2(s1_ip)\n client=RestClient::Resource.new(\"https://#{s1_ip}/protected/enableSsh.cgi\",:user=>\"Nemuadmin\",:password=>\"nemuuser\",:verify_ssl => OpenSSL::SSL::VERIFY_NONE)\n begin\n # Timeout.timeout(5){\n response=client.get\n # }\n\n if response.body.match(\"SSH Service Enabled Successfully\")\n # puts \"#{s1_ip} enable ssh succ(no token)!\"\n return true \n else\n #puts \"enable ssh for #{s1_ip} fail!(no token)\"\n\n return false\n end\n\n rescue\n #puts $@\n #puts \"enable ssh for #{s1_ip} exception!(no token)\"\n return false\n end\nend", "def disable\n {\n method: \"Security.disable\"\n }\n end", "def disable_basic_service_on_action(action)\n if action == :start\n return unless pacemaker_options[:disable_basic_service_on_start]\n elsif action == :stop\n return unless pacemaker_options[:disable_basic_service_on_stop]\n elsif action == :status\n return unless pacemaker_options[:disable_basic_service_on_status]\n else\n fail \"Action '#{action}' is incorrect!\"\n end\n\n disable_basic_service\n end", "def host=(_); end", "def host_notifications_enabled=(arg)\n @host_notifications_enabled = check_bool(arg)\n end", "def disable_plugin_shim!\n include_recipe 'openvpn'\n resources(openvpn_conf: 'server').plugins.delete(plugin_str)\n end", "def clear_forwarded_ports\n end", "def network_disable(vid)\n perform_request(action: 'vserver-network-disable', vserverid: vid)\n end", "def disable(index)\n return enable(:all) if index == :none\n index = check_index(index)\n relay = @relays[index]\n relay.disable\n end", "def disable_tls; end", "def disable_ssl; end", "def test_hosts_are_not_traced_if_on_the_denylist\n desc = basic_grpc_desc\n desc.instance_variable_set(:@trace_with_newrelic, false)\n\n new_transaction_called = false\n NewRelic::Agent::Transaction.stub(:start_new_transaction, proc { new_transaction_called = true }) do\n # by passing nil as the first argument, an exception will happen if the\n # code proceeds beyond the early return. this gives us confidence that the\n # early return is activated\n result = desc.handle_with_tracing(nil, nil, nil, nil) { return_value }\n\n assert_equal return_value, result\n refute new_transaction_called\n end\n end", "def prevent_pjax!\n raise Pjax::Unsupported if pjax_request?\n end", "def ignore_apdex\n record_api_supportability_metric(:ignore_apdex)\n NewRelic::Agent::Transaction.tl_current&.ignore_apdex!\n end", "def host_delete(host)\n curl = setup_curl(\"#{@foreman_url}/api/hosts/#{host}\", true)\n curl.http_delete\n end", "def inherit(node)\n ping.remove\n super\n end", "def setNodeOFF(node_id) \n cm_url = APP_CONFIG['cm_ip'] + ':' + APP_CONFIG['cm_port'].to_s\n\n options = {body: {state:\"off\"}.to_json, :headers => { 'Content-Type' => 'application/json' }}\n res = HTTParty.put(cm_url+\"/resources/node/\"+ node_id, options)\n \n end", "def disable\n @disabled = true\n end", "def unconfigure_vs_pxe_client(client_name)\n client_mac = get_client_mac(client_name)\n if !client_mac\n puts \"Warning:\\tNo MAC Address entry found for \"+client_name\n exit\n end\n tftp_pxe_file = client_mac.gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxelinux\"\n tftp_pxe_file = $tftp_dir+\"/\"+tftp_pxe_file\n if File.exists?(tftp_pxe_file)\n message = \"Removing:\\tPXE boot file \"+tftp_pxe_file+\" for \"+client_name\n command = \"rm #{tftp_pxe_file}\"\n execute_command(message,command)\n end\n pxe_cfg_dir = $tftp_dir+\"/pxelinux.cfg\"\n pxe_cfg_file = client_mac.gsub(/:/,\"-\")\n pxe_cfg_file = \"01-\"+pxe_cfg_file\n pxe_cfg_file = pxe_cfg_file.downcase\n pxe_cfg_file = pxe_cfg_dir+\"/\"+pxe_cfg_file\n if File.exists?(pxe_cfg_file)\n message = \"Removing:\\tPXE boot config file \"+pxe_cfg_file+\" for \"+client_name\n command = \"rm #{pxe_cfg_file}\"\n execute_command(message,command)\n end\n client_info = get_vs_clients()\n service_name = client_info.grep(/#{client_name}/)[0].split(/ = /)[1].chomp\n ks_dir = $tftp_dir+\"/\"+service_name\n ks_cfg_file = ks_dir+\"/\"+client_name+\".cfg\"\n if File.exist?(ks_cfg_file)\n message = \"Removing:\\tKickstart boot config file \"+ks_cfg_file+\" for \"+client_name\n command = \"rm #{ks_cfg_file}\"\n execute_command(message,command)\n end\n unconfigure_vs_dhcp_client(client_name)\n return\nend", "def disable!\n self.enabled = false\n end", "def unconfigure_vs_pxe_client(options)\n options['mac'] = get_install_nac(options)\n if not options['mac']\n handle_output(options,\"Warning:\\tNo MAC Address entry found for #{options['name']}\")\n quit(options)\n end\n tftp_pxe_file = options['mac'].gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxelinux\"\n tftp_pxe_file = options['tftpdir']+\"/\"+tftp_pxe_file\n if File.exist?(tftp_pxe_file)\n message = \"Information:\\tRemoving PXE boot file \"+tftp_pxe_file+\" for \"+options['name']\n command = \"rm #{tftp_pxe_file}\"\n execute_command(options,message,command)\n end\n pxe_cfg_dir = options['tftpdir']+\"/pxelinux.cfg\"\n pxe_cfg_file1 = options['mac'].gsub(/:/,\"-\")\n pxe_cfg_file1 = \"01-\"+pxe_cfg_file1\n pxe_cfg_file1 = pxe_cfg_file1.downcase\n pxe_cfg_file1 = pxe_cfg_dir+\"/\"+pxe_cfg_file1\n pxe_cfg_file2 = options['mac'].split(\":\")[0..3].join+\"-\"+options['mac'].split(\":\")[4..5].join+\"-0000-0000-\"+options['mac'].gsub(/\\:/,\"\")\n pxe_cfg_file2 = pxe_cfg_file2.downcase\n pxe_cfg_file2 = pxe_cfg_dir+\"/\"+pxe_cfg_file2\n if File.exist?(pxe_cfg_file1)\n message = \"Information:\\tRemoving PXE boot config file \"+pxe_cfg_file1+\" for \"+options['name']\n command = \"rm #{pxe_cfg_file1}\"\n execute_command(options,message,command)\n end\n if File.exist?(pxe_cfg_file2)\n message = \"Information:\\tRemoving PXE boot config file \"+pxe_cfg_file2+\" for \"+options['name']\n command = \"rm #{pxe_cfg_file2}\"\n execute_command(options,message,command)\n end\n client_info = get_vs_clients()\n options['service'] = client_info.grep(/#{options['name']}/)[0].split(/ = /)[1].chomp\n ks_dir = options['tftpdir']+\"/\"+options['service']\n ks_cfg_file = ks_dir+\"/\"+options['name']+\".cfg\"\n if File.exist?(ks_cfg_file)\n message = \"Information:\\tRemoving Kickstart boot config file \"+ks_cfg_file+\" for \"+options['name']\n command = \"rm #{ks_cfg_file}\"\n execute_command(options,message,command)\n end\n unconfigure_vs_dhcp_client(options)\n return\nend", "def reset()\n super\n=begin\n url = \"#{self.api_protocol}://#{self.api_domain}:#{self.api_port.to_s}/api1.3/threads/reset.json\"\n res = BlackStack::Netting::api_call(url, {\n 'api_key' => self.api_key,\n 'filename' => self.filename,\n 'id_client' => self.id_client,\n })\n=end\n end", "def unconfigure_xb_pxe_client(client_name)\n client_mac=get_client_mac(client_name)\n if !client_mac\n puts \"Warning:\\tNo MAC Address entry found for \"+client_name\n exit\n end\n tftp_pxe_file = client_mac.gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxeboot\"\n tftp_pxe_file = $tftp_dir+\"/\"+tftp_pxe_file\n if File.exist?(tftp_pxe_file)\n message = \"Removing:\\tPXE boot file \"+tftp_pxe_file+\" for \"+client_name\n command = \"rm #{tftp_pxe_file}\"\n output = execute_command(message,command)\n end\n unconfigure_xb_dhcp_client(client_name)\n return\nend", "def remove_host(name)\n configure \"no logging host #{name}\"\n end", "def disable!\n @disabled = true\n end", "def send_unwhitelist_request\n\n Rails.logger.info(\"user_kyc_detail id:: #{@user_kyc_detail_id} - making private ops api call\")\n r = Request::OpsApi::Whitelist.new.whitelist({\n whitelister_address: api_data[:client_whitelist_detail_obj].whitelister_address,\n contract_address: api_data[:client_whitelist_detail_obj].contract_address,\n address: api_data[:address],\n phase: api_data[:phase],\n gasPrice: EstimatedGasPrice::CurrentPrice.new.fetch\n })\n # Rails.logger.info(\"Whitelist API Response: #{r.inspect}\")\n\n unless r.success?\n get_client_whitelist_detail_obj.mark_client_eth_balance_low if GlobalConstant::ClientWhitelistDetail.low_balance_error?(r.error)\n return r\n end\n\n @kyc_whitelist_log = KycWhitelistLog.create!({\n client_id: @client_id,\n ethereum_address: api_data[:address],\n client_whitelist_detail_id: api_data[:client_whitelist_detail_obj].id,\n phase: api_data[:phase],\n transaction_hash: r.data[:transaction_hash],\n nonce: r.data[:nonce],\n gas_price: r.data[:gas_price],\n next_timestamp: Time.now.to_i + GlobalConstant::KycWhitelistLog.expected_transaction_mine_time,\n status: GlobalConstant::KycWhitelistLog.pending_status,\n failed_reason: 0\n })\n\n success\n end", "def a_pi_key_disable_with_http_info(api_key_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: APIKeyApi.a_pi_key_disable ...\"\n end\n # verify the required parameter 'api_key_id' is set\n fail ArgumentError, \"Missing the required parameter 'api_key_id' when calling APIKeyApi.a_pi_key_disable\" if api_key_id.nil?\n # resource path\n local_var_path = \"/apiKey/disable\".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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\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', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n form_params[\"apiKeyID\"] = api_key_id\n\n # http body (model)\n post_body = nil\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 => 'APIKey')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: APIKeyApi#a_pi_key_disable\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def disable\n {\n method: \"Performance.disable\"\n }\n end", "def disable\n\n @enabled = false\n\n return self\n\n end", "def flag_xms_system_to_be_normal \n put(\"/globalsettings.json/xms/normal\")\nend", "def without_reasoning\n @reasoning = false\n @connection = stardog(@endpoint,@options)\n self\n end", "def read_host_only_interfaces\n end", "def global_proxy_exclusion\n super\n end", "def skip_http_headers=(_arg0); end", "def host_status\n if self.host.listings.count <= 1\n self.host.update(:host => false)\n end\n end", "def reserved_net_checker; end" ]
[ "0.74900347", "0.65866226", "0.6487242", "0.6405204", "0.62242097", "0.60866934", "0.60456496", "0.5968984", "0.588974", "0.5888264", "0.58156306", "0.5756981", "0.5699836", "0.56459945", "0.5637966", "0.56275225", "0.5570077", "0.55105084", "0.54867864", "0.5481838", "0.5469803", "0.545863", "0.542526", "0.54109806", "0.53925514", "0.53807694", "0.534793", "0.53423095", "0.5341993", "0.53304684", "0.53010297", "0.5280676", "0.52803934", "0.52751696", "0.5263863", "0.5261997", "0.52600425", "0.5258217", "0.52434474", "0.52366805", "0.5215053", "0.5202856", "0.5195131", "0.5180006", "0.5179978", "0.5177266", "0.51759243", "0.5161532", "0.5160909", "0.515131", "0.51489085", "0.51273835", "0.51146", "0.51138985", "0.51063484", "0.5105844", "0.5099665", "0.50960606", "0.5078708", "0.5075564", "0.50711256", "0.5059307", "0.50516075", "0.50481904", "0.5047355", "0.5025711", "0.5019529", "0.50096935", "0.5003976", "0.49998528", "0.4998468", "0.49981976", "0.4992042", "0.498835", "0.49800274", "0.4967421", "0.49619308", "0.4960507", "0.49520007", "0.4947224", "0.49456573", "0.4945077", "0.49294603", "0.49243942", "0.4923095", "0.49169415", "0.49141404", "0.49124035", "0.4911614", "0.49102318", "0.49071226", "0.4905368", "0.4905157", "0.49027514", "0.48946685", "0.48930576", "0.48905498", "0.4888071", "0.48824903", "0.48782837" ]
0.78032476
0
Baseline implementation for the disable_xpn_resource REST call
def disable_xpn_resource request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_disable_xpn_resource_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def disable_xpn_resource request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/disableXpnResource\"\n body = request_pb.projects_disable_xpn_resource_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def intelligent_disable(pks)\n todisable = intelligent_nodeps(pks, :disable, :cant_disable, true)\n logger.info 'COMPONENTS WITHOUT DEPENDENCIES: ' + todisable.to_s\n not_found_vnfds = set_vnfds_status(todisable[:disable][:vnfds], 'inactive')\n not_found_nsds = set_nsds_status(todisable[:disable][:nsds], 'inactive')\n set_pd_status(pks, 'inactive')\n if ( not_found_vnfds.length == 0 ) and ( not_found_nsds.length == 0 )\n logger.debug \"Catalogue: leaving DISABLE /api/v2/packages?#{query_string}\\\" with PD #{pks}\"\n halt 200, JSON.generate(result: todisable)\n else\n logger.debug \"Catalogue: leaving DISABLE /api/v2/packages?#{query_string}\\\" with PD #{pks}\"\n logger.info \"Some descriptors where not found \"\n logger.info \"Vnfds not found: \" + not_found_vnfds.to_s\n logger.info \"Nsds not found: \" + not_found_nsds.to_s\n halt 404, JSON.generate(result: todisable,\n not_found: { vnfds: not_found_vnfds, nsds: not_found_nsds })\n end\n end", "def disable\n self.stop if self.status == :running\n output = supervisorctl(:remove, @resource[:name])\n rescue Puppet::ExecutionFailure\n raise Puppet::Error, \"Could not disable #{self.name}: #{output}\"\n end", "def disable\n end", "def disable_xpn_host request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_disable_xpn_host_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::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def disable_xpn_host request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/disableXpnHost\"\n\n query_string_params = {}\n query_string_params[\"requestId\"] = request_pb.request_id.to_s if request_pb.request_id && request_pb.request_id != \"\"\n\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def disable_pxe\n delegate(provider, :disable_pxe)\n end", "def disable!\n @enabled = false\n end", "def disable\n debug \"Call 'disable' for Pacemaker service '#{name}' on node '#{hostname}'\"\n unmanage_primitive name\n end", "def disable\n @disabled = true\n end", "def disable\n @enabled = false\n end", "def disable!\n @enabled = false\n end", "def disable\n {\n method: \"Security.disable\"\n }\n end", "def disable!\n @disabled = true\n end", "def disable!\n self.enabled = false\n end", "def disable\n \n orignial_state = @enabled\n @enabled = false\n \n if block_given?\n yield\n @enabled = orignial_state\n end\n \n return self\n \n end", "def disable(probe)\n Ruby.primitive :taskprobe_disable\n raise PrimtiveFailure, \"TaskProbe#disable primitive failed\"\n end", "def revoke_on_unenroll_disabled=(value)\n @revoke_on_unenroll_disabled = value\n end", "def disabled=(_arg0); end", "def disable\n\n @enabled = false\n\n return self\n\n end", "def disabled; end", "def disable!\n @active = false\n change_status(:disabled)\n end", "def disable\n @service.disabled = true\n end", "def disable\n {\n method: \"WebAuthn.disable\"\n }\n end", "def enable_rx; @disabled_rx -= 1 end", "def receive_disabled\n\n wrap_reply('disable' => Flor.true?(payload['ret']))\n end", "def disable\n @bill.update_attribute :is_recurring, false\n account = Account.find(@bill.account_id)\n user = User.find(account.user_id)\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def disable_smart_proxy\n params = {:enabled => false}\n smart_proxy(params)\n end", "def disable_rx; @disabled_rx += 1 end", "def disable\n {\n method: \"Performance.disable\"\n }\n end", "def disable\n Puppet.notice \"Disabling Puppet.\"\n lockfile.lock(:anonymous => true)\n end", "def disable\n {\n method: \"HeadlessExperimental.disable\"\n }\n end", "def revoke_on_unenroll_disabled\n return @revoke_on_unenroll_disabled\n end", "def disable(key)\n @status[key] = :disabled\n end", "def disableAI _obj, _args\n \"_obj disableAI _args;\" \n end", "def disable_approval!\n send(:remove_const, :DRAFT_PUNK_IS_SETUP) if const_defined? :DRAFT_PUNK_IS_SETUP\n send(:remove_const, :DRAFT_NULLIFY_ATTRIBUTES) if const_defined? :DRAFT_NULLIFY_ATTRIBUTES\n fresh_amoeba do\n disable\n end\n end", "def disable\n request = Net::HTTP::Post.new(\"/proxies/#{name}\")\n request[\"Content-Type\"] = \"application/json\"\n\n hash = { enabled: false }\n request.body = hash.to_json\n\n response = http_request(request)\n assert_response(response)\n self\n end", "def disable!\n @mutex.synchronize do\n @advised.each { | x | x.disable! }\n end\n self\n end", "def disable\n authorize! @user\n @user.enabled = false\n @user.save\n @user.owned_extensions.update_all(enabled: false)\n redirect_to root_path, notice: t(\"user.disabled\", name: @user.username)\n end", "def no_ripple_check opts={}\n params = {\n account: opts.delete(:account) || client_account,\n role: \"gateway\",\n limit: 2,\n ledger_index: \"validated\"\n }.merge!(opts)\n post(:no_ripple_check, params)\n end", "def disable\n {\n method: \"Page.disable\"\n }\n end", "def disable_pending_cops=(_arg0); end", "def payload_disable_nops(explicit_target = nil)\n explicit_target ||= target\n\n if (explicit_target and explicit_target.payload_disable_nops)\n explicit_target.payload_disable_nops\n else\n payload_info['DisableNops']\n end\n end", "def disable_rate_limits!\n @rate_limits_disabled = true\n end", "def disable_alert_feature \n put(\"/globalsettings.json/alerts/disable\")\nend", "def disableTIEquipment _obj, _args\n \"_obj disableTIEquipment _args;\" \n end", "def bypass_inactive_disable\n @attributes[:bypass_inactive_disable]\n end", "def disable_pending_cops; end", "def payload_disable_nops\n opts['Payload'] ? opts['Payload']['DisableNops'] : nil\n end", "def disable # :nodoc:\n @trace_point.disable\n end", "def disable\n {\n method: \"WebAudio.disable\"\n }\n end", "def action_disable\n super\n end", "def disabled!\n self\n end", "def disable_approval!\n send(:remove_const, :DRAFT_PUNK_IS_SETUP) if const_defined? :DRAFT_PUNK_IS_SETUP\n send(:remove_const, :DRAFT_NULLIFY_ATTRIBUTES) if const_defined? :DRAFT_NULLIFY_ATTRIBUTES\n send(:remove_const, :ALLOW_PREVIOUS_VERSIONS_TO_BE_CHANGED) if const_defined? :ALLOW_PREVIOUS_VERSIONS_TO_BE_CHANGED\n fresh_amoeba do\n disable\n end\n end", "def skip_load_and_authorize_resource(*args)\n skip_load_resource(*args)\n skip_authorize_resource(*args)\n end", "def disable(patch)\n @socket.disable\n end", "def deactivate_resource(resource)\n work_link = %W(#{@workdir} #{resource}).join('/')\n log.debug \"deactivating: #{work_link}\"\n File.delete(work_link) if File.symlink?(work_link)\n log.debug \"deactivated resource #{resource}\"\n end", "def reject!(response_data={})\n @client.post(\"#{path}/reject\", response_data)\n end", "def disable\n {\n method: \"DOM.disable\"\n }\n end", "def enable_xpn_resource request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_enable_xpn_resource_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def enable_xpn_resource request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/enableXpnResource\"\n body = request_pb.projects_enable_xpn_resource_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def disable_plex_media_server(resource_name)\n ChefSpec::Matchers::ResourceMatcher.new(:plex_media_server, :disable, resource_name)\n end", "def disable(thing = Types::Boolean.new(false))\n instrument(:disable, thing) { |payload|\n adapter.add self\n\n gate = gate_for(thing)\n payload[:gate_name] = gate.name\n\n if gate.is_a?(Gates::Boolean)\n adapter.clear self\n else\n adapter.disable self, gate, gate.wrap(thing)\n end\n }\n end", "def cancelled_requests; end", "def disable\n @water_point = WaterPoint.find_by_id_and_user_id(params[:id], @current_user.id)\n @water_point.delete!\n respond_to do |format|\n format.any(:html,:iphone) { redirect_to water_points_path }\n format.xml { head :ok }\n end\n end", "def disabled?; end", "def disabled?; end", "def disable\n run \"#{try_sudo} /sbin/chkconfig puppet off\"\n end", "def disable(id)\n change_status id, false\n end", "def ignore_apdex\n record_api_supportability_metric(:ignore_apdex)\n NewRelic::Agent::Transaction.tl_current&.ignore_apdex!\n end", "def disable_resilience_defaults=(value)\n @disable_resilience_defaults = value\n end", "def disable\n unless @employee.can_be_disabled?\n redirect_to :back, :alert => \"First remove all assigned asset from #{@employee.name}\"\n else\n @employee.soft_delete! \n redirect_to :back, :notice => \"Employee #{@employee.name} has been disabled successfully\"\n end\n end", "def noop\n # This is only here to make testing easier.\n if @resource.respond_to?(:noop?)\n @resource.noop?\n else\n if defined?(@noop)\n @noop\n else\n Puppet[:noop]\n end\n end\n end", "def disable_resilience_defaults\n return @disable_resilience_defaults\n end", "def disable\n admin_only do\n handle_recurring_schedule_failure 'disable', 'disabled' do\n # get the schedule object to be disabled.\n @test = get_test_with_rescue\n @test.active = nil\n @test.save!\n end\n redirect_to action: \"index\"\n end\n end", "def disable(item)\n run(\"no #{ item }\")\n end", "def disable(&block)\n @disable_block = block\n end", "def disable_polling(reason = nil)\n self.deactivate\n self.deactivation_reason = reason.to_s\n self.deactivated_at = Time.now\n self.save!\n end", "def handle_disabled\n @was_disabled = true\n cancel_associated_job!\n\n refs_pointing_to_self = ModelReference.find_references_to(self)\n refs_pointing_to_self.update_all(disabled: true)\n end", "def disable_switch_data(pwnfx_scope)\n pwnfx_tag_id = pwnfx_scope + '_field'\n { pwnfx_disable_scope: pwnfx_scope, pwnfx_disable: pwnfx_tag_id,\n pwnfx_disable_trigger: 'checked' }\n end", "def resource_skipped(resource, action, conditional)\n end", "def disable_alerting=(value)\n start = Time.now\n debug \"Updating disable_alerting setting for device group: \\\"#{resource[:full_path]}\\\"\"\n connection = self.class.get_connection(resource[:account])\n update_device_group(connection,\n resource[:full_path],\n resource[:description],\n resource[:properties],\n value)\n debug \"Finished in #{(Time.now-start)*1000.0} ms\"\n end", "def disable\n @queue << \"disable\"\n end", "def deactivate; end", "def reject!\n super { |r| yield(r) && orphan_resource(r) }\n end", "def disable\n @enabled = false\n disable_output_method if @output_method\n false\n end", "def disable_threshold\n @enable_threshold = false\n end", "def disable\n redis.set(flag_key, 0)\n end", "def disable\n @office = Office.find(params[:id])\n authorize! :update, @office\n \n @office.active_flag = 0\n\n track_event(\"Disabled Listing\");\n\n respond_to do |format|\n if @office.save\n format.html { redirect_to office_path(@office), notice: \"This listing has been successfully disabled.\" }\n format.json { head :no_content }\n else \n flash[:error] = 'Your office could not be disabled. Please contact us at spaces@intuit.com for assistance.'\n format.html { redirect_to office_path(@office) }\n format.json { head :no_content }\n end\n end\n end", "def unbind(desired_resource)\n iq = Iq.new(:set)\n unbind = iq.add REXML::Element.new('unbind')\n unbind.add_namespace @stream_features['unbind']\n resource = unbind.add REXML::Element.new('resource')\n resource.text = desired_resource\n\n send_with_id(iq)\n end", "def enable_tx; @disabled_tx -= 1 end", "def denied\n end", "def a_pi_key_disable_with_http_info(api_key_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: APIKeyApi.a_pi_key_disable ...\"\n end\n # verify the required parameter 'api_key_id' is set\n fail ArgumentError, \"Missing the required parameter 'api_key_id' when calling APIKeyApi.a_pi_key_disable\" if api_key_id.nil?\n # resource path\n local_var_path = \"/apiKey/disable\".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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\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', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n form_params[\"apiKeyID\"] = api_key_id\n\n # http body (model)\n post_body = nil\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 => 'APIKey')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: APIKeyApi#a_pi_key_disable\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def onProviderDisabled(eventData)\n endPosting(JourneyEventData::R_DISABLED)\n end", "def strip_resource\r\n @resource=nil\r\n return self\r\n end", "def deactivate()\n end", "def kvm_disable(handle:, server_id: 1)\n kvm_mo = CommKvm.new(parent_mo_or_dn: _get_comm_mo_dn(handle, server_id))\n kvm_mo.set_prop(:admin_state, \"disabled\")\n handle.set_mo(mo: kvm_mo)\nend", "def skip_authorize_resource(name, **options)\n cancan_skipper[:authorize][name] = options\n end", "def excluded_resource_actions=(value)\n @excluded_resource_actions = value\n end", "def disable_rollback\n data[:disable_rollback]\n end" ]
[ "0.76148224", "0.64701885", "0.6257961", "0.62534875", "0.62182504", "0.6121089", "0.61057836", "0.6075139", "0.60473377", "0.59914917", "0.59818035", "0.59754074", "0.5946178", "0.58969575", "0.5872311", "0.58631057", "0.5840956", "0.58352727", "0.581321", "0.5805529", "0.5802312", "0.5788786", "0.5784497", "0.57745177", "0.57516783", "0.5738374", "0.5723158", "0.5715753", "0.5705546", "0.56824875", "0.5665208", "0.56588364", "0.56509686", "0.56482834", "0.5620634", "0.5612435", "0.5598894", "0.5592523", "0.55737144", "0.5565936", "0.55591774", "0.55519295", "0.5543062", "0.5502866", "0.5497639", "0.54955155", "0.5478138", "0.5471073", "0.5452402", "0.5443426", "0.5428865", "0.541558", "0.54155767", "0.5408104", "0.54079944", "0.5405805", "0.5403792", "0.5396531", "0.5392633", "0.5390074", "0.5390069", "0.5388275", "0.53862375", "0.5376874", "0.53736585", "0.5368786", "0.5368786", "0.5357695", "0.53550273", "0.535324", "0.53478277", "0.534738", "0.5344796", "0.53057283", "0.5301099", "0.5300895", "0.52996725", "0.5295732", "0.5292059", "0.52871317", "0.52840835", "0.52839774", "0.5278868", "0.52600974", "0.5256463", "0.52386975", "0.5234351", "0.52319324", "0.52297175", "0.5224705", "0.5222565", "0.5212855", "0.5209516", "0.52090573", "0.5206586", "0.52007425", "0.51997226", "0.5194392", "0.51932174", "0.5192325" ]
0.76709634
0
Baseline implementation for the enable_xpn_host REST call
def enable_xpn_host request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, query_string_params = transcode_enable_xpn_host_request request_pb response = @client_stub.make_post_request( uri: uri, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_xpn_host request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/enableXpnHost\"\n\n query_string_params = {}\n query_string_params[\"requestId\"] = request_pb.request_id.to_s if request_pb.request_id && request_pb.request_id != \"\"\n\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def disable_xpn_host request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_disable_xpn_host_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::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def enable(session, id, enabled)\n write_task('rvpe.host.enable', session, true) do\n call_one_xmlrpc('one.host.enable', session, id, enabled)\n end\n end", "def enable_xpn_resource request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_enable_xpn_resource_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def disable_xpn_host request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/disableXpnHost\"\n\n query_string_params = {}\n query_string_params[\"requestId\"] = request_pb.request_id.to_s if request_pb.request_id && request_pb.request_id != \"\"\n\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def enable_xpn_resource request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/enableXpnResource\"\n body = request_pb.projects_enable_xpn_resource_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def enable_smart_proxy(host=nil, port=nil)\n params = {:enabled => true}\n params[:host] = host unless host.nil?\n params[:port] = port unless port.nil?\n smart_proxy(params)\n end", "def has_required_host?\n true\n end", "def set_hostname_verification (enable)\n not_bool_response = fail_response(13001, \"NaServer::set_hostname_verification: invalid argument \" + enable + \"specified\")\n return not_bool_response unless !!enable == enable\n not_serv_cert_response = fail_response(13001, \"NaServer::set_hostname_verification: server certificate verification is not enabled\")\n return not_serv_cert_response unless server_cert_verification_enabled?\n @enable_hostname_verification = enable\n end", "def enable_pxe\n delegate(provider, :enable_pxe)\n end", "def enable_ssh(s1_ip,logger)\n\n uri = URI.parse(\"https://#{s1_ip}/protected/sshservice.html\") #common url for all release\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth(\"Nemuadmin\", \"nemuuser\")\n \n ssh_service_status_response=\"\"\n\n client=RestClient::Resource.new(\"https://#{s1_ip}/protected/sshservice.html\",:user=>\"Nemuadmin\",:password=>\"nemuuser\",:verify_ssl => OpenSSL::SSL::VERIFY_NONE)\n\n # response_body\n\n begin\n #Timeout.timeout(2){\n #ssh_service_status_response = http.request(request)\n response=client.get\n #puts \"response=#{response}\" \n #delete those fake bts\n if not response.match(/SSH\\sService\\sStatus/)\n LiveStatus.where(:s1_ip=>s1_ip).delete_all\n # puts \"#{s1_ip} deleted!\"\n logger.error \"#{s1_ip} deleted! \"\n return false\n end\n\n rescue\n live_status=LiveStatus.where(:s1_ip=>s1_ip).first\n logger.error \"#{s1_ip} is not a BTS \"\n return false if live_status.nil?\n\n # if live_status.ssh_pass.nil? ||live_status.ssh_pass<=1\n # puts \"#{s1_ip} deleted!\"\n # LiveStatus.where(:s1_ip=>s1_ip).delete_all\n # end\n\n return false\n end\n\n\n#check need token or not\n\n if response.match(\"token\") #this is a site version bigger >RL55\n result=enable_ssh_with_token(s1_ip,response)\n else\n #enable_ssh_without_token(s1_ip)\n result= enable_ssh_without_token_2(s1_ip)\n end\n\n if result==true\n logger.info \"#{s1_ip} enable ssh succsefully !\"\n return true\n else\n logger.error \"#{s1_ip} enable ssh fail !\"\n return false\n end\n \n return nil\nend", "def allowHost\n end", "def enable_ssh_without_token_2(s1_ip)\n client=RestClient::Resource.new(\"https://#{s1_ip}/protected/enableSsh.cgi\",:user=>\"Nemuadmin\",:password=>\"nemuuser\",:verify_ssl => OpenSSL::SSL::VERIFY_NONE)\n begin\n # Timeout.timeout(5){\n response=client.get\n # }\n\n if response.body.match(\"SSH Service Enabled Successfully\")\n # puts \"#{s1_ip} enable ssh succ(no token)!\"\n return true \n else\n #puts \"enable ssh for #{s1_ip} fail!(no token)\"\n\n return false\n end\n\n rescue\n #puts $@\n #puts \"enable ssh for #{s1_ip} exception!(no token)\"\n return false\n end\nend", "def host_authorization=(_arg0); end", "def host_authorization=(_arg0); end", "def host_notifications_enabled=(arg)\n @host_notifications_enabled = check_bool(arg)\n end", "def enable\n debug \"Call 'enable' for Pacemaker service '#{name}' on node '#{hostname}'\"\n manage_primitive name\n end", "def host_allowed?(arg)\n true\n end", "def enable_xack\n getok('XACK ON')\n @xack = true\n end", "def enable\n CircleCi.request(conf, \"#{base_path}/enable\").post\n end", "def enable_icmp_device_discovery=(enable)\n icmp = REXML::XPath.first(@xml, 'ScanTemplate/DeviceDiscovery/CheckHosts/icmpHostCheck')\n icmp.attributes['enabled'] = (enable ? 1 : 0)\n end", "def on_enable_instance(msg, reply)\n @logger.debug(\"#{service_description}: enable instance #{msg} request from #{reply}\")\n credentials = Yajl::Parser.parse(msg)\n prov_cred, binding_creds_hash = credentials\n result = enable_instance(prov_cred, binding_creds_hash)\n # Update node_id in provision credentials..\n prov_cred, binding_creds_hash = result\n prov_cred['node_id'] = @node_id\n result = [prov_cred, binding_creds_hash]\n @node_nats.publish(reply, Yajl::Encoder.encode(result))\n rescue => e\n @logger.warn(e)\n end", "def enabled?\n !host.nil?\n end", "def run_host(ip)\n\n\t\tverbs = [\n\t\t\t\t'get',\n\t\t\t\t'active',\n\t\t\t\t'create',\n\t\t\t\t'change',\n\t\t\t\t'set',\n\t\t\t\t'put',\n\t\t\t\t'do',\n\t\t\t\t'go',\n\t\t\t\t'resolve',\n\t\t\t\t'start',\n\t\t\t\t'recover',\n\t\t\t\t'initiate',\n\t\t\t\t'negotiate',\n\t\t\t\t'define',\n\t\t\t\t'stop',\n\t\t\t\t'begin',\n\t\t\t\t'end',\n\t\t\t\t'manage',\n\t\t\t\t'administer',\n\t\t\t\t'modify',\n\t\t\t\t'register',\n\t\t\t\t'log',\n\t\t\t\t'add',\n\t\t\t\t#'delete', # Best to be safe!\n\t\t\t]\n\n\t\tnouns = [\n\t\t\t\t'password',\n\t\t\t\t'task',\n\t\t\t\t'pass',\n\t\t\t\t'administration',\n\t\t\t\t'account',\n\t\t\t\t'admin',\n\t\t\t\t'login',\n\t\t\t\t'token',\n\t\t\t\t'credentials',\n\t\t\t\t'credential',\n\t\t\t\t'key',\n\t\t\t\t'guid',\n\t\t\t\t'message',\n\t\t\t\t'user',\n\t\t\t\t'username',\n\t\t\t\t'load',\n\t\t\t\t'list',\n\t\t\t\t'name',\n\t\t\t\t'file',\n\t\t\t\t'path',\n\t\t\t\t'directory',\n\t\t\t\t'configuration',\n\t\t\t\t'config',\n\t\t\t\t'setting',\n\t\t\t\t'settings',\n\t\t\t\t'registry',\n\t\t\t\t'on',\n\t\t\t\t'off',\n\t\t\t]\n\n\t\ttarget_port = datastore['RPORT']\n\t\tvhost = datastore['VHOST'] || wmap_target_host || ip\n\n\t\tbegin\n\t\t\t# Check service exists\n\t\t\tres = send_request_raw({\n\t\t\t\t'uri' => datastore['PATH'],\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'vhost' => vhost,\n\t\t\t}, 10)\n\n\t\t\tif (res.code == 200)\n\t\t\t\tprint_status(\"PATH appears to be OK.\")\n\n\t\t\t\tverbs.each do |v|\n\t\t\t\t\tnouns.each do |n|\n\n\t\t\t\t\t\t# This could be cleaned up - patrickw\n\t\t\t\t\t\tdata = '<?xml version=\"1.0\" encoding=\"utf-8\"?>' + \"\\r\\n\"\n\t\t\t\t\t\tdata << '<soap:Envelope xmlns:xsi=\"' + datastore['XMLINSTANCE'] + '\" xmlns:xsd=\"' + datastore['XMLSCHEMA'] + '\" xmlns:soap=\"' + datastore['XMLSOAP'] + '\">' + \"\\r\\n\"\n\t\t\t\t\t\tdata << '<soap:Body>' + \"\\r\\n\"\n\t\t\t\t\t\tdata << \"<#{v}#{n}\" + \" xmlns=\\\"#{datastore['XMLNAMESPACE']}\\\">\" + \"\\r\\n\"\n\t\t\t\t\t\tdata << \"</#{v}#{n}>\" + \"\\r\\n\"\n\t\t\t\t\t\tdata << '</soap:Body>' + \"\\r\\n\"\n\t\t\t\t\t\tdata << '</soap:Envelope>' + \"\\r\\n\\r\\n\"\n\n\t\t\t\t\t\tres = send_request_raw({\n\t\t\t\t\t\t\t'uri' => datastore['PATH'] + '/' + v + n,\n\t\t\t\t\t\t\t'method' => 'POST',\n\t\t\t\t\t\t\t'vhost' => vhost,\n\t\t\t\t\t\t\t'data'\t\t=> data,\n\t\t\t\t\t\t\t'headers' =>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'Content-Length' => data.length,\n\t\t\t\t\t\t\t\t\t'SOAPAction'\t=> '\"' + datastore['XMLNAMESPACE'] + v + n + '\"',\n\t\t\t\t\t\t\t\t\t'Expect'\t=> '100-continue',\n\t\t\t\t\t\t\t\t\t'Content-Type'\t=> datastore['CONTENTTYPE'],\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 15)\n\n\t\t\t\t\t\tif (res && !(res.body.empty?))\n\t\t\t\t\t\t\tif (res.body =~ /method name is not valid/)\n\t\t\t\t\t\t\t\tprint_status(\"Server rejected SOAPAction: #{v}#{n} with HTTP: #{res.code} #{res.message}.\")\n\t\t\t\t\t\t\telsif (res.message =~ /Cannot process the message because the content type/)\n\t\t\t\t\t\t\t\tprint_status(\"Server rejected CONTENTTYPE: HTTP: #{res.code} #{res.message}.\")\n\t\t\t\t\t\t\t\tres.message =~ /was not the expected type\\s\\'([^']+)'/\n\t\t\t\t\t\t\t\tprint_status(\"Set CONTENTTYPE to \\\"#{$1}\\\"\")\n\t\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t\telsif (res.code == 404)\n\t\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tprint_status(\"Server responded to SOAPAction: #{v}#{n} with HTTP: #{res.code} #{res.message}.\")\n\t\t\t\t\t\t\t\t## Add Report\n\t\t\t\t\t\t\t\treport_note(\n\t\t\t\t\t\t\t\t\t:host\t=> ip,\n\t\t\t\t\t\t\t\t\t:proto\t=> 'HTTP',\n\t\t\t\t\t\t\t\t\t:port\t=> rport,\n\t\t\t\t\t\t\t\t\t:type\t=> \"SOAPAction: #{v}#{n}\",\n\t\t\t\t\t\t\t\t\t:data\t=> \"SOAPAction: #{v}#{n} with HTTP: #{res.code} #{res.message}.\"\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tif datastore['DISPLAYHTML']\n\t\t\t\t\t\t\t\t\tprint_status(\"The HTML content follows:\")\n\t\t\t\t\t\t\t\t\tprint_status(res.body + \"\\r\\n\")\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\n\t\telse\n\t\t\tprint_status(\"Server did not respond with 200 OK.\")\n\t\t\tprint_status(res.to_s)\n\t\tend\n\t\trescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n\t\trescue ::Timeout::Error, ::Errno::EPIPE\n\t\tend\n\tend", "def enable_ip_stack_fingerprinting=(enable)\n ns = REXML::XPath.first(@xml, 'ScanTemplate/Plugins/Plugin[@name=\"java/NetworkScanners\"]')\n param = REXML::XPath.first(ns, './param[@name=\"ipFingerprintEnabled\"]')\n if param\n param.text = (enable ? 1 : 0)\n else\n param = REXML::Element.new('param')\n param.add_attribute('name', 'ipFingerprintEnabled')\n param.text = (enable ? 1 : 0)\n ns.add_element(param)\n end\n end", "def configure_xb_pxe_client(client_name,client_ip,client_mac,client_arch,service_name,publisher_host)\n os_version = service_name.split(/_/)[1..2].join(\".\")\n tftp_pxe_file = client_mac.gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tmp_file = \"/tmp/pxecfg\"\n if service_name.match(/openbsd/)\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxeboot\"\n test_file = $tftp_dir+\"/\"+tftp_pxe_file\n pxeboot_file = service_name+\"/\"+os_version+\"/\"+client_arch.gsub(/x86_64/,\"amd64\")+\"/pxeboot\"\n else\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxelinux\"\n test_file = $tftp_dir+\"/\"+tftp_pxe_file\n pxeboot_file = service_name+\"/isolinux/pxelinux.0\"\n end\n if File.symlink?(test_file)\n message = \"Removing:\\tOld PXE boot file \"+test_file\n command = \"rm #{test_file}\"\n execute_command(message,command)\n end\n message = \"Creating:\\tPXE boot file for \"+client_name+\" with MAC address \"+client_mac\n command = \"cd #{$tftp_dir} ; ln -s #{pxeboot_file} #{tftp_pxe_file}\"\n execute_command(message,command)\n if service_name.match(/coreos/)\n ldlinux_file = $tftp_dir+\"/\"+service_name+\"/isolinux/ldlinux.c32\"\n ldlinux_link = $tftp_dir+\"/ldlinux.c32\"\n if !File.exist?(ldlinux_link)\n message = \"Copying:\\tFile #{ldlinux_file} #{ldlinux_link}\"\n command = \"cp #{ldlinux_file} #{ldlinux_link}\"\n execute_command(message,command)\n end\n client_dir = $client_base_dir+\"/\"+service_name+\"/\"+client_name\n client_file = client_dir+\"/\"+client_name+\".yml\"\n client_url = \"http://\"+publisher_host+\"/clients/\"+service_name+\"/\"+client_name+\"/\"+client_name+\".yml\"\n pxe_cfg_dir = $tftp_dir+\"/pxelinux.cfg\"\n pxe_cfg_file = client_mac.gsub(/:/,\"-\")\n pxe_cfg_file = \"01-\"+pxe_cfg_file\n pxe_cfg_file = pxe_cfg_file.downcase\n pxe_cfg_file = pxe_cfg_dir+\"/\"+pxe_cfg_file\n vmlinuz_file = \"/\"+service_name+\"/coreos/vmlinuz\"\n initrd_file = \"/\"+service_name+\"/coreos/cpio.gz\"\n file = File.open(tmp_file,\"w\")\n file.write(\"default coreos\\n\")\n file.write(\"prompt 1\\n\")\n file.write(\"timeout 3\\n\")\n file.write(\"label coreos\\n\")\n file.write(\" menu default\\n\")\n file.write(\" kernel #{vmlinuz_file}\\n\")\n file.write(\" append initrd=#{initrd_file} cloud-config-url=#{client_url}\\n\")\n file.close\n message = \"Creating:\\tPXE configuration file \"+pxe_cfg_file\n command = \"cp #{tmp_file} #{pxe_cfg_file} ; rm #{tmp_file}\"\n execute_command(message,command)\n print_contents_of_file(pxe_cfg_file)\n end\n return\nend", "def enable\n end", "def enable_nat(ip_addr)\n raise 'not implemented'\n end", "def ipn_endpoint; end", "def ipn_endpoint; end", "def check_host_attribute_state\n super\n end", "def addhost(config)\n\n uri = URI.parse(\"#{config[\"addurl\"]}\")\n node = { \"EntityType\" => \"Orion.Nodes\", \"IPAddress\" => \"#{config[\"ipaddr\"]}\",\n \"Caption\"=> \"#{config[\"nodename\"]}\", \"DynamicIP\" => \"False\", \"EngineID\" => \"#{config[\"engineid\"]}\", \n \"Status\" => 1, \"UnManaged\" => \"False\", \"Allow64BitCounters\" => \"True\", \n \"SysObjectID\" => \"\", \"MachineType\" => \"\", \"VendorIcon\" => \"\", \n \"ObjectSubType\" => \"SNMP\", \"SNMPVersion\" => 2, \"Community\" => \"#{config[\"community\"]}\",\n }\n\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Post.new(uri.request_uri, initheader = {'Content-Type' =>'application/json'})\n request.body = node.to_json\n request.basic_auth(\"#{config[\"username\"]}\", \"#{config[\"password\"]}\")\n\n response = http.request(request)\nend", "def load_balancer_status\n puts\n @haproxy.identity_filter(@load_balancer)\n rpcresult = @haproxy.backend_status(:backend => 'puppetcamp')\n puts \"Enabled Nodes :\".green\n rpcresult.each do |enabled| \n enabled[:data][:enabled].each do |host|\n puts \" #{host}\".green\n end\n end\n puts\n puts \"Disabled Nodes :\".red\n rpcresult.each do |disabled|\n disabled[:data][:disabled].each do |host|\n puts \" #{host}\".red\n end\n end\n puts\nend", "def enable(machine, folders, nfsopts)\n response = machine.provider.driver.get_host_ip\n host_ip = response[\"host_ip\"]\n if machine.config.vm.guest == :windows\n folders.each do |id, data|\n machine.ui.output \"#{data[:hostpath]} ==>\"\n machine.ui.output \"\\\\\\\\#{host_ip}\\\\#{data[:smb_id]}\"\n end\n guest_startup_script(machine, folders, host_ip)\n else\n original_enable(machine, folders, nfsopts)\n end\n end", "def host_authorization; end", "def host_authorization; end", "def enable\n output = chkconfig(@resource[:name], :on)\n rescue Puppet::ExecutionFailure => detail\n raise Puppet::Error, \"Could not enable #{self.name}: #{detail}\"\n end", "def report_host(opts)\n\n return if !active\n addr = opts.delete(:host) || return\n\n # Sometimes a host setup through a pivot will see the address as \"Remote Pipe\"\n if addr.eql? \"Remote Pipe\"\n return\n end\n\n ::ApplicationRecord.connection_pool.with_connection {\n wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework)\n opts = opts.clone\n opts.delete(:workspace)\n\n begin\n retry_attempts ||= 0\n if !addr.kind_of? ::Mdm::Host\n addr = Msf::Util::Host.normalize_host(addr)\n\n unless ipv46_validator(addr)\n raise ::ArgumentError, \"Invalid IP address in report_host(): #{addr}\"\n end\n\n conditions = {address: addr}\n conditions[:comm] = opts[:comm] if !opts[:comm].nil? && opts[:comm].length > 0\n host = wspace.hosts.where(conditions).first_or_initialize\n else\n host = addr\n end\n\n ostate = host.state\n\n # Truncate the info field at the maximum field length\n if opts[:info]\n opts[:info] = opts[:info][0,65535]\n end\n\n # Truncate the name field at the maximum field length\n if opts[:name]\n opts[:name] = opts[:name][0,255]\n end\n\n if opts[:os_name]\n os_name, os_flavor = split_windows_os_name(opts[:os_name])\n opts[:os_name] = os_name if os_name.present?\n if opts[:os_flavor].present?\n if os_flavor.present? # only prepend if there is a value that needs it\n opts[:os_flavor] = os_flavor + opts[:os_flavor]\n end\n else\n opts[:os_flavor] = os_flavor\n end\n end\n\n opts.each do |k,v|\n if host.attribute_names.include?(k.to_s)\n unless host.attribute_locked?(k.to_s)\n host[k] = v.to_s.gsub(/[\\x00-\\x1f]/n, '')\n end\n elsif !v.blank?\n dlog(\"Unknown attribute for ::Mdm::Host: #{k}\")\n end\n end\n host.info = host.info[0,::Mdm::Host.columns_hash[\"info\"].limit] if host.info\n\n # Set default fields if needed\n host.state = Msf::HostState::Alive if host.state.nil? || host.state.empty?\n host.comm = '' unless host.comm\n host.workspace = wspace unless host.workspace\n\n begin\n framework.events.on_db_host(host) if host.new_record?\n rescue => e\n wlog(\"Exception in on_db_host event handler: #{e.class}: #{e}\")\n wlog(\"Call Stack\\n#{e.backtrace.join(\"\\n\")}\")\n end\n\n host_state_changed(host, ostate) if host.state != ostate\n\n if host.changed?\n msf_import_timestamps(opts, host)\n host.save!\n end\n rescue ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid\n # two concurrent report requests for a new host could result in a RecordNotUnique or\n # RecordInvalid exception, simply retry the report once more as an optimistic approach\n retry if (retry_attempts+=1) <= 1\n raise\n end\n\n if opts[:task]\n Mdm::TaskHost.create(\n :task => opts[:task],\n :host => host\n )\n end\n\n host\n }\n end", "def enable_root_on_hosts\n @hosts.each do |host|\n enable_root(host)\n end\n end", "def modify_host(host, args = {}, action = 'create')\n args[:host] = host\n ! @backend.send(\"#{action}_host\", args).nil?\n end", "def enable\n end", "def service_x25!()\n @service = TAC_PLUS_AUTHEN_SVC_X25\n end", "def ipn_endpoint=(_arg0); end", "def host!(_arg0); end", "def enable\n {\n method: \"HeadlessExperimental.enable\"\n }\n end", "def enable\n request = Net::HTTP::Post.new(\"/proxies/#{name}\")\n request[\"Content-Type\"] = \"application/json\"\n\n hash = { enabled: true }\n request.body = hash.to_json\n\n response = http_request(request)\n assert_response(response)\n self\n end", "def configure_vs_pxe_client(options)\n tftp_pxe_file = options['mac'].gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tftp_boot_file = \"boot.cfg.01\"+tftp_pxe_file\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxelinux\"\n test_file = options['tftpdir']+\"/\"+tftp_pxe_file\n if options['verbose'] == true\n handle_output(options,\"Information:\\tChecking vSphere TFTP directory\")\n end\n check_dir_exists(options,options['tftpdir'])\n check_dir_owner(options,options['tftpdir'],options['uid'])\n if !File.exist?(test_file)\n message = \"Information:\\tCreating PXE boot file for \"+options['name']+\" with MAC address \"+options['mac']\n if options['biostype'].to_s.match(/efi/)\n efi_boot_file = options['service'].to_s+\"/efi/boot/bootx64.efi\"\n command = \"cd #{options['tftpdir']} ; ln -s #{efi_boot_file} #{tftp_pxe_file}\"\n else\n pxelinux_file = options['service']+\"/usr/share/syslinux/pxelinux.0\"\n command = \"cd #{options['tftpdir']} ; ln -s #{pxelinux_file} #{tftp_pxe_file}\"\n end\n execute_command(options,message,command)\n end\n pxe_cfg_dir = options['tftpdir']+\"/pxelinux.cfg\"\n if options['verbose'] == true\n handle_output(options,\"Information:\\tChecking vSphere PXE configuration directory\")\n end\n check_dir_exists(options,pxe_cfg_dir)\n check_dir_owner(options,pxe_cfg_dir,options['uid'])\n ks_url = \"http://\"+options['hostip']+\"/\"+options['name']+\"/\"+options['name']+\".cfg\"\n #ks_url = \"http://\"+options['hostip']+\"/clients/\"+options['service']+\"/\"+options['name']+\"/\"+options['name']+\".cfg\"\n mboot_file = options['service']+\"/mboot.c32\"\n if options['biostype'].to_s.match(/efi/)\n pxe_cfg_dir = options['tftpdir'].to_s+\"/\"+options['mac'].gsub(/:/,\"-\")\n check_dir_exists(options,pxe_cfg_dir)\n check_dir_owner(options,pxe_cfg_dir,options['uid'])\n else\n pxe_cfg_file1 = options['mac'].to_s.gsub(/:/,\"-\")\n pxe_cfg_file1 = \"01-\"+pxe_cfg_file1\n pxe_cfg_file1 = pxe_cfg_file1.downcase\n pxe_cfg_file1 = pxe_cfg_dir+\"/\"+pxe_cfg_file1\n pxe_cfg_file2 = options['mac'].split(\":\")[0..3].join+\"-\"+options['mac'].split(\":\")[4..5].join+\"-0000-0000-\"+options['mac'].gsub(/\\:/,\"\")\n pxe_cfg_file2 = pxe_cfg_file2.downcase\n pxe_cfg_file2 = pxe_cfg_dir+\"/\"+pxe_cfg_file2\n for pxe_cfg_file in [ pxe_cfg_file1, pxe_cfg_file2 ]\n verbose_output(options,\"Information:\\tCreating Menu config file #{pxe_cfg_file}\")\n file = File.open(pxe_cfg_file,\"w\")\n if options['serial'] == true\n file.write(\"serial 0 115200\\n\")\n end\n file.write(\"DEFAULT ESX\\n\")\n file.write(\"LABEL ESX\\n\")\n file.write(\"KERNEL #{mboot_file}\\n\")\n if options['text'] == true\n if options['serial'] == true\n file.write(\"APPEND -c #{tftp_boot_file} text gdbPort=none logPort=none tty2Port=com1 ks=#{ks_url} +++\\n\")\n else\n file.write(\"APPEND -c #{tftp_boot_file} text ks=#{ks_url} +++\\n\")\n end\n else\n file.write(\"APPEND -c #{tftp_boot_file} ks=#{ks_url} +++\\n\")\n end\n file.write(\"IPAPPEND 1\\n\")\n file.close\n print_contents_of_file(options,\"\",pxe_cfg_file)\n end\n end\n if options['biostype'].to_s.match(/efi/)\n tftp_boot_file = options['tftpdir'].to_s+\"/01-\"+options['mac'].to_s.gsub(/:/,\"-\").downcase+\"/boot.cfg\"\n else\n tftp_boot_file = options['tftpdir'].to_s+\"/\"+options['service'].to_s+\"/\"+tftp_boot_file\n end\n esx_boot_file = options['tftpdir'].to_s+\"/\"+options['service'].to_s+\"/boot.cfg\"\n if options['verbose'] == true\n handle_output(options,\"Creating:\\tBoot config file #{tftp_boot_file}\")\n end\n copy=[]\n file=IO.readlines(esx_boot_file)\n file.each do |line|\n line=line.gsub(/\\//,\"\")\n if options['text'] == true\n if line.match(/^kernelopt/)\n if not line.match(/text/)\n line = line.chomp+\" text\\n\"\n end\n end\n end\n if line.match(/^kernelopt/)\n line = \"kernelopt=ks=#{ks_url}\\n\"\n end\n if options['serial'] == true\n if line.match(/^kernelopt/)\n if not line.match(/nofb/)\n line = line.chomp+\" nofb com1_baud=115200 com1_Port=0x3f8 tty2Port=com1 gdbPort=none logPort=none\\n\"\n end\n end\n end\n if line.match(/^title/)\n copy.push(line)\n copy.push(\"prefix=#{options['service']}\\n\")\n else\n if !line.match(/^prefix/)\n copy.push(line)\n end\n end\n end\n tftp_boot_file_dir = File.dirname(tftp_boot_file)\n if options['verbose'] == true\n handle_output(options,\"Information:\\tChecking vSphere TFTP boot file directory\")\n end\n check_dir_exists(options,tftp_boot_file_dir)\n check_dir_owner(options,options['tftpdir'],options['uid'])\n check_dir_owner(options,tftp_boot_file_dir,options['uid'])\n File.open(tftp_boot_file,\"w\") {|file_data| file_data.puts copy}\n check_file_owner(options,tftp_boot_file,options['uid'])\n print_contents_of_file(options,\"\",tftp_boot_file)\n return\nend", "def enable(params)\n node_ip = get_ip(params)\n if params.has_key?(:pool)\n pool_name = params[:pool]\n node_port = (params[:port] || 80).to_i\n if @environment.in_dry_run_mode\n notify(:msg => \"[#{@name}] Would enable member #{node_ip}:#{node_port} in pool #{pool_name} on load balancer #{@config[:host]}\",\n :tags => [:f5, :dryrun])\n get_member(params)\n else\n notify(:msg => \"[#{@name}] Enabling member #{node_ip}:#{node_port} in pool #{pool_name} on load balancer #{@config[:host]}\",\n :tags => [:f5, :trace])\n set_pool_member_status(pool_name,\n 'member' => { 'address' => node_ip, 'port' => node_port },\n 'monitor_state' => 'STATE_ENABLED')\n end\n else\n if @environment.in_dry_run_mode\n node = get_node(params)\n notify(:msg => \"[#{@name}] Would enable node #{node_ip} on load balancer #{@config[:host]}\",\n :tags => [:f5, :dryrun])\n node\n else\n notify(:msg => \"[#{@name}] Enabling node #{node_ip} on load balancer #{@config[:host]}\",\n :tags => [:f5, :trace])\n set_node_status(node_ip, 'STATE_ENABLED')\n end\n end\n end", "def setPxeEnv(node)\n if (@pxePrefix != nil)\n ns = \"[#{node.x},#{node.y}]\"\n url = @pxePrefix + ns\n debug \"PXE: #{url}\"\n NodeHandler.service_call(url, \"Error requesting PXE image\")\n end\n end", "def enable_publicendpoint_vhost_json(name, enabled)\n service = getTableValue(\"table://vhosts/#{name}/Service\")\n endpoint = getTableValue(\"table://vhosts/#{name}/Endpoint\")\n vhostName = getTableValue(\"table://vhosts/#{name}/Name\")\n return enable_publicendpoint_vhost(service, endpoint, vhostName, enabled)\n end", "def enable!; end", "def host_key_regen\n send_req(act: :host_key_regen)\n end", "def host=(_arg0); end", "def host=(_arg0); end", "def get_xpn_host request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/getXpnHost\"\n\n response = @client_stub.make_get_request(\n uri: uri,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Project.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def enable\n run \"#{try_sudo} /sbin/chkconfig puppet on\"\n end", "def make_host\n unless self.host.host\n self.host.update(:host => true)\n end\n end", "def per_host\n @per_host = true\n end", "def platform_endpoint=(_arg0); end", "def host(host)\n @api.host = host\n end", "def host=(_); end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def service_ppp!()\n @service = TAC_PLUS_AUTHEN_SVC_PPP\n end", "def externalNodes\n certname = params[:name]\n @host ||= resource_base.find_by_certname certname\n @host ||= resource_base.find_by_name certname\n not_found and return unless @host\n\n begin\n respond_to do |format|\n format.html { render :text => \"<pre>#{@host.info.to_yaml}</pre>\" }\n format.yml { render :text => @host.info.to_yaml }\n end\n rescue\n # failed\n logger.warn \"Failed to generate external nodes for #{@host} with #{$!}\"\n render :text => _('Unable to generate output, Check log files\\n'), :status => 412 and return\n end\n end", "def default_ipn_endpoint; end", "def enable_publicendpoint_port_json(name, enabled)\n service = getTableValue(\"table://ports/#{name}/Service\")\n endpoint = getTableValue(\"table://ports/#{name}/Endpoint\")\n portAddr = getTableValue(\"table://ports/#{name}/PortAddr\")\n return enable_publicendpoint_port(service, endpoint, portAddr, enabled)\n end", "def set_ip_or_hostname(opts)\n opts = check_params(opts,[:ip_or_hostnames])\n super(opts)\n end", "def initialize(host)\n super(host,'/interface/xmlrpc')\n @logged_in = false\n @fastserver = false\n @lastupdate = ''\n end", "def initialize(host, request_timeout = 5)\n @host = URI(host)\n super(\"#{host}/admin/ping\", request_timeout)\n end", "def install\n if resource[:ipsource] == \"static\"\n ip = resource[:ip]\n netmask = resource[:netmask]\n gateway = resource[:gateway]\n end\n #if resource[:snmp]\n # snmp = resource[:snmp]\n #end\n ipsrc = resource[:ipsource]\n if resource[:vlanid]\n vlanid = resource[:vlanid]\n end\n enable_channel\n end", "def insert_xforwarded_for_header_mode\n super\n end", "def xapi\n @xapi ||= begin \n\n session = XenApi::Client.new( Chef::Config[:knife][:xenserver_host] )\n \n # get the password from the user\n password = Chef::Config[:knife][:xenserver_password] || nil\n username = Chef::Config[:knife][:xenserver_username] || \"root\"\n if password.nil? or password.empty?\n password = ask(\"Enter password for user #{username}: \" ) { |input| input.echo = \"*\" }\n end\n session.login_with_password(username, password) \n\n session\n end\n end", "def http_endpoint_enabled\n data[:http_endpoint_enabled]\n end", "def enable_root(host)\n host['ssh'] = {:password => host['instance'].id}\n @logger.notify(\"netscaler: nsroot password is #{host['instance'].id}\")\n #if host['user'] != 'root'\n # host.exec(Command.new(\"modify sys db systemauth.disablerootlogin value false\"), :acceptable_exit_codes => [0,1])\n # for tries in 1..10\n # begin\n # #This command is problematic as the netscaler is not always done loading\n # if host.exec(Command.new(\"modify sys global-settings gui-setup disabled\"), :acceptable_exit_codes => [0,1]).exit_code == 0 and host.exec(Command.new(\"save sys config\"), :acceptable_exit_codes => [0,1]).exit_code == 0\n # backoff_sleep(tries)\n # break\n # elsif tries == 10\n # raise \"Instance was unable to be configured\"\n # end\n # rescue Beaker::Host::CommandFailure => e\n # @logger.debug(\"Instance not yet configured (#{e})\")\n # end\n # backoff_sleep(tries)\n # end\n # host['user'] = 'root'\n # host.close\n # sha256 = Digest::SHA256.new\n # password = sha256.hexdigest((1..50).map{(rand(86)+40).chr}.join.gsub(/\\\\/,'\\&\\&'))\n # host['ssh'] = {:password => password}\n # host.exec(Command.new(\"echo -e '#{password}\\\\n#{password}' | tmsh modify auth password admin\"))\n # @logger.notify(\"netscaler: Configured admin password to be #{password}\")\n # host.close\n #end\n end", "def run_host(ip)\n\n\t\t[[139, false], [445, true]].each do |info|\n\n\t\tdatastore['RPORT'] = info[0]\n\t\tdatastore['SMBDirect'] = info[1]\n\n\t\tlsa_pipe = nil\n\t\tlsa_handle = nil\n\t\tbegin\n\t\t\t# find the lsarpc pipe\n\t\t\tlsa_pipe = smb_find_dcerpc_pipe(@@lsa_uuid, @@lsa_vers, @@lsa_pipes)\n\t\t\tbreak if not lsa_pipe\n\n\t\t\t# OpenPolicy2()\n\t\t\tstub =\n\t\t\t\tNDR.uwstring(ip) +\n\t\t\t\tNDR.long(24) +\n\t\t\t\tNDR.long(0) +\n\t\t\t\tNDR.long(0) +\n\t\t\t\tNDR.long(0) +\n\t\t\t\tNDR.long(0) +\n\t\t\t\tNDR.long(rand(0x10000000)) +\n\t\t\t\tNDR.long(12) +\n\t\t\t\t[\n\t\t\t\t\t2, # Impersonation\n\t\t\t\t\t1, # Context\n\t\t\t\t\t0 # Effective\n\t\t\t\t].pack('vCC') +\n\t\t\t\tNDR.long(0x02000000)\n\n\t\t\tdcerpc.call(44, stub)\n\t\t\tresp = dcerpc.last_response ? dcerpc.last_response.stub_data : nil\n\n\t\t\tif ! (resp and resp.length == 24)\n\t\t\t\tprint_error(\"#{ip} Invalid response from the OpenPolicy request\")\n\t\t\t\tdisconnect\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tphandle = resp[0,20]\n\t\t\tperror = resp[20,4].unpack(\"V\")[0]\n\n\t\t\t# Recent versions of Windows restrict this by default\n\t\t\tif(perror == 0xc0000022)\n\t\t\t\tdisconnect\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\tif(perror != 0)\n\t\t\t\tprint_error(\"#{ip} Received error #{\"0x%.8x\" % perror} from the OpenPolicy2 request\")\n\t\t\t\tdisconnect\n\t\t\t\treturn\n\t\t\tend\n\n\t\t\t# QueryInfoPolicy(Local)\n\t\t\tstub = phandle + NDR.long(5)\n\t\t\tdcerpc.call(7, stub)\n\t\t\tresp = dcerpc.last_response ? dcerpc.last_response.stub_data : nil\n\t\t\thost_sid, host_name = smb_parse_sid(resp)\n\n\t\t\t# QueryInfoPolicy(Domain)\n\t\t\tstub = phandle + NDR.long(3)\n\t\t\tdcerpc.call(7, stub)\n\t\t\tresp = dcerpc.last_response ? dcerpc.last_response.stub_data : nil\n\t\t\tdomain_sid, domain_name = smb_parse_sid(resp)\n\n\n\t\t\t# Store SID, local domain name, joined domain name\n\t\t\tprint_status(\"#{ip} PIPE(#{lsa_pipe}) LOCAL(#{host_name} - #{host_sid}) DOMAIN(#{domain_name} - #{domain_sid})\")\n\n\n\t\t\tdomain = {\n\t\t\t\t:name => host_name,\n\t\t\t\t:txt_sid => host_sid,\n\t\t\t\t:users => {},\n\t\t\t\t:groups => {}\n\t\t\t}\n\n\t\t\t# Brute force through a common RID range\n\t\t\t500.upto(4000) do |rid|\n\n\t\t\t\tstub =\n\t\t\t\t\tphandle +\n\t\t\t\t\tNDR.long(1) +\n\t\t\t\t\tNDR.long(rand(0x10000000)) +\n\t\t\t\t\tNDR.long(1) +\n\t\t\t\t\tNDR.long(rand(0x10000000)) +\n\t\t\t\t\tNDR.long(5) +\n\t\t\t\t\tsmb_pack_sid(host_sid) +\n\t\t\t\t\tNDR.long(rid) +\n\t\t\t\t\tNDR.long(0) +\n\t\t\t\t\tNDR.long(0) +\n\t\t\t\t\tNDR.long(1) +\n\t\t\t\t\tNDR.long(0)\n\n\n\t\t\t\tdcerpc.call(15, stub)\n\t\t\t\tresp = dcerpc.last_response ? dcerpc.last_response.stub_data : nil\n\n\t\t\t\t# Skip the \"not mapped\" error message\n\t\t\t\tif(resp and resp[-4,4].unpack(\"V\")[0] == 0xc0000073)\n\t\t\t\t\tnext\n\t\t\t\tend\n\n\t\t\t\t# Stop if we are seeing access denied\n\t\t\t\tif(resp and resp[-4,4].unpack(\"V\")[0] == 0xc0000022)\n\t\t\t\t\tbreak\n\t\t\t\tend\n\n\t\t\t\tutype,uname = smb_parse_sid_lookup(resp)\n\t\t\t\tcase utype\n\t\t\t\twhen 1\n\t\t\t\t\tprint_status(\"#{ip} USER=#{uname} RID=#{rid}\")\n\t\t\t\t\tdomain[:users][rid] = uname\n\t\t\t\twhen 2\n\t\t\t\t\tdomain[:groups][rid] = uname\n\t\t\t\t\tprint_status(\"#{ip} GROUP=#{uname} RID=#{rid}\")\n\t\t\t\telse\n\t\t\t\t\tprint_status(\"#{ip} TYPE=#{utype} NAME=#{uname} rid=#{rid}\")\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Store the domain information\n\t\t\treport_note(\n\t\t\t\t:host => ip,\n\t\t\t\t:proto => 'tcp',\n\t\t\t\t:port => datastore['RPORT'],\n\t\t\t\t:type => 'smb.domain.lookupsid',\n\t\t\t\t:data => domain\n\t\t\t)\n\n\t\t\tprint_status(\"#{ip} #{domain.upcase} [ #{users.keys.map{|k| users[k]}.join(\", \")} ]\")\n\n\t\t\t# cleanup\n\t\t\tdisconnect\n\t\t\treturn\n\t\trescue ::Timeout::Error\n\t\trescue ::Interrupt\n\t\t\traise $!\n\t\trescue ::Rex::ConnectionError\n\t\trescue ::Rex::Proto::SMB::Exceptions::LoginError\n\t\t\tnext\n\t\trescue ::Exception => e\n\t\t\tprint_line(\"Error: #{ip} #{e.class} #{e}\")\n\t\tend\n\t\tend\n\tend", "def disable_xpn_resource request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_disable_xpn_resource_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def conditional_requests=(enabled); end", "def set_check_host_attribute_state(opts)\n opts = check_params(opts,[:states])\n super(opts)\n end", "def check_ip; end", "def xapi\n @xapi ||= begin\n\n ui.fatal 'Must provide a xapi host with --host ' unless locate_config_value(:xapi_host)\n verify = :verify_none\n verify = :verify_peer if locate_config_value(:xapi_ssl_verify) == true\n session = XenApi::Client.new(locate_config_value(:xapi_host), 10, verify)\n\n # get the password from the user\n password = locate_config_value(:xapi_password) || nil\n username = locate_config_value(:xapi_username) || 'root'\n if password.nil? || password.empty?\n password = h.ask(\"Enter password for user #{username}: \") { |input| input.echo = '*' }\n end\n session.login_with_password(username, password)\n\n session\n end\n end", "def verify_host\n @j_del.isVerifyHost\n end", "def enable\n CircleCi.request(@conf, \"/project/#{username}/#{project}/enable\").post\n end", "def disabled?\n host.nil?\n end", "def a_pi_key_enable_with_http_info(api_key_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: APIKeyApi.a_pi_key_enable ...\"\n end\n # verify the required parameter 'api_key_id' is set\n fail ArgumentError, \"Missing the required parameter 'api_key_id' when calling APIKeyApi.a_pi_key_enable\" if api_key_id.nil?\n # resource path\n local_var_path = \"/apiKey/enable\".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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\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', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n form_params[\"apiKeyID\"] = api_key_id\n\n # http body (model)\n post_body = nil\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 => 'APIKey')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: APIKeyApi#a_pi_key_enable\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def host_with_port\n @context.registers[:host_with_port]\n end", "def flag_xms_system_to_be_normal \n put(\"/globalsettings.json/xms/normal\")\nend", "def configure_vs_pxe_client(client_name,client_mac,service_name)\n tftp_pxe_file = client_mac.gsub(/:/,\"\")\n tftp_pxe_file = tftp_pxe_file.upcase\n tftp_boot_file = \"boot.cfg.01\"+tftp_pxe_file\n tftp_pxe_file = \"01\"+tftp_pxe_file+\".pxelinux\"\n test_file = $tftp_dir+\"/\"+tftp_pxe_file\n if !File.exists?(test_file)\n pxelinux_file = service_name+\"/usr/share/syslinux/pxelinux.0\"\n message = \"Creating:\\tPXE boot file for \"+client_name+\" with MAC address \"+client_mac\n command = \"cd #{$tftp_dir} ; ln -s #{pxelinux_file} #{tftp_pxe_file}\"\n execute_command(message,command)\n end\n pxe_cfg_dir = $tftp_dir+\"/pxelinux.cfg\"\n pxe_cfg_file = client_mac.gsub(/:/,\"-\")\n pxe_cfg_file = \"01-\"+pxe_cfg_file\n pxe_cfg_file = pxe_cfg_file.downcase\n pxe_cfg_file = pxe_cfg_dir+\"/\"+pxe_cfg_file\n ks_url = \"http://\"+$default_host+\"/\"+service_name+\"/\"+client_name+\".cfg\"\n mboot_file = \"/\"+service_name+\"/mboot.c32\"\n if $verbose_mode == 1\n puts \"Creating:\\tMenu config file \"+pxe_cfg_file\n end\n file = File.open(pxe_cfg_file,\"w\")\n if $serial_mode == 1\n file.write(\"serial 0 115200\\n\")\n end\n file.write(\"DEFAULT ESX\\n\")\n file.write(\"LABEL ESX\\n\")\n file.write(\"KERNEL #{mboot_file}\\n\")\n if $text_mode == 1\n if $serial_mode == 1\n file.write(\"APPEND -c #{tftp_boot_file} text gdbPort=none logPort=none tty2Port=com1 ks=#{ks_url} +++\\n\")\n else\n file.write(\"APPEND -c #{tftp_boot_file} text ks=#{ks_url} +++\\n\")\n end\n else\n file.write(\"APPEND -c #{tftp_boot_file} ks=#{ks_url} +++\\n\")\n end\n file.write(\"IPAPPEND 1\\n\")\n file.close\n if $verbose_mode == 1\n puts \"Created:\\tPXE menu file \"+pxe_cfg_file+\":\"\n system(\"cat #{pxe_cfg_file}\")\n end\n tftp_boot_file=$tftp_dir+\"/\"+tftp_boot_file\n esx_boot_file=$tftp_dir+\"/\"+service_name+\"/boot.cfg\"\n if $verbose_mode == 1\n puts \"Creating:\\tBoot config file \"+tftp_boot_file\n end\n copy=[]\n file=IO.readlines(esx_boot_file)\n file.each do |line|\n line=line.gsub(/\\//,\"\")\n if $text_mode == 1\n if line.match(/^kernelopt/)\n if !line.match(/text/)\n line = line.chomp+\" text\\n\"\n end\n end\n end\n if $serial_mode == 1\n if line.match(/^kernelopt/)\n if !line.match(/nofb/)\n line = line.chomp+\" nofb com1_baud=115200 com1_Port=0x3f8 tty2Port=com1 gdbPort=none logPort=none\\n\"\n end\n end\n end\n if line.match(/^title/)\n copy.push(line)\n copy.push(\"prefix=#{service_name}\\n\")\n else\n copy.push(line)\n end\n end\n File.open(tftp_boot_file,\"w\") {|file_data| file_data.puts copy}\n if $verbose_mode == 1\n puts \"Created:\\tBoot config file \"+tftp_boot_file+\":\"\n system(\"cat #{tftp_boot_file}\")\n end\n return\nend", "def service_enable!()\n @service = TAC_PLUS_AUTHEN_SVC_ENABLE\n end", "def set_host host\n @host = host\n end", "def host=(new_host); end", "def host_only=(value)\n @host_only = value\n end", "def configureStartup\n `chkconfig --add nagios`\n `chkconfig --level 35 nagios on`\n `chkconfig --add httpd`\n `chkconfig --level 35 httpd on`\n `iptables -I INPUT 1 -s #{@ips[0]}/#{@mask} -p tcp -m tcp --dport 80 -j ACCEPT`\n `iptables -I INPUT 1 -s #{@ips[0]}/#{@mask} -p udp -m udp --dport 80 -j ACCEPT`\n `service iptables save`\n `service iptables restart`\n end" ]
[ "0.70874244", "0.6420996", "0.63731235", "0.63036346", "0.6262263", "0.6165541", "0.59492815", "0.5906526", "0.58198625", "0.5789588", "0.5729914", "0.56694514", "0.56039906", "0.55609286", "0.55609286", "0.5553002", "0.5544773", "0.55361956", "0.55023575", "0.54946643", "0.54338455", "0.54224896", "0.5395647", "0.539122", "0.5354661", "0.53520846", "0.5341085", "0.5337188", "0.5331134", "0.5331134", "0.53284925", "0.5326644", "0.53257686", "0.53245914", "0.53232306", "0.53232306", "0.53129923", "0.5305172", "0.5281415", "0.52774644", "0.5268655", "0.5262601", "0.5261426", "0.5246909", "0.5242564", "0.52358", "0.523265", "0.52299905", "0.5201969", "0.5200861", "0.5199055", "0.5174852", "0.516219", "0.516219", "0.5159811", "0.5157709", "0.51502126", "0.51467633", "0.51442164", "0.5139294", "0.51336294", "0.51186734", "0.51186734", "0.51186734", "0.51186734", "0.51186734", "0.51186734", "0.51186734", "0.51186734", "0.51186734", "0.51077455", "0.5103974", "0.50997466", "0.5098826", "0.5085725", "0.5083317", "0.5075447", "0.5074087", "0.5064861", "0.5055457", "0.5050093", "0.5049912", "0.50469977", "0.504318", "0.5037813", "0.50374705", "0.5036899", "0.5033982", "0.5032953", "0.5031723", "0.5016495", "0.50084865", "0.50056005", "0.5004652", "0.49901032", "0.49851328", "0.49813673", "0.49748334", "0.49721748", "0.49714264" ]
0.7431035
0
Baseline implementation for the enable_xpn_resource REST call
def enable_xpn_resource request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_enable_xpn_resource_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def enable_xpn_resource request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/enableXpnResource\"\n body = request_pb.projects_enable_xpn_resource_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def enable\n output = chkconfig(@resource[:name], :on)\n rescue Puppet::ExecutionFailure => detail\n raise Puppet::Error, \"Could not enable #{self.name}: #{detail}\"\n end", "def disable_xpn_resource request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_disable_xpn_resource_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def enable_xpn_host request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_enable_xpn_host_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::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def enable\n end", "def enable_pxe\n delegate(provider, :enable_pxe)\n end", "def disable_xpn_resource request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/disableXpnResource\"\n body = request_pb.projects_disable_xpn_resource_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def enable_xpn_host request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/enableXpnHost\"\n\n query_string_params = {}\n query_string_params[\"requestId\"] = request_pb.request_id.to_s if request_pb.request_id && request_pb.request_id != \"\"\n\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def enable\n end", "def enable!; end", "def build_resource(hash=nil)\n super(hash)\n self.resource.auto_approve = true if self.resource && session[:auto_approve_account] == true\n end", "def retrieve\n @resource['enable']\n end", "def enable\n CircleCi.request(conf, \"#{base_path}/enable\").post\n end", "def enable(probe)\n Ruby.primitive :taskprobe_enable\n raise PrimtiveFailure, \"TaskProbe#enable primitive failed\"\n end", "def enable\n debug \"Call 'enable' for Pacemaker service '#{name}' on node '#{hostname}'\"\n manage_primitive name\n end", "def enable\n {\n method: \"Security.enable\"\n }\n end", "def on_enable_instance(msg, reply)\n @logger.debug(\"#{service_description}: enable instance #{msg} request from #{reply}\")\n credentials = Yajl::Parser.parse(msg)\n prov_cred, binding_creds_hash = credentials\n result = enable_instance(prov_cred, binding_creds_hash)\n # Update node_id in provision credentials..\n prov_cred, binding_creds_hash = result\n prov_cred['node_id'] = @node_id\n result = [prov_cred, binding_creds_hash]\n @node_nats.publish(reply, Yajl::Encoder.encode(result))\n rescue => e\n @logger.warn(e)\n end", "def enable\n @enabled = true\n end", "def conditional_requests=(enabled); end", "def enabled=(_arg0); end", "def enabled=(_arg0); end", "def enabled=(_arg0); end", "def enabled=(_arg0); end", "def enabled=(_arg0); end", "def enable_enforce(enabled = true)\n self.enabled = enabled\n end", "def enable(key)\n @status[key] = :prohibited\n end", "def enable(session, id, enabled)\n write_task('rvpe.host.enable', session, true) do\n call_one_xmlrpc('one.host.enable', session, id, enabled)\n end\n end", "def enable(session, id, enabled)\n write_task('rvpe.image.enable', session) do\n err_msg = \"You don't have permission to enable/disable the image.\"\n sanity_check(session, id, err_msg) do\n call_one_xmlrpc('one.image.enable', session, id, enabled)\n end\n end\n end", "def a_pi_key_enable_with_http_info(api_key_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: APIKeyApi.a_pi_key_enable ...\"\n end\n # verify the required parameter 'api_key_id' is set\n fail ArgumentError, \"Missing the required parameter 'api_key_id' when calling APIKeyApi.a_pi_key_enable\" if api_key_id.nil?\n # resource path\n local_var_path = \"/apiKey/enable\".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', 'application/xml', 'text/xml', 'application/javascript', 'text/javascript']\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', 'application/x-www-form-urlencoded']\n header_params['Content-Type'] = @api_client.select_header_content_type(local_header_content_type)\n\n # form parameters\n form_params = {}\n form_params[\"apiKeyID\"] = api_key_id\n\n # http body (model)\n post_body = nil\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 => 'APIKey')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: APIKeyApi#a_pi_key_enable\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def enable\n @provider_account = ProviderAccount.find(params[:provider_account_id])\n @server_profiles = ServerProfile(params[:server_profile_ids])\n @server_profiles.each do |i|\n i.update_attribute(:is_enabled, true) if current_user.has_server_profile_access?(i)\n end\n\n respond_to do |format|\n flash[:notice] = 'Server Profile(s) have been enabled.'\n format.html { redirect_to provider_account_server_profiles_path(@provider_account) }\n format.xml { head :ok }\n end\n end", "def enable_ip_stack_fingerprinting=(enable)\n ns = REXML::XPath.first(@xml, 'ScanTemplate/Plugins/Plugin[@name=\"java/NetworkScanners\"]')\n param = REXML::XPath.first(ns, './param[@name=\"ipFingerprintEnabled\"]')\n if param\n param.text = (enable ? 1 : 0)\n else\n param = REXML::Element.new('param')\n param.add_attribute('name', 'ipFingerprintEnabled')\n param.text = (enable ? 1 : 0)\n ns.add_element(param)\n end\n end", "def required_resource_access=(value)\n @required_resource_access = value\n end", "def enable!\n self.enabled = true\n end", "def enable\n @bill.update_attribute :is_recurring, true\n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :no_content }\n end\n end", "def enabled; end", "def enabled; end", "def enabled; end", "def enabled; end", "def enableAI _obj, _args\n \"_obj enableAI _args;\" \n end", "def enable\n\n @enabled = true\n\n return self\n\n end", "def enable\n {\n method: \"Page.enable\"\n }\n end", "def setup_request\n @resource_name = params[:resource]\n @resource_klass_name = \"Entity::#{@resource_name}\"\n \n begin \n # Check that resource is managed by this controller\n unless ACCEPTED_RESOURCES.include? @resource_name\n raise NameError\n end\n\n rescue NameError => e\n logger.info(\"ressource-name:\"+@resource_name)\n render json: { errors: process_errors([\"Unknown Resource\"], 400) }, status: :bad_request\n return false\n end\n \n true\n end", "def enable\n {\n method: \"WebAuthn.enable\"\n }\n end", "def enable_pending_cops=(_arg0); end", "def enable!\n @active = true\n change_status(:wait)\n end", "def enabled!\n self\n end", "def enable_pending_cops; end", "def service_enable!()\n @service = TAC_PLUS_AUTHEN_SVC_ENABLE\n end", "def enable_xack\n getok('XACK ON')\n @xack = true\n end", "def install\n if resource[:ipsource] == \"static\"\n ip = resource[:ip]\n netmask = resource[:netmask]\n gateway = resource[:gateway]\n end\n #if resource[:snmp]\n # snmp = resource[:snmp]\n #end\n ipsrc = resource[:ipsource]\n if resource[:vlanid]\n vlanid = resource[:vlanid]\n end\n enable_channel\n end", "def enable\n @service.disabled = false\n end", "def enable\n {\n method: \"HeadlessExperimental.enable\"\n }\n end", "def intelligent_enable_all(pks)\n begin\n pattern = { 'pd.name' => pks.pd['name'],\n 'pd.version' => pks.pd['version'],\n 'pd.vendor' => pks.pd['vendor'] }\n pdep_mapping = Dependencies_mapping.find_by(pattern)\n rescue Mongoid::Errors::DocumentNotFound => e\n logger.error 'Dependencies not found: ' + e.message\n # If no document found, avoid to delete descriptors blindly\n return { nodeps_sym => { vnfds: [], nsds: [] } }\n end\n not_found_vnfds = set_vnfds_status(pdep_mapping.vnfds, 'active')\n not_found_nsds = set_nsds_status(pdep_mapping.nsds, 'active')\n set_pd_status(pks, 'active')\n if ( not_found_vnfds.length == 0 ) and ( not_found_nsds.length == 0 )\n logger.debug \"Catalogue: leaving DISABLE /api/v2/packages?#{query_string}\\\" with PD #{pks}\"\n halt 200, JSON.generate(result: { enable: { vnfds: pdep_mapping.vnfds,\n nsds: pdep_mapping.nsds } })\n else\n logger.debug \"Catalogue: leaving DISABLE /api/v2/packages?#{query_string}\\\" with PD #{pks}\"\n logger.info \"Some descriptors where not found \"\n logger.info \"Vnfds not found: \" + not_found_vnfds.to_s\n logger.info \"Nsds not found: \" + not_found_nsds.to_s\n halt 404, JSON.generate(result: { enable: { vnfds: pdep_mapping.vnfds,\n nsds: pdep_mapping.nsds } },\n not_found: { vnfds: not_found_vnfds, nsds: not_found_nsds })\n end\n end", "def enableIRLasers _obj, _args\n \"_obj enableIRLasers _args;\" \n end", "def enable\n CircleCi.request(@conf, \"/project/#{username}/#{project}/enable\").post\n end", "def systemctl_change_enable(action)\n output = systemctl(action, @resource[:name])\n rescue\n raise Puppet::Error, \"Could not #{action} #{self.name}: #{output}\", $!.backtrace\n ensure\n @cached_enabled = nil\n end", "def method_missing(name,*args,&block)\n if resource_has_extension_method? name\n perform_operation name, *args, &block\n else\n super\n end\n end", "def enable\n {\n method: \"Performance.enable\"\n }\n end", "def enableAttack _obj, _args\n \"_obj enableAttack _args;\" \n end", "def enable\n request = Net::HTTP::Post.new(\"/proxies/#{name}\")\n request[\"Content-Type\"] = \"application/json\"\n\n hash = { enabled: true }\n request.body = hash.to_json\n\n response = http_request(request)\n assert_response(response)\n self\n end", "def enableAIFeature _obj, _args\n \"_obj enableAIFeature _args;\" \n end", "def enable(params)\n node_ip = get_ip(params)\n if params.has_key?(:pool)\n pool_name = params[:pool]\n node_port = (params[:port] || 80).to_i\n if @environment.in_dry_run_mode\n notify(:msg => \"[#{@name}] Would enable member #{node_ip}:#{node_port} in pool #{pool_name} on load balancer #{@config[:host]}\",\n :tags => [:f5, :dryrun])\n get_member(params)\n else\n notify(:msg => \"[#{@name}] Enabling member #{node_ip}:#{node_port} in pool #{pool_name} on load balancer #{@config[:host]}\",\n :tags => [:f5, :trace])\n set_pool_member_status(pool_name,\n 'member' => { 'address' => node_ip, 'port' => node_port },\n 'monitor_state' => 'STATE_ENABLED')\n end\n else\n if @environment.in_dry_run_mode\n node = get_node(params)\n notify(:msg => \"[#{@name}] Would enable node #{node_ip} on load balancer #{@config[:host]}\",\n :tags => [:f5, :dryrun])\n node\n else\n notify(:msg => \"[#{@name}] Enabling node #{node_ip} on load balancer #{@config[:host]}\",\n :tags => [:f5, :trace])\n set_node_status(node_ip, 'STATE_ENABLED')\n end\n end\n end", "def register(&prc)\n @eff.perform prc\n end", "def enable_alert_feature \n put(\"/globalsettings.json/alerts/enable\")\nend", "def action_enable\n end", "def enabled_checks; end", "def setup_preapproval\n api.execute :Preapproval, preapproval_payment_options\nend", "def enable\n run \"#{try_sudo} /sbin/chkconfig puppet on\"\n end", "def enable_ssh_without_token_2(s1_ip)\n client=RestClient::Resource.new(\"https://#{s1_ip}/protected/enableSsh.cgi\",:user=>\"Nemuadmin\",:password=>\"nemuuser\",:verify_ssl => OpenSSL::SSL::VERIFY_NONE)\n begin\n # Timeout.timeout(5){\n response=client.get\n # }\n\n if response.body.match(\"SSH Service Enabled Successfully\")\n # puts \"#{s1_ip} enable ssh succ(no token)!\"\n return true \n else\n #puts \"enable ssh for #{s1_ip} fail!(no token)\"\n\n return false\n end\n\n rescue\n #puts $@\n #puts \"enable ssh for #{s1_ip} exception!(no token)\"\n return false\n end\nend", "def enabled!\n self\n end", "def enable_profile( profile_name )\n Faraday.get do |req|\n req.url \"#{@base_url}/services/conf/brokerConfigurations/#{find_profile_id(profile_name)}?opts=active\"\n req.headers = @authorization_headers\n end\n end", "def enable!\n events.compliance_input_enabled(self)\n @enabled = true\n end", "def enabled_checks=(_arg0); end", "def enable!\n @mutex.synchronize do\n @advised.each { | x | x.enable! }\n end\n self\n end", "def disable_xpn_host request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/disableXpnHost\"\n\n query_string_params = {}\n query_string_params[\"requestId\"] = request_pb.request_id.to_s if request_pb.request_id && request_pb.request_id != \"\"\n\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def provision\n method_proxy(:provision)\n\n true\n end", "def flag_xms_system_to_be_normal \n put(\"/globalsettings.json/xms/normal\")\nend", "def enable_ssh(s1_ip,logger)\n\n uri = URI.parse(\"https://#{s1_ip}/protected/sshservice.html\") #common url for all release\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth(\"Nemuadmin\", \"nemuuser\")\n \n ssh_service_status_response=\"\"\n\n client=RestClient::Resource.new(\"https://#{s1_ip}/protected/sshservice.html\",:user=>\"Nemuadmin\",:password=>\"nemuuser\",:verify_ssl => OpenSSL::SSL::VERIFY_NONE)\n\n # response_body\n\n begin\n #Timeout.timeout(2){\n #ssh_service_status_response = http.request(request)\n response=client.get\n #puts \"response=#{response}\" \n #delete those fake bts\n if not response.match(/SSH\\sService\\sStatus/)\n LiveStatus.where(:s1_ip=>s1_ip).delete_all\n # puts \"#{s1_ip} deleted!\"\n logger.error \"#{s1_ip} deleted! \"\n return false\n end\n\n rescue\n live_status=LiveStatus.where(:s1_ip=>s1_ip).first\n logger.error \"#{s1_ip} is not a BTS \"\n return false if live_status.nil?\n\n # if live_status.ssh_pass.nil? ||live_status.ssh_pass<=1\n # puts \"#{s1_ip} deleted!\"\n # LiveStatus.where(:s1_ip=>s1_ip).delete_all\n # end\n\n return false\n end\n\n\n#check need token or not\n\n if response.match(\"token\") #this is a site version bigger >RL55\n result=enable_ssh_with_token(s1_ip,response)\n else\n #enable_ssh_without_token(s1_ip)\n result= enable_ssh_without_token_2(s1_ip)\n end\n\n if result==true\n logger.info \"#{s1_ip} enable ssh succsefully !\"\n return true\n else\n logger.error \"#{s1_ip} enable ssh fail !\"\n return false\n end\n \n return nil\nend", "def enabled?\n debug \"Call 'enabled?' for Pacemaker service '#{name}' on node '#{hostname}'\"\n out = get_primitive_puppet_enable name\n debug \"Return: '#{out}' (#{out.class})\"\n out\n end", "def enable(options = {})\n # Why is this here? Why are the defaults not whats set on this object?\n #options = options.reverse_merge({\n #self_promote_only: false,\n #admin_only: false,\n #featured: false\n #})\n properties = wrap_attributes(options, :edit_with, ignore_defaults: true)\n\n properties.tapjoy_enabled = true\n properties.user_enabled = true\n\n properties.self_promote_only = self.self_promote_only unless options.key?(:self_promote_only)\n properties.admin_only = self.admin_only unless options.key?(:admin_only)\n properties.featured = self.featured unless options.key?(:featured)\n\n properties.title ||= self.attributes.fetch_with_default(:title)\n properties.details ||= self.attributes.fetch_with_default(:details)\n properties.require_admin_device = !!properties.admin_only\n properties.ppi_instructions = !!self.instructions\n\n properties.objective_id = self.objective_id\n properties.bid = self.bid\n properties.allow_negative_balance = self.allow_negative_balance\n properties.device_types = self.device_types\n properties.moments = self.moments\n\n properties.compound_template_url = self.compound_template_url if self.compound_template_url\n\n if properties.featured\n properties.featured_ad_action = 'featured_ad_title_demo'\n properties.featured_ad_content = 'featured_ad_content_demo'\n end\n\n self.edit(properties)\n\n unless record(reload: true).enabled?\n raise \"The offer in the db was not enabled even after we enabled it in the UI. Offer ID: #{id}\"\n end\n end", "def enabled?; end", "def enabled?; end", "def service_enable_variable_name\n \"#{@new_resource.service_name}_flags\"\n end", "def set_active_state( ndev_xml )\n @ndev_hash[:active] = ndev_xml['inactive'] ? :false : :true \n @pp_obj.ndev_res[:name] = @pp_obj.resource[:name]\n ndev_xml\n end", "def set_enable\n @enable = Enable.find(params[:id])\n end", "def get_primitive_puppet_enable(primitive)\n if primitive_is_managed? primitive\n :true\n else\n :false\n end\n end", "def enable(id)\n change_status id, true\n end", "def enable=(value); self.is_enable = value end", "def enable_alert(alert_name, project_name, optional={})\n\t\targs = self.class.new_params\n\t\targs[:method] = 'PUT'\n\t\targs[:path]['AlertName'] = alert_name\n\t\targs[:path]['ProjectName'] = project_name\n\t\targs[:pattern] = '/projects/[ProjectName]/alerts/[AlertName]/enable'\n\t\targs[:query]['Action'] = 'EnableAlert'\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\targs[:scheme] = 'http'\n\t\tself.run(args)\n\tend", "def enable_params\n params.require(:enable).permit(:option_id, :enable_element_id)\n end", "def publishResourceEnter(app_id, run_id, resource, baseStationRid)\n publishResourcesEnter(app_id, run_id, [resource], baseStationRid)\nend", "def disable_xpn_host request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_disable_xpn_host_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::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def enable_service\n super\n sleep 1 until ::FileTest.pipe?(\"#{service_resource.service_dir}/#{service_resource.service_name}/supervise/ok\")\n if service_resource.log\n sleep 1 until ::FileTest.pipe?(\"#{service_resource.service_dir}/#{service_resource.service_name}/log/supervise/ok\")\n end\n end", "def resource_with_extensions base=nil, &declaration\n self.base_resource = base if base.present?\n resource_without_extensions base_resource do\n instance_eval(&RESOURCE_EXTENSION_BLOCK)\n instance_eval(&declaration)\n end\n end", "def test_adds_a_request_header_to_outgoing_requests_if_xp_enabled\n NewRelic::Agent::Agent.any_instance.stubs(:connected?).returns(true)\n with_config(:\"cross_application_tracer.enabled\" => true, :'distributed_tracing.enabled' => false) do\n in_transaction { get_response }\n\n assert_equal 'VURQV1BZRkZdXUFT', server.requests.last['HTTP_X_NEWRELIC_ID']\n end\n NewRelic::Agent::Agent.any_instance.unstub(:connected?)\n end", "def proxy_action(action)\n Chef::Log.debug(\"[#{new_resource} Running proxied #{action} action\")\n new_resource.subresources.each do |r|\n begin\n r.run_action(action) if r.allowed_actions.include?(action)\n rescue Chef::Exceptions::UnsupportedAction\n # Don't care, just move on.\n end\n end\n end", "def netdev_resxml_change_active( xml )\n par = xml.instance_variable_get(:@parent)\n admin = resource[:active] == :false ? 'inactive' : 'active'\n par[admin] = admin\n end", "def allow_additional_certificate_state\n super\n end", "def enable_require_ingredient\n change_ingredient_status_link.click\n ingredient_status_select.select('Yes')\n submit_ingredient_status_btn.click\n wait_until{ !submit_ingredient_status_btn.visible? }\n end", "def update!(**args)\n @enable_rpc_whitelist = args[:enable_rpc_whitelist] if args.key?(:enable_rpc_whitelist)\n end" ]
[ "0.7172265", "0.6231739", "0.6006011", "0.5932258", "0.58999354", "0.588118", "0.5855175", "0.58359385", "0.5815846", "0.5690324", "0.56875044", "0.5579524", "0.55619884", "0.55097157", "0.5461821", "0.5456827", "0.5438458", "0.5396896", "0.53866416", "0.53780454", "0.53780454", "0.53780454", "0.53780454", "0.53780454", "0.53572667", "0.5344287", "0.53404987", "0.53364396", "0.5334336", "0.53225523", "0.53219056", "0.5306956", "0.5304191", "0.5300538", "0.5293511", "0.5293511", "0.5293511", "0.5293511", "0.52694315", "0.5266961", "0.52194685", "0.52060103", "0.52011836", "0.5183293", "0.516442", "0.5163128", "0.51575804", "0.51545507", "0.51527107", "0.5140318", "0.51270366", "0.5124934", "0.5102334", "0.5076739", "0.50603664", "0.50549656", "0.5038149", "0.50335133", "0.5020212", "0.49885747", "0.49851838", "0.49681917", "0.4967797", "0.49604732", "0.4952338", "0.4935133", "0.49328676", "0.49304056", "0.49300864", "0.49268904", "0.4924765", "0.49175918", "0.4914088", "0.49131832", "0.4910368", "0.49095324", "0.4907587", "0.4904458", "0.4895209", "0.4884973", "0.4876221", "0.4876221", "0.48741323", "0.48709404", "0.48695678", "0.48668304", "0.4861568", "0.48572823", "0.48543033", "0.4843469", "0.48347846", "0.48322916", "0.48310736", "0.482939", "0.48278958", "0.48107713", "0.4810256", "0.48034155", "0.48026383", "0.47998306" ]
0.72756726
0
Baseline implementation for the get REST call
def get request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, _query_string_params = transcode_get_request request_pb response = @client_stub.make_get_request( uri: uri, options: options ) result = ::Google::Cloud::Compute::V1::Project.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get; end", "def _get\n http_method(:get)\n end", "def rest_endpoint; end", "def rest_get(base_uri,params)\n begin\n @response = RestClient.get(base_uri,params)\n rescue => e\n puts @response.code\n end\n return @response\n end", "def http_method\n :get\n end", "def get\n\t\t\tself.make_request!({uri: self.to_uri, method: :get})\n\t\tend", "def get endpoint\n do_request :get, endpoint\n end", "def GET; end", "def get\n Iterable.request(conf, base_path).get\n end", "def get\n Iterable.request(conf, base_path).get\n end", "def get\n RestClient.get(url, @header) do |rso, req, res|\n setup(rso, req, res)\n end\n end", "def get\n check_response( @httpcli.get(@endpoint) )\n end", "def get\n end", "def get(uri, params = {}, env = {}, &block)\n super(uri, params, env, &block).tap do |response|\n record_request_response_pair!('get')\n end\n end", "def get\n end", "def perform_get(rest_url, request)\n query_params = request.api_params.blank? ? '' : to_query_params(request.api_params)\n url = \"#{rest_url}&#{query_params}\"\n\n response = RestClient::Request.execute(\n method: request.http_method,\n url: url,\n headers: request.header_params,\n read_timeout: 30,\n open_timeout: 15\n )\n JSON.parse(response)\n end", "def http_get_early(request, response)\n params = request.query_parameters\n return http_get(request, response) if params['sabreAction'] == 'info'\n end", "def get(request, response)\n NotImplemented\n end", "def get(request, response)\n NotImplemented\n end", "def rest_get\n ##define the url path\n url =\"/get\"\n\n ##This is headers definition.\n headers = [\n ['Cached-Control', \"no-cache\" ],\n [\"Content-Type\", \"application/x-www-form-urlencoded\"]\n ]\n begin\n #------------------------\n # Send Get Request\n #------------------------\n request, response = send_get(url, headers)\n\n if response.code.to_i == 200\n actual_value = response.body.chop!\n actual_value.gsub!(\"\\n\",\"\")\n return actual_value.gsub!(/\\s+/, \"\")\n else\n return false\n end\n rescue Exception => ex\n @log.error \"#### Response code is: #{response.code} #####\"\n @log.error ex.message\n puts \"#### Response code is: #{response.code} #####\"\n puts ex.message\n return false\n end\n end", "def rest_end_point; end", "def get()\n \n end", "def get(resource, other_query = nil)\n raise NotImplementedError, \"#{self.class}#get not implemented\"\n end", "def get_response\n raise NotImplementedError.new(\"method not overriden\")\n end", "def get(url); end", "def do_get(path, params={})\n login if need_login?\n\n # Resource id is a special param as it needs to be added to the path\n path = add_id_and_params_to_path(path, params)\n\n req, res, resource_type, body = nil\n\n begin\n retry_request(true) do\n # Return content type so the resulting resource object knows what kind of resource it is.\n resource_type, body = @rest_client[path].get(headers) do |response, request, result, &block|\n req, res = request, response\n update_cookies(response)\n update_last_request(request, response)\n\n case response.code\n when 200\n # Get the resource_type from the content_type, the resource_type\n # will be used later to add relevant methods to relevant resources\n type = if result.content_type.index('rightscale')\n get_resource_type(result.content_type)\n elsif result.content_type.index('text/plain')\n 'text'\n else\n ''\n end\n\n # work around getting ASCII-8BIT from some resources like audit entry detail\n charset = get_charset(response.headers)\n if charset && response.body.encoding != charset\n response.body.force_encoding(charset)\n end\n\n # raise an error if the API is misbehaving and returning an empty response when it shouldn't\n if type != 'text' && response.body.empty?\n raise EmptyBodyError.new(request, response)\n end\n\n [type, response.body]\n when 301, 302\n update_api_url(response)\n response.follow_redirection(request, result, &block)\n when 404\n raise UnknownRouteError.new(request, response)\n else\n raise ApiError.new(request, response)\n end\n end\n end\n rescue => e\n raise wrap(e, :get, path, params, req, res)\n end\n\n data = if resource_type == 'text'\n { 'text' => body }\n else\n JSON.parse(body, :allow_nan => true)\n end\n\n [resource_type, path, data]\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\n start { |connection| connection.request http :Get }\n end", "def rest_endpoint=(_arg0); end", "def get\n end", "def get_rest_api(endpoint, http)\n rest_api_endpoint = \"/classifier-api/v1/#{endpoint}\"\n\n # Create an HTTP GET request against the specified REST API endpoint.\n request = Net::HTTP::Get.new(rest_api_endpoint)\n # Submit the request\n response = http.request(request)\n # Return the response body (JSON containing the results of the query).\n response.body\nend", "def get!\n self.https.request self.http_request # Net::HTTPResponse object\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n execute(:get)\n end", "def get\n execute(:get)\n end", "def get(request, response)\n @resource.get(request, response)\n end", "def get(params={})\n rpc_call :get, params\n end", "def http( *args )\n p http_get( *args )\n end", "def do_get\n Net::HTTP.get(URI.parse(api_url))\n end", "def api_request(&block)\n response = block.call\n if response.status == 307 and response.body =~ /^\\/REST\\//\n response.body.sub!('/REST/','') \n response = get(response.body)\n end\n parse_response(JSON.parse(response.body || '{}'))\n end", "def http; end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get\n url = prefix + \"get\"\n return response(url)\n end", "def get(*params); raise('Stub or mock required.') end", "def call\n resource = base_resource\n\n response = (\n case request_method\n when :get\n resource.get fill do |req|\n (req.body = source) if source\n end\n when :head\n resource.head fill\n when :delete\n resource.delete(fill) do |req|\n req.body = source if source\n end\n when :post\n resource.post(fill, source)\n when :put\n resource.put(fill, source)\n end\n )\n \n response\n end", "def get(path, params={})\n params[:apikey] = self.api_key\n RestClient::Request.execute(\n :method => :get,\n :url => \"#{self.uri}#{path}\",\n :headers => {\n :params => params\n },\n :verify_ssl=> @ssl_verify )\n end", "def get(*args)\n prepare_request(:get, args)\n @@client.add(:get, @path, *args)\n end", "def get options={}, &block\n handle_exceptions do\n Chimps.log.info(\"GET #{url}\")\n Response.new(super(options, &block))\n end\n end", "def get\n request_object.get_query\n end", "def call_api\n @client.build_url\n @client.get\n assign_data\n end", "def api_get(action, data)\n api_request(action, data, 'GET')\n end", "def api_get(action, data)\n api_request(action, data, 'GET')\n end", "def get\n url = prefix + \"get\" + id_param\n return response(url)\n end", "def get!\n request! :get\n end", "def retrieve!\n response = @client.rest_get(self.class::BASE_URI)\n body = @client.response_handler(response)\n set_all(body)\n true\n end", "def rest_get(url)\n JSON.parse(RestClient.get(url))\n end", "def api_fetch(url)\n JSON.parse(RestClient.get url)\nend", "def get(url, headers={})\n RestClient.get url, headers\n end", "def _http_get resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Get.new(path)\n _build_request resource, request\nend", "def _http_get resource, path\n uri = ::URI.parse(resource.auth_uri)\n path = _path uri, path\n request = Net::HTTP::Get.new(path)\n _build_request resource, request\nend", "def get\n JSON.parse(self.class.get(url).response.body)\n end", "def get\n subclass(:Response).new connection.get do |req|\n req.url uri\n end\n end", "def http_get(end_point)\n uri= URI.parse \"#{@main_url}#{end_point}\"\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth(@username, @api_key)\n response = http.request(request)\n response.body\nend", "def get(path, params={})\n RestClient.get request_base+path, {params: params}\n end", "def get\n if(resource.exist?)\n #print_range(request)\n res = resource.get(request, response)\n if(res == OK && !resource.collection?)\n response['Etag'] = resource.etag\n response['Content-Type'] = resource.content_type\n response['Content-Length'] = resource.content_length.to_s\n response['Last-Modified'] = resource.last_modified.httpdate\n end\n res\n else\n NotFound\n end\n end", "def http_get(endpoint)\n uri= URI.parse \"#{@main_url}#{endpoint}\"\n http = Net::HTTP.new(uri.host, uri.port)\n request = Net::HTTP::Get.new(uri.request_uri)\n request.basic_auth(@username, @api_key)\n response = http.request(request)\n response.body\nend", "def get()\n return @http.request(@req)\n end", "def get(uri, request_headers)\n raise NotImplementedError\n end", "def index()\n method_url = @resource\n return self.get(method_url)\n end", "def get(path)\n # build full URL\n url = API_URL % [path]\n\n # log full URL\n @ctx.log.debug('BaseObject#get') { '%s' % [url] }\n\n # get URL from cache\n @ctx.cache.get(url)\n end", "def get\n raise NoMethodError unless is_full_route? @cur_route\n @retrieved_url = @cur_url\n response = HTTParty.get(\"https://api.uwaterloo.ca/v2#{@cur_url}.json\", { query: { key: @api_key, format: 'json' } })\n case response.code\n when 400...600\n raise \"UWaterloo API Server returned a #{response.code} error\"\n end\n @response = RecursiveOpenStruct.new response, recurse_over_arrays: true\n @meta = response['meta']\n @response.data\n end", "def rest_request(verb, url, data)\n if Rails.env.production?\n rest_production(verb, url, JSON.generate(data))\n else\n log_info(\"[#{Rails.env}]: #{verb} #{url}\", 200)\n end\n rescue RestClient::Exception => e\n log_error \"Failed with #{e.http_code}: #{e}\\n#{e.response}\", e.http_code\n end", "def get(path, params={})\n params = merge_set_up_params(params)\n @token = \"b3688c52-9235-45ca-b01f-c5b2b83a4f4f\"\n @result = Typhoeus::Request.get(API_URL + path, :params => params,\n :headers => {\"Authorization\" => \"Basic#{@token}\"})\n puts @result.body\n # check if the url looks correct in the log\n puts @result.effective_url\n # parse the result to json\n return JSON.parse(@result.body)\n end", "def get\n raise NotImplementedError\n end", "def get_wrapper(url, headers)\n [parse_response(RestClient.get(resource + url, headers)), true]\n rescue RestClient::Exception => e\n [parse_error(e.response), false]\n end", "def get(path_part, additional_headers = {}, &block)\n api_request { @rest.get('/REST/' + path_part, nil, additional_headers, &block) }\n end", "def get(data = {})\n call data, method: :get\n end", "def get\n execute_request('GET') do |uri, headers|\n HTTP.http_client.get(\n uri,\n follow_redirect: true,\n header: headers\n )\n end\n end", "def get_request\n# Use our @http_object object's request method to call the\n# Net::HTTP::Get class and return the resulting response object\n @http_object.request(Net::HTTP::Get.new(@url.request_uri))\n end", "def get!(*args)\n @response = get(*args)\n end", "def rest\n @@rest\n end", "def fetch\n raise NotImplementedError\n end", "def auth_get_call(location,params,auth)\n puts \"#Wrapper Service GET req:- \\n#Host: #{@host} \\n#Location: #{location} \\n#Params: #{params.to_json} \"\n response = @conn.get do |req|\n req.url location\n req.headers['Content-Type'] = 'application/json'\n req.headers['Authorization'] = auth.to_s\n req.body = params.to_json\n end\n puts \"#Response Code: #{response.status}\"\n return response\n end", "def query\n\n JSON.parse(Net::HTTP.get(self.build_uri))\n\n end", "def fetch; end", "def fetch; end", "def get(params)\n request.method = :get\n execute(params)\n end", "def fetch\n raise \"not implemented\"\n end", "def api_keys; rest_query(:api_key); end", "def api_keys; rest_query(:api_key); end", "def http_get(opts={})\n raw_content = opts[:raw_content] || false\n ret=http_get_low(opts)\n if !raw_content then\n\tif ret.is_a?(Hash) and ret.has_key?('error') and ret['error']=='Invalid Credentials' then\n authdefault\n ret=http_get_low(opts)\n return ret\n else\n return ret\n\tend\n else\n\treturn ret\n end\n end", "def get(path, id)\n path = \"#{API_PATH}#{path}\"\n return super(path, id, headers: admin_headers(path, '', 'GET', resource_id: id))\n end", "def get path = \"\", payload = {}\n make_request(path, \"get\", payload)\n end", "def rest_get(api_url)\n RestClient::Request.execute(method: :get,\n url: api_url,\n verify_ssl: @verify_ssl).body\n end", "def fetch(*args)\n raise NotImplementedError, 'Implement a method to fetch the resource.'\n end", "def get(url)\n raise \"Needs to be implemented\"\n end", "def get url\n RestClient::Request.execute(:method => :get, :url => url, :headers => lbaas_headers, :timeout => @timeout, :open_timeout => @open_timeout)\n end", "def consume_url; end", "def run\n super\n\n # start with negative\n api_endpoint = nil\n api_reason = nil\n\n require_enrichment\n\n # get our url\n url = _get_entity_name\n\n ###\n # First just check our fingerprint, lots of stuff will already have been\n # fingerprinted during our ident run\n ###\n (_get_entity_detail(\"fingerprint\") || []).each do |fp|\n api_endpoint = true if fp[\"tags\"] && fp[\"tags\"].include?(\"API\")\n api_reason = \"fingerprint\"\n end\n\n # first get a standard response\n standard_response = http_request :get, url\n return unless standard_response\n\n ####\n # next just check keywords in the url, but of course, sanity check this.\n ###\n if ( url.match(/api\\./) ||\n url.match(/apis\\./) ||\n url.match(/\\/api/) ||\n url.match(/\\/json/) ||\n url.match(/\\.json/) ||\n url.match(/\\.xml/) ||\n url.match(/skiptoken/) ||\n url.match(/\\/restapis/) )\n\n unless (\n url.match(/googleapis/) ||\n url.match(/\\.amazonaws\\.com/) ||\n standard_response.body_utf8.match(/^<HTML>/i) ||\n standard_response.body_utf8.match(/HTTP Status 404/i) ||\n standard_response.body_utf8.match(/NoSuchBucket/i) ) \n api_endpoint = true\n api_reason = \"url\"\n end\n\n end\n\n ###\n ### If we made it this far, and our base url matches, just return that\n if api_endpoint\n _create_api_endpoint(url, url, api_reason)\n return # return if our base URL was an endpoint\n end\n\n ####\n # otherwise check patterns in / around the original\n ####\n\n # always start empty\n api_endpoint = nil\n\n [\n \"#{url}\",\n \"#{url}/api\",\n \"#{url}/api/v1\",\n \"#{url}/api/v2\",\n \"#{url}/api/v3\",\n \"#{url}/docs\",\n \"#{url}/graphql\",\n \"#{url}/api-docs\",\n \"#{url}/api-docs/swagger.json\",\n \"#{url}/api/swagger\",\n \"#{url}/api/swagger-ui.html\",\n \"#{url}/api/swagger.yml\",\n \"#{url}/api/v2/swagger.json\",\n \"#{url}/apidocs\",\n \"#{url}/apidocs/swagger.json\",\n \"#{url}/rest\",\n \"#{url}/swagger\",\n \"#{url}/swagger/\",\n \"#{url}/swagger-resources\",\n \"#{url}/swagger-ui\",\n \"#{url}/swagger-ui.html\",\n \"#{url}/swagger.json\",\n \"#{url}/swagger/index.html\",\n \"#{url}/swagger/swagger-ui.html\",\n \"#{url}/swagger/ui/index\",\n \"#{url}/swagger/v1/swagger.json\",\n \"#{url}/v1/swagger.json\"\n ].each do |u|\n\n _log \"Checking... #{u}\"\n\n # Go ahead and get the response for this paritcular endpoint\n\n response = http_request :get, u\n\n next unless response\n # skip if we're not the original url, but we're getting the same response\n\n next if u != url && response.body_utf8 == standard_response.body_utf8\n\n ###\n ### Check for known strings\n ###\n if (response.body_utf8.match(/swagger-section/) ||\n response.body_utf8.match(/swaggerhub.com/) ||\n response.body_utf8.match(/soapenv:Envelope/) )\n # break and create it\n api_reason = \"response_body\"\n api_endpoint = u\n break\n end\n\n # check for content type of application.. note that this will flag\n # application/javascript, which is probably not wanted\n headers = standard_response.headers\n if headers\n ct = headers.find{|x, y| x if x =~ /^content-type/i }\n if ct\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/xml/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/json/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/ld+json/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/x-protobuf/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^application\\/octet-stream/i)\n api_endpoint = u if \"#{headers[ct]}\".match(/^text\\/csv/i)\n\n # break and create it\n if api_endpoint\n api_reason = \"content_type\"\n break\n end\n\n end\n end\n\n ###\n # try to parse it (JSON)\n ###\n begin\n # get request body\n body = standard_response.body_utf8\n if body\n json = JSON.parse(body)\n\n if json\n # now check for common error scenarios, and proceed if we pass\n break if json.kind_of?(Hash) && \n ((standard_response.code == \"404\" && json[\"error\"] == \"Not Found\") ||\n (standard_response.code == \"404\" && json[\"response\"] == \"Content was not found.\"))\n \n # create it as an api endpoint\n api_endpoint = u\n api_reason = \"json_body\"\n break\n end\n\n end\n rescue JSON::ParserError\n _log \"No body!\"\n end\n\n # check known fingeprints\n _log \"Attempting to fingerprint (without the browser)!\"\n ident_matches = generate_http_requests_and_check(u,{:enable_browser => false, :'only-check-base-url' => true}) || {}\n ident_fingerprints = ident_matches[\"fingerprint\"] || []\n ident_fingerprints.each do |fp|\n api_endpoint = u if fp[\"tags\"] && fp[\"tags\"].include?(\"API\")\n # break if it's been set so we dont genereate a bunch of FP's\n if api_endpoint\n api_reason = \"fingerprint\"\n break\n end\n end\n end\n\n ###\n ### Okay now that we're at the end, do we have an endpoint?!?\n ###\n\n # set the details and create a new entity if we made it this far!\n if api_endpoint\n _create_api_endpoint(url, api_endpoint, api_reason)\n else\n _set_entity_detail \"api_endpoint\", false\n end\n\n end", "def fetch\n raise NotImplementedError\n end" ]
[ "0.73324287", "0.7292981", "0.70138574", "0.693026", "0.6865241", "0.6816611", "0.6803572", "0.6795961", "0.6773166", "0.6773166", "0.6769716", "0.67421967", "0.6724426", "0.664156", "0.6633361", "0.66158813", "0.6603196", "0.65990484", "0.65990484", "0.65959835", "0.65769184", "0.65752673", "0.65514386", "0.6501347", "0.64738977", "0.6467637", "0.64499986", "0.6448686", "0.6432968", "0.64135736", "0.63871425", "0.636521", "0.6334899", "0.6334899", "0.63291854", "0.63291854", "0.6328541", "0.63204324", "0.63138103", "0.63049775", "0.6303206", "0.6289398", "0.6268877", "0.6268877", "0.6267518", "0.6267327", "0.6250351", "0.62501556", "0.624835", "0.62342066", "0.62159723", "0.62114966", "0.62114966", "0.62048465", "0.6182773", "0.61703616", "0.61606944", "0.61552453", "0.61489344", "0.6145329", "0.6145329", "0.6141569", "0.6141472", "0.6138623", "0.6137982", "0.6136574", "0.6131754", "0.6126944", "0.6117962", "0.6114535", "0.6105252", "0.6091298", "0.60832053", "0.6076587", "0.6075163", "0.60737413", "0.6070054", "0.6069903", "0.6065379", "0.6061536", "0.60556006", "0.60382813", "0.60365766", "0.6034071", "0.60290843", "0.60275555", "0.60275555", "0.60202533", "0.60127044", "0.60069984", "0.60069984", "0.6004713", "0.60025156", "0.60018563", "0.60014194", "0.5997072", "0.5995303", "0.5991738", "0.59909433", "0.5978456", "0.5977528" ]
0.0
-1
Baseline implementation for the get_xpn_host REST call
def get_xpn_host request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, _query_string_params = transcode_get_xpn_host_request request_pb response = @client_stub.make_get_request( uri: uri, options: options ) result = ::Google::Cloud::Compute::V1::Project.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xpn_host request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/getXpnHost\"\n\n response = @client_stub.make_get_request(\n uri: uri,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Project.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def host_meta\n @host_meta ||= begin\n request = Net::HTTP::Get.new(host_meta_uri.path)\n http = Net::HTTP.new(host_meta_uri.host, host_meta_uri.port)\n http.use_ssl = (host_meta_uri.port==443)\n response = http.start {|http| http.request(request) }\n raise OpenTransact::UndiscoverableResource unless response.code==\"200\"\n MultiXml.parse(response.body)[\"XRD\"]\n end\n end", "def get_host\n @host\n end", "def externalNodes\n certname = params[:name]\n @host ||= resource_base.find_by_certname certname\n @host ||= resource_base.find_by_name certname\n not_found and return unless @host\n\n begin\n respond_to do |format|\n format.html { render :text => \"<pre>#{@host.info.to_yaml}</pre>\" }\n format.yml { render :text => @host.info.to_yaml }\n end\n rescue\n # failed\n logger.warn \"Failed to generate external nodes for #{@host} with #{$!}\"\n render :text => _('Unable to generate output, Check log files\\n'), :status => 412 and return\n end\n end", "def build_host\n host = @host_value || base_value.host\n raise UnresolvableResourceError, 'no HTTP host specified' if host.blank?\n host\n end", "def uri_host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def host; end", "def enable_xpn_host request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_enable_xpn_host_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::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def host\n @host ||= 'api.postmarkapp.com'\n end", "def host\n @host\n end", "def host\n @host\n end", "def host=(_arg0); end", "def host=(_arg0); end", "def get_host_by_displayname(displayname)\n host = nil\n host_json = rpc(\"getHost\", {\"displayName\" => URI::encode(displayname)})\n host_resp = JSON.parse(host_json)\n# p host_resp\n if host_resp[\"status\"] == 200\n host = host_resp[\"data\"]\n# puts(\"Found host matching #{displayname}\")\n end\n host\nend", "def public_hostname\n get_proxy.get_public_hostname\n end", "def get_ip_address\n rpc_get_fact_direct('host_ip')\n end", "def api_v11_hosts_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_hosts_get ...\"\n end\n \n # resource path\n path = \"/api/v11/hosts\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'view'] = opts[:'view'] if opts[:'view']\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_hosts_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def host\n @host || \"https://api.digitalriver.com/\"\n end", "def get_public_hostname\n rpc_get_fact_direct('public_hostname')\n end", "def ipn_endpoint; end", "def ipn_endpoint; end", "def host\n @host\n end", "def public_host\n get('beef.http.public.host')\n end", "def host\n @request['Host']\n end", "def test_get_with_host_header\n uri = default_uri\n uri.host = '127.0.0.1'\n res = nil\n\n in_transaction do\n res = get_response(uri.to_s, 'Host' => 'test.local')\n end\n\n assert_match %r{<head>}i, body(res)\n assert_externals_recorded_for('test.local', 'GET')\n end", "def host_key; end", "def disable_xpn_host request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_disable_xpn_host_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::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def report_host(opts)\n\n return if !active\n addr = opts.delete(:host) || return\n\n # Sometimes a host setup through a pivot will see the address as \"Remote Pipe\"\n if addr.eql? \"Remote Pipe\"\n return\n end\n\n ::ApplicationRecord.connection_pool.with_connection {\n wspace = Msf::Util::DBManager.process_opts_workspace(opts, framework)\n opts = opts.clone\n opts.delete(:workspace)\n\n begin\n retry_attempts ||= 0\n if !addr.kind_of? ::Mdm::Host\n addr = Msf::Util::Host.normalize_host(addr)\n\n unless ipv46_validator(addr)\n raise ::ArgumentError, \"Invalid IP address in report_host(): #{addr}\"\n end\n\n conditions = {address: addr}\n conditions[:comm] = opts[:comm] if !opts[:comm].nil? && opts[:comm].length > 0\n host = wspace.hosts.where(conditions).first_or_initialize\n else\n host = addr\n end\n\n ostate = host.state\n\n # Truncate the info field at the maximum field length\n if opts[:info]\n opts[:info] = opts[:info][0,65535]\n end\n\n # Truncate the name field at the maximum field length\n if opts[:name]\n opts[:name] = opts[:name][0,255]\n end\n\n if opts[:os_name]\n os_name, os_flavor = split_windows_os_name(opts[:os_name])\n opts[:os_name] = os_name if os_name.present?\n if opts[:os_flavor].present?\n if os_flavor.present? # only prepend if there is a value that needs it\n opts[:os_flavor] = os_flavor + opts[:os_flavor]\n end\n else\n opts[:os_flavor] = os_flavor\n end\n end\n\n opts.each do |k,v|\n if host.attribute_names.include?(k.to_s)\n unless host.attribute_locked?(k.to_s)\n host[k] = v.to_s.gsub(/[\\x00-\\x1f]/n, '')\n end\n elsif !v.blank?\n dlog(\"Unknown attribute for ::Mdm::Host: #{k}\")\n end\n end\n host.info = host.info[0,::Mdm::Host.columns_hash[\"info\"].limit] if host.info\n\n # Set default fields if needed\n host.state = Msf::HostState::Alive if host.state.nil? || host.state.empty?\n host.comm = '' unless host.comm\n host.workspace = wspace unless host.workspace\n\n begin\n framework.events.on_db_host(host) if host.new_record?\n rescue => e\n wlog(\"Exception in on_db_host event handler: #{e.class}: #{e}\")\n wlog(\"Call Stack\\n#{e.backtrace.join(\"\\n\")}\")\n end\n\n host_state_changed(host, ostate) if host.state != ostate\n\n if host.changed?\n msf_import_timestamps(opts, host)\n host.save!\n end\n rescue ActiveRecord::RecordNotUnique, ActiveRecord::RecordInvalid\n # two concurrent report requests for a new host could result in a RecordNotUnique or\n # RecordInvalid exception, simply retry the report once more as an optimistic approach\n retry if (retry_attempts+=1) <= 1\n raise\n end\n\n if opts[:task]\n Mdm::TaskHost.create(\n :task => opts[:task],\n :host => host\n )\n end\n\n host\n }\n end", "def get_host( host_id)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::GetHost.new,\n :path => \"/api/1.1/hosts/#{host_id}.xml\"\n )\n end", "def hostname; end", "def hostname; end", "def host_info\n @host_info\n end", "def host\n conf['api']['host']\n end", "def normalized_host; end", "def get_host(fqdn)\n foreman('GET', \"/api/hosts/#{fqdn}\")\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 host\n self.host\n end", "def host\n @host ||= 'http://open.denglu.cc'\n end", "def api_host\n uri = api_uri\n host, port = uri.host, uri.port\n\n port == 80 ? uri.host : \"#{uri.host}:#{uri.port}\"\n end", "def host_as_string; end", "def host\n return @host\n end", "def host\n return @host\n end", "def getHost()\n return @uri.host\n end", "def api_host #:nodoc:\n API_URI\n end", "def host\n # find host in opts first\n host = options[:host] || @configuration['host']\n host = 'http://api.unipept.ugent.be' if host.nil? || host.empty?\n\n # add http:// if needed\n if host.start_with?('http://', 'https://')\n host\n else\n \"http://#{host}\"\n end\n end", "def target_host\n\t\tif(self.respond_to?('rhost'))\n\t\t\treturn rhost()\n\t\tend\n\n\t\tif(self.datastore['RHOST'])\n\t\t\treturn self.datastore['RHOST']\n\t\tend\n\n\t\tnil\n\tend", "def http_uri\n \"http://#{hostname}/\"\n end", "def host; config[:host]; end", "def host\n @host ||= opts.fetch(:host, parsed_uri.host)\n end", "def external_fqdn() ; info[:external_fqdn] ; end", "def host\n \"#{request.env['rack.url_scheme']}://#{request.host}:#{request.port}\".sub(':80','')# rescue 'http://locahost:3000'\n end", "def host=(_); end", "def list_xpn_hosts request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_list_xpn_hosts_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::XpnHostList.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def list_xpn_hosts request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/listXpnHosts\"\n body = request_pb.projects_list_xpn_hosts_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::XpnHostList.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def get_host_details\n @host = find_host_by_spoof || find_host_by_token || find_host_by_ip_or_mac\n unless @host\n logger.info \"#{controller_name}: unable to find a host that matches the request from #{request.env['REMOTE_ADDR']}\"\n head(:not_found) and return\n end\n unless @host.operatingsystem\n logger.error \"#{controller_name}: #{@host.name}'s operating system is missing!\"\n head(:conflict) and return\n end\n unless @host.operatingsystem.family\n # Then, for some reason, the OS has not been specialized into a Redhat or Debian class\n logger.error \"#{controller_name}: #{@host.name}'s operating system [#{@host.operatingsystem.fullname}] has no OS family!\"\n head(:conflict) and return\n end\n logger.info \"Found #{@host}\"\n end", "def initialize(*args)\n options = args.first.is_a?(Hash) ? args.first : {}\n @result = self.class.get('/get_xml.php', query: options)[\"HostipLookupResultSet\"][\"featureMember\"][\"Hostip\"]\n end", "def enable_xpn_host request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/enableXpnHost\"\n\n query_string_params = {}\n query_string_params[\"requestId\"] = request_pb.request_id.to_s if request_pb.request_id && request_pb.request_id != \"\"\n\n response = @client_stub.make_post_request(\n uri: uri,\n params: query_string_params,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def host\n \"http://api.lvh.me:3000\"\n end", "def info(session, id)\n read_task('rvpe.host.info', session) do\n call_one_xmlrpc('one.host.info', session, id)\n end\n end", "def ipn_endpoint=(_arg0); end", "def host\n URI(self.uri).host\n end", "def local_host_2_ip (host)\n\t\tputs \"DNS lookup from the local host repository\" if @verbose\n\t\thost=host.strip unless host.nil?\n\t\tif @known_hosts.key?(host)\n\t\t\treturn @known_hosts[host]\n\t\telse\n\t\t\treturn nil\n\t\tend\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\t\treturn nil\n\tend", "def host\r\n return for_context(nil, false) { |c| c.host }\r\n end", "def host\n @host || Sapience.config.host\n end", "def host\n domain\n end", "def full_host_record(ip:)\n load_cnames\n \n @forward_host_record ||= {} # Global, as we want to do name lookups.\n return_record = []\n unless( (host_records = @infoblox.get_host_by_ip(ip_address: ip)).nil? )\n host_records.each do |hosts|\n hosts.each do |hn|\n # Assign an empty record, if we haven't seen this host before\n @forward_host_record[hn] ||= { hostname: hn, ip: '', aliases: [], cnames: [] }\n \n # Record the IP. There may be multiple IPs with one hostname.\n @forward_host_record[hn][:ip] = ip\n \n # The hostname might have CNAMES point to it\n unless @reverse_cnames[hn].nil?\n @reverse_cnames[hn].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n \n # The hostname may have alternate hostname A records, stored in IPAM as ALIASES\n @infoblox.get_alias(hostname: hn) do |a| \n short_alias = a.split('.',2)[0]\n @forward_host_record[hn][:aliases] << short_alias\n \n # The ALIASes might have CNAME records pointing to it\n unless @reverse_cnames[a].nil?\n # Record the ALIAS CNAMES against the parent hostname.\n @reverse_cnames[a].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n end\n return_record << @forward_host_record[hn]\n \n # Add forward lookup entries for each ALIAS\n host_domain = hn.split('.',2)[1]\n @forward_host_record[hn][:aliases].each do |a|\n @forward_host_record[\"#{a}.#{host_domain}\"] = @forward_host_record[hn]\n end\n \n # Add forward lookup entries for each CNAME\n @forward_host_record[hn][:cnames].each do |cn|\n @forward_host_record[cn] = @forward_host_record[hn]\n end\n \n end\n end\n end\n return return_record\nend", "def host\n attributes['host']\n end", "def determine_hostname\n @info[:hostname] = @shell.query('HOST', 'hostname')\n end", "def nsx_info\n create_nsx_client = true\n nsx_manager = @host['TEMPLATE/NSX_MANAGER'] || @nsx_obj['url']\n nsx_user = @host['TEMPLATE/NSX_USER']\n nsx_password = @host['TEMPLATE/NSX_PASSWORD']\n nsx_type = @host['TEMPLATE/NSX_TYPE'] || @nsx_obj['type']\n\n [nsx_manager, nsx_user, nsx_password, nsx_type].each do |v|\n next if !v.nil? && !v.empty?\n\n create_nsx_client = false\n break\n end\n\n if create_nsx_client\n @nsx_client = NSXDriver::NSXClient.new_child(nsx_manager,\n nsx_user,\n nsx_password,\n nsx_type)\n end\n\n return '' if @nsx_client.nil?\n\n #-----------------------------------------------------------------------\n # Transport Zones\n #-----------------------------------------------------------------------\n tz_object = NSXDriver::TransportZone.new_child(@nsx_client)\n\n nsx_info = 'NSX_TRANSPORT_ZONES = ['\n\n case nsx_type\n when NSXDriver::NSXConstants::NSXV\n tzs = tz_object.tzs\n tzs.each do |tz|\n nsx_info << \"#{tz.xpath('name').text}=\\\"#{tz.xpath('objectId').text}\\\",\"\n end\n\n when NSXDriver::NSXConstants::NSXT\n tzs = tz_object.tzs\n tzs['results'].each do |tz|\n nsx_info << \"#{tz['display_name']}=\\\"#{tz['id']}\\\",\"\n end\n\n else\n raise \"Unknown PortGroup type #{nsx_type}\"\n end\n\n nsx_info.chomp!(',')\n\n nsx_info << ']'\n end", "def info(decrypt = false)\n super(HOST_METHODS[:info], 'HOST', decrypt)\n end", "def host\n\t\t\t# FIXME: This is both a hack and the best way I know to do this.\n\t\t\tSocket.getaddrinfo(Socket.gethostname, 0)[0][2]\n\t\tend", "def tenancy_host\n ld_api ? ld_api.tenancy_host : nil\n end", "def run_host(ip)\n\n\t\tself.target_port = datastore['RPORT']\t\n\n\t\tbegin\n\t\t\tres = send_request_raw({\n\t\t\t\t'uri' => '/',\n\t\t\t\t'method' => 'GET'\n\t\t\t}, 10)\n\n\t\t\tif (res and res.headers['Server'])\n\t\t\t\textra = http_fingerprint(res)\n\t\t\t\tprint_status(\"#{ip} is running #{res.headers['Server']}#{extra}\")\n\n\t\t\t\trep_id = wmap_base_report_id(\n\t\t\t\t\t\twmap_target_host,\n\t\t\t\t\t\twmap_target_port,\n\t\t\t\t\t\twmap_target_ssl\n\t\t\t\t)\n\t\t\t\twmap_report(rep_id,'WEB_SERVER','TYPE',\"#{res.headers['Server']}#{extra}\",nil)\n\t\t\tend\n\t\t\t\n\t\trescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n\t\trescue ::Timeout::Error, ::Errno::EPIPE\n\t\tend\n\n\tend", "def run_host(ip)\n\n\t\tverbs = [\n\t\t\t\t'get',\n\t\t\t\t'active',\n\t\t\t\t'create',\n\t\t\t\t'change',\n\t\t\t\t'set',\n\t\t\t\t'put',\n\t\t\t\t'do',\n\t\t\t\t'go',\n\t\t\t\t'resolve',\n\t\t\t\t'start',\n\t\t\t\t'recover',\n\t\t\t\t'initiate',\n\t\t\t\t'negotiate',\n\t\t\t\t'define',\n\t\t\t\t'stop',\n\t\t\t\t'begin',\n\t\t\t\t'end',\n\t\t\t\t'manage',\n\t\t\t\t'administer',\n\t\t\t\t'modify',\n\t\t\t\t'register',\n\t\t\t\t'log',\n\t\t\t\t'add',\n\t\t\t\t#'delete', # Best to be safe!\n\t\t\t]\n\n\t\tnouns = [\n\t\t\t\t'password',\n\t\t\t\t'task',\n\t\t\t\t'pass',\n\t\t\t\t'administration',\n\t\t\t\t'account',\n\t\t\t\t'admin',\n\t\t\t\t'login',\n\t\t\t\t'token',\n\t\t\t\t'credentials',\n\t\t\t\t'credential',\n\t\t\t\t'key',\n\t\t\t\t'guid',\n\t\t\t\t'message',\n\t\t\t\t'user',\n\t\t\t\t'username',\n\t\t\t\t'load',\n\t\t\t\t'list',\n\t\t\t\t'name',\n\t\t\t\t'file',\n\t\t\t\t'path',\n\t\t\t\t'directory',\n\t\t\t\t'configuration',\n\t\t\t\t'config',\n\t\t\t\t'setting',\n\t\t\t\t'settings',\n\t\t\t\t'registry',\n\t\t\t\t'on',\n\t\t\t\t'off',\n\t\t\t]\n\n\t\ttarget_port = datastore['RPORT']\n\t\tvhost = datastore['VHOST'] || wmap_target_host || ip\n\n\t\tbegin\n\t\t\t# Check service exists\n\t\t\tres = send_request_raw({\n\t\t\t\t'uri' => datastore['PATH'],\n\t\t\t\t'method' => 'GET',\n\t\t\t\t'vhost' => vhost,\n\t\t\t}, 10)\n\n\t\t\tif (res.code == 200)\n\t\t\t\tprint_status(\"PATH appears to be OK.\")\n\n\t\t\t\tverbs.each do |v|\n\t\t\t\t\tnouns.each do |n|\n\n\t\t\t\t\t\t# This could be cleaned up - patrickw\n\t\t\t\t\t\tdata = '<?xml version=\"1.0\" encoding=\"utf-8\"?>' + \"\\r\\n\"\n\t\t\t\t\t\tdata << '<soap:Envelope xmlns:xsi=\"' + datastore['XMLINSTANCE'] + '\" xmlns:xsd=\"' + datastore['XMLSCHEMA'] + '\" xmlns:soap=\"' + datastore['XMLSOAP'] + '\">' + \"\\r\\n\"\n\t\t\t\t\t\tdata << '<soap:Body>' + \"\\r\\n\"\n\t\t\t\t\t\tdata << \"<#{v}#{n}\" + \" xmlns=\\\"#{datastore['XMLNAMESPACE']}\\\">\" + \"\\r\\n\"\n\t\t\t\t\t\tdata << \"</#{v}#{n}>\" + \"\\r\\n\"\n\t\t\t\t\t\tdata << '</soap:Body>' + \"\\r\\n\"\n\t\t\t\t\t\tdata << '</soap:Envelope>' + \"\\r\\n\\r\\n\"\n\n\t\t\t\t\t\tres = send_request_raw({\n\t\t\t\t\t\t\t'uri' => datastore['PATH'] + '/' + v + n,\n\t\t\t\t\t\t\t'method' => 'POST',\n\t\t\t\t\t\t\t'vhost' => vhost,\n\t\t\t\t\t\t\t'data'\t\t=> data,\n\t\t\t\t\t\t\t'headers' =>\n\t\t\t\t\t\t\t\t{\n\t\t\t\t\t\t\t\t\t'Content-Length' => data.length,\n\t\t\t\t\t\t\t\t\t'SOAPAction'\t=> '\"' + datastore['XMLNAMESPACE'] + v + n + '\"',\n\t\t\t\t\t\t\t\t\t'Expect'\t=> '100-continue',\n\t\t\t\t\t\t\t\t\t'Content-Type'\t=> datastore['CONTENTTYPE'],\n\t\t\t\t\t\t\t\t}\n\t\t\t\t\t\t}, 15)\n\n\t\t\t\t\t\tif (res && !(res.body.empty?))\n\t\t\t\t\t\t\tif (res.body =~ /method name is not valid/)\n\t\t\t\t\t\t\t\tprint_status(\"Server rejected SOAPAction: #{v}#{n} with HTTP: #{res.code} #{res.message}.\")\n\t\t\t\t\t\t\telsif (res.message =~ /Cannot process the message because the content type/)\n\t\t\t\t\t\t\t\tprint_status(\"Server rejected CONTENTTYPE: HTTP: #{res.code} #{res.message}.\")\n\t\t\t\t\t\t\t\tres.message =~ /was not the expected type\\s\\'([^']+)'/\n\t\t\t\t\t\t\t\tprint_status(\"Set CONTENTTYPE to \\\"#{$1}\\\"\")\n\t\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t\telsif (res.code == 404)\n\t\t\t\t\t\t\t\treturn false\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tprint_status(\"Server responded to SOAPAction: #{v}#{n} with HTTP: #{res.code} #{res.message}.\")\n\t\t\t\t\t\t\t\t## Add Report\n\t\t\t\t\t\t\t\treport_note(\n\t\t\t\t\t\t\t\t\t:host\t=> ip,\n\t\t\t\t\t\t\t\t\t:proto\t=> 'HTTP',\n\t\t\t\t\t\t\t\t\t:port\t=> rport,\n\t\t\t\t\t\t\t\t\t:type\t=> \"SOAPAction: #{v}#{n}\",\n\t\t\t\t\t\t\t\t\t:data\t=> \"SOAPAction: #{v}#{n} with HTTP: #{res.code} #{res.message}.\"\n\t\t\t\t\t\t\t\t)\n\t\t\t\t\t\t\t\tif datastore['DISPLAYHTML']\n\t\t\t\t\t\t\t\t\tprint_status(\"The HTML content follows:\")\n\t\t\t\t\t\t\t\t\tprint_status(res.body + \"\\r\\n\")\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\n\t\telse\n\t\t\tprint_status(\"Server did not respond with 200 OK.\")\n\t\t\tprint_status(res.to_s)\n\t\tend\n\t\trescue ::Rex::ConnectionRefused, ::Rex::HostUnreachable, ::Rex::ConnectionTimeout\n\t\trescue ::Timeout::Error, ::Errno::EPIPE\n\t\tend\n\tend", "def api_v11_cm_all_hosts_config_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_cm_all_hosts_config_get ...\"\n end\n \n # resource path\n path = \"/api/v11/cm/allHosts/config\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'view'] = opts[:'view'] if opts[:'view']\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_cm_all_hosts_config_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def ise_host_get(ip_address)\n post_data = {:ip_address => ip_address}\n nessus_rest_post(\"connectors/cisco-ise/#{ip_address}\")\n end", "def hosts=(_arg0); end", "def hosts=(_arg0); end", "def default_ipn_endpoint; end", "def cmd_resolve_hosts argv\n setup argv\n name = @hash['name']\n response = @api.resolve_hosts(name)\n msg response\n return response\n end", "def get_usage_network_hosts_with_http_info(start_hr, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_usage_network_hosts ...'\n end\n # verify the required parameter 'start_hr' is set\n if @api_client.config.client_side_validation && start_hr.nil?\n fail ArgumentError, \"Missing the required parameter 'start_hr' when calling UsageMeteringAPI.get_usage_network_hosts\"\n end\n # resource path\n local_var_path = '/api/v1/usage/network_hosts'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'start_hr'] = start_hr\n query_params[:'end_hr'] = opts[:'end_hr'] if !opts[:'end_hr'].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;datetime-format=rfc3339'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'UsageNetworkHostsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :get_usage_network_hosts,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsageMeteringAPI#get_usage_network_hosts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def rest_endpoint=(_arg0); end", "def get_endpoint()\n end", "def get_public_ip_address\n rpc_get_fact_direct('public_ip')\n end", "def host_with_port\n @context.registers[:host_with_port]\n end", "def host\n \"https://api.monzo.com/\"\n end", "def raw_host_with_port; end", "def get_abs_resource_host(host_to_request)\n uri = URI(\"#{@abs_base_url}/awsdirect\")\n puts \"Host_to_request: #{host_to_request}\"\n\n request_body = get_awsdirect_request_body(host_to_request)\n response = perform_awsdirect_request(uri, request_body)\n\n if !valid_abs_response?(response)\n raise \"Unable to provision host for role: #{host_to_request[:role]}\"\n else\n host = parse_awsdirect_response_body(response.body)\n end\n\n return host\n\n end", "def host_detail(scan_id, host_id)\n res = http_get(:uri=>\"/scans/#{scan_id}/hosts/#{host_id}\", :fields=>x_cookie)\n end", "def read_host_info\n json { execute_prlctl('server', 'info', '--json') }\n end", "def search_host\n begin\n if @host_search\n @host = Resolv.getname self.ip.to_s\n else\n @host = nil\n end\n rescue Resolv::ResolvError\n @host = nil\n end\n end", "def api_v11_hosts_host_id_get_with_http_info(host_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_hosts_host_id_get ...\"\n end\n \n # verify the required parameter 'host_id' is set\n fail \"Missing the required parameter 'host_id' when calling api_v11_hosts_host_id_get\" if host_id.nil?\n \n # resource path\n path = \"/api/v11/hosts/{hostId}\".sub('{format}','json').sub('{' + 'hostId' + '}', host_id.to_s)\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n\n # HTTP header 'Accept' (if needed)\n _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_hosts_host_id_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end" ]
[ "0.7175156", "0.65536964", "0.6349638", "0.6277782", "0.6198358", "0.6165674", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.6149152", "0.61478895", "0.60542005", "0.60414577", "0.60414577", "0.6010017", "0.6010017", "0.6007132", "0.5999362", "0.5973848", "0.59308356", "0.59231627", "0.59029204", "0.58980215", "0.58980215", "0.58895797", "0.58738893", "0.58493763", "0.58381087", "0.5815771", "0.5807843", "0.5805123", "0.578867", "0.57875764", "0.57875764", "0.57842916", "0.5769406", "0.5763655", "0.57468814", "0.5723098", "0.5707025", "0.5694642", "0.56737024", "0.56715554", "0.56616014", "0.56616014", "0.56591725", "0.5649634", "0.56438744", "0.5641727", "0.56390435", "0.56267095", "0.56193864", "0.5615084", "0.5613831", "0.55975044", "0.5584674", "0.55785435", "0.5572091", "0.55557895", "0.55541104", "0.55487734", "0.5539982", "0.5537887", "0.5530749", "0.5523286", "0.55193406", "0.55154824", "0.551533", "0.55103457", "0.55052096", "0.54959494", "0.5495282", "0.54866505", "0.548631", "0.54792106", "0.5476068", "0.5474442", "0.5470318", "0.5468596", "0.5465992", "0.5465992", "0.54611355", "0.5460867", "0.5459023", "0.54587567", "0.5457654", "0.54539716", "0.54500556", "0.5440205", "0.5439514", "0.54381675", "0.5420701", "0.5419065", "0.54189605", "0.54168826" ]
0.70225894
1
Baseline implementation for the get_xpn_resources REST call
def get_xpn_resources request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, _body, query_string_params = transcode_get_xpn_resources_request request_pb response = @client_stub.make_get_request( uri: uri, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::ProjectsGetXpnResources.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_xpn_resources request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/getXpnResources\"\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::ProjectsGetXpnResources.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def xres\n get \"xres\"\n end", "def list_resources\n resources = []\n addr = create_address(:sliceID => @@sliceID, :domain => @@domain)\n resource_prefix = \"#{addr.generate_address}/\"\n nodes = list_nodes(@@domain)\n nodes.each{|node|\n next if !node.include?(resource_prefix)\n node.slice!(resource_prefix)\n resources << node if !node.empty?\n }\n resources\n end", "def resources\n @resources ||= @response[@resource_field].to_a\n end", "def test_list_available_resources\n puts \"## list_available_resources (retrieveable SF objects) ##\"\n resp = Salesforce::Rest::AsfRest.xlist_available_resources()\n\n resp.each {|key, val| pp key + ' => ' + val.to_s}\n assert !resp.nil?\n end", "def resources\n @resources ||=\n query_service.custom_queries.find_by_property(property: :source_metadata_identifier, value: [], lazy: true).select do |resource|\n id = resource.source_metadata_identifier.first\n next if /99.*3506421/.match?(id)\n next if transform_id(id).length > 18\n RemoteRecord.catalog?(id)\n end.to_a\n end", "def get_resource_params\n \traise NotImplementedError\n end", "def get_all_datasets_and_resources(base_url)\n return handle_request(URI.encode(base_url + '/current_package_list_with_ressources'))\n end", "def all\n setup_request \"#{@@resource_url}s\"\n end", "def ar_retrieve_resources\n run_callbacks :ar_retrieve_resources do\n if params[:_search]\n # Fulltext search\n\n @resources = ar_model.search(params[:_search])\n @resources_count = @resources.count\n else\n intf = ar_model.interfaces[:rest]\n\n @resources_relation ||= ar_model.all\n\n # Authorization\n if intf.authorization_required?\n @resources_relation = @resources_relation.with_capability(aaa_context)\n end\n\n @authorized_resources_relation = @resources_relation\n\n # Filters\n @resources_relation = apply_scopes_to_relation(@resources_relation)\n @resources_relation = apply_json_filter_to_relation(@resources_relation)\n @resources_relation = apply_simple_filter_to_relation(@resources_relation)\n\n # Display filters\n @resources_relation = apply_sorting_to_relation(@resources_relation)\n @paginated_resources_relation = apply_pagination_to_relation(@resources_relation)\n\n @resources = @paginated_resources_relation\n @resources_count = @resources_relation.count\n end\n end\n\n @resources\n rescue ActiveRecord::RecordNotFound => e\n raise Exception::NotFound.new(e.message,\n :retry_possible => false)\n end", "def get_resources_with_http_info()\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DiagnosticsApi.get_resources ...\"\n end\n # resource path\n local_var_path = \"/v2.1\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = []\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ResourceInformation')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: DiagnosticsApi#get_resources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def resource_all(stack)\n raise NotImplementedError\n end", "def resource_list\n self.resources\n end", "def list_resources(options)\n #debug \"options = \" + options.inspect\n body, format = parse_body(options)\n params = body[:options]\n #debug \"Body & Format = \", opts.inspect + \", \" + format.inspect\n\n debug 'ListResources: Options: ', params.inspect\n\n only_available = params[:only_available]\n slice_urn = params[:slice_urn]\n\n authorizer = options[:req].session[:authorizer]\n # debug \"!!!authorizer = \" + authorizer.inspect\n\n debug \"!!!USER = \" + authorizer.user.inspect\n debug \"!!!ACCOUNT = \" + authorizer.account.inspect\n # debug \"!!!ACCOUNT_URN = \" + authorizer.account[:urn]\n # debug \"!!!ACCOUNT = \" + authorizer.user.accounts.first.inspect\n\n if slice_urn\n @return_struct[:code][:geni_code] = 4 # Bad Version\n @return_struct[:output] = \"Geni version 3 no longer supports arguement 'geni_slice_urn' for list resources method, please use describe instead.\"\n @return_struct[:value] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n else\n resources = @am_manager.find_all_samant_leases(nil, $acceptable_lease_states, authorizer)\n comps = @am_manager.find_all_samant_components_for_account(nil, authorizer)\n # child nodes should not be included in listresources\n comps.delete_if {|c| ((c.nil?)||(c.to_uri.to_s.include?\"/leased\"))}\n if only_available\n debug \"only_available selected\"\n # TODO maybe delete also interfaces and locations as well\n comps.delete_if {|c| (c.kind_of?SAMANT::Uxv) && c.hasResourceStatus && (c.hasResourceStatus.to_uri == SAMANT::BOOKED.to_uri) }\n end\n resources.concat(comps)\n #debug \"the resources: \" + resources.inspect\n # TODO uncomment to obtain rspeck, commented out because it's very time-wasting\n #used_for_side_effect = OMF::SFA::AM::Rest::ResourceHandler.rspecker(resources, :Offering) # -> creates the advertisement rspec file inside /ready4translation (less detailed, sfa enabled)\n start = Time.now\n debug \"START CREATING JSON\"\n res = OMF::SFA::AM::Rest::ResourceHandler.omn_response_json(resources, options) # -> returns the json formatted results (more detailed, omn enriched)\n debug \"END CREATING JSON. total time = \" + (Time.now-start).to_s\n end\n\n @return_struct[:code][:geni_code] = 0\n @return_struct[:value] = res\n @return_struct[:output] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n rescue OMF::SFA::AM::InsufficientPrivilegesException => e\n @return_struct[:code][:geni_code] = 3\n @return_struct[:output] = e.to_s\n @return_struct[:value] = ''\n return ['application/json', JSON.pretty_generate(@return_struct)]\n end", "def list_resources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcesApi.list_resources ...'\n end\n # resource path\n local_var_path = '/resource_set'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n # return_type\n return_type = opts[:return_type] || 'Array<String>' \n\n # auth_names\n auth_names = opts[:auth_names] || ['protection_auth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourcesApi#list_resources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @api_v1_resources = Api::V1::Resource.all\n end", "def resources\n @resources ||= @internal_struct[:resources] || {}\n end", "def get_resources_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcePermissionsApi.get_resources ...'\n end\n # resource path\n local_var_path = '/v1/resources'\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/links+json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] \n\n return_type = opts[:return_type] || 'InlineResponse2004' \n\n auth_names = opts[:auth_names] || ['oauth2']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type)\n\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourcePermissionsApi#get_resources\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def resources\n @pruned_resources || super\n end", "def resource_requests\n return @resource_requests\n end", "def resource_params\n raise NotImplementedError\n end", "def search_pn\n @pn_cross_references = invoke_webservice method: 'get', action: 'xrefParts', query_string: { :partNo => params[:pn_part_number]}\n if @pn_cross_references.present? && @pn_cross_references[\"errMsg\"].blank?\n @xNSN = @pn_cross_references[\"xNSN\"].split(\",\")\n @xPartNo = @pn_cross_references[\"xPartNo\"].split(\",\")\n @xCage = @pn_cross_references[\"xCage\"].split(\",\")\n @xCageName = @pn_cross_references[\"xCageName\"].split(\",\")\n else\n @error = @pn_cross_references.present? ? @pn_cross_references[\"errMsg\"] : \"Service Temporarily Unavailable\"\n end\n render :index\n end", "def resources\n @resources ||= process_data(decoded_body[resources_key])\n end", "def show\n params[:q] ||= {}\n @api_resources_q = @api_namespace.api_resources.ransack(params[:q])\n @api_resources = @api_resources_q.result.paginate(page: params[:page], per_page: 10)\n end", "def query_resources\n powershell_exec(\"get-dscresource\").result\n end", "def getNodeList\n broker_url = APP_CONFIG['broker_ip'] + ':' + APP_CONFIG['broker_port'].to_s\n result = HTTParty.get(broker_url + \"/resources/nodes\", :verify => false)\n temp2 = JSON.parse(result.body)\n\n node_data = temp2[\"resource_response\"][\"resources\"]\n return node_data\n \n end", "def indexable_resources\n return to_enum(:indexable_resources) { size } unless block_given?\n\n resources.each do |resource|\n yield resource\n\n next unless resource.exists?\n\n resource.items.each do |r|\n yield Purl.new(r.druid)\n end\n end\n end", "def load_patient_resources (type, profile, patientfield, pid, datefield=nil)\n parameters = {}\n parameters[patientfield] = \"Patient/\" + pid\n parameters[:_profile] = profile if profile\n parameters[:_count] = 1000 \n \n if datefield \n parameters[datefield] = []\n parameters[datefield] << \"ge\"+ DateTime.parse(start_date).strftime(\"%Y-%m-%d\") if start_date.present?\n parameters[datefield] << \"le\"+ DateTime.parse(end_date).strftime(\"%Y-%m-%d\") if end_date.present?\n end\n search = {parameters: parameters }\n results = @client.search(type, search: search )\n results.resource.entry.map(&:resource)\n end", "def enclosing_resources\n self.resource_tuple[0..-2]\n end", "def get_resource\n\t\t\tlogger.debug {\"ALLOCATING NEW RESOURCE --> #{ ActiveOrient.db_pool.size }\" }\n login = [ActiveOrient.default_server[:user] , ActiveOrient.default_server[:password]]\n server_adress = \"http://#{ActiveOrient.default_server[:server]}:#{ActiveOrient.default_server[:port]}\"\n\t\t\t RestClient::Resource.new(server_adress, *login)\n end", "def resources\n @resources ||= []\n end", "def resource_all(stack)\n request(\n :path => \"global/deployments/#{stack.name}/resources\"\n ).fetch('body', 'resources', []).map do |resource|\n Stack::Resource.new(stack,\n :id => resource[:id],\n :type => resource[:type],\n :name => resource[:name],\n :logical_id => resource[:name],\n :created => Time.parse(resource[:insertTime]),\n :updated => resource[:updateTime] ? Time.parse(resource[:updateTime]) : nil,\n :state => :create_complete,\n :status => 'OK',\n :status_reason => resource.fetch(:warnings, []).map{|w| w[:message]}.join(' ')\n ).valid_state\n end\n end", "def index\n @resources = Resource.find(:all, :conditions => {:parent_id => nil}, :order => 'created_at DESC')\n @deliverable_keys = Deliverable.all.collect{ |d| d.key_resource_id }.uniq.sort\n @project_keys = Project.all.collect{ |p| p.key_resource_id }.uniq.sort\n #@key_array = (@deliverable_keys + @project_keys).uniq.sort\n respond_to do |format|\n format.html { render :layout => false if request.xhr? }# index.html.erb\n format.xml { render :xml => @resources }\n end\n end", "def index\n @resource_allocations = ResourceAllocation.scoped\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @resource_allocations }\n end\n end", "def get_nested_resource_objects\n end", "def index\n @resources = resource_class.send(:all)\n render json: @resources\n end", "def get_resourcepool_lease_resource_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ResourcepoolApi.get_resourcepool_lease_resource_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/resourcepool/LeaseResources'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'ResourcepoolLeaseResourceResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"ResourcepoolApi.get_resourcepool_lease_resource_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ResourcepoolApi#get_resourcepool_lease_resource_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def show_resources\r\n @resources_pages = Paginator.new self, \r\n Resource.count, \r\n Resource.get(\"resources_paginator_count\").to_i, \r\n params[:page] \r\n @resources = Resource.find :all, :order => 'name',\r\n :limit => @resources_pages.items_per_page,\r\n :offset => @resources_pages.current.offset \r\n end", "def catalog_resources\n # This method exists to supply a common interface to the puppet catalog\n # for different versions of puppet.\n @catalog.resources.map do |r|\n if r.is_a?(String)\n # puppet 0.25 and older\n resource(r)\n elsif r.is_a?(Puppet::Resource)\n # puppet 2.6 and newer\n r\n else\n raise \"Unknown resource object #{r.class}\"\n end\n end\n end", "def resources\n @resources.values\n end", "def fetch_external\n object.controlled_properties.each do |property|\n object[property].each do |value|\n resource = value.respond_to?(:resource) ? value.resource : value\n next unless resource.is_a?(ActiveTriples::Resource)\n next if value.is_a?(ActiveFedora::Base)\n fetch_with_persistence(resource)\n end\n end\n end", "def index\n self.resources = resource_class.all.paginate(per_page: 15, page: (params[:page] || 1).to_i)\n end", "def list(resource,limit=0,params={})\n uri = '/api/' + resource.to_s\n params.merge!({limit: limit.to_s})\n http_get(uri,params)\n end", "def generate_resources_list\n resources = YARD::Registry.all(:resource).uniq.sort_by {|resource| resource.name.to_s}\n generate_full_list(resources, 'Resource', 'resources')\nend", "def resource_all(stack)\n all_result_pages(nil, :body,\n \"ListStackResourcesResponse\", \"ListStackResourcesResult\",\n \"StackResourceSummaries\", \"member\") do |options|\n request(\n :method => :post,\n :path => \"/\",\n :form => options.merge(\n Smash.new(\n \"Action\" => \"ListStackResources\",\n \"StackName\" => stack.id,\n )\n ),\n )\n end.map do |res|\n Stack::Resource.new(\n stack,\n :id => res[\"PhysicalResourceId\"],\n :name => res[\"LogicalResourceId\"],\n :logical_id => res[\"LogicalResourceId\"],\n :type => res[\"ResourceType\"],\n :state => res[\"ResourceStatus\"].downcase.to_sym,\n :status => res[\"ResourceStatus\"],\n :updated => res[\"LastUpdatedTimestamp\"],\n ).valid_state\n end\n end", "def resource_all(stack)\n result = request(\n :method => :get,\n :path => \"/stacks/#{stack.name}/#{stack.id}/resources\",\n :expects => 200\n )\n result.fetch(:body, :resources, []).map do |resource|\n Stack::Resource.new(\n stack,\n :id => resource[:physical_resource_id],\n :name => resource[:resource_name],\n :type => resource[:resource_type],\n :logical_id => resource[:logical_resource_id],\n :state => resource[:resource_status].downcase.to_sym,\n :status => resource[:resource_status],\n :status_reason => resource[:resource_status_reason],\n :updated => Time.parse(resource[:updated_time])\n ).valid_state\n end\n end", "def host_meta\n @host_meta ||= begin\n request = Net::HTTP::Get.new(host_meta_uri.path)\n http = Net::HTTP.new(host_meta_uri.host, host_meta_uri.port)\n http.use_ssl = (host_meta_uri.port==443)\n response = http.start {|http| http.request(request) }\n raise OpenTransact::UndiscoverableResource unless response.code==\"200\"\n MultiXml.parse(response.body)[\"XRD\"]\n end\n end", "def resources()\n end", "def get_crls_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: NsxComponentAdministrationApi.get_crls ...\"\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling NsxComponentAdministrationApi.get_crls, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling NsxComponentAdministrationApi.get_crls, must be greater than or equal to 0.'\n end\n\n if @api_client.config.client_side_validation && opts[:'type'] && !['cluster_api_certificate'].include?(opts[:'type'])\n fail ArgumentError, 'invalid value for \"type\", must be one of cluster_api_certificate'\n end\n # resource path\n local_var_path = \"/trust-management/crls\"\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'details'] = opts[:'details'] if !opts[:'details'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n query_params[:'type'] = opts[:'type'] if !opts[:'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 # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'CrlList')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: NsxComponentAdministrationApi#get_crls\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def index\n @q_resources = QResource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @q_resources }\n end\n end", "def all\n describe(resource_uri)\n end", "def resources\n @resources ||= {}\n end", "def getAllResources(domain = \"*\")\n where_clause = \"\"\n if domain != \"*\" then\n where_clause = \"WHERE testbeds.name='#{domain}'\"\n end\n qs = <<ALLRESOURCES_QS\nSELECT nodes.hrn\n FROM nodes\n LEFT JOIN locations ON nodes.location_id = locations.id\n LEFT JOIN testbeds ON locations.testbed_id = testbeds.id\n#{where_clause};\nALLRESOURCES_QS\n\n resources = Set.new\n runQuery(qs) { |name|\n resources.add(name)\n }\n return resources\n end", "def all(params = {})\n response = http_get(resource_url, params)\n format_object(response, TYPE)\n end", "def resources\n @resources\n end", "def api_keys; rest_query(:api_key); end", "def api_keys; rest_query(:api_key); end", "def index\n @fundamental_resource_pools = Fundamental::ResourcePool.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @fundamental_resource_pools }\n end\n end", "def resources\n return @resources\n end", "def resources\n return @resources\n end", "def resources\n return @resources\n end", "def initialize\n @resource_parts = Array.new\n end", "def index\n @resources = Resource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @resources }\n end\n end", "def load_patient_resources (type, profile, patientfield, pid, datefield=nil)\n parameters = {}\n# parameters[patientfield] = \"Patient/\" + pid\n parameters[patientfield] = pid\n parameters[:_profile] = profile if profile\n# parameters[:_count] = 1000 \n # binding.pry \n if datefield \n parameters[datefield] = []\n parameters[datefield] << \"ge\"+ DateTime.parse(start_date).strftime(\"%Y-%m-%d\") if start_date.present?\n parameters[datefield] << \"le\"+ DateTime.parse(end_date).strftime(\"%Y-%m-%d\") if end_date.present?\n end\n search = { parameters: parameters }\n results = @client.search(type, search: search)\n results.resource.entry.map(&:resource)\n end", "def api_get_resources(url, page, resource_type, o = {})\n json = api_get_json(url, page, o)\n json.is_a?(Hash) ? resource_type.new(json) : json.map { |r| resource_type.new(r) }\n end", "def index\n build_resource({})\n respond_with self.resource\n end", "def extract_titles(resources)\n titles = []\n\n resources.each do |resource|\n titles << resource[:resource_id]\n end\n\n titles\nend", "def resources\n @data.keys\n end", "def get_fhir_resources(fhir_client, type, resource_id, patient_id=nil)\n if patient_id == nil\n search = { parameters: { _id: resource_id} } \n else\n search = { parameters: { _id: resource_id, patient: patient_id} }\n end\n results = fhir_client.search(type, search: search )\n binding.pry if results == nil || results.resource == nil || results.resource.entry == nil \n results.resource.entry.map(&:resource)\n end", "def resources; end", "def resources; end", "def get_fhir_resources(fhir_client, type, resource_id, patient_id=nil)\n if patient_id == nil\n search = { parameters: { _id: resource_id} } \n else\n search = { parameters: { _id: resource_id, patient: patient_id} }\n end\n results = fhir_client.search(type, search: search )\n # binding.pry if results == nil || results.resource == nil || results.resource.entry == nil \n results.resource.entry.map(&:resource)\n end", "def index\n @resources = Resource.all\n end", "def each_resource(call_back, **kwargs)\n offset = kwargs[:offset].nil? ? 0 : kwargs[:offset]\n\n loop do\n response = request(call_back, :offset => offset, **kwargs)\n offset = response.fetch(:offset) + response.fetch(:limit)\n\n resources = response[:items]\n resources&.each { |value| yield value }\n\n return if resources.empty?\n end\n end", "def index\n @resources = Resource.eager_load(:resource_type).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end", "def index\n @resources = Resource.all\n converted_resources = @resources.map do |r|\n {\n id: r.id,\n name: r.name,\n timeLimit: r.time_limit,\n visible: r.visible,\n vaccine: r.vaccine,\n questions: r.questions\n }\n end\n render json: converted_resources, status: :ok\n end", "def obtain_vm_data(resource)\n\n puts \"Obtaining virtual machines' data\"\n return obtain_torque_data(resource[:head], resource[:compute])\n \nend", "def list(resource_type,limit=0,params={})\n path = '/api/' + resource_type.to_s\n params.merge!({limit: limit.to_s})\n response = http_get(path,params)\n hydrate_list(resource_type, response['objects'])\n end", "def enable_xpn_resource request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, body, query_string_params = transcode_enable_xpn_resource_request request_pb\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n params: query_string_params,\n options: options\n )\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def jsonapi_pagination(resources)\n links = { self: request.base_url + request.fullpath }\n pagination = jsonapi_pagination_meta(resources)\n\n return links if pagination.blank?\n\n original_params = params.except(\n *jsonapi_path_parameters.keys.map(&:to_s)\n ).as_json.with_indifferent_access\n\n original_params[:page] = original_params[:page].dup || {}\n original_url = request.base_url + request.path + '?'\n\n pagination.each do |page_name, number|\n next if page_name == :records\n\n original_params[:page][:number] = number\n links[page_name] = original_url + CGI.unescape(\n original_params.to_query\n )\n end\n\n links\n end", "def index\n @resources = Resource.all\n end", "def index\n @resources = Resource.all\n end", "def index\n @resources = Resource.all\n end", "def arguments\n resource_names\n end", "def resource_limits; end", "def resource_limits; end", "def rest_endpoint; end", "def list(\n filter,\n *args,\n deadline: nil\n )\n req = V1::ResourceListRequest.new()\n req.meta = V1::ListRequestMetadata.new()\n page_size_option = @parent._test_options[\"PageSize\"]\n if page_size_option.is_a? Integer\n req.meta.limit = page_size_option\n end\n if not @parent.snapshot_time.nil?\n req.meta.snapshot_at = @parent.snapshot_time\n end\n\n req.filter = Plumbing::quote_filter_args(filter, *args)\n resp = Enumerator::Generator.new { |g|\n tries = 0\n loop do\n begin\n plumbing_response = @stub.list(req, metadata: @parent.get_metadata(\"Resources.List\", req), deadline: deadline)\n rescue => exception\n if (@parent.shouldRetry(tries, exception))\n tries + +@parent.jitterSleep(tries)\n next\n end\n raise Plumbing::convert_error_to_porcelain(exception)\n end\n tries = 0\n plumbing_response.resources.each do |plumbing_item|\n g.yield Plumbing::convert_resource_to_porcelain(plumbing_item)\n end\n break if plumbing_response.meta.next_cursor == \"\"\n req.meta.cursor = plumbing_response.meta.next_cursor\n end\n }\n resp\n end", "def resource(*resources, &block); end", "def index\n # @cloud_resources = CloudResource.all\n root = CloudResource.find_root\n root = params[:id] || root.id\n @cloud_resource = CloudResource.find root.to_i\n @cloud_resources = @cloud_resource.children(params[:page] || 1).order(\"name DESC\")\n end", "def fabricate_via_api!\n validate_reuse_preconditions\n\n resource_web_url(api_get)\n rescue Errors::ResourceNotFoundError\n super\n ensure\n self.class.resources[reuse_as] ||= {\n tests: Set.new,\n resource: self\n }\n\n self.class.resources[reuse_as][:attributes] ||= all_attributes.each_with_object({}) do |attribute_name, attributes|\n attributes[attribute_name] = instance_variable_get(\"@#{attribute_name}\")\n end\n self.class.resources[reuse_as][:tests] << Runtime::Example.location\n end", "def index(**params)\n params.stringify_keys!\n path = nest_path_within_parent(plural_resource_path, params)\n api_request(:get, path, params: params)\n end", "def resource_base_uri\n @resource ||= \"#{Hyperloop::Resource::ClientDrivers.opts[:resource_api_base_path]}/#{self.to_s.underscore.pluralize}\"\n end", "def resource_names\n JSON.parse(@body).fetch('Resources', {}).keys\n end", "def comparable\n reload! if api_response.nil?\n\n api_resource.except(\n :id,\n :web_url,\n :project_id,\n :source_project_id,\n :target_project_id,\n :merge_status,\n # these can differ depending on user fetching mr\n :user,\n :subscribed,\n :first_contribution\n ).merge({ references: api_resource[:references].except(:full) })\n end", "def unshift(*resources)\n relate_resources(resources)\n super\n end", "def index\n @resources_customs = ResourcesCustom.all\n end", "def get_resources(url, resource_class, params={})\n get(url, params).map do |result|\n resource_class.from_hash(result, client: self)\n end\n end", "def resources\n instance_variable_get(\"@#{resources_name}\")\n end", "def externalNodes\n certname = params[:name]\n @host ||= resource_base.find_by_certname certname\n @host ||= resource_base.find_by_name certname\n not_found and return unless @host\n\n begin\n respond_to do |format|\n format.html { render :text => \"<pre>#{@host.info.to_yaml}</pre>\" }\n format.yml { render :text => @host.info.to_yaml }\n end\n rescue\n # failed\n logger.warn \"Failed to generate external nodes for #{@host} with #{$!}\"\n render :text => _('Unable to generate output, Check log files\\n'), :status => 412 and return\n end\n end" ]
[ "0.6579212", "0.60368466", "0.5889131", "0.5756236", "0.5748071", "0.57277274", "0.5681401", "0.56520116", "0.5607179", "0.5588175", "0.55734694", "0.5544406", "0.5519638", "0.5487556", "0.543016", "0.54168254", "0.5416376", "0.5393172", "0.5328364", "0.53093916", "0.53086144", "0.53041434", "0.530088", "0.5298577", "0.52752525", "0.52457273", "0.5240741", "0.5212752", "0.52126676", "0.52116275", "0.5197861", "0.51949465", "0.51921594", "0.5190395", "0.5186648", "0.5181177", "0.51796615", "0.5165618", "0.51652324", "0.5161704", "0.51557374", "0.514669", "0.51280963", "0.5127667", "0.5122819", "0.51180303", "0.5101229", "0.5090514", "0.5071919", "0.50493294", "0.5048607", "0.5045626", "0.50446695", "0.5043653", "0.5028", "0.50279206", "0.50279206", "0.5002915", "0.50004786", "0.50004786", "0.50004786", "0.49999875", "0.49958405", "0.49893636", "0.4987322", "0.4983859", "0.49748456", "0.4963523", "0.49606365", "0.49605814", "0.49605814", "0.49530613", "0.49472344", "0.49429265", "0.4938968", "0.4935936", "0.49265996", "0.49261162", "0.4919436", "0.49182755", "0.49108034", "0.49108034", "0.49108034", "0.49082798", "0.49026904", "0.49026904", "0.48998845", "0.4898034", "0.48916513", "0.4883366", "0.48798728", "0.48785406", "0.48779067", "0.4867463", "0.48661438", "0.4863964", "0.48633018", "0.48547408", "0.48509616", "0.48487973" ]
0.63943833
1
Baseline implementation for the list_xpn_hosts REST call
def list_xpn_hosts request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_list_xpn_hosts_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::XpnHostList.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list_xpn_hosts request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/listXpnHosts\"\n body = request_pb.projects_list_xpn_hosts_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::XpnHostList.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def list_of_hosts\n super\n end", "def hosts; end", "def hosts; end", "def hosts; end", "def hosts=(_arg0); end", "def hosts=(_arg0); 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 index_hosts\n load_service\n return if (@service.blank?)\n\n # Preload hosts\n @hosts = Host.where(:_id.in => @service.host_ids)\n\n respond_to do |format|\n format.html\n end\n end", "def cmd_resolve_hosts argv\n setup argv\n name = @hash['name']\n response = @api.resolve_hosts(name)\n msg response\n return response\n end", "def host_list()\n host_list = [\n {\"ip\"=>\"192.168.110.207\", \"host\"=>\"zabbix-server\", \"roles\"=>[\"zabbix-server\", \"csgw\"], \"deployment\"=>\"vm\", \"status\"=>1},\n {\"ip\"=>\"192.168.110.210\", \"host\"=>\"test-01\", \"roles\"=>[\"test\"], \"deployment\"=>\"test\", \"status\"=>1}\n ]\n return host_list\n end", "def hosts\n @hosts ||= []\n end", "def hosts\n if @hosts\n @hosts\n elsif @host\n [@host]\n else\n self.class.hosts\n end\n end", "def list_hosts( zone_id)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::ListHosts.new,\n :path => \"/api/1.1/zones/#{zone_id}/hosts.xml\"\n )\n end", "def externalNodes\n certname = params[:name]\n @host ||= resource_base.find_by_certname certname\n @host ||= resource_base.find_by_name certname\n not_found and return unless @host\n\n begin\n respond_to do |format|\n format.html { render :text => \"<pre>#{@host.info.to_yaml}</pre>\" }\n format.yml { render :text => @host.info.to_yaml }\n end\n rescue\n # failed\n logger.warn \"Failed to generate external nodes for #{@host} with #{$!}\"\n render :text => _('Unable to generate output, Check log files\\n'), :status => 412 and return\n end\n end", "def 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 hosts\n `#{cmk} --list-hosts`.split(/\\n/).sort\n end", "def get_all_hosts()\n results = @zabbix.host.get({\"output\" => [\"name\"], \"sortfield\" => \"name\",})\n host_names = []\n results.each { |result| host_names << result['name'] }\n return host_names\n end", "def list_hosts(domain, compact_list_optional)\n validate_list([[\"Domain\", domain, :domain_format]])\n options = {\"Domain\" => domain}\n optional_fields = [ [\"compact_list_optional\", compact_list_optional] ]\n options = set_optional_fields(optional_fields, options)\n\n connection = Connection.new\n connection.post(\"Domain/Host/List\", options)\n end", "def list_hosts(folder = '')\n rows = JSON.parse(http_request(@uri + '/view.py', {\n wato_folder: folder,\n\tsearch: 'Search',\n\tfilled_in: 'filter',\n\thost_address_prefix: 'yes',\n\tview_name: 'searchhost',\n\toutput_format: 'json',\n\t}))\n rows.shift # skip the header\n rows.map { |r| r[1] }\n end", "def index\n @host_addresses = HostAddress.all\n end", "def get_foreman_hosts(per_page = 10000)\n curl = setup_curl(\"#{@foreman_url}/api/hosts?per_page=#{per_page}\", true)\n curl.perform\n servers_junk = JSON.parse(curl.body_str)\n servers_array = []\n servers_junk.each { |server| servers_array << server['host']['name'] }\n @foreman_hosts = servers_array\n end", "def index\n @page = params[:page].nil? ? 1 : params[:page].to_i\n @page_max = Host.count / PAGE_SIZE\n @all_hosts = Host.order('name ASC')\n @count = @all_hosts.count\n @hosts = @all_hosts.offset((@page - 1) * PAGE_SIZE).limit(PAGE_SIZE)\n\n respond_to do |format|\n format.html\n format.json { render json: @all_hosts.to_json }\n end\n end", "def api_v11_hosts_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_hosts_get ...\"\n end\n \n # resource path\n path = \"/api/v11/hosts\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'view'] = opts[:'view'] if opts[:'view']\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_hosts_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def report_hosts(report_id)\r\n\t\tpost= { \"token\" => @token, \"report\" => report_id } \r\n\t\tdocxml=nessus_request('report/hosts', post)\r\n\t\tlist = Array.new\r\n\t\tdocxml.root.elements['contents'].elements['hostList'].each_element('//host') { |host| \r\n\t\t\tlist.push host.elements['hostname'].text\r\n\t\t}\r\n\t\treturn list\r\n\tend", "def hosts\n @hosts.values\n end", "def index\n @hostnames = current_user.hostnames.all\n end", "def list\n unless hosts.empty?\n format hosts\n else\n \"No custom hosts found.\\nYou can add some using:\\n\\thoust add [alias] [address]\\n\"\n end\n end", "def hosts\n # prevent original array from being changed\n @hosts.dup\n end", "def get_all(source=nil)\n extra_params = {}\n if source\n extra_params['source'] = source\n end\n\n request(Net::HTTP::Get, '/api/' + API_VERSION + '/tags/hosts', extra_params, nil, false)\n end", "def get_virtualization_host_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VirtualizationApi.get_virtualization_host_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/virtualization/Hosts'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'VirtualizationHostResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VirtualizationApi.get_virtualization_host_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VirtualizationApi#get_virtualization_host_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def available_hosts\n @available_hosts ||= []\n end", "def index\n @hosts = Host.find(:all, :order => 'name ASC')\n\n respond_to do |format|\n format.html # index.rhtml\n format.xml { render :xml => @hosts.to_xml }\n end\n end", "def get_host_by_hostname(hostname, collector)\n host = nil\n if collector\n hosts_json = rpc(\"getHosts\", {\"hostGroupId\" => 1})\n hosts_resp = JSON.parse(hosts_json)\n# p hosts_resp\n collector_resp = JSON.parse(rpc(\"getAgents\", {}))\n if hosts_resp[\"status\"] == 200\n hosts_resp[\"data\"][\"hosts\"].each do |h|\n if h[\"hostName\"].eql?(hostname)\n # puts(\"Found host with matching hostname: #{resource[:hostname]}\")\n # puts(\"Checking agent match\")\n if collector_resp[\"status\"] == 200\n collector_resp[\"data\"].each do |c|\n if c[\"description\"].eql?(collector)\n host = h\n end\n end\n else\n puts(\"Unable to retrieve collector list from server\")\n end\n end\n end\n else\n puts(\"Unable to retrieve host list from server\" )\n end\n end\n host\nend", "def hosts\n @job = Job.find(params[:id])\n host_array = []\n @job.nodes.each do |node|\n host_array << \"#{node.private_dns_name} #{node.private_dns_name.split('.')[0]}\"\n end\n send_data host_array.join(\"\\n\"), :type => 'text/html; charset=utf-8'\n end", "def get_vcenter_hosts(vcenter_id=nil, auth=nil, cert=nil)\n check_vcenter(vcenter_id)\n rest_get(\"#{@base_url}/compute/vcenters/#{vcenter_id}/hosts\", auth.nil? ? @auth_token : auth, cert.nil? ? @verify_cert : cert)\n end", "def build_hosts_list(env_vms)\n\n int_id = 10\n\n first = true\n env_vms.each do |vm, vmconfig|\n vmconfig[\"networks\"].each do |name, netcfg|\n if netcfg[\"type\"] == \"private\" then\n if netcfg['ip'].nil? then\n netcfg['ip'] = \"192.168.50.\" + int_id.to_s\n #add the default IP to the environment definnition\n env_vms[vm][\"networks\"][name][\"ip\"] = \"192.168.50.\" + int_id.to_s\n int_id += 1\n end\n if first then\n $base_vars = \"vms_hosts={\"\n $base_vars << \"\\\"#{netcfg['ip']}\\\":\\\"#{vm}\\\"\"\n first = false\n elsif\n $base_vars << \",\\\"#{netcfg['ip']}\\\":\\\"#{vm}\\\"\"\n end\n end\n end if vmconfig[\"networks\"]\n end\n $base_vars << \"}\" if $base_vars\nend", "def parse_hosts (args)\n\n discoveryrc = File.expand_path(\"~/.discoveryrc\")\n aliasmap = {}\n if File.readable?(discoveryrc)\n File.readlines(discoveryrc).each {|line| line.scan(/(\\w+)\\s*=\\s*(.*)/) {|k,v| aliasmap[k]=v}}\n end\n\n if args.size == 0 || args[0] =~ /^-/\n @hosts = aliasmap[\"localhost\"].nil? ? [\"http://localhost:8080\"] : aliasmap[\"localhost\"]\n else\n hostname = args.shift()\n @hosts = (aliasmap[hostname] || hostname).split(',').map() {|host| host.strip()};\n end\n \n return @hosts\n end", "def index\n @hosts = Host.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @hosts }\n end\n end", "def stub_hosts(ip_spec)\n stub_hosts_on(default, ip_spec)\n end", "def parse_host\n args = ENV['host'].split(',')\n hosts = []\n args.each do |arg|\n if XP5K::Role.listnames.include? arg\n hosts << roles(arg)\n else\n hosts << arg\n end\n end\n hosts.flatten\nend", "def transform_hosts(hosts)\n require 'time'\n\n node_data = []\n\n hosts.each do |host|\n if host[:report_timestamp].nil?\n # This can happen in weird cases. Mark as an expired node, so\n # the expired logic doesn't try to do math on a nil timestamp.\n last_checkin = nil\n formatted_checkin = 'N/A'\n host[:expired] = nil\n else\n last_checkin = Time.now - Time.parse(host[:report_timestamp])\n formatted_checkin = sprintf(\"%#{@options.round_to}f\",(last_checkin * @options.divisor).abs)\n end\n node_data << {\n :last_checkin => last_checkin,\n :expired => host[:expired].nil? ? false : host[:expired],\n :certname => host[:certname],\n :environment => host[:report_environment].nil? ? 'N/A' : host[:report_environment],\n :status => host[:latest_report_status].nil? ? 'N/A' : host[:latest_report_status],\n :formatted_checkin => formatted_checkin\n }\n end\n\n unless @options.environments.empty?\n node_data.delete_if {|node| not @options.environments.include? node[:environment] }\n end\n unless @options.statuses.empty?\n node_data.delete_if {|node| not @options.statuses.include? node[:status] }\n end\n\n node_data\n end", "def hosts\n h = []\n r = ('a'..'z')\n r.each do |i|\n r.each do |j|\n r.each do |k|\n h << i.to_s + j + k + \".com\"\n end\n end\n end\n h\n end", "def get_virtualization_vmware_host_list_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: VirtualizationApi.get_virtualization_vmware_host_list ...'\n end\n allowable_values = [\"allpages\", \"none\"]\n if @api_client.config.client_side_validation && opts[:'inlinecount'] && !allowable_values.include?(opts[:'inlinecount'])\n fail ArgumentError, \"invalid value for \\\"inlinecount\\\", must be one of #{allowable_values}\"\n end\n # resource path\n local_var_path = '/api/v1/virtualization/VmwareHosts'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'$filter'] = opts[:'filter'] if !opts[:'filter'].nil?\n query_params[:'$orderby'] = opts[:'orderby'] if !opts[:'orderby'].nil?\n query_params[:'$top'] = opts[:'top'] if !opts[:'top'].nil?\n query_params[:'$skip'] = opts[:'skip'] if !opts[:'skip'].nil?\n query_params[:'$select'] = opts[:'select'] if !opts[:'select'].nil?\n query_params[:'$expand'] = opts[:'expand'] if !opts[:'expand'].nil?\n query_params[:'$apply'] = opts[:'apply'] if !opts[:'apply'].nil?\n query_params[:'$count'] = opts[:'count'] if !opts[:'count'].nil?\n query_params[:'$inlinecount'] = opts[:'inlinecount'] if !opts[:'inlinecount'].nil?\n query_params[:'at'] = opts[:'at'] if !opts[:'at'].nil?\n query_params[:'tags'] = opts[:'tags'] if !opts[:'tags'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json', 'text/csv', 'application/vnd.openxmlformats-officedocument.spreadsheetml.sheet'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'VirtualizationVmwareHostResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"VirtualizationApi.get_virtualization_vmware_host_list\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VirtualizationApi#get_virtualization_vmware_host_list\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def hosts\n\t\tHost.find(:all)\n\tend", "def list_host_tags_with_http_info(opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: TagsAPI.list_host_tags ...'\n end\n # resource path\n local_var_path = '/api/v1/tags/hosts'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'source'] = opts[:'source'] if !opts[:'source'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'TagToHosts'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :list_host_tags,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: TagsAPI#list_host_tags\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def collectHosts(rf, db)\n\trf.childEntity.grep(RbVmomi::VIM::Datacenter).each do |dc|\n\t\tprogressbar = ProgressBar.create(:title => \"Hosts\", :format => '%t |%b>>%i| %p%% %a')\n\t\tprogressbar.total = counter(dc, \"h\")\n\t\tdc.hostFolder.childEntity.each do |cluster|\n\t\t\tcluster.host.each do |host|\n\t\t\t\tdb.select(2)\n\t\t\t\tdb.hset(\"#{host.name}\", \"Status\", \"#{host.summary.overallStatus}\")\n\t\t\t\tdb.hset(\"#{host.name}\", \"PowerStatus\", \"#{host.summary.runtime.powerState}\")\n\t\t\t\tdb.hset(\"#{host.name}\", \"Connection\", \"#{host.summary.runtime.connectionState}\")\n\t\t\t\tdb.hset(\"#{host.name}\", \"OverallCpu\", \"#{host.summary.quickStats.overallCpuUsage}\")\n\t\t\t\tdb.hset(\"#{host.name}\", \"OverallMem\", \"#{host.summary.quickStats.overallMemoryUsage}\") \n\t\t\t\t#db.hset(\"#{host.name}\", \"SystemSensor\", \"#{host.summary.runtime.healthSystemRuntime.systemHealthInfo.numericSensorInfo.name}\")\n\t\t\t\tprogressbar.increment\n\t\t\tend\n\t\tend\n\tend\nend", "def index\n @event_hosts = EventHost.where(event_id: @event.id)\n end", "def return_abs_resource_hosts(abs_resource_hosts)\n returned_hosts = []\n puts \"ABS hosts specified for return: #{abs_resource_hosts}\"\n\n is_valid = valid_abs_resource_hosts?(abs_resource_hosts)\n unless is_valid\n puts \"De-provisioning via awsdirectreturn requires an array of hostnames to be specified\"\n puts \"Specify hostnames via the ABS_RESOURCE_HOSTS environment variable\"\n puts \"Or specify via the last_abs_resource_hosts.log file\"\n puts\n end\n\n has_token = abs_initialize\n unless has_token\n puts \"Unable to proceed without a valid ABS token\"\n puts\n end\n\n if is_valid && has_token\n uri = URI(\"#{@abs_base_url}/awsdirectreturn\")\n hosts = JSON.parse(abs_resource_hosts)\n hosts.each do |host|\n hostname = host[\"hostname\"]\n\n puts \"Returning host: #{hostname}\"\n body = get_awsdirectreturn_request_body(hostname)\n res = perform_awsdirect_request(uri, body)\n\n if valid_abs_response?(res)\n puts \"Successfully returned host: #{hostname}\"\n returned_hosts << host\n else\n puts \"Failed to return host: #{hostname}\"\n end\n end\n\n end\n\n returned_hosts.to_json\n end", "def api_v11_hosts_get(opts = {})\n api_v11_hosts_get_with_http_info(opts)\n return nil\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 hosts(wspace = workspace, only_up = false, addresses = nil)\n\t\tconditions = {}\n\t\tconditions[:state] = [Msf::HostState::Alive, Msf::HostState::Unknown] if only_up\n\t\tconditions[:address] = addresses if addresses\n\t\twspace.hosts.all(:conditions => conditions, :order => :address)\n\tend", "def hosts(key)\n unless @@vendors[key].nil?\n @@vendors[key][:hosts].collect { |id| @@hosts[id] }\n else\n []\n end\n end", "def get_usage_network_hosts_with_http_info(start_hr, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_usage_network_hosts ...'\n end\n # verify the required parameter 'start_hr' is set\n if @api_client.config.client_side_validation && start_hr.nil?\n fail ArgumentError, \"Missing the required parameter 'start_hr' when calling UsageMeteringAPI.get_usage_network_hosts\"\n end\n # resource path\n local_var_path = '/api/v1/usage/network_hosts'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'start_hr'] = start_hr\n query_params[:'end_hr'] = opts[:'end_hr'] if !opts[:'end_hr'].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;datetime-format=rfc3339'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'UsageNetworkHostsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :get_usage_network_hosts,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsageMeteringAPI#get_usage_network_hosts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def servers\n endpoint = 'https://pcs.baidu.com/rest/2.0/pcs/manage?method=listhost'\n @res = @api.request_json( endpoint )\n end", "def hosts(touchAndPrune=false)\n hosts=@vp_lock.synchronize{@hostname2vp.keys}\n if touchAndPrune\n check_up_hosts(hosts)\n else\n hosts\n end\n end", "def find_hosts( fqdn, zone_id = nil)\n if zone_id.nil?\n #look for matching host across all zones\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::FindHosts.new,\n :path => \"/api/1.1/hosts.xml?fqdn=#{fqdn}\"\n )\n else\n #look for hosts in a specific zone\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::FindHosts.new,\n :path => \"/api/1.1/zones/#{zone_id}/hosts.xml?fqdn=#{fqdn}\"\n )\n end\n end", "def hosts\n @hosts ||= begin\n r, h, u = [], (config[:hosts] rescue nil), (config[:user] rescue nil)\n h.each {|host| r << Host.new(host, u) } if h && u; r\n end\n end", "def hosts(filter = {})\n paged_response(raw_hosts.index(filter).first)\n end", "def all_server_hosts\n [server_host]\n end", "def deploy(_)\n OneProvisionLogger.info('(Deploy skipped)')\n\n [@hosts.map do |h|\n h.to_hash['HOST']['TEMPLATE']['PROVISION']['HOSTNAME']\n end,\n nil,\n nil]\n end", "def hosts\n @hosts ||= Array(Hansolo.target).map { |target| URI.parse(target) }\n end", "def print_known_hosts\n\t\tputs \"\\nSummary of local hosts Table:\"\n\t\tputs \"Total entries: #{@known_hosts.size}\"\n\t\t(@known_hosts.keys.sort-[\"\",nil]).each do |key|\n\t\t\tvalue=@known_hosts[key]\n\t\t\tputs \"#{key}\\t#{value}\" if is_fqdn?(key)\n\t\tend\n\t\tputs \"End of the summary\"\n\tend", "def index\n if params[:data_source_id].nil?\n @hosts = Host.all.paginate(page: params[:page], per_page: 10)\n else\n @data_source = DataSource.find(params[:data_source_id])\n if params[:search].present?\n @hosts = @data_source.hosts.where('ip ILIKE ? OR fqdn ILIKE ? OR netbios_name ILIKE ?',\n \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\").paginate(page: params[:page], per_page: 10)\n else\n @hosts = @data_source.hosts.paginate(page: params[:page], per_page: 10)\n end\n end\n\n # if params[:search]\n # @affected_hosts = AffectedHost.where(source_file_id: @project_group.source_file_ids).where(\n # 'host_ip ILIKE ? OR host_fqdn ILIKE ? OR netbios_name ILIKE ?', \"%#{params[:search]}%\", \"%#{params[:search]}%\", \"%#{params[:search]}%\"\n # ).paginate(page: params[:page], per_page: 10)\n # else\n # @affected_hosts = AffectedHost.where(source_file_id: @project_group.source_file_ids).paginate(page: params[:page], per_page: 10)\n # end\n end", "def get_xpn_host request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/getXpnHost\"\n\n response = @client_stub.make_get_request(\n uri: uri,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Project.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def add_hosts(_)\n deploy(nil)\n end", "def visit_hosts\n @host_rules.accept\n end", "def get_virtualization_host_list(opts = {})\n data, _status_code, _headers = get_virtualization_host_list_with_http_info(opts)\n data\n end", "def hosts(args = nil)\n if args and args[:server]\n args[:server].split(';').collect { |server| $hosts[server] ||\n Config.warn_fail(\"#{server} is not a known host\") }\n else\n $hosts.values\n end\nend", "def dns_check\n gen_host_records # These are the hosts we have\n load_all_subnets # These are the DNS entries\n \n # We want a standard layout, with the hypervisor API entries being \n @host_record.each do |hr| # Array of host record Hash's\n hn = hr[:hostname]\n shn = hn.split('.',2)[0] # Remove the domain\n forward_hr = @forward_host_record[hn] # Find Host Record\n if forward_hr.nil?\n # We have no IPAM entry for this hostname\n if (rhr = @reverse_host_records[hr[:ip]])\n puts \"Only Reverse IPAM entry for #{shn}: #{rhr}\"\n @infoblox.create_host_record(ip_address: hr[:ip], hostname: hn, aliases: hr[:aliases])\n else\n puts \"No IPAM entry for hostrecord: #{hr}\"\n @infoblox.create_host_record(ip_address: hr[:ip], hostname: hn, aliases: hr[:aliases])\n end\n else\n # We have an IPAM record for this hostname\n if forward_hr[:ip] != hr[:ip]\n puts \"IP mismatch #{shn} #{hr[:ip]} != #{forward_hr[:ip]} for IPAM: #{forward_hr}\"\n elsif forward_hr[:hostname] != hn\n # Reference must be via ALIASES or CNAMES\n if forward_hr[:aliases].include?(shn)\n puts \"Hostname #{shn} is an ALIAS. IPAM: #{forward_hr}\"\n elsif forward_hr[:cnames].include?(hn)\n puts \"Hostname #{shn} is a CNAME. IPAM: #{forward_hr}\"\n end\n end\n end\n end\n \n # We want to find IPAM entries, not matching existing @host_record entries\n @reverse_host_records.each do |ip, ahr| # Hash to array of host records from IPAM, indexed by IP\n ahr.each do |hr| # One IP can have multiple host records, with associated ALIAS and CNAME records\n local_hr = @host_record_index[hr[:hostname]]\n if local_hr.nil?\n puts \"No local entry #{hr[:hostname]} for #{hr}\"\n end\n end\n end\nend", "def api_v11_cm_all_hosts_config_get_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: DefaultApi#api_v11_cm_all_hosts_config_get ...\"\n end\n \n # resource path\n path = \"/api/v11/cm/allHosts/config\".sub('{format}','json')\n\n # query parameters\n query_params = {}\n query_params[:'view'] = opts[:'view'] if opts[:'view']\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_cm_all_hosts_config_get\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def format_hosts\n all_hosts(@config).inject('') do |str, (address, aliases)|\n str << \"#{address} #{aliases.join(' ')}\\n\"\n end\n end", "def format_hosts\n all_hosts(@config).inject('') do |str, (address, aliases)|\n str << \"#{address} #{aliases.join(' ')}\\n\"\n end\n end", "def get_usage_hosts_with_http_info(start_hr, opts = {})\n\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsageMeteringAPI.get_usage_hosts ...'\n end\n # verify the required parameter 'start_hr' is set\n if @api_client.config.client_side_validation && start_hr.nil?\n fail ArgumentError, \"Missing the required parameter 'start_hr' when calling UsageMeteringAPI.get_usage_hosts\"\n end\n # resource path\n local_var_path = '/api/v1/usage/hosts'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'start_hr'] = start_hr\n query_params[:'end_hr'] = opts[:'end_hr'] if !opts[:'end_hr'].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;datetime-format=rfc3339'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'UsageHostsResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || [:apiKeyAuth, :appKeyAuth, :AuthZ]\n\n new_options = opts.merge(\n :operation => :get_usage_hosts,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type,\n :api_version => \"V1\"\n )\n\n data, status_code, headers = @api_client.call_api(Net::HTTP::Get, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsageMeteringAPI#get_usage_hosts\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def report_hosts(report_id)\n\t\t\tpost= { \"token\" => @token, \"report\" => report_id }\n\t\t\tdocxml = nil\n\t\t\tdocxml=nessus_request('report/hosts', post)\n\t\t\tif docxml.nil?\n\t\t\t\treturn\n\t\t\tend\n\t\t\thosts=Array.new\n\t\t\tdocxml.elements.each('/reply/contents/hostList/host') do |host|\n\t\t\t\tentry=Hash.new\n\t\t\t\tentry['hostname'] = host.elements['hostname'].text if host.elements['hostname']\n\t\t\t\tentry['severity'] = host.elements['severity'].text if host.elements['severity']\n\t\t\t\tsevs=Array.new\n\t\t\t\thost.elements.each('severityCount/item') do |item|\n\t\t\t\t\tsevs.push item.elements['count'].text if item.elements['count']\n\t\t\t\tend\n\t\t\t\tentry['sev0'] = sevs[0] if sevs[0]\n\t\t\t\tentry['sev1'] = sevs[1] if sevs[1]\n\t\t\t\tentry['sev2'] = sevs[2] if sevs[2]\n\t\t\t\tentry['sev3'] = sevs[3] if sevs[3]\n\t\t\t\tentry['current'] = host.elements['scanProgressCurrent'].text if host.elements['scanProgressCurrent']\n\t\t\t\tentry['total'] = host.elements['scanProgressTotal'].text if host.elements['scanProgressTotal']\n\t\t\t\thosts.push(entry)\n\t\t\tend\n\t\t\treturn hosts\n\t\tend", "def query_files_hosts(hostlist, hosts)\n report_dir = get_report_dir\n\n existing_nodes = hostlist.map{|x| x[:certname]}\n\n local_host_template = {\n :deactivated=>false,\n :latest_report_hash=>nil,\n :facts_environment=>nil,\n :cached_catalog_status=>\"not_used\",\n :report_environment=>nil,\n :latest_report_corrective_change=>nil,\n :catalog_environment=>nil,\n :facts_timestamp=>nil,\n :latest_report_noop=>nil,\n :expired=>false,\n :latest_report_noop_pending=>nil,\n :report_timestamp=>nil,\n :certname=>nil,\n :catalog_timestamp=>nil,\n :latest_report_job_id=>nil,\n :latest_report_status=>nil\n }.freeze\n\n local_host_reports = []\n\n if File.directory?(report_dir)\n @logger.debug(\"Processing Report Directory: #{report_dir}\")\n\n Dir.glob(\"#{report_dir}/*\").each do |node_dir|\n @logger.debug(\"Processing Node Directory: #{node_dir}\")\n\n latest_report = Dir.glob(\"#{node_dir}/*.yaml\").sort.last\n if latest_report\n @logger.debug(\"Processing YAML Report: #{latest_report}\")\n\n begin\n require 'puppet'\n\n transaction_report = YAML.load_file(latest_report)\n\n unless (hosts.empty? || hosts.include?(transaction_report.host))\n @logger.debug(\"Skipping #{transaction_report.host} since it is not in the host list\")\n next\n end\n\n if existing_nodes.include?(transaction_report.host)\n @logger.debug(\"Skipping #{transaction_report.host} since it already exists\")\n next\n end\n\n local_host_data = Marshal.load(Marshal.dump(local_host_template))\n local_host_data[:latest_report_hash] = transaction_report.catalog_uuid\n local_host_data[:facts_environment] = transaction_report.environment\n local_host_data[:report_environment] = transaction_report.environment\n local_host_data[:latest_report_corrective_change] = transaction_report.corrective_change\n local_host_data[:catalog_environment] = transaction_report.environment\n local_host_data[:facts_timestamp] = transaction_report.time.to_s\n local_host_data[:latest_report_noop] = transaction_report.noop\n local_host_data[:latest_report_noop_pending] = transaction_report.noop_pending\n local_host_data[:report_timestamp] = transaction_report.time.to_s\n local_host_data[:certname] = transaction_report.host\n local_host_data[:catalog_timestamp] = transaction_report.time.to_s\n local_host_data[:latest_report_job_id] = transaction_report.catalog_uuid\n local_host_data[:latest_report_status] = transaction_report.status\n\n hostlist << local_host_data\n\n @logger.debug(\"Processed Host Report: #{local_host_data}\")\n rescue => e\n @logger.warn \"Error processing report at '#{latest_report}': #{e}\"\n end\n else\n @logger.debug \"Could not find latest report in '#{node_dir}'\"\n end\n end\n else\n @logger.debug \"Could not find report directory at '#{report_dir}'\"\n end\n end", "def index\n @host_executions = HostExecution.all\n end", "def find_hosts!(host_spec)\n if self.groups[host_spec]\n return self.groups[host_spec].host_list.map { |m| self.hosts[m] }\n elsif self.hosts[host_spec]\n return [self.hosts[host_spec]]\n else\n say \"No inventory matching: '#{host_spec}' found. \"\n say ([\"Available hosts:\"] + self.hosts.keys).join(\"\\n\\t\")\n say ([\"Available groups:\"] + self.groups.keys).join(\"\\n\\t\")\n exit\n end\n end", "def monitor_hosts_and_vms\n totalmemory = 0\n totalcpu = 0\n\n host_info = \"HYPERVISOR=opennebula\\n\"\n host_info << \"PUBLIC_CLOUD=YES\\n\"\n host_info << \"PRIORITY=-1\\n\"\n host_info << \"CPUSPEED=1000\\n\"\n host_info << \"HOSTNAME=\\\"#{@host['hostname']}\\\"\\n\"\n case @host['host_mon']['type']\n when 'fixed'\n host_info << \"TOTALMEMORY=#{@host['host_mon']['memory']}\\n\"\n host_info << \"TOTALCPU=#{@host['host_mon']['cpu']}\\n\"\n when 'instance_based'\n @host['capacity'].each { |name, size|\n cpu, mem = instance_type_capacity(name)\n totalmemory += mem * size.to_i\n totalcpu += cpu * size.to_i\n }\n host_info << \"TOTALMEMORY=#{totalmemory.round}\\n\"\n host_info << \"TOTALCPU=#{totalcpu}\\n\"\n when 'dynamic'\n host_info << get_remote_quotas\n end\n\n usedcpu = 0\n usedmemory = 0\n\n vms_info = get_all_vms_poll_info\n puts host_info\n puts vms_info\n end", "def host_list( query=nil, username=nil, prefer_ip=nil )\n file = Tempfile.new('ck')\n\n client.get('nodes', query).each do |node|\n target = prefer_ip ? node.ipaddress : node.name \n file.puts sprintf \"%s %s\", target, username\n end\n\n file.flush\n \n return file\n end", "def full_host_record(ip:)\n load_cnames\n \n @forward_host_record ||= {} # Global, as we want to do name lookups.\n return_record = []\n unless( (host_records = @infoblox.get_host_by_ip(ip_address: ip)).nil? )\n host_records.each do |hosts|\n hosts.each do |hn|\n # Assign an empty record, if we haven't seen this host before\n @forward_host_record[hn] ||= { hostname: hn, ip: '', aliases: [], cnames: [] }\n \n # Record the IP. There may be multiple IPs with one hostname.\n @forward_host_record[hn][:ip] = ip\n \n # The hostname might have CNAMES point to it\n unless @reverse_cnames[hn].nil?\n @reverse_cnames[hn].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n \n # The hostname may have alternate hostname A records, stored in IPAM as ALIASES\n @infoblox.get_alias(hostname: hn) do |a| \n short_alias = a.split('.',2)[0]\n @forward_host_record[hn][:aliases] << short_alias\n \n # The ALIASes might have CNAME records pointing to it\n unless @reverse_cnames[a].nil?\n # Record the ALIAS CNAMES against the parent hostname.\n @reverse_cnames[a].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n end\n return_record << @forward_host_record[hn]\n \n # Add forward lookup entries for each ALIAS\n host_domain = hn.split('.',2)[1]\n @forward_host_record[hn][:aliases].each do |a|\n @forward_host_record[\"#{a}.#{host_domain}\"] = @forward_host_record[hn]\n end\n \n # Add forward lookup entries for each CNAME\n @forward_host_record[hn][:cnames].each do |cn|\n @forward_host_record[cn] = @forward_host_record[hn]\n end\n \n end\n end\n end\n return return_record\nend", "def ip_list\n\t\t\t\t\tips = Array.new\n\t\t\t\t\thosts = Host.where(\"ip is not NULL\").order(\"ip\").to_a\n\n\t\t\t\t\thosts.each do |host|\n\t\t\t\t\t\tips << host.ip if host.ip != nil\n\t\t\t\t\tend\n\n\t\t\t\t\tips.join(\"\\n\")\n\t\t\t\tend", "def hosts\n Put.warn \"\\nStarted configuring ansible hosts.......\\n\"\n @ansible.groups.each do |group|\n Put.info \"Adding group [#{group['name']}]\"\n\n response = Rest::SubutaiConsole.command(\"echo [#{group['name']}] >> /etc/ansible/hosts\", @environment.ansible_host_id, \"/root\",\"1000\", @url, @token)\n status(response)\n\n group['hostnames'].each do |hostname|\n container = find(hostname)\n Put.info \"Adding hosts #{container.containerName} to group [#{group['name']}]\"\n\n if group.key?('python-interpreter')\n response = Rest::SubutaiConsole.command(\"echo \\\"#{container.containerName} ansible_user=root template=#{hostname} ansible_ssh_host=#{container.ip} ansible_python_interpreter=#{group['python-interpreter']}\\\" >> /etc/ansible/hosts\",\n @environment.ansible_host_id,\n \"/root\",\n \"360000\",\n @url, @token)\n status(response)\n else\n response = Rest::SubutaiConsole.command(\"echo \\\"#{container.containerName} ansible_user=root template=#{hostname} ansible_ssh_host=#{container.ip}\\\" >> /etc/ansible/hosts\",\n @environment.ansible_host_id,\n \"/root\",\"360000\",\n @url, @token)\n status(response)\n end\n end\n end\n end", "def get_results(in_progress)\nhostname2pid = {}\nin_progress.each { |pid, hostname|\n hostname2pid[hostname] = pid\n}\nissue_command_on_hosts(hostname2pid, 30){ |vp, pid| vp.get_results(pid) }\nend", "def server_hosts\n return [:default] if @resource[:server_hosts] &&\n @resource[:server_hosts][0] == :default &&\n @property_hash[:server_hosts] ==\n @aaa_group.default_servers\n @property_hash[:server_hosts]\n end", "def format_hosts\n all_hosts.inject('') do |str, (address, aliases)|\n str << \"#{address} #{aliases.join(' ')}\\n\"\n end\n end", "def bad_hosts\n bad_hosts.collect {|r| r.host }\n end", "def index\n included = default_to_array(params[:included])\n excluded = default_to_array(params[:excluded])\n records = Record.custom_filter(included, excluded)\n related_hostnames = Hostname\n .filter_related_hostnames(included, excluded)\n .map{ |h| h.address }\n .tally\n\n render json: {\n total_records: records.length,\n records: records.map { |r| { id: r.id, ip_address: r.ip } },\n related_hostnames: related_hostnames.map { |h, c| { hostname: h, count: c } }\n }\n end", "def reload_hosts\n send_simple_request('reload hosts', {}) { |response| response['msg'] }\n end", "def hosts\n @hosts ||= match[5].split(\",\")\n end", "def get_hosts\n\t\t#all_hosts={}\n\t\t#config=self.load_config\n\t\t#config['hosts'].each do |section|\n\t\t#\tsection.each do |host_section, host_values|\n\t\t#\t\thost_values.each do |host|\n\t\t#\t\t\tall_hosts[host['title']] = host['sshparams'] unless host['sshparams'].nil?\n\t\t#\t\tend\n\t\t#\tend\n\t\t#end\n\t\t#return all_hosts\n all_hosts={}\n config=self.load_config\n\t\tbegin \n config['hosts'].each do |section|\n section.each do |host_section, host_values|\n all_hosts[host_section] = host_values unless host_section.nil?\n end\n end\n\t\trescue Exception => e\n\t\t\tputs \"Your hosts.yml file is empty?: #{e}\"\n\t\t\texit\n\t\tend\n return all_hosts\n\tend", "def hosts\n @hosts ||= match[5].split(\",\")\n end", "def get_host(fqdn)\n foreman('GET', \"/api/hosts/#{fqdn}\")\n end", "def hosts\n (self.web_hosts.to_a + self.db_hosts.to_a + self.balance_hosts.to_a + self.app_hosts.to_a).uniq.sort\n end", "def get_usage_hosts(start_hr, opts = {})\n data, _status_code, _headers = get_usage_hosts_with_http_info(start_hr, opts)\n data\n end", "def list\n cf_get(path: \"#{uri_prefix}/virtual_dns\")\n end", "def get_virtualization_vmware_host_list(opts = {})\n data, _status_code, _headers = get_virtualization_vmware_host_list_with_http_info(opts)\n data\n end", "def check_up_hosts(hostlisthash, settings={ :retry => true, :maxalert => NO_EMAIL, :timeout => 30})\n if hostlisthash.class==Array\n hostlisthash=hostlisthash.to_h(true)\n end\n if not settings.include?(:timeout)\n settings[:timeout]=30\n end\n if not settings.include?(:retry)\n settings[:retry]=true\n end\n if not settings.include?(:maxalert)\n settings[:maxalert]=NO_EMAIL\n end\n results, unsuccessful_hosts=issue_command_on_hosts(hostlisthash,settings){|h,p| h.backtic(\"hostname --fqdn\").chomp(\"\\n\").strip.downcase}\n uphosts=[]\n results.each{|vp|\n uphosts << ($rename_vp.has_key?(vp.at(0)) ? $rename_vp[vp.at(0)] : vp.at(0))\n if vp.at(0) != vp.at(1)\n log { \"check_up_hosts(): vp.at(0) != vp.at(1): #{vp.join(\" \")}\" }\n end\n }\n # if prune\n # unsuccessful_hosts.each{|h|\n # self.unregister_host(h)\n # }\n # end\n return uphosts\n end", "def index\n @host_orgs = HostOrg.all\n end", "def hosts_entry\n \"#{@ip} #{name}\"\n end" ]
[ "0.74857867", "0.723118", "0.6974196", "0.6974196", "0.6974196", "0.67777866", "0.67777866", "0.671636", "0.66991603", "0.6595991", "0.6574017", "0.64809173", "0.6470523", "0.6466958", "0.6465235", "0.64368975", "0.64307463", "0.64129657", "0.63699335", "0.6310194", "0.6297351", "0.6271011", "0.6263994", "0.62407774", "0.623117", "0.62304324", "0.6200071", "0.61863923", "0.61843467", "0.61411446", "0.6105205", "0.6081457", "0.6077756", "0.60737985", "0.6069108", "0.60682076", "0.60637707", "0.6058589", "0.6052481", "0.60497725", "0.6036866", "0.6014277", "0.60129786", "0.5997629", "0.59874874", "0.59625584", "0.5923905", "0.5921688", "0.59107083", "0.5904215", "0.59038687", "0.5894982", "0.58941436", "0.5838228", "0.58351254", "0.5833044", "0.58278394", "0.57896733", "0.5785422", "0.5783751", "0.57734627", "0.5763908", "0.57543015", "0.5751628", "0.57472014", "0.573111", "0.5729978", "0.57249165", "0.5723588", "0.5710746", "0.5692612", "0.56917685", "0.56917685", "0.56912214", "0.568869", "0.5686385", "0.5679938", "0.56790453", "0.5678156", "0.5678107", "0.5673819", "0.5672107", "0.5670009", "0.5667987", "0.56499165", "0.5649448", "0.5645079", "0.5643915", "0.56283456", "0.562826", "0.5625586", "0.5619283", "0.56141657", "0.5590658", "0.55850327", "0.55817807", "0.5569096", "0.55687904", "0.5557086", "0.5552043" ]
0.7576346
0
Baseline implementation for the move_disk REST call
def move_disk request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_move_disk_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_disk request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/moveDisk\"\n body = request_pb.disk_move_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def move_disk(from,to)\n @towers[to] << @towers[from][-1]\n @towers[from].pop\n nil\nend", "def move(*args)\n \t# Sending destination path\n \tputs \"MOVING\"\n \tmove_entity(*args[0].public_path)\n \tsuper\n end", "def http_move(request, response)\n path = request.path\n\n move_info = @server.copy_and_move_info(request)\n\n if move_info['destinationExists']\n return false unless @server.emit('beforeUnbind', [move_info['destination']])\n end\n\n return false unless @server.emit('beforeUnbind', [path])\n return false unless @server.emit('beforeBind', [move_info['destination']])\n return false unless @server.emit('beforeMove', [path, move_info['destination']])\n\n if move_info['destinationExists']\n @server.tree.delete(move_info['destination'])\n @server.emit('afterUnbind', [move_info['destination']])\n end\n\n @server.tree.move(path, move_info['destination'])\n\n # Its important afterMove is called before afterUnbind, because it\n # allows systems to transfer data from one path to another.\n # PropertyStorage uses this. If afterUnbind was first, it would clean\n # up all the properties before it has a chance.\n @server.emit('afterMove', [path, move_info['destination']])\n @server.emit('afterUnbind', [path])\n @server.emit('afterBind', [move_info['destination']])\n\n # If a resource was overwritten we should send a 204, otherwise a 201\n response.update_header('Content-Length', '0')\n response.status = move_info['destinationExists'] ? 204 : 201\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 test_post_move_file\n\n src = 'folder1/FileTest.pdf'\n dest = 'folder3/folder1/FileTest.pdf'\n versionId = nil\n storage = 'First Storage'\n destStorage = 'First Storage'\n request = PostMoveFileRequest.new(src, dest, versionId, storage, destStorage)\n\n result = @storage_api.post_move_file(request)\n assert result.code == 200, 'Error while moving document'\n\n end", "def move; end", "def move; end", "def move_file\n\n end", "def test_post_move_folder()\n\n src = 'folder6'\n dest = 'folder7/folder6'\n storage = 'First Storage'\n dest_storage = 'First Storage'\n request = PostMoveFolderRequest.new(src, dest, storage, dest_storage)\n\n result = @storage_api.post_move_folder(request)\n assert result.code == 200, 'Error while moving folder'\n\n end", "def move\n\n end", "def move\n file = session[:user].x_files.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n raise RequestError.new(:bad_param, \"File not uploaded\") if !file.folder && !file.uploaded\n raise RequestError.new(:bad_param, \"Can not move the root folder\") if file.id == session[:user].root_folder.id\n source = WFolder.get(params[:source])\n raise RequestError.new(:file_not_found, \"Source not found\") unless source\n raise RequestError.new(:bad_param, \"Source is not a folder\") unless source.folder\n raise RequestError.new(:bad_access, \"No access to the source folder\") unless source.users.include? session[:user] \n raise RequestError.new(:bad_param, \"Source does not contain the file\") if source.files.include? file == false && !file.folder\n raise RequestError.new(:bad_param, \"Source does not contain the folder\") if source.childrens.include? file && file.folder\n destination = WFolder.get(params[:destination])\n raise RequestError.new(:file_not_found, \"Destination not found\") unless destination\n raise RequestError.new(:bad_param, \"Destination is not a folder\") unless destination.folder\n raise RequestError.new(:bad_access, \"No access to the destination folder\") unless destination.users.include? session[:user] \n raise RequestError.new(:bad_param, \"Destination and Source are identical\") if source.id == destination.id\n raise RequestError.new(:bad_param, \"Destination and File are identical\") if file.id == destination.id\n raise RequestError.new(:bad_param, \"File and Source are identical\") if source.id == file.id\n\n WFile.move(file, source, destination) unless file.folder\n WFolder.move(file, source, destination) if file.folder\n\n @result = { success: true }\n end", "def move(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.move(src, dest)\n end", "def move(*args, &block)\n args = web_dav_args args\n map_method :move, args, &block\n end", "def move(from, to, aux, disk_count)\n # base case\n if disk_count == 1 # we're only moving one disc\n disk = from.pop\n check_disk_sizes(disk, to.last)\n to.push(disk)\n print_state\n @step_counter += 1\n return\n end\n\n # otherwise we need to do some flippin aorund\n move(from, aux, to, disk_count - 1)\n move(from, to, aux, 1)\n move(aux, to, from, disk_count - 1)\n end", "def move(from_path, to_path, opts = {})\n input_json = {\n from_path: from_path,\n to_path: to_path,\n }\n response = @session.do_rpc_endpoint(\"/#{ @namespace }/move\", input_json)\n Dropbox::API::File.from_json(Dropbox::API::HTTP.parse_rpc_response(response))\n end", "def move(cloud_file, to_path, root=\"auto\")\n payload = {\n root: root,\n from_path: cloud_file.path,\n to_path: to_path\n }\n\n connexion = Dropbox.start(:move, access_token)\n res = connexion.post do |req|\n req.url \"fileops/move\"\n req.body = payload\n end\n\n response = format_response(res)\n #tree_cache(response)\n end", "def move\n \n end", "def move\n \n end", "def move_disks(n, src, dest, remain)\n return if n <= 0\n move_disks n - 1, src, remain, dest\n move_disk src, dest\n move_disks n - 1, remain, dest, src\n end", "def move_entity entity; end", "def post_move(filename,src_repo,data)\n curl_post(\"#{self.host}/api2/repos/#{src_repo}/file/?p=#{filename}\",data).body_str\n end", "def move_folder\n source_dir = Item.new(Path.new(params[:source_dir]))\n dest_dir = Item.new(Path.new(params[:dest_dir]))\n\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.move_to(dest_dir)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end", "def move(*args)\n unless(resource.exist?)\n NotFound\n else\n resource.lock_check if resource.supports_locking? && !args.include?(:copy)\n destination = url_unescape(env['HTTP_DESTINATION'].sub(%r{https?://([^/]+)}, ''))\n dest_host = $1\n if(dest_host && dest_host.gsub(/:\\d{2,5}$/, '') != request.host)\n BadGateway\n elsif(destination == resource.public_path)\n Forbidden\n else\n dest = resource_class.new(destination, clean_path(destination), @request, @response, @options.merge(:user => resource.user))\n status = nil\n if(args.include?(:copy))\n status = resource.copy(dest, overwrite)\n else\n return Conflict unless depth.is_a?(Symbol) || depth > 1\n status = resource.move(dest, overwrite)\n end\n response['Location'] = \"#{scheme}://#{host}:#{port}#{url_format(dest)}\" if status == Created\n # RFC 2518\n return_status(dest,status)\n end\n end\n end", "def move(io, id, shrine_metadata: {}, **upload_options)\n if io.respond_to?(:path)\n FileUtils.mv io.path, path!(id)\n else\n FileUtils.mv io.storage.path(io.id), path!(id)\n io.storage.clean(io.storage.path(io.id)) if io.storage.clean?\n end\n path(id).chmod(permissions) if permissions\n end", "def move\n display_change\n File.move(@real_path, new_path, false)\n end", "def move_dirs\n \n end", "def pre_sync\n #move\n end", "def test_move_under_single_lock\n setup_hr\n\n lock = lock 'httplock/hr', :depth => RubyDav::INFINITY\n\n response = @request.move('httplock/hr/recruiting/resumes', 'httplock/hr/archives/resumes')\n assert_equal '423', response.status\n assert_exists 'httplock/hr/recruiting/resumes/'\n assert_does_not_exist 'httplock/hr/archives/resumes/'\n\n if_hdr = lock.token\n response = @request.move('httplock/hr/recruiting/resumes', 'httplock/hr/archives/resumes', false, :if => if_hdr)\n assert_equal '201', response.status\n assert_does_not_exist 'httplock/hr/recruiting/resumes/'\n assert_exists 'httplock/hr/archives/resumes/'\n\n # cleanup\n unlock('httplock/hr', lock.token)\n delete_coll('httplock')\n end", "def disk_mv(src_file, dst_file, options)\n mover = options[:git] ? 'git mv' : 'mv'\n command = \"#{mover} '#{src_file.path}' '#{dst_file.path}'\"\n system(command) || raise(InputError, \"#{command} failed\")\n end", "def move_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.move_files_to(dest_dir, type)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end", "def delete_from_disk; end", "def move(src, dst)\n not_implemented('move')\n end", "def mv(from_location, to_location)\n @client.file_move(from_location, to_location)\n rescue\n puts $! if @@verbose\n nil\n end", "def move\n unless moved?\n offset = @deltas.pop\n @moved = true\n end\n end", "def move(from, to)\n @ctx.mv(@path + from, @path + to)\n end", "def move(source, destination)\n if isLegal?(source,destination)\n if source==1\n disk_to_move = @@tower_1.pop\n elsif source==2\n disk_to_move = @@tower_2.pop\n elsif source==3\n disk_to_move = @@tower_3.pop\n else\n puts(\"the source should be 1,2,or 3.\")\n end\n \n if destination ==1 \n @@tower_1.push(disk_to_move)\n elsif destination == 2 \n @@tower_2.push(disk_to_move)\n elsif destination == 3 \n @@tower_3.push(disk_to_move)\n end \n else\n puts(\"Sorry that was an incorrect move. Please review the rules and try again.\")\n end\n end", "def move_to_target_directory!\n return if new_record? || !readable?\n\n src = diskfile\n self.disk_directory = target_directory\n dest = diskfile\n\n return if src == dest\n\n if !RedmicaS3::Connection.move_object(src, dest)\n Rails.logger.error \"Could not move attachment from #{src} to #{dest}\"\n return\n end\n\n update_column :disk_directory, disk_directory\n end", "def mv srcpath, dstpath\n end", "def move(m)\n @path_log.push(@coordinate.clone)\n @coordinate = Navigation.execute_move(m,@coordinate)\n end", "def process_move(move, state)\n from = move[1].to_i - 1\n to = move[3].to_i - 1\n\n #check if there's a disk to move\n if state[from].first == nil\n puts \"There's no disk in tower #{from + 1}!\"\n #check if destination tower has space\n elsif state[to].length == @disk\n puts \"Tower #{to + 1} is at full capacity!\"\n #check if \"from\" disk is smaller than \"to\" disk\n elsif state[to].last != nil && state[from].last > state[to].last\n puts \"This disk is larger than the destination disk! Illegal move!\"\n #otherwise proceed to move the plates\n else\n state[to].push(state[from].last)\n state[from].pop\n end\n\n return state\n end", "def move_file\n source_file = Item.new(Path.new(params[:source_file]))\n dest_file = Item.new(Path.new(params[:dest_file]))\n\n response = {}\n if source_file.path.to_s == dest_file.path.to_s\n response[:msg] = \"Same file\"\n render json: response, status: 200\n return\n end\n\n response[:source_file] = source_file\n response[:dest_file] = dest_file\n if source_file.move_to(dest_file)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end", "def move_type_path\n return if @path == :pending\n return unless movable?\n while (command = @path[@move_route_index])\n # @move_route_index += 1\n break if move_type_custon_exec_command(command)\n end\n end", "def move\n @guest.move params[:index]\n\n respond_to do |format|\n format.html { render nothing: true }\n format.json { head :ok }\n end\n end", "def cmd_move(_args)\n #puts [:move, _args].inspect\n data=get_src(_args[0][0], _args[2][0], _args[2][1])\n #p '%x' % data\n set_dst(_args[0][0], _args[1][0], _args[1][1], data)\n @flags[:n]=true if data<0\n @flags[:z]=true if data==0\n @flags[:v]=false\n @flags[:c]=false\n end", "def move_folder\n parent_folder = Folder.find_folder(params[:folder_id])\n parent_folder1 = Folder.find_folder(parent_folder.parent_id)\n portfolio_id_old = parent_folder.portfolio_id\n @portfolio_old = portfolio_id_old\n folder_id_old = params[:folder_id]\n @folder = parent_folder\n @portfolio = @folder.portfolio\n @parent_folder = parent_folder\n move_folder_id = Folder.find_folder(params[:move_folder_id])\n @moved_folder = move_folder_id\n @moved_portfolio_old = @moved_folder.portfolio_id\n params[:folder_id] = parent_folder.parent_id if !parent_folder.nil?\t\tand !params[:element_type].nil? and params[:element_type].blank?\n if params[:move_folder_id] and !params[:move_folder_id].blank?\n move_document(parent_folder,parent_folder1,portfolio_id_old,folder_id_old,move_folder_id) if params[:element_type] == \"document\" and params[:operation] and params[:operation] == \"move\"\n copy_document(parent_folder,parent_folder1,portfolio_id_old,folder_id_old,move_folder_id) if params[:element_type] == \"document\" and params[:operation] and params[:operation] == \"copy\"\n move_folders(parent_folder,parent_folder1,portfolio_id_old,folder_id_old,move_folder_id) if params[:element_type] != \"document\" and params[:operation] and params[:operation] == \"move\"\n copy_folder(parent_folder,parent_folder1,portfolio_id_old,folder_id_old,move_folder_id) if params[:element_type] != \"document\" and params[:operation] and params[:operation] == \"copy\"\n end\n display_collection_of_folders_docs_tasks\n end", "def move(direction)\n \n end", "def move(path, new_path)\n cleanup(path)\n new_client.move(path, new_path)\n rescue\n false\n else\n true\n end", "def move_diffs\n\n end", "def rewind_disk(time_going_back)\n if (@dvd_time_move - time_going_back) > 0\n @dvd_time_move = @dvd_time_move - time_going_back\n else\n @dvd_time_move = 0\n end\n end", "def move(disks, starting, goal)\n if disks == 1 # base case\n puts \"#{starting}->#{goal}\"\n else\n\n # Steps:\n # move n - 1 disks from starting to spare peg\n # move bottom disk from starting to goal peg\n # move n - 1 disks from spare peg to goal peg\n\n spare_peg = %w[1 2 3].reject do |x|\n x == starting || x == goal\n end\n spare_peg = spare_peg[0]\n\n move(disks - 1, starting, spare_peg)\n move(1, starting, goal)\n move(disks - 1, spare_peg, goal)\n end\nend", "def lmove(source, destination, where_source, where_destination); end", "def lmove(source, destination, where_source, where_destination); end", "def move_opt_chef(src, dest)\n converge_by(\"moving all files under #{src} to #{dest}\") do\n FileUtils.rm_rf dest\n raise \"rm_rf of #{dest} failed\" if ::File.exist?(dest) # detect mountpoints that were not deleted\n FileUtils.mv src, dest\n end\nrescue => e\n # this handles mountpoints\n converge_by(\"caught #{e}, falling back to copying and removing from #{src} to #{dest}\") do\n begin\n FileUtils.rm_rf dest\n rescue\n nil\n end # mountpoints can throw EBUSY\n begin\n FileUtils.mkdir dest\n rescue\n nil\n end # mountpoints can throw EBUSY\n FileUtils.cp_r Dir.glob(\"#{src}/*\"), dest\n FileUtils.rm_rf Dir.glob(\"#{src}/*\")\n end\nend", "def move_machine(machine, from, to)\n handle_action_exceptions(__method__) do\n cmd_line = [\"movemachine '#{machine}' '#{from}' '#{to}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end", "def move url, options={} \n response = self.class.move(url, {:body => options}).parsed_response\n raise Skydrive::Error.new(response[\"error\"]) if response[\"error\"]\n response[\"data\"] ? response[\"data\"] : response\n end", "def move_sales_line\r\n=begin\r\n sales_line = ERP::SalesLine.find params[:id]\r\n @original_order_id = sales_line.erp_sales_order_id\r\n sales_line.update_attribute :erp_sales_order_id, params[:target]\r\n \r\n mark_as_unsync [@original_order_id, params[:target]]\r\n=end\r\n @sales_line = ERP::SalesLine.find params[:id]\r\n @store_user.my_account_log(@sales_line,\"Move Sales Line #{@sales_line.invent_trans_id} From #{@sales_line.sales_order.sales_id}\")\r\n if @sales_line && @sales_line.sales_order.erp_customer_id == @customer.id\r\n @sales_line.move_to_order @customer.sales_orders.find( params[:target] )\r\n end\r\n end", "def move (source_path, dest_path)\n \"mv '#{source_path}' '#{dest_path}'\"\n end", "def move_folder request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_move_folder_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def file_move(from_path, to_path)\n params = {\n \"root\" => @root,\n \"from_path\" => format_path(from_path, false),\n \"to_path\" => format_path(to_path, false),\n }\n response = @session.do_post build_url(\"/fileops/move\", params)\n parse_response(response)\n end", "def move_card(card, destination)\n card.location = destination\n card.save\n end", "def move \n\n # If we've reached the end of our path, not much to do\n if @path_step >= @path.length\n return\n end\n\n # So, just set the destination to the next step on the path and let the base\n # ship movement handle it\n @dest_x = @path[@path_step][0]\n @dest_y = @path[@path_step][1]\n super\n\n # Now just check to see if we've reached the target - if so, move on to the next\n # step on the path\n if ( @x == @path[@path_step][0] ) && ( @y == @path[@path_step][1] )\n @path_step += 1\n end\n\n end", "def move(admin, r, newServer, original)\n # Now move it. Do it in a loop so can retry if fail. Have seen issue where\n # we tried move region but failed and retry put it back on old location;\n # retry in this case.\n\n retries = admin.getConfiguration.getInt(\"hbase.move.retries.max\", 5)\n count = 0\n same = true\n start = Time.now\n while count < retries and same\n if count > 0\n $LOG.info(\"Retry \" + count.to_s + \" of maximum \" + retries.to_s)\n end\n count = count + 1\n begin\n admin.move(Bytes.toBytes(r.getEncodedName()), Bytes.toBytes(newServer))\n rescue java.lang.reflect.UndeclaredThrowableException,\n org.apache.hadoop.hbase.UnknownRegionException => e\n $LOG.info(\"Exception moving \" + r.getEncodedName() +\n \"; split/moved? Continuing: \" + e)\n return\n end\n # Wait till its up on new server before moving on\n maxWaitInSeconds = admin.getConfiguration.getInt(\"hbase.move.wait.max\", 60)\n maxWait = Time.now + maxWaitInSeconds\n while Time.now < maxWait\n same = isSameServer(admin, r, original)\n break unless same\n sleep 0.1\n end\n end\n raise RuntimeError, \"Region stuck on #{original}, newserver=#{newServer}\" if same\n # Assert can Scan from new location.\n isSuccessfulScan(admin, r)\n $LOG.info(\"Moved region \" + r.getRegionNameAsString() + \" cost: \" + \n java.lang.String.format(\"%.3f\", (Time.now - start)))\nend", "def smove(source, destination, member); end", "def smove(source, destination, member); end", "def move\n @tail = @location\n closest_food = detect_closest_food\n @location = calculate_next_location(closest_food)\n\n end", "def move_diffs\n \n end", "def user_move(from, to)\n\t# If FROM peg is empty, there is no disk to move. Display error \n\t# message.\n\tif $pegs[from].count == 0\n\t\tputs \"That peg is empty, please choose a different peg!\"\n\t# If the disk the user is trying to move is larger than the disk on \n\t# the TO peg, don't allow the move. Display invalid move message.\n\telsif ($pegs[to].count != 0) && ($pegs[from].last > $pegs[to].last)\n\t\tputs \"That is an invalid move. Please try again.\"\n\t# If move is valid, pop FROM peg and push disk to the TO peg.\n\telse\n\t\t$pegs[to] << $pegs[from].pop\n\tend\nend", "def move\n check_placement\n\n new_position = make_move(current_position, direction)\n position(new_position[0], new_position[1], @table.size)\n end", "def move\n @page = Page.find(params[:drag_id])\n @page.update_sorting Page.find(params[:drop_id]), params[:position]\n \n render :json => { :moved => true }\n end", "def move\n\t\t'moved passed'\n\tend", "def test_move_in_fetch\n tmp_data = '{\"Device\":{\"_id\":\"3454\",\"hd_ops\":{\"is_generic\":0,\"stop_on_detect\":0,\"overlay_result_specs\":0},\"hd_specs\":{\"general_vendor\":\"Sagem\",\"general_model\":\"MyX5-2\",\"general_platform\":\"\",\"general_image\":\"\",\"general_aliases\":\"\",\"general_eusar\":\"\",\"general_battery\":\"\",\"general_type\":\"\",\"general_cpu\":\"\",\"design_formfactor\":\"\",\"design_dimensions\":\"\",\"design_weight\":0,\"design_antenna\":\"\",\"design_keyboard\":\"\",\"design_softkeys\":\"\",\"design_sidekeys\":\"\",\"display_type\":\"\",\"display_color\":\"\",\"display_colors\":\"\",\"display_size\":\"\",\"display_x\":\"128\",\"display_y\":\"160\",\"display_other\":\"\",\"memory_internal\":\"\",\"memory_slot\":\"\",\"network\":\"\",\"media_camera\":\"\",\"media_secondcamera\":\"\",\"media_videocapture\":\"\",\"media_videoplayback\":\"\",\"media_audio\":\"\",\"media_other\":\"\",\"features\":\"\",\"connectors\":\"\",\"general_platform_version\":\"\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_language\":\"\",\"general_platform_version_max\":\"\",\"general_app\":\"\",\"general_app_version\":\"\",\"display_ppi\":0,\"display_pixel_ratio\":0,\"benchmark_min\":0,\"benchmark_max\":0,\"general_app_category\":\"\",\"general_virtual\":0,\"display_css_screen_sizes\":\"\"}}}'\n File.open('Device_3454.json', 'w') { |f| f.write(tmp_data) }\n @store.move_in 'Device_3454.json', 'Device_3454.json'\n refute File.file? 'Device_3454.json'\n assert File.file? File.join(@store.directory, 'Device_3454.json')\n\n tmp_data = '{\"Device\":{\"_id\":\"3455\",\"hd_ops\":{\"is_generic\":0,\"stop_on_detect\":0,\"overlay_result_specs\":0},\"hd_specs\":{\"general_aliases\":\"\",\"display_x\":\"120\",\"display_y\":\"120\",\"general_vendor\":\"Sagem\",\"general_model\":\"MY X55\",\"general_platform\":\"\",\"general_image\":\"\",\"network\":\"\",\"general_type\":\"\",\"general_eusar\":\"\",\"general_battery\":\"\",\"general_cpu\":\"\",\"design_formfactor\":\"\",\"design_dimensions\":\"\",\"design_weight\":0,\"design_antenna\":\"\",\"design_keyboard\":\"\",\"design_softkeys\":\"\",\"design_sidekeys\":\"\",\"display_type\":\"\",\"display_color\":\"\",\"display_colors\":\"\",\"display_size\":\"\",\"display_other\":\"\",\"memory_internal\":\"\",\"memory_slot\":\"\",\"media_camera\":\"\",\"media_secondcamera\":\"\",\"media_videocapture\":\"\",\"media_videoplayback\":\"\",\"media_audio\":\"\",\"media_other\":\"\",\"features\":\"\",\"connectors\":\"\",\"general_platform_version\":\"\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_language\":\"\",\"general_platform_version_max\":\"\",\"general_app\":\"\",\"general_app_version\":\"\",\"display_ppi\":0,\"display_pixel_ratio\":0,\"benchmark_min\":0,\"benchmark_max\":0,\"general_app_category\":\"\",\"general_virtual\":0,\"display_css_screen_sizes\":\"\"}}}'\n File.open('Device_3455.json', 'w') { |f| f.write(tmp_data) }\n @store.move_in 'Device_3455.json', 'Device_3455.json'\n\n tmp_data = '{\"Device\":{\"_id\":\"3456\",\"hd_ops\":{\"is_generic\":0,\"stop_on_detect\":0,\"overlay_result_specs\":0},\"hd_specs\":{\"general_vendor\":\"Sagem\",\"general_model\":\"myX5-2v\",\"general_platform\":\"\",\"general_image\":\"\",\"general_aliases\":\"\",\"general_eusar\":\"\",\"general_battery\":\"\",\"general_type\":\"\",\"general_cpu\":\"\",\"design_formfactor\":\"\",\"design_dimensions\":\"\",\"design_weight\":0,\"design_antenna\":\"\",\"design_keyboard\":\"\",\"design_softkeys\":\"\",\"design_sidekeys\":\"\",\"display_type\":\"\",\"display_color\":\"\",\"display_colors\":\"\",\"display_size\":\"\",\"display_x\":\"128\",\"display_y\":\"160\",\"display_other\":\"\",\"memory_internal\":\"\",\"memory_slot\":\"\",\"network\":\"\",\"media_camera\":\"\",\"media_secondcamera\":\"\",\"media_videocapture\":\"\",\"media_videoplayback\":\"\",\"media_audio\":\"\",\"media_other\":\"\",\"features\":\"\",\"connectors\":\"\",\"general_platform_version\":\"\",\"general_browser\":\"\",\"general_browser_version\":\"\",\"general_language\":\"\",\"general_platform_version_max\":\"\",\"general_app\":\"\",\"general_app_version\":\"\",\"display_ppi\":0,\"display_pixel_ratio\":0,\"benchmark_min\":0,\"benchmark_max\":0,\"general_app_category\":\"\",\"general_virtual\":0,\"display_css_screen_sizes\":\"\"}}}'\n File.open('Device_3456.json', 'w') { |f| f.write(tmp_data) }\n @store.move_in 'Device_3456.json', 'Device_3456.json'\n\n devices = @store.fetch_devices\n assert_equal 3, devices['devices'].length\n end", "def move_folder\n\n destFolder = params[:dest]\n targetFolder = params[:folder_id]\n client = user_client\n mixpanel_tab_event(\"My Vault\", \"Move Folder - Drag & Drop\")\n\n # get folder\n folder = Rails.cache.fetch(\"/folder/#{session[:box_id]}/my_folder/#{params[:dest]}\", :expires_in => 10.minutes) do\n client.folder_from_id(params[:dest])\n end\n\n begin\n # get shared folder, then move file into shared folder\n client.move_folder(targetFolder, destFolder)\n flash[:notice] = \"Folder moved into \\\"#{folder.name}\\\"\"\n rescue\n flash[:error] = \"Error: Folder could not be moved\"\n end\n\n redirect_to dashboard_id_path(session[:current_folder])\n end", "def moveTo x, y\n\n\tend", "def google_move_file(client)\n notify \"Command : Google move file\"\n # result : error message\n # google treat folders as files\n src_files = move_copy_file_source\n dest_path = CGI::unescape(@fields[:dst_path].to_s)\n result = client.move_files(src_files,dest_path)\n\n end", "def smove(*arguments)\n\t\t\t\t\tcall(\"SMOVE\", *arguments)\n\t\t\t\tend", "def commandMove _obj, _args\n \"_obj commandMove _args;\" \n end", "def move(key, options = {})\n if options.include?(:position)\n options[:position] = options[:position].downcase.capitalize\n end\n fetch({:method => :post, :key => \"#{key}/move\", :body => options})\n end", "def call_move(reg_key, addr, i_reg, m_spec)\n to_addr = get_mem_addr(addr, i_reg)\n from_addr = @registers['I1'].word.to_i\n\n (0..(m_spec - 1)).each do |i|\n @computer.memory.write(to_addr + i, @computer.memory.read(from_addr + i))\n end\n end", "def move_file\n\n destFolder = params[:dest]\n targetFile = params[:file_id]\n client = user_client\n mixpanel_tab_event(\"My Vault\", \"Move File - Drag & Drop\")\n\n # get folder\n folder = Rails.cache.fetch(\"/folder/#{session[:box_id]}/my_folder/#{params[:dest]}\", :expires_in => 10.minutes) do\n client.folder_from_id(params[:dest])\n end\n\n begin\n # get shared folder, then move file into shared folder\n client.move_file(targetFile, destFolder)\n flash[:notice] = \"File moved into \\\"#{folder.name}\\\"\"\n rescue\n flash[:error] = \"Error: File could not be moved\"\n end\n\n redirect_to dashboard_id_path(session[:current_folder])\n end", "def move_down\n @treasure = Treasure.find_by_id(params[:id])\n @treasure.move_lower\n respond_to do |format|\n if @treasure.save\n flash[:notice] = 'Treasure was successfully updated.'\n format.html { redirect_to :action => :index}\n else\n format.html { render :action => \"index\" }\n end\n end\n end", "def move_to(x, y); end", "def move x, y\n put x, y # FIXME\n end", "def move(request)\n possible_moves = %w[up down left right]\n my_snake_id = request.dig(:you, :id)\n\n obstacles =\n request.dig(:board, :snakes).each_with_object([]) do |snake, res|\n next if snake[:id] == my_snake_id && request[:turn].zero?\n\n # don't add my own head as an obstacle\n snake[:body].shift if snake[:id] == my_snake_id\n\n res << snake[:body]\n end.flatten.uniq\n\n graph = Graph.new(\n width: request.dig(:board, :width),\n height: request.dig(:board, :height),\n start_x: request.dig(:you, :head, :x),\n start_y: request.dig(:you, :head, :y),\n obstacles: obstacles\n )\n\n h_sorted_foods =\n request\n .dig(:board, :food)\n .sort do |a, b|\n a_node_h_dist = graph.start.distance(Node.new(a[:x], a[:y]))\n b_node_h_dist = graph.start.distance(Node.new(b[:x], b[:y]))\n\n a_node_h_dist <=> b_node_h_dist\n end\n\n food = h_sorted_foods.first\n\n graph.set_end(food[:x], food[:y])\n\n path = ASTAR.new(graph.start, graph.end).search\n\n next_node = path&.first\n\n if next_node.x > graph.start.x\n 'right'\n elsif next_node.x < graph.start.x\n 'left'\n elsif next_node.y > graph.start.y\n 'up'\n elsif next_node.y < graph.start.y\n 'down'\n else\n # TODO: replace this with navigating to biggest open space\n possible_moves.sample\n end\nend", "def move_without_saving(vector)\n if vector.kind_of?(Hash)\n action, object = vector.keys[0], vector.values[0]\n else\n action = vector\n end\n\n # set the start position to 1 or, if offset in the list_options is :list, :first => X\n minpos = model.list_options[:first]\n\n # the previous position (if changed) else current position\n prepos = original_attributes[properties[:position]] || position\n\n # set the last position in the list or previous position if the last item\n maxpos = (last = list.last) ? (last == self ? prepos : last.position + 1) : minpos\n\n newpos = case action\n when :highest then minpos\n when :top then minpos\n when :lowest then maxpos\n when :bottom then maxpos\n when :higher,:up then [ position - 1, minpos ].max\n when :lower,:down then [ position + 1, maxpos ].min\n when :above\n # the object given, can either be:\n # -- the same as self\n # -- already below self\n # -- higher up than self (lower number in list)\n ( (self == object) or (object.position > self.position) ) ? self.position : object.position\n\n when :below\n # the object given, can either be:\n # -- the same as self\n # -- already above self\n # -- lower than self (higher number in list)\n ( self == object or (object.position < self.position) ) ? self.position : object.position + 1\n\n when :to\n # can only move within top and bottom positions of list\n # -- .move(:to => 2 ) Hash with FixNum\n # -- .move(:to => '2' ) Hash with String\n\n # NOTE:: sensitive functionality\n # maxpos is incremented above, so decrement by 1 to get true maxpos\n # minpos is fixed, so just take the object position value given\n # else add 1 to object position value\n obj = object.to_i\n if (obj > maxpos)\n [ minpos, [ obj, maxpos - 1 ].min ].max\n else\n [ minpos, [ obj, maxpos ].min ].max\n end\n\n else\n raise ArgumentError, \"unrecognized vector: [#{action}]. Please check your spelling and/or the docs\" if action.is_a?(Symbol)\n # -- .move(2) as FixNum only\n # -- .move('2') as String only\n if action.to_i < minpos\n [ minpos, maxpos - 1 ].min\n else\n [ action.to_i, maxpos - 1 ].min\n end\n end\n\n # don't move if already at the position\n return false if [ :lower, :down, :higher, :up, :top, :bottom, :highest, :lowest, :above, :below ].include?(action) && newpos == prepos\n return false if !newpos || ([ :above, :below ].include?(action) && list_scope != object.list_scope)\n return true if newpos == position && position == prepos || (newpos == maxpos && position == maxpos - 1)\n\n if !position\n list.all(:position.gte => newpos).adjust!({ :position => 1 }, true) unless action =~ /:(lowest|bottom)/\n elsif newpos > prepos\n newpos -= 1 if [:lowest,:bottom,:above,:below].include?(action)\n list.all(:position => prepos..newpos).adjust!({ :position => -1 }, true)\n elsif newpos < prepos\n list.all(:position => newpos..prepos).adjust!({ :position => 1 }, true)\n end\n\n self.position = newpos\n self.moved = true\n true\n end", "def move request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_move_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::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def move_dirs\n :both\n end", "def execute_move\n\t\traise RuntimeError, 'This must be implemented in child class'\n\tend", "def move_unit args\n $LOGGER.warn \"MOVE UNITS\"\n path, new_current_character = *args\n #puts \"#{path.inspect} is path\"\n enqueue_state_change StateChange::Movement.new(path, @state.current_character)\n #if @state.current_character.c_id != new_current_character\n enqueue_state_change StateChange::ChangeCurrentCharacter.new(new_current_character)\n #else\n #end\n end", "def move_folder_ind\n create_process(process: \"MOVE_FOLDER\")\n end", "def move\n @event.starttime = make_time_from_minute_and_day_delta(@event.starttime)\n @event.endtime = make_time_from_minute_and_day_delta(@event.endtime)\n if @event.save\n render nothing: true\n else\n render json: { message: 'This service could not be moved' }\n end\n end", "def sync_disks(machine)\n @logger.info \"Syncing disks for #{machine.name}...\"\n machine.disks.each do |disk|\n begin\n disk.remote_id ? update_disk(disk) : create_disk(disk)\n rescue StandardError => e\n message = e.is_a?(RestClient::Exception) ? e.response : e\n raise Exceptions::OnPremiseException, message\n end\n end\n end", "def move(*args)\n begin\n move_no_cleanup(*args)\n rescue Orp::MovementAlreadyComplete\n warn \"Attempted to complete already completed movement\"\n nil\n rescue\n delete\n raise\n end\n end", "def move_me\n new_loc = nil\n ploc = @partner[:loc]\n dir = @partner[:dir]\n dist = @partner[:dist]\n if dist == 30\n new_dist = 16\n else\n new_dist = dist / 2\n end\n log \"Moving me. Partner data: #{@partner}\"\n new_loc = [ploc[0] - dir[0] * new_dist, ploc[1] - dir[1] * new_dist]\n log \"Move me to #{new_loc}\"\n \n goto new_loc\n return new_loc\n end", "def compute_deltas \n req_disks = @new_resource.disks\n keyed_req = {} # for easy lookup, make a map of the requested disks \n cur = @ring_test\n name = @new_resource.name\n @to_add = []\n @to_rem = []\n \n \n ## figure out which disks need adding\n req_disks.each {|disk| \n key = RingInfo.dev_key disk[:ip],disk[:port],disk[:dev_name]\n @to_add << disk unless cur and cur.devices[key] # add unless present\n keyed_req[key] = disk\n } \n \n ### figure out which disks need removing\n cur.devices.each {|key, d|\n @to_rem << d unless keyed_req[key] # remove unless still requested\n } if cur\n \n Chef::Log.info(\"disks, to add #{@to_add.length} , to remove: #{@to_rem.length}\" ) \n Chef::Log.debug(\"disks, to add #{@to_add.join(\";\")} , to remove: #{@to_rem.join(\";\")}\" )\n \nend", "def move(io, id, metadata = {})\n if io.respond_to?(:path)\n FileUtils.mv io.path, path!(id)\n else\n FileUtils.mv io.storage.path(io.id), path!(id)\n io.storage.clean(io.id) if io.storage.clean?\n end\n path(id).chmod(permissions) if permissions\n end", "def update_move\n self.x = screen_x\n self.y = screen_y\n update_move_arch if @type == Arched\n end", "def move_dir d\n\t\tmove d.dir( @square)\n\tend", "def compute_deltas\n req_disks = @new_resource.disks\n keyed_req = {} # for easy lookup, make a map of the requested disks\n cur = @ring_test\n name = @new_resource.name\n @to_add = []\n @to_rem = []\n\n ## figure out which disks need adding\n req_disks.each {|disk|\n key = RingInfo.dev_key disk[:ip],disk[:port],disk[:dev_name]\n @to_add << disk unless cur and cur.devices[key] # add unless present\n keyed_req[key] = disk\n }\n\n ### figure out which disks need removing\n cur.devices.each {|key, d|\n @to_rem << d unless keyed_req[key] # remove unless still requested\n } if cur\n\n Chef::Log.info(\"disks, to add #{@to_add.length} , to remove: #{@to_rem.length}\")\n Chef::Log.debug(\"disks, to add #{@to_add.join(\";\")} , to remove: #{@to_rem.join(\";\")}\")\n\nend", "def move_diffs\n raise NotImplementedError\n end", "def drive\n\t\t@commands.each do |cmd|\n\t\t\tunless cmd == 'M'\n\t\t\t\tveer cmd\n\t\t\telse\n\t\t\t\tunless @car.toBeOverFlow?\n\t\t\t\t\tmove\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend" ]
[ "0.70715916", "0.6548687", "0.6484039", "0.61993146", "0.60974747", "0.6041206", "0.6041206", "0.5995685", "0.5972715", "0.593383", "0.59021443", "0.58517075", "0.5839177", "0.5828931", "0.57950985", "0.5774989", "0.57248795", "0.57248795", "0.5713674", "0.5682578", "0.56420326", "0.5629778", "0.5616506", "0.561147", "0.55700564", "0.55626416", "0.55624175", "0.5554042", "0.5530596", "0.55269605", "0.5522601", "0.5521394", "0.5513261", "0.55077213", "0.5505189", "0.5493432", "0.54932517", "0.54855853", "0.54699945", "0.54636914", "0.5460585", "0.5423873", "0.54228073", "0.5420194", "0.540684", "0.54005855", "0.5392687", "0.5389091", "0.53872526", "0.5386432", "0.53772956", "0.53772956", "0.5375706", "0.5374848", "0.53744805", "0.53720766", "0.5365928", "0.5358554", "0.53549594", "0.5354848", "0.53545296", "0.5344847", "0.5343101", "0.5343101", "0.53292227", "0.5316476", "0.5304783", "0.52806115", "0.52765095", "0.52677613", "0.5266508", "0.525754", "0.52435195", "0.5242067", "0.5234162", "0.523101", "0.52213347", "0.5213065", "0.52094287", "0.5200641", "0.52002496", "0.51888543", "0.5180877", "0.51747257", "0.51736945", "0.51700395", "0.5163878", "0.5162138", "0.51615965", "0.5160375", "0.51560575", "0.5146589", "0.51407397", "0.5132387", "0.51320124", "0.5124083", "0.5118772", "0.5094416", "0.50927126", "0.508117" ]
0.7306026
0
Baseline implementation for the move_instance REST call
def move_instance request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_move_instance_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def move_instance request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/moveInstance\"\n body = request_pb.instance_move_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def move(*args)\n \t# Sending destination path\n \tputs \"MOVING\"\n \tmove_entity(*args[0].public_path)\n \tsuper\n end", "def move_entity entity; end", "def move; end", "def move; end", "def move\n @guest.move params[:index]\n\n respond_to do |format|\n format.html { render nothing: true }\n format.json { head :ok }\n end\n end", "def move\n\n end", "def move _obj, _args\n \"_obj move _args;\" \n end", "def doMove _obj, _args\n \"_obj doMove _args;\" \n end", "def move(*args)\n unless(resource.exist?)\n NotFound\n else\n resource.lock_check if resource.supports_locking? && !args.include?(:copy)\n destination = url_unescape(env['HTTP_DESTINATION'].sub(%r{https?://([^/]+)}, ''))\n dest_host = $1\n if(dest_host && dest_host.gsub(/:\\d{2,5}$/, '') != request.host)\n BadGateway\n elsif(destination == resource.public_path)\n Forbidden\n else\n dest = resource_class.new(destination, clean_path(destination), @request, @response, @options.merge(:user => resource.user))\n status = nil\n if(args.include?(:copy))\n status = resource.copy(dest, overwrite)\n else\n return Conflict unless depth.is_a?(Symbol) || depth > 1\n status = resource.move(dest, overwrite)\n end\n response['Location'] = \"#{scheme}://#{host}:#{port}#{url_format(dest)}\" if status == Created\n # RFC 2518\n return_status(dest,status)\n end\n end\n end", "def commandMove _obj, _args\n \"_obj commandMove _args;\" \n end", "def put_instance(opts)\n opts = check_params(opts,[:instances])\n super(opts)\n end", "def smove(source, destination, member); end", "def smove(source, destination, member); end", "def move(*args, &block)\n args = web_dav_args args\n map_method :move, args, &block\n end", "def move\n @event.starttime = make_time_from_minute_and_day_delta(@event.starttime)\n @event.endtime = make_time_from_minute_and_day_delta(@event.endtime)\n if @event.save\n render nothing: true\n else\n render json: { message: 'This service could not be moved' }\n end\n end", "def move\n # Noting that insert, if applied to an existing resource, moves it\n # to its new URL.\n item_insert(item_find)\n end", "def http_move(request, response)\n path = request.path\n\n move_info = @server.copy_and_move_info(request)\n\n if move_info['destinationExists']\n return false unless @server.emit('beforeUnbind', [move_info['destination']])\n end\n\n return false unless @server.emit('beforeUnbind', [path])\n return false unless @server.emit('beforeBind', [move_info['destination']])\n return false unless @server.emit('beforeMove', [path, move_info['destination']])\n\n if move_info['destinationExists']\n @server.tree.delete(move_info['destination'])\n @server.emit('afterUnbind', [move_info['destination']])\n end\n\n @server.tree.move(path, move_info['destination'])\n\n # Its important afterMove is called before afterUnbind, because it\n # allows systems to transfer data from one path to another.\n # PropertyStorage uses this. If afterUnbind was first, it would clean\n # up all the properties before it has a chance.\n @server.emit('afterMove', [path, move_info['destination']])\n @server.emit('afterUnbind', [path])\n @server.emit('afterBind', [move_info['destination']])\n\n # If a resource was overwritten we should send a 204, otherwise a 201\n response.update_header('Content-Length', '0')\n response.status = move_info['destinationExists'] ? 204 : 201\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 move(options = {})\n self.class.move(self.version_key, options)\n end", "def move\n \n end", "def move\n \n end", "def migrate(dst)\n self.stop\n new_instance = self.class.new(@box, @options)\n new_instance.start\n return new_instance\n end", "def execute_move\n\t\traise RuntimeError, 'This must be implemented in child class'\n\tend", "def move url, options={} \n response = self.class.move(url, {:body => options}).parsed_response\n raise Skydrive::Error.new(response[\"error\"]) if response[\"error\"]\n response[\"data\"] ? response[\"data\"] : response\n end", "def feature_move \n klass = params[:class].camelize.constantize\n \n if valid_classes.include? klass\n element = klass.find(params[:id])\n \n #TODO: TOTAL HACK, be way more robust here\n if klass == Item\n logger.info \"Iteam!\"\n element.owner = active_character.area\n element.save\n area = element.owner\n else\n area = element.area\n end\n \n element.update_position(params[:left], params[:top])\n # Update all clients in area\n render_to_area area do |page|\n page.call :addEvent, \"#{h current_user} has moved a #{klass}!\"\n page.call 'game.updateDisplayable', element.css_id, element.left, element.top\n end\n render :nothing => true\n else\n render :text => 'Invalid Class', :status => 403\n end\n end", "def switchmove _obj, _args\n \"_obj switchmove _args;\" \n end", "def receive_move_by_application\n @game = Game.find_by_id(params[:game_id])\n do_move_by_application \n \n handle_response_display false \n end", "def move_gear_post(gear, destination_container, state_map)\n app = gear.application\n reply = ResultIO.new\n gear_components = gear.component_instances\n start_order, stop_order = app.calculate_component_orders\n source_container = gear.get_proxy\n\n if gear.group_instance.platform.downcase == \"windows\"\n log_debug \"DEBUG: Restoring ownership and user ACLs for Windows gear '#{gear.uuid}'\"\n rsync_keyfile = Rails.configuration.auth[:rsync_keyfile]\n log_debug `eval \\`ssh-agent\\`; ssh-add #{rsync_keyfile}; ssh -o StrictHostKeyChecking=no -A root@#{destination_container.get_ip_address} \"/cygdrive/c/openshift/bin/oo-cmd.exe oo-admin-restore-acls --uuid:#{gear.uuid}\"; exit_code=$?; ssh-agent -k;exit $exit_code`\n end\n\n start_order.each do |cinst|\n next unless gear_components.include? cinst\n cart = cinst.cartridge_name\n idle, leave_stopped = state_map[cart]\n unless leave_stopped\n log_debug \"DEBUG: Starting cartridge '#{cart}' in '#{app.name}' after move on #{destination_container.id}\"\n args = build_base_gear_args(gear)\n args = build_base_component_args(cinst, args)\n reply.append destination_container.send(:run_cartridge_command, cart, gear, \"start\", args, false)\n end\n end\n\n log_debug \"DEBUG: Fixing DNS and mongo for gear '#{gear.uuid}' after move\"\n log_debug \"DEBUG: Changing server identity of '#{gear.uuid}' from '#{source_container.id}' to '#{destination_container.id}'\"\n gear.server_identity = destination_container.id\n # Persist server identity for gear in mongo\n res = Application.where({\"_id\" => app.id, \"gears.uuid\" => gear.uuid}).update({\"$set\" => {\"gears.$.server_identity\" => gear.server_identity}})\n raise OpenShift::OOException.new(\"Could not set gear server_identity to #{gear.server_identity}\") if res.nil? or !res[\"updatedExisting\"]\n\n gear.group_instance.gear_size = destination_container.get_node_profile\n # Persist gear size for current group instance in mongo\n res = Application.where({\"_id\" => app.id, \"group_instances._id\" => gear.group_instance.id}).update({\"$set\" => {\"group_instances.$.gear_size\" => gear.group_instance.gear_size}})\n raise OpenShift::OOException.new(\"Could not set group instance gear_size to #{gear.group_instance.gear_size}\") if res.nil? or !res[\"updatedExisting\"]\n begin\n dns = OpenShift::DnsService.instance\n public_hostname = destination_container.get_public_hostname\n dns.modify_application(gear.name, app.domain_namespace, public_hostname)\n dns.publish\n ensure\n dns.close\n end\n reply\n end", "def moveTo _obj, _args\n \"_obj moveTo _args;\" \n end", "def move\n\t\t'moved passed'\n\tend", "def move\n Log.add_info(request, params.inspect)\n\n raise(RequestPostOnlyException) unless request.post?\n\n unless params[:tree_node_id].nil?\n folder_id = params[:tree_node_id]\n SqlHelper.validate_token([folder_id])\n\n workflow = Workflow.find(params[:id])\n\n workflow.item.update_attribute(:folder_id, folder_id)\n\n flash[:notice] = t('msg.move_success')\n end\n\n my_wf_folder = WorkflowsHelper.get_my_wf_folder(@login_user.id)\n\n sql = WorkflowsHelper.get_list_sql(@login_user.id, my_wf_folder.id)\n @workflows = Workflow.find_by_sql(sql)\n\n render(:partial => 'ajax_workflow', :layout => false)\n\n rescue => evar\n Log.add_error(request, evar)\n\n flash[:notice] = 'ERROR:' + evar.to_s[0, 64]\n render(:partial => 'ajax_workflow', :layout => false)\n end", "def move(from, to, options={})\n valid_options = %w(movesubpages movetalk noredirect reason watch unwatch)\n options.keys.each{|opt| raise ArgumentError.new(\"Unknown option '#{opt}'\") unless valid_options.include?(opt.to_s)}\n\n form_data = options.merge({'action' => 'move', 'from' => from, 'to' => to, 'token' => get_token('move', from)})\n make_api_request(form_data)\n end", "def move_records(params)\n end", "def move_records(params)\n end", "def test_move_under_single_lock\n setup_hr\n\n lock = lock 'httplock/hr', :depth => RubyDav::INFINITY\n\n response = @request.move('httplock/hr/recruiting/resumes', 'httplock/hr/archives/resumes')\n assert_equal '423', response.status\n assert_exists 'httplock/hr/recruiting/resumes/'\n assert_does_not_exist 'httplock/hr/archives/resumes/'\n\n if_hdr = lock.token\n response = @request.move('httplock/hr/recruiting/resumes', 'httplock/hr/archives/resumes', false, :if => if_hdr)\n assert_equal '201', response.status\n assert_does_not_exist 'httplock/hr/recruiting/resumes/'\n assert_exists 'httplock/hr/archives/resumes/'\n\n # cleanup\n unlock('httplock/hr', lock.token)\n delete_coll('httplock')\n end", "def move\n file = session[:user].x_files.get(params[:id])\n raise RequestError.new(:file_not_found, \"File not found\") unless file\n raise RequestError.new(:bad_param, \"File not uploaded\") if !file.folder && !file.uploaded\n raise RequestError.new(:bad_param, \"Can not move the root folder\") if file.id == session[:user].root_folder.id\n source = WFolder.get(params[:source])\n raise RequestError.new(:file_not_found, \"Source not found\") unless source\n raise RequestError.new(:bad_param, \"Source is not a folder\") unless source.folder\n raise RequestError.new(:bad_access, \"No access to the source folder\") unless source.users.include? session[:user] \n raise RequestError.new(:bad_param, \"Source does not contain the file\") if source.files.include? file == false && !file.folder\n raise RequestError.new(:bad_param, \"Source does not contain the folder\") if source.childrens.include? file && file.folder\n destination = WFolder.get(params[:destination])\n raise RequestError.new(:file_not_found, \"Destination not found\") unless destination\n raise RequestError.new(:bad_param, \"Destination is not a folder\") unless destination.folder\n raise RequestError.new(:bad_access, \"No access to the destination folder\") unless destination.users.include? session[:user] \n raise RequestError.new(:bad_param, \"Destination and Source are identical\") if source.id == destination.id\n raise RequestError.new(:bad_param, \"Destination and File are identical\") if file.id == destination.id\n raise RequestError.new(:bad_param, \"File and Source are identical\") if source.id == file.id\n\n WFile.move(file, source, destination) unless file.folder\n WFolder.move(file, source, destination) if file.folder\n\n @result = { success: true }\n end", "def migrate(dst)\n self.stop\n new_instance = self.class.new(@node, @options)\n new_instance.start\n return new_instance\n end", "def move(key, options = {})\n if options.include?(:position)\n options[:position] = options[:position].downcase.capitalize\n end\n fetch({:method => :post, :key => \"#{key}/move\", :body => options})\n end", "def move\n if params[:location_id]\n resources = Resource.where('id IN (?)', params[:resources])\n location = Location.find(params[:location_id])\n\n command = MoveResourcesCommand.new(resources, location, current_user,\n request.remote_ip)\n begin\n command.execute\n rescue => e\n flash['error'] = \"#{e}\"\n else\n flash['success'] = \"Moved #{resources.length} resources to \"\\\n \"\\\"#{command.object.name}\\\".\"\n end\n redirect_back fallback_location: location_url(location)\n else\n flash['error'] = 'No location selected.'\n redirect_back fallback_location: root_url\n end\n end", "def move(*args)\n result = copy(*args)\n delete if [Created, NoContent].include?(result)\n result\n end", "def make_move\n # process the user's credentials\n return render json: { errors: ['not authenticated'] }, status: 403 unless username_and_password?\n user_id = User.authenticate(params[:username], params[:password])\n return render json: { errors: ['not authenticated'] }, status: 403 if user_id.nil?\n\n # find the game and verify that the game is still going and that the user should make the next move\n game = Game.find(params[:id])\n return render json: { errors: ['not a participant'] }, status: 403 unless game.has_user(user_id)\n return render json: { errors: ['game already over'] }, status: 422 if game.game_over\n return render json: { errors: ['not your turn'] }, status: 422 unless game.next_player() == user_id\n return render json: { errors: ['location is required'] }, status: 422 unless params[:location].present?\n\n # attempt to play the provided move\n result = game.play(user_id, params[:location].to_s)\n\n # alert the user if they made a bad move\n return render json: { errors: ['bad move'] }, status: 422 if result == :unable_to_set\n\n # save otherwise\n if game.save\n render json: game, status: 201, location: [game]\n else\n render json: { errors: game.errors }, status: 422\n end\n end", "def test_move\n # the source box\n src = defaults.box_type.new_container(:site => defaults.hospital, :name => Jinx::StringUniquifier.uniquify('Test Box'))\n src << @spc\n verify_save(@spc)\n # the target box\n tgt = defaults.box_type.new_container(:site => defaults.hospital, :name => Jinx::StringUniquifier.uniquify('Test Box'))\n verify_save(tgt)\n # move the specimen\n logger.debug { \"#{self} moving #{@spc} from #{src} to #{tgt}...\" }\n spc = @spc.copy(:label).find\n tgt << spc \n verify_save(spc)\n end", "def state_move(parameters = {}, invocation_options = {})\n exec(RubyTerraform::Commands::StateMove,\n parameters, invocation_options)\n end", "def test_post_move_file\n\n src = 'folder1/FileTest.pdf'\n dest = 'folder3/folder1/FileTest.pdf'\n versionId = nil\n storage = 'First Storage'\n destStorage = 'First Storage'\n request = PostMoveFileRequest.new(src, dest, versionId, storage, destStorage)\n\n result = @storage_api.post_move_file(request)\n assert result.code == 200, 'Error while moving document'\n\n end", "def move_file\n\n end", "def convert_instance(instance)\n state = @@INSTANCE_STATE_MAP[instance[\"status\"]]\n Instance.new(\n :id => instance[\"id\"],\n :owner_id => instance[\"owner\"],\n :image_id => instance[\"imageId\"],\n :name => instance[\"name\"],\n :realm_id => instance[\"location\"],\n :state => state,\n :actions => instance_actions_for(state),\n :public_addresses => [ InstanceAddress.new(instance[\"primaryIP\"][\"ip\"]) ],\n :private_addresses => [],\n :instance_profile => InstanceProfile.new(instance[\"instanceType\"].gsub('/', '-')),\n :launch_time => instance[\"launchTime\"],\n :keyname => instance[\"keyName\"]\n )\n end", "def move\n super\n gravitize\n end", "def moveitem\n\n\t\terrors = []\n\n\t\t@binder = Binder.find(params[:id])\n\n\t\tif params[:target] != params[:id]\n\n\t\t\tsrc = Mongo.log(current_teacher.id.to_s,\n\t\t\t\t\t\t\t__method__.to_s,\n\t\t\t\t\t\t\tparams[:controller].to_s,\n\t\t\t\t\t\t\t@binder.id.to_s,\n\t\t\t\t\t\t\tparams)\n\n\t\t\t@binder.sift_siblings()\n\n\t\t\t@inherited = inherit_from(params[:target])\n\n\t\t\t@parenthash = @inherited[:parenthash]\n\t\t\t@parentsarr = @inherited[:parentsarr]\n\t\t\t@parentperarr = @inherited[:parentperarr]\n\n\t\t\t@parent_child_count = @inherited[:parent_child_count]\n\n\t\t\t#nps = new parents, ops = old parents\n\n\t\t\t@nps = @parentsarr.collect {|x| x[\"id\"] || x[:id]}\n\n\n\t\t\tif !@nps.include?(params[:id])\n\n\t\t\t\t@ops = @binder.parents.collect {|x| x[\"id\"] || x[:id]}\n\t\t\t\t@ops.each do |opid|\n\t\t\t\t\tif opid != \"0\"\n\t\t\t\t\t\top = Binder.find(opid)\n\n\t\t\t\t\t\top.update_attributes(\t:owned_fork_total => op.owned_fork_total - (@binder.fork_total+@binder.owned_fork_total),\n\t\t\t\t\t\t\t\t\t\t\t\t:files\t\t=> op.files - @binder.files,\n\t\t\t\t\t\t\t\t\t\t\t\t:folders\t=> op.folders - @binder.folders - (@binder.type == 1 ? 1 : 0),\n\t\t\t\t\t\t\t\t\t\t\t\t:total_size\t=> op.total_size - @binder.total_size,\n\t\t\t\t\t\t\t\t\t\t\t\t:pub_size\t=> op.pub_size - @binder.pub_size,\n\t\t\t\t\t\t\t\t\t\t\t\t:priv_size\t=> op.priv_size - @binder.priv_size)\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\t\t#Binder.find(op.last).inc(:children,-1)\n\n\t\t\t\t# DELAYTAG\n\t\t\t\tBinder.delay(:queue => 'thumbgen').generate_folder_thumbnail(@binder.parent[\"id\"] || @binder.parent[:id])\n\n\t\t\t\t#Save old permissions to remove childrens' inherited permissions\n\t\t\t\t@ppers = @binder.parent_permissions\n\n\t\t\t\t@binder.update_attributes(\t:parent\t\t\t\t=> @parenthash,\n\t\t\t\t\t\t\t\t\t\t\t:parents\t\t\t=> @parentsarr,\n\t\t\t\t\t\t\t\t\t\t\t:parent_permissions\t=> @parentperarr,\n\t\t\t\t\t\t\t\t\t\t\t:order_index\t\t=> @parent_child_count)\n\n\n\t\t\t\t# DELAYTAG\n\t\t\t\tBinder.delay(:queue => 'thumbgen').generate_folder_thumbnail(@binder.parent[\"id\"] || @binder.parent[:id])\n\n\t\t\t\t# must update the common ancestor of the children before\n\t\t\t\t@binder.update_parent_tags()\n\n\t\t\t\t#@binder is the object being moved\n\t\t\t\t#If directory, deal with the children\n\t\t\t\tif @binder.type == 1 #Eventually will apply to type == 3 too\n\n\t\t\t\t\t@children = @binder.subtree\n\n\t\t\t\t\t@children.each do |h|\n\n\n\t\t\t\t\t\t@current_parents = h.parents\n\n\t\t\t\t\t\t@size = @current_parents.size\n\n\t\t\t\t\t\t@npperarr = h.parent_permissions\n\n\t\t\t\t\t\t@ppers.each {|p| @npperarr.delete(p)}\n\n\t\t\t\t\t\th.update_attributes(:parents\t\t\t=> @parentsarr + @current_parents[(@current_parents.index({\"id\" => @binder.id.to_s, \"title\" => @binder.title}))..(@size - 1)],\n\t\t\t\t\t\t\t\t\t\t\t:parent_permissions\t=> @parentperarr + @npperarr)\n\n\t\t\t\t\t\th.update_parent_tags()\n\n\t\t\t\t\t\tMongo.log(\tcurrent_teacher.id.to_s,\n\t\t\t\t\t\t\t\t\t__method__.to_s,\n\t\t\t\t\t\t\t\t\tparams[:controller].to_s,\n\t\t\t\t\t\t\t\t\th.id.to_s,\n\t\t\t\t\t\t\t\t\tparams,\n\t\t\t\t\t\t\t\t\t{ :src => src })\n\t\t\t\t\tend\n\n\t\t\t\tend\n\n\t\t\t\t#Update new parents' folder/file/size counts\n\t\t\t\t@parents = @binder.parents.collect {|x| x[\"id\"] || x[:id]}\n\n\t\t\t\t@parents.each do |pid|\n\t\t\t\t\tif pid != \"0\"\n\t\t\t\t\t\tparent = Binder.find(pid)\n\n\t\t\t\t\t\tparent.update_attributes(\t:owned_fork_total => parent.owned_fork_total + (@binder.fork_total+@binder.owned_fork_total),\n\t\t\t\t\t\t\t\t\t\t\t\t\t:files\t\t=> parent.files + @binder.files,\n\t\t\t\t\t\t\t\t\t\t\t\t\t:folders\t=> parent.folders + @binder.folders + (@binder.type == 1 ? 1 : 0),\n\t\t\t\t\t\t\t\t\t\t\t\t\t:total_size\t=> parent.total_size + @binder.total_size,\n\t\t\t\t\t\t\t\t\t\t\t\t\t:pub_size \t=> parent.pub_size + @binder.pub_size,\n\t\t\t\t\t\t\t\t\t\t\t\t\t:priv_size \t=> parent.priv_size + @binder.priv_size)\n\t\t\t\t\tend\n\t\t\t\tend\n\n\t\t\telse\n\n\t\t\t\terrors << \"Invalid target location\"\n\n\t\t\tend\n\n\t\telse\n\n\t\t\terrors << \"You cannot put something inside itself\"\n\n\t\tend\n\n\t\trescue BSON::InvalidObjectId\n\t\t\terrors << \"Invalid Request\"\n\t\trescue Mongoid::Errors::DocumentNotFound\n\t\t\terrors << \"Invalid Request\"\n\t\tensure\n\t\t\trespond_to do |format|\n\t\t\t\tformat.html {render :text => errors.empty? ? 1 : errors.map{|err| \"<li>#{err}</li>\"}.join.html_safe}\n\t\t\tend\n\n\tend", "def receive_move_by_player\n @game = Game.find_by_id(params[:game_id])\n do_move_by_player params[:drop_zone]\n \n handle_response_display true\n end", "def move(src, dst)\n not_implemented('move')\n end", "def move request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n uri, _body, query_string_params = transcode_move_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::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n result\n end", "def move_slide_with_http_info(name, slide_index, new_position, password = nil, folder = nil, storage = nil)\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: SlidesApi.move_slide ...'\n end\n\n # verify the required parameter 'name' is set\n if @api_client.config.client_side_validation && name.nil?\n fail ArgumentError, \"Missing the required parameter 'name' when calling SlidesApi.move_slide\"\n end\n # verify the required parameter 'slide_index' is set\n if @api_client.config.client_side_validation && slide_index.nil?\n fail ArgumentError, \"Missing the required parameter 'slide_index' when calling SlidesApi.move_slide\"\n end\n # verify the required parameter 'new_position' is set\n if @api_client.config.client_side_validation && new_position.nil?\n fail ArgumentError, \"Missing the required parameter 'new_position' when calling SlidesApi.move_slide\"\n end\n # resource path\n local_var_path = '/slides/{name}/slides/{slideIndex}/move'\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'name', name)\n local_var_path = @api_client.replace_path_parameter(local_var_path, 'slideIndex', slide_index)\n\n # query parameters\n query_params = {}\n query_params[:'newPosition'] = @api_client.prepare_for_query(new_position) unless new_position.nil?\n query_params[:'folder'] = @api_client.prepare_for_query(folder) unless folder.nil?\n query_params[:'storage'] = @api_client.prepare_for_query(storage) unless storage.nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n header_params[:'password'] = password unless password.nil?\n\n # http body (model)\n post_body = nil\n\n # form parameters\n post_files = []\n\n auth_names = ['JWT']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :body => post_body,\n :files => post_files,\n :auth_names => auth_names,\n :return_type => 'Slides')\n return data, status_code, headers\n end", "def test_post_move_folder()\n\n src = 'folder6'\n dest = 'folder7/folder6'\n storage = 'First Storage'\n dest_storage = 'First Storage'\n request = PostMoveFolderRequest.new(src, dest, storage, dest_storage)\n\n result = @storage_api.post_move_folder(request)\n assert result.code == 200, 'Error while moving folder'\n\n end", "def smove(*arguments)\n\t\t\t\t\tcall(\"SMOVE\", *arguments)\n\t\t\t\tend", "def move(admin, r, newServer, original)\n # Now move it. Do it in a loop so can retry if fail. Have seen issue where\n # we tried move region but failed and retry put it back on old location;\n # retry in this case.\n\n retries = admin.getConfiguration.getInt(\"hbase.move.retries.max\", 5)\n count = 0\n same = true\n start = Time.now\n while count < retries and same\n if count > 0\n $LOG.info(\"Retry \" + count.to_s + \" of maximum \" + retries.to_s)\n end\n count = count + 1\n begin\n admin.move(Bytes.toBytes(r.getEncodedName()), Bytes.toBytes(newServer))\n rescue java.lang.reflect.UndeclaredThrowableException,\n org.apache.hadoop.hbase.UnknownRegionException => e\n $LOG.info(\"Exception moving \" + r.getEncodedName() +\n \"; split/moved? Continuing: \" + e)\n return\n end\n # Wait till its up on new server before moving on\n maxWaitInSeconds = admin.getConfiguration.getInt(\"hbase.move.wait.max\", 60)\n maxWait = Time.now + maxWaitInSeconds\n while Time.now < maxWait\n same = isSameServer(admin, r, original)\n break unless same\n sleep 0.1\n end\n end\n raise RuntimeError, \"Region stuck on #{original}, newserver=#{newServer}\" if same\n # Assert can Scan from new location.\n isSuccessfulScan(admin, r)\n $LOG.info(\"Moved region \" + r.getRegionNameAsString() + \" cost: \" + \n java.lang.String.format(\"%.3f\", (Time.now - start)))\nend", "def move options\n\t\t# Options: time, location, correction\n\t\tif options[:handle_code].to_i == 6\n\t\t\tif self.location_network != Location.find(options[:location_id]).network\n\t\t\t\tself.last_action_time = options[:time]\n\t\t\t\tself.location_id = options[:location_id]\n\t\t\t\tself.asset_activity_fact = AssetActivityFact.create_from_asset(self)\n\t\t\t\tself.asset_activity_fact.save!\n\t\t\t\tprint \"RFNet Catch \\n\"\n\t\t\tend\n\t\telse\t\t\t\n\t\t\tprint \"Not RF \\n\"\t\t\t\n\t\t\tself.last_action_time = options[:time]\t\t\t# Required\n\t\t\tself.location_id = options[:location_id]\t\t# Required\n\t\t\tself.user_id = options[:user_id]\n\n\t\t\toptions[:asset_type_id].nil? ? nil : self.asset_type_id = options[:asset_type_id] \t\t\t\t\t# If not nil\t\t\t\t\t\n\t\t\toptions[:batch_number].nil? ? nil : self.batch_number = options[:batch_number]\n\t\t\toptions[:product_id].nil? ? nil : self.product_id = options[:product_id] \t\t\t\t\t\t\t# If not nil\n\n\t\t\tunless options[:product_id].nil?\n\t\t\t\tself.fill_time = options[:time]\n\t\t\tend\n\n\t\t\tself.asset_activity_fact = AssetActivityFact.create_from_asset(self)\n\t\t\tself.asset_activity_fact.save!\n\n\t\t\tself.save!\n\t\tend\n#\t\tself.add_to_invoice(options)\n\tend", "def moving!\n end", "def move(*args)\n begin\n move_no_cleanup(*args)\n rescue Orp::MovementAlreadyComplete\n warn \"Attempted to complete already completed movement\"\n nil\n rescue\n delete\n raise\n end\n end", "def move(to)\n @moved = true\n super(to)\n end", "def respawn\r\n @object.id = @original_id\r\n @depleted = false\r\n end", "def moveInCargo _obj, _args\n \"_obj moveInCargo _args;\" \n end", "def moveObjectToEnd _obj, _args\n \"_obj moveObjectToEnd _args;\" \n end", "def moveInCommander _obj, _args\n \"_obj moveInCommander _args;\" \n end", "def apply\n\t\tunless @already_added\n\t\t\t@space.entities.add @clone\n\t\t\t@already_added = true\n\t\tend\n\t\t\n\t\t@move_action.apply\n\tend", "def pre_sync\n #move\n end", "def move_without_saving(vector)\n if vector.kind_of?(Hash)\n action, object = vector.keys[0], vector.values[0]\n else\n action = vector\n end\n\n # set the start position to 1 or, if offset in the list_options is :list, :first => X\n minpos = model.list_options[:first]\n\n # the previous position (if changed) else current position\n prepos = original_attributes[properties[:position]] || position\n\n # set the last position in the list or previous position if the last item\n maxpos = (last = list.last) ? (last == self ? prepos : last.position + 1) : minpos\n\n newpos = case action\n when :highest then minpos\n when :top then minpos\n when :lowest then maxpos\n when :bottom then maxpos\n when :higher,:up then [ position - 1, minpos ].max\n when :lower,:down then [ position + 1, maxpos ].min\n when :above\n # the object given, can either be:\n # -- the same as self\n # -- already below self\n # -- higher up than self (lower number in list)\n ( (self == object) or (object.position > self.position) ) ? self.position : object.position\n\n when :below\n # the object given, can either be:\n # -- the same as self\n # -- already above self\n # -- lower than self (higher number in list)\n ( self == object or (object.position < self.position) ) ? self.position : object.position + 1\n\n when :to\n # can only move within top and bottom positions of list\n # -- .move(:to => 2 ) Hash with FixNum\n # -- .move(:to => '2' ) Hash with String\n\n # NOTE:: sensitive functionality\n # maxpos is incremented above, so decrement by 1 to get true maxpos\n # minpos is fixed, so just take the object position value given\n # else add 1 to object position value\n obj = object.to_i\n if (obj > maxpos)\n [ minpos, [ obj, maxpos - 1 ].min ].max\n else\n [ minpos, [ obj, maxpos ].min ].max\n end\n\n else\n raise ArgumentError, \"unrecognized vector: [#{action}]. Please check your spelling and/or the docs\" if action.is_a?(Symbol)\n # -- .move(2) as FixNum only\n # -- .move('2') as String only\n if action.to_i < minpos\n [ minpos, maxpos - 1 ].min\n else\n [ action.to_i, maxpos - 1 ].min\n end\n end\n\n # don't move if already at the position\n return false if [ :lower, :down, :higher, :up, :top, :bottom, :highest, :lowest, :above, :below ].include?(action) && newpos == prepos\n return false if !newpos || ([ :above, :below ].include?(action) && list_scope != object.list_scope)\n return true if newpos == position && position == prepos || (newpos == maxpos && position == maxpos - 1)\n\n if !position\n list.all(:position.gte => newpos).adjust!({ :position => 1 }, true) unless action =~ /:(lowest|bottom)/\n elsif newpos > prepos\n newpos -= 1 if [:lowest,:bottom,:above,:below].include?(action)\n list.all(:position => prepos..newpos).adjust!({ :position => -1 }, true)\n elsif newpos < prepos\n list.all(:position => newpos..prepos).adjust!({ :position => 1 }, true)\n end\n\n self.position = newpos\n self.moved = true\n true\n end", "def shift\n orphan_resource(super)\n end", "def move_machine(machine, from, to)\n handle_action_exceptions(__method__) do\n cmd_line = [\"movemachine '#{machine}' '#{from}' '#{to}'\"]\n cmd_line << 'json' if @json\n\n handle_return(@toolshck_ether.cmd(cmd_line.join(' ')))\n end\n end", "def relocate!\n raise 'Abstract method'\n end", "def move_files\n source_dir = Item.new(Path.new(params[:source]))\n dest_dir = Item.new(Path.new(params[:dest]))\n type = params[:type]\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.move_files_to(dest_dir, type)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end", "def move_card(card, destination)\n card.location = destination\n card.save\n end", "def move( x, y=nil )\n self.dup.move!(x, y)\n end", "def move(direction)\n \n end", "def move_folder\n source_dir = Item.new(Path.new(params[:source_dir]))\n dest_dir = Item.new(Path.new(params[:dest_dir]))\n\n response = {}\n response[:source_dir] = source_dir\n response[:dest_dir] = dest_dir\n if source_dir.move_to(dest_dir)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end", "def batch_move(batch_client, new_folder = nil, new_state = nil)\n perform_move(client, batch_client, scope_parameters, [id], {}, new_folder, new_state)\n end", "def restore\n p \"Doing a restore ...\"\n params = {:instance_href => \"/api/clouds/907/instances/#{@instance2_id}\"}\n id = @test_client.backups.index(:lineage => \"ns_backup_test_lineage\").first.show.href.split(\"/\")[-1] # => to get the id\n task = @test_client.backups(:id => id).show.restore(params)\n return task\nend", "def move_picture picture\n end", "def moveInDriver _obj, _args\n \"_obj moveInDriver _args;\" \n end", "def moves\n # overridden in slideable/stepable modules\n end", "def post_move(filename,src_repo,data)\n curl_post(\"#{self.host}/api2/repos/#{src_repo}/file/?p=#{filename}\",data).body_str\n end", "def moveInGunner _obj, _args\n \"_obj moveInGunner _args;\" \n end", "def move_next\n \n # before validation, clear validation residues\n self.clear_associated_errors\n \n Logger.new(STDOUT).info(\"Step: \" + self.step.to_s)\n Logger.new(STDOUT).info(\"Sortie object before validation: \" + self.sortie.inspect)\n if self.valid?\n \n # init some new defaults in here\n case self.step\n when 0, 1\n \n case self.step\n when 0\n \n case self.operation\n when 'join'\n # create sortie result object on selected geo\n\n # respond ajax/json for map refresh\n\n #@sorties = Sortie.find_sorties_for_user(current_user)\n @sorties ||= []\n \n when 'create'\n\n # not much to do\n #@user = session[:user]\n self.sortie ||= Sortie.new( :time => self.timerange.start )\n Logger.new(STDOUT).info(self.sortie.inspect)\n\n end\n \n when 1\n \n # switch to full validation for user, TODO: revert, refactor for existing usser...\n self.host.completeness = 'complete' if self.host.completeness == 'discovery'\n \n # profile/review step\n # profile: # set up dob year based on age\n\n # actually need to be refactored: it's a submit...\n case self.operation\n when 'join'\n #session[:selected_dates] = params[:dates]\n\n\n when 'create'\n\n end\n \n end\n \n # common for step 0 and 1\n self.step += 1\n 'next'\n when 2\n # finish...\n self.save_associated\n # do save etc. call separate action?\n self.complete = {'create' => 'created', 'join' => 'joined'}[self.operation]\n 'complete'\n end\n else\n Logger.new(STDOUT).info(\"Stepflow Validation Errors: \" + self.errors.full_messages.inspect)\n 'error'\n end\n end", "def move_params\n params.fetch(:move, {})\n end", "def move_diffs\n\n end", "def move!\r\n return unless create_new_parent?\r\n parent_arg = find_new_parent\r\n self.move_to_child_of(parent_arg)\r\n if parent_arg\r\n self.debate_id = parent_arg.debate_id\r\n self.children.update_all(\"debate_id = #{parent_arg.debate_id}\")\r\n end\r\n end", "def user_move(start, finish)\n start , finish = Board.pos_to_coord(start), Board.pos_to_coord(finish)\n self[finish] = self[start]\n self[start] = NullPiece.instance\n self[finish].position = finish\n end", "def move(command)\n src = clean_up(command[1])\n dest = clean_up(command[2])\n pp @client.files.move(src, dest)\n end", "def move(x,y)\n self.dup.move!(x,y)\n end", "def test_move\n map = create_towns\n p1 = Prospector::new map[0]\n test_i = move p1, map, 2\n assert test_i, -1\n end", "def init_private_members\n super\n @move_route = nil # Move route\n @move_route_index = 0 # Move route execution position\n @original_move_route = nil # Original move route\n @original_move_route_index = 0 # Original move route execution position\n @wait_count = 0 # Wait count\n end", "def move_diffs\n \n end", "def update_routine_move\n if @wait_count > 0\n @wait_count -= 1\n else\n @move_succeed = true\n command = @move_route.list[@move_route_index]\n if command\n process_move_command(command)\n advance_move_route_index\n end\n end\n end", "def instance=(instance); end", "def rollback_instance request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_rollback_instance_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end", "def move_file\n source_file = Item.new(Path.new(params[:source_file]))\n dest_file = Item.new(Path.new(params[:dest_file]))\n\n response = {}\n if source_file.path.to_s == dest_file.path.to_s\n response[:msg] = \"Same file\"\n render json: response, status: 200\n return\n end\n\n response[:source_file] = source_file\n response[:dest_file] = dest_file\n if source_file.move_to(dest_file)\n response[:msg] = \"Success\"\n render json: response, status: 200\n else\n response[:msg] = \"Fail\"\n render json: response, status: 402\n end\n end", "def set_instance\n if Instance.exists?(params[:id])\n @instance = Instance.find(params[:id])\n else\n render json: { error: 'No se ejecuto nada con ese id', codigo: 707 }\n end\n end", "def set_instance\n @instance = @workflow.instances.find(params[:instance_id])\n end", "def Move(player, start, stop)\r\n end", "def move_item(id, to)\n record \"/todos/move_item/#{id}\", :to => to\n end", "def update_instance request_pb, options = nil\n raise ::ArgumentError, \"request must be provided\" if request_pb.nil?\n\n verb, uri, query_string_params, body = ServiceStub.transcode_update_instance_request request_pb\n query_string_params = if query_string_params.any?\n query_string_params.to_h { |p| p.split \"=\", 2 }\n else\n {}\n end\n\n response = @client_stub.make_http_request(\n verb,\n uri: uri,\n body: body || \"\",\n params: query_string_params,\n options: options\n )\n operation = ::Gapic::Rest::TransportOperation.new response\n result = ::Google::Longrunning::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, operation if block_given?\n result\n end" ]
[ "0.7261041", "0.68380046", "0.64573467", "0.6040252", "0.6040252", "0.5971018", "0.59322816", "0.58851117", "0.583903", "0.5821589", "0.58022183", "0.57998997", "0.5789968", "0.5789968", "0.5773893", "0.5762453", "0.5751228", "0.57282317", "0.5724356", "0.5676663", "0.5676663", "0.5645921", "0.5627368", "0.5625708", "0.5529165", "0.5467768", "0.54101026", "0.53854537", "0.53754175", "0.53648645", "0.534241", "0.5336151", "0.53258204", "0.53258204", "0.5323612", "0.53179663", "0.5311131", "0.53074175", "0.5301014", "0.5290964", "0.5289275", "0.52890235", "0.52767485", "0.5265258", "0.5256462", "0.52364737", "0.5227767", "0.522327", "0.52170557", "0.5182843", "0.5181898", "0.5180982", "0.5164944", "0.5156747", "0.513673", "0.51305574", "0.51076686", "0.51061594", "0.5104916", "0.50862074", "0.50856245", "0.50807565", "0.505202", "0.50471026", "0.50376153", "0.5032958", "0.5031149", "0.5029465", "0.50168353", "0.49999696", "0.49936932", "0.49930677", "0.4991284", "0.49892026", "0.49886537", "0.4987928", "0.49767452", "0.49763417", "0.49720544", "0.49704424", "0.4969063", "0.49637964", "0.49607322", "0.49588287", "0.49539202", "0.49513626", "0.49506074", "0.4942692", "0.49388134", "0.4934833", "0.49317273", "0.4928737", "0.49252903", "0.49215934", "0.4919661", "0.4913634", "0.4908241", "0.48988485", "0.48947614", "0.4889103" ]
0.7474949
0
Baseline implementation for the set_common_instance_metadata REST call
def set_common_instance_metadata request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_set_common_instance_metadata_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_common_instance_metadata request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/setCommonInstanceMetadata\"\n body = request_pb.metadata_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def process_metadata\n if @response\n self.resource.metadata[:http_version] = @response.http_version\n self.resource.metadata[:status] = @response.status\n self.resource.metadata[:reason] = @response.reason\n self.resource.metadata[:headers] = @response.headers\n end\n end", "def metadata=(_); end", "def set_metadata(*args)\n self.metadata.set(*args)\n end", "def response_metadata=(_); end", "def set_vm_metadata(vm_cid, metadata)\n @telemetry_manager.monitor('initialize') do\n _init_azure\n end\n with_thread_name(\"set_vm_metadata(#{vm_cid})\") do\n @telemetry_manager.monitor('set_vm_metadata', id: vm_cid) do\n @logger.info(\"set_vm_metadata(#{vm_cid}, #{metadata})\")\n @vm_manager.set_metadata(InstanceId.parse(vm_cid, _azure_config.resource_group_name), encode_metadata(metadata))\n end\n end\n end", "def initialize(client, address, other_metadata = {})\n super(client, address)\n @written_md_vars = {}\n @metadata_loaded = false\n @metadata = {}\n \n key_lookup = self.class.md_key_map\n type_lookup = self.class.md_type_coercion_map\n other_metadata.each do |key, value|\n insert_metadata key, value, key_lookup, type_lookup\n end\n end", "def metadata=(_arg0); end", "def metadata=(value)\n @metadata = value\n end", "def metadata=(value)\n @metadata = value\n end", "def update_initial_metadata(metadata)\n end", "def set_meta_headers_for(instance)\n # Open storage with cf admin credentials for setting quotas and meta-key\n storage_options_for_tenant = @fog_options[:storage].merge(:hp_tenant_id => instance.tenant_id)\n storage = VCAP::Services::Swift::Storage.new(@logger, storage_options_for_tenant)\n storage.set_meta_key_and_quotas(instance.account_meta_key, BASE_QUOTA)\n end", "def populate_meta(servers, operation, overwrite=false)\n save_output_value('method', operation) if operation\n\n # Cannot use 'read_output_value' without ensuring the value is already set, otherwise it will\n # return the value from the previous run, so we will have to hack it until the read_output_value\n # method can take a \"ignore_previous\" type flag -- akk\n my_context_outputs = get_field('__context_outputs__') || {}\n context_servers = (overwrite ? nil : my_context_outputs[SERVERS_CONTEXT_OUTPUT_KEY]) || []\n \n servers.each do |server|\n raise ArgumentError, \"Parameter is not a Fog::Compute::Server object, it is a #{server.class}\" unless server.is_a?(Fog::Compute::Server)\n\n # delete if already exists\n context_servers.delete_if {|s| s['id'] == server.identity and s['provider'] == provider}\n\n server_meta_data = { 'id' => server.identity, 'name' => server_name(server), 'ip' => server.public_ip_address, 'image' => server_image_id(server), 'flavor' => server_flavor_id(server) , 'provider' => provider }\n ipv4 = server.public_ip_address\n server_meta_data['ipv4'] = ipv4 if ipv4\n context_servers << server_meta_data\n end\n save_output_value(SERVERS_CONTEXT_OUTPUT_KEY, context_servers)\n end", "def set_metadata(metadatahash)\n headers = {}\n metadatahash.each{|key, value| headers['X-Object-Meta-' + key.to_s.capitalize] = value.to_s}\n response = self.container.connection.cfreq(\"POST\",@storagehost,@storagepath,headers)\n raise NoSuchObjectException, \"Object #{@name} does not exist\" if (response.code == \"404\")\n raise InvalidResponseException, \"Invalid response code #{response.code}\" unless (response.code == \"202\")\n true\n end", "def apply_base_metadata\n\t\tdc_ds = self.dc\n\t\tdesc_ds = self.descMetadata\n\n\t \t#Here's where we call specific additional metadata changes...\n\t\tif self.respond_to?(:apply_specific_base_metadata)\n self.apply_specific_base_metadata\n end\t\n\n #Add the dc required elements\n\t\tdc_ds.update_indexed_attributes([:dc_identifier]=> self.pid) unless dc_ds.nil?\n\t\tdc_ds.update_indexed_attributes([:dc_genre]=>self.get_values_from_datastream(\"descMetadata\", [:genre], {}).to_s) unless dc_ds.nil?\n\t\n\t\t#Add the descMetadata required elements\n\t\tdesc_ds.update_indexed_attributes([:identifier]=> self.pid) unless desc_ds.nil?\n\t\tdesc_ds.update_indexed_attributes([:location, :primary_display]=> \"http://hydra.hull.ac.uk/resources/\" + self.pid) unless desc_ds.nil?\n\t return true\n end", "def set_vm_metadata(vm_id, metadata)\n @logger.info('Setting virtual machine metadata...')\n end", "def metadata=(metadata)\n @metadata = metadata\n end", "def metadata=(metadata)\n @metadata = metadata\n end", "def metadata=(metadata)\n @metadata = metadata\n end", "def metadata=(metadata)\n @metadata = metadata\n end", "def instance_data\n @instance_data ||= JSON.parse(Net::HTTP.get(URI.parse('http://169.254.169.254/latest/dynamic/instance-identity/document')))\n end", "def set_vm_metadata(server_id, metadata)\n with_thread_name(\"set_vm_metadata(#{server_id}, ...)\") do\n @openstack.with_openstack do\n server = @openstack.compute.servers.get(server_id)\n cloud_error(\"Server `#{server_id}' not found\") unless server\n\n TagManager.tag_server(server, metadata)\n\n if server.metadata.get(REGISTRY_KEY_TAG)\n name = metadata['name']\n job = metadata['job']\n index = metadata['index']\n compiling = metadata['compiling']\n if name\n @logger.debug(\"Rename VM with id '#{server_id}' to '#{name}'\")\n @openstack.compute.update_server(server_id, 'name' => name.to_s)\n elsif job && index\n @logger.debug(\"Rename VM with id '#{server_id}' to '#{job}/#{index}'\")\n @openstack.compute.update_server(server_id, 'name' => \"#{job}/#{index}\")\n elsif compiling\n @logger.debug(\"Rename VM with id '#{server_id}' to 'compiling/#{compiling}'\")\n @openstack.compute.update_server(server_id, 'name' => \"compiling/#{compiling}\")\n end\n else\n @logger.debug(\"VM with id '#{server_id}' has no 'registry_key' tag\")\n end\n end\n end\n end", "def initialize(metadata, instance)\n @metadata, @instance = metadata, instance\n end", "def derive_metadata\n primary_jsons = derive_rnp_jsons.reject { |j| j[\"primary key grip\"] }\n secret_json, public_json = %w[secret public].map do |k|\n primary_jsons.detect { |j| j[\"#{k} key\"][\"present\"] }\n end\n\n json = merge_public_secret_jsons(\n secret_json: secret_json,\n public_json: public_json,\n )\n\n update_column(:metadata, json)\n end", "def save(*args, &block)\n super\n # begin\n # require 'restclient'\n # server[\"/instances/#{instance_id}\"].put(to_json)\n # rescue Exception => e\n # Metavirt::Log.error \"cloudkit fail:\\n\\t#{e.inspect}\"\n # end\n self\n end", "def load_attrs\n self.availability_zone = cluster_config[:availability_zone] || Settings.availability_zone\n self.image_id = cluster_config[:image_id] if cluster_config[:image_id]\n self.instance_type = cluster_config[:instance_type] if cluster_config[:instance_type]\n # self.deletes_on_termination = cluster_config[:deletes_on_termination] if cluster_config[:deletes_on_termination]\n end", "def write_metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def metadata; end", "def update_metadata(metric, options= {})\n @metadata_svc.update(metric, options)\n end", "def apply_extracted_metadata\n\n return if content_blob.nil? or content_type.nil?\n\n metadata = Workflow.extract_metadata(:type => content_type.title, :data => content_blob.data)\n\n self.title = metadata[\"title\"] if metadata[\"title\"] and title.nil?\n self.body = metadata[\"description\"] if metadata[\"description\"] and body.nil?\n self.image = metadata[\"image\"] if metadata[\"image\"] and image.nil?\n self.svg = metadata[\"svg\"] if metadata[\"svg\"] and svg.nil?\n end", "def apply_extracted_metadata\n\n return if content_blob.nil? or content_type.nil?\n\n metadata = Workflow.extract_metadata(:type => content_type.title, :data => content_blob.data)\n\n self.title = metadata[\"title\"] if metadata[\"title\"] and title.nil?\n self.body = metadata[\"description\"] if metadata[\"description\"] and body.nil?\n self.image = metadata[\"image\"] if metadata[\"image\"] and image.nil?\n self.svg = metadata[\"svg\"] if metadata[\"svg\"] and svg.nil?\n end", "def ec2_instance_data # rubocop:disable Metrics/MethodLength, Metrics/AbcSize\n i = {\n :placement => {\n :availability_zone => config[:availability_zone]\n },\n :instance_type => config[:instance_type],\n :ebs_optimized => config[:ebs_optimized],\n :image_id => config[:image_id],\n :key_name => config[:aws_ssh_key_id],\n :subnet_id => config[:subnet_id],\n :private_ip_address => config[:private_ip_address]\n }\n i[:block_device_mappings] = block_device_mappings unless block_device_mappings.empty?\n i[:security_group_ids] = config[:security_group_ids] if config[:security_group_ids]\n i[:user_data] = prepared_user_data if prepared_user_data\n if config[:iam_profile_name]\n i[:iam_instance_profile] = { :name => config[:iam_profile_name] }\n end\n if !config.fetch(:associate_public_ip, nil).nil?\n i[:network_interfaces] =\n [{\n :device_index => 0,\n :associate_public_ip_address => config[:associate_public_ip],\n :delete_on_termination => true\n }]\n # If specifying `:network_interfaces` in the request, you must specify\n # network specific configs in the network_interfaces block and not at\n # the top level\n if config[:subnet_id]\n i[:network_interfaces][0][:subnet_id] = i.delete(:subnet_id)\n end\n if config[:private_ip_address]\n i[:network_interfaces][0][:private_ip_address] = i.delete(:private_ip_address)\n end\n if config[:security_group_ids]\n i[:network_interfaces][0][:groups] = i.delete(:security_group_ids)\n end\n end\n i\n end", "def put_vapp_metadata_item_metadata(vm_id, metadata_key, metadata_value)\n body=\"\n <MetadataValue xmlns=\\\"http://www.vmware.com/vcloud/v1.5\\\">\n <Value>#{metadata_value}</Value>\n </MetadataValue>\"\n\n request(\n :body => body,\n :expects => 202,\n :headers => {'Content-Type' => \"application/vnd.vmware.vcloud.metadata.value+xml\"},\n :method => 'PUT',\n :parser => Fog::ToHashDocument.new,\n :path => \"vApp/#{vm_id}/metadata/#{URI.escape(metadata_key)}\"\n )\n end", "def get_specific_metadata_for_preservation\n res = ''\n instances.each do |ins|\n res += '<representation>'\n res += \"<name>#{ins.instance_name}</name>\"\n res += \"<uuid>#{ins.uuid}</uuid>\"\n res += '</representation>'\n end\n res\n end", "def metadata\n @metadata ||= Metaforce::Metadata::Client.new(@options)\n end", "def create_image_metadata\n {}\n end", "def get_instance_data\n JSON.parse(Net::HTTP.get(URI.parse('http://169.254.169.254/latest/dynamic/instance-identity/document')))\n end", "def set_page_meta_info(custom_extended_data = {})\n service_response = GetPageMetaInfo.new(\n controller: params[:controller],\n action: params[:action],\n request_url: request.url,\n custom_extended_data: custom_extended_data\n ).perform\n\n unless service_response.success?\n raise 'Incomplete Page Meta.'\n end\n\n page_extended_data = service_response.data\n\n @page_meta_data = page_extended_data[:meta]\n @page_assets_data = page_extended_data[:assets]\n end", "def set_page_meta_info(custom_extended_data = {})\n service_response = GetPageMetaInfo.new(\n controller: params[:controller],\n action: params[:action],\n request_url: request.url,\n custom_extended_data: custom_extended_data\n ).perform\n\n unless service_response.success?\n raise 'Incomplete Page Meta.'\n end\n\n page_extended_data = service_response.data\n\n @page_meta_data = page_extended_data[:meta]\n @page_assets_data = page_extended_data[:assets]\n end", "def set_page_meta_info(custom_extended_data = {})\n service_response = GetPageMetaInfo.new(\n controller: params[:controller],\n action: params[:action],\n request_url: request.url,\n custom_extended_data: custom_extended_data\n ).perform\n\n unless service_response.success?\n raise 'Incomplete Page Meta.'\n end\n\n page_extended_data = service_response.data\n\n @page_meta_data = page_extended_data[:meta]\n @page_assets_data = page_extended_data[:assets]\n end", "def update_metadata(params)\n @client.put(metadata_path, nil, params, \"Content-Type\" => \"application/json\")\n end", "def set_meta_headers(headers)\n @logger.info \"Setting #{headers.keys.join(', ')} for tenant #{@fog_options[:hp_tenant_id]}...\"\n response = @connection.request({\n :method => 'POST',\n :headers => headers\n })\n\n # Confirm meta data changes\n response = @connection.request({\n :method => 'HEAD'\n })\n\n @logger.info \"Done setting account meta key.\"\n end", "def set_asset_metadata\n headers = fog_connection.head_object(CarrierWave::Uploader::Base.fog_directory, upload_data[:path]).headers\n\n self.name = upload_data[:filename]\n self.size = headers['Content-Length']\n self.etag = headers['Etag']\n self.content_type = headers['Content-Type']\n end", "def update_kubernetes_virtual_machine_instance_type_with_http_info(moid, kubernetes_virtual_machine_instance_type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.update_kubernetes_virtual_machine_instance_type ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.update_kubernetes_virtual_machine_instance_type\"\n end\n # verify the required parameter 'kubernetes_virtual_machine_instance_type' is set\n if @api_client.config.client_side_validation && kubernetes_virtual_machine_instance_type.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_virtual_machine_instance_type' when calling KubernetesApi.update_kubernetes_virtual_machine_instance_type\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/VirtualMachineInstanceTypes/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\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(kubernetes_virtual_machine_instance_type)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVirtualMachineInstanceType'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.update_kubernetes_virtual_machine_instance_type\",\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: KubernetesApi#update_kubernetes_virtual_machine_instance_type\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def patch_kubernetes_virtual_machine_instance_type_with_http_info(moid, kubernetes_virtual_machine_instance_type, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: KubernetesApi.patch_kubernetes_virtual_machine_instance_type ...'\n end\n # verify the required parameter 'moid' is set\n if @api_client.config.client_side_validation && moid.nil?\n fail ArgumentError, \"Missing the required parameter 'moid' when calling KubernetesApi.patch_kubernetes_virtual_machine_instance_type\"\n end\n # verify the required parameter 'kubernetes_virtual_machine_instance_type' is set\n if @api_client.config.client_side_validation && kubernetes_virtual_machine_instance_type.nil?\n fail ArgumentError, \"Missing the required parameter 'kubernetes_virtual_machine_instance_type' when calling KubernetesApi.patch_kubernetes_virtual_machine_instance_type\"\n end\n # resource path\n local_var_path = '/api/v1/kubernetes/VirtualMachineInstanceTypes/{Moid}'.sub('{' + 'Moid' + '}', CGI.escape(moid.to_s))\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n content_type = @api_client.select_header_content_type(['application/json', 'application/json-patch+json'])\n if !content_type.nil?\n header_params['Content-Type'] = content_type\n end\n header_params[:'If-Match'] = opts[:'if_match'] if !opts[:'if_match'].nil?\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(kubernetes_virtual_machine_instance_type)\n\n # return_type\n return_type = opts[:debug_return_type] || 'KubernetesVirtualMachineInstanceType'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['cookieAuth', 'http_signature', 'oAuth2', 'oAuth2']\n\n new_options = opts.merge(\n :operation => :\"KubernetesApi.patch_kubernetes_virtual_machine_instance_type\",\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(:PATCH, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: KubernetesApi#patch_kubernetes_virtual_machine_instance_type\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def all_instances\n Puppet.debug(\"all_instances - cached instances is: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object id: #{cached_instances.object_id}\")\n # return cache if it has been created, this means that this function will only need\n # to be loaded once, returning all instances that exist of this resource in vsphere\n # then, we can lookup our version by name/id/whatever. This saves a TON of processing\n return cached_instances unless cached_instances.nil?\n\n # Want to return an array of instances\n # each hash should have the same properties as the properties\n # of this \"type\"\n # remember the keys should be symbols, aka :ntp_servers not 'ntp_servers'\n # This is a tracking hash which will contain info about each host and NTP server relationships\n cmd = <<-EOF\n $ntp_servers_hash = @{}\n $hosts = #{powercli_get_online_hosts}\n foreach($h in $hosts) {\n $servers = Get-VMHostNtpServer -VMHost $h\n if ($servers) {\n $ntp_servers_hash[$h.Name] = @($servers)\n } else {\n $ntp_servers_hash[$h.Name] = @()\n }\n }\n $ntp_servers_hash | ConvertTo-Json\n EOF\n\n ntpservers_stdout = powercli_connect_exec(cmd)[:stdout]\n # json parse expects a json string, powershell does not stdout with quotes\n # we might be able to remove this line because powershell exits with a viable ruby array already:\n # [\n # \"time1.dev.encore.tech\",\n # \"time2.dev.encore.tech\"\n # ]\n # what happens if this returns null??\n ntpservers_hash = JSON.parse(ntpservers_stdout)\n\n # create instance hash - this contains info about ONE host at a time\n # the values should match the data \"shape\" (ie have the same fields) as our\n # type.\n # the key, should be the title/namevar so we can do a lookup in our\n # read_instance function\n cached_instances_set({})\n ntpservers_hash.each do |esx_host, ntp_servers_array|\n cached_instances[esx_host] = {\n ensure: :present,\n esx_host: esx_host,\n ntp_servers: ntp_servers_array,\n }\n end\n Puppet.debug(\"all_instances - cached instances is at end: #{cached_instances}\")\n Puppet.debug(\"all_instances - cached instances object_id at end: #{cached_instances.object_id}\")\n cached_instances\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def update!(**args)\n @generic_metadata = args[:generic_metadata] if args.key?(:generic_metadata)\n end", "def metadata\n attributes['metadata'] ||= {}\n attributes['metadata']\n end", "def metadata_params_for(node, new_resource)\n { platform: node['platform'],\n platform_version: node['platform_version'],\n machine_arch: node['kernel']['machine'],\n version: new_resource.version,\n prerelease: new_resource.prerelease,\n nightlies: new_resource.nightlies }\n end", "def run\n _log \"Enriching... AWS EC2 Instance: #{_get_entity_name}\"\n\n public_hostname = _get_entity_detail('public_dns_name')\n private_hostname = _get_entity_detail('private_dns_name')\n # no point in having public ip address since DNSRecord enrichment will create it\n private_ip_address = _get_entity_detail('private_ip_address')\n\n # ec2 entity belongs to organization so setting scope to true\n _create_entity 'DnsRecord', {'name' => public_hostname, 'scoped' => true } unless public_hostname.empty? || public_hostname.nil? \n _create_entity 'DnsRecord', 'name' => private_hostname unless private_hostname.empty? || private_hostname.nil?\n _create_entity 'IpAddress', 'name' => private_ip_address unless private_ip_address.empty? || private_ip_address.nil?\n\n end", "def metadata\n @metadata ||= {}\n end", "def metadata\n self[:metadata] || {}\n end", "def set_metadata(key, value)\n params = java.util.HashMap.new()\n params.put(key.to_s, value)\n @stamp.setMoreInfo(params)\n end", "def metadata\n @metadata ||= {}\n end" ]
[ "0.74214065", "0.59669435", "0.5650688", "0.5604885", "0.5567124", "0.5562294", "0.5514305", "0.54849464", "0.5435901", "0.5435901", "0.5379111", "0.53608197", "0.5331841", "0.53090143", "0.5303271", "0.52978647", "0.52880114", "0.52880114", "0.52880114", "0.52880114", "0.52705985", "0.5249312", "0.5241172", "0.5186671", "0.51776433", "0.5169035", "0.5155793", "0.51494676", "0.51494676", "0.51494676", "0.51494676", "0.51494676", "0.51494676", "0.51494676", "0.5125196", "0.5120148", "0.5120148", "0.5105871", "0.5099092", "0.5098722", "0.5094175", "0.50923616", "0.5081643", "0.5053511", "0.5053511", "0.5053511", "0.50509804", "0.50281245", "0.50254095", "0.5016785", "0.5014621", "0.49925852", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49901545", "0.49882287", "0.4981011", "0.49699888", "0.49671018", "0.49516013", "0.49457967", "0.49203533" ]
0.7489561
0
Baseline implementation for the set_default_network_tier REST call
def set_default_network_tier request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_set_default_network_tier_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_default_network_tier request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/setDefaultNetworkTier\"\n body = request_pb.projects_set_default_network_tier_request_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def tier\n raw_tier || Tier.default\n end", "def tier\n settings[:tier]\n end", "def patch_tier0_with_http_info(tier_0_id, tier0, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.patch_tier0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.patch_tier0\"\n end\n # verify the required parameter 'tier0' is set\n if @api_client.config.client_side_validation && tier0.nil?\n fail ArgumentError, \"Missing the required parameter 'tier0' when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.patch_tier0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.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 = @api_client.object_to_http_body(tier0)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi#patch_tier0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_or_replace_tier0_with_http_info(tier_0_id, tier0, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.create_or_replace_tier0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.create_or_replace_tier0\"\n end\n # verify the required parameter 'tier0' is set\n if @api_client.config.client_side_validation && tier0.nil?\n fail ArgumentError, \"Missing the required parameter 'tier0' when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.create_or_replace_tier0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.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 = @api_client.object_to_http_body(tier0)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Tier0')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi#create_or_replace_tier0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def patch_tier0_0_with_http_info(tier_0_id, tier0, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.patch_tier0_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.patch_tier0_0\"\n end\n # verify the required parameter 'tier0' is set\n if @api_client.config.client_side_validation && tier0.nil?\n fail ArgumentError, \"Missing the required parameter 'tier0' when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.patch_tier0_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.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 = @api_client.object_to_http_body(tier0)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi#patch_tier0_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_or_replace_tier0_0_with_http_info(tier_0_id, tier0, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.create_or_replace_tier0_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.create_or_replace_tier0_0\"\n end\n # verify the required parameter 'tier0' is set\n if @api_client.config.client_side_validation && tier0.nil?\n fail ArgumentError, \"Missing the required parameter 'tier0' when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.create_or_replace_tier0_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.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 = @api_client.object_to_http_body(tier0)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Tier0')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi#create_or_replace_tier0_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_default\n cmd = \"{\\\"id\\\":8,\\\"method\\\":\\\"set_default\\\",\\\"params\\\":[]}\\r\\n\"\n request(cmd)\n end", "def create_or_replace_tier1_0_with_http_info(tier_1_id, tier1, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.create_or_replace_tier1_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.create_or_replace_tier1_0\"\n end\n # verify the required parameter 'tier1' is set\n if @api_client.config.client_side_validation && tier1.nil?\n fail ArgumentError, \"Missing the required parameter 'tier1' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.create_or_replace_tier1_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.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 = @api_client.object_to_http_body(tier1)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Tier1')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#create_or_replace_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def patch_tier1_0_with_http_info(tier_1_id, tier1, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.patch_tier1_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.patch_tier1_0\"\n end\n # verify the required parameter 'tier1' is set\n if @api_client.config.client_side_validation && tier1.nil?\n fail ArgumentError, \"Missing the required parameter 'tier1' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.patch_tier1_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.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 = @api_client.object_to_http_body(tier1)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#patch_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_tier0s_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.list_tier0s ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.list_tier0s, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.list_tier0s, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-0s'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Tier0ListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi#list_tier0s\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_or_replace_tier1_with_http_info(tier_1_id, tier1, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.create_or_replace_tier1 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.create_or_replace_tier1\"\n end\n # verify the required parameter 'tier1' is set\n if @api_client.config.client_side_validation && tier1.nil?\n fail ArgumentError, \"Missing the required parameter 'tier1' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.create_or_replace_tier1\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.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 = @api_client.object_to_http_body(tier1)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Tier1')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#create_or_replace_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_tier1_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-1s'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Tier1ListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#list_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def read_tier0_with_http_info(tier_0_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.read_tier0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.read_tier0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.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(: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 => 'Tier0')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi#read_tier0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def load_tier\n if id = tier_param_id\n @tier = Tier.find_by_permalink_and_region_and_active(id)\n @tier_class = @tier.class if @tier\n end\n end", "def load_tier\n if id = tier_param_id\n @tier = Tier.find_by_permalink_and_region_and_active(id)\n @tier_class = @tier.class if @tier\n end\n end", "def list_tier0s_0_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.list_tier0s_0 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.list_tier0s_0, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.list_tier0s_0, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/global-infra/tier-0s'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Tier0ListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi#list_tier0s_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def patch_tier1_with_http_info(tier_1_id, tier1, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.patch_tier1 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.patch_tier1\"\n end\n # verify the required parameter 'tier1' is set\n if @api_client.config.client_side_validation && tier1.nil?\n fail ArgumentError, \"Missing the required parameter 'tier1' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.patch_tier1\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.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 = @api_client.object_to_http_body(tier1)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#patch_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def list_tier1_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1 ...'\n end\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] > 1000\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1, must be smaller than or equal to 1000.'\n end\n\n if @api_client.config.client_side_validation && !opts[:'page_size'].nil? && opts[:'page_size'] < 0\n fail ArgumentError, 'invalid value for \"opts[:\"page_size\"]\" when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.list_tier1, must be greater than or equal to 0.'\n end\n\n # resource path\n local_var_path = '/infra/tier-1s'\n\n # query parameters\n query_params = {}\n query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?\n query_params[:'include_mark_for_delete_objects'] = opts[:'include_mark_for_delete_objects'] if !opts[:'include_mark_for_delete_objects'].nil?\n query_params[:'included_fields'] = opts[:'included_fields'] if !opts[:'included_fields'].nil?\n query_params[:'page_size'] = opts[:'page_size'] if !opts[:'page_size'].nil?\n query_params[:'sort_ascending'] = opts[:'sort_ascending'] if !opts[:'sort_ascending'].nil?\n query_params[:'sort_by'] = opts[:'sort_by'] if !opts[:'sort_by'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = nil\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:GET, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Tier1ListResult')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#list_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def save_tier\n self.tier = @tier_cache if @tier_cache\n end", "def read_tier0_0_with_http_info(tier_0_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.read_tier0_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.read_tier0_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.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(: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 => 'Tier0')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi#read_tier0_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_webtier\n @webtier = Webtier.find(params[:id])\n end", "def tier\n @tier_cache || self.tiers[0]\n end", "def create_zero_tier\n ManageIQ::Showback::Tier.create(:tier_start_value => 0, :tier_end_value => Float::INFINITY, :rate => self)\n end", "def tier0_gateway_reprocess_with_http_info(tier_0_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.tier0_gateway_reprocess ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.tier0_gateway_reprocess\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}?action=reprocess'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi#tier0_gateway_reprocess\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tier0_gateway_reprocess_0_with_http_info(tier_0_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.tier0_gateway_reprocess_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.tier0_gateway_reprocess_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}?action=reprocess'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi#tier0_gateway_reprocess_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def default_ipn_endpoint; end", "def selected_network_type\n network_type = params['neural_network_data']['network_type']\n return NeuralNetworkAi4r if network_type == 'ai4r'\n return NeuralNetworkFann if network_type == 'ruby-fann'\n end", "def read_tier1_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.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(: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 => 'Tier1')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#read_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_payment_tier\n @payment_tier = PaymentTier.find(params[:id])\n authorize! :manage, @payment_tier\n end", "def set_item_tier\n @item_tier = ItemTier.find(params[:id])\n end", "def load_tier\n if id = params[:tier_id]\n @tier = Tier.find_by_permalink_and_region_and_active(id)\n end\n end", "def get_base_price_tier_description\n\tcase self.base_price_tier.to_i\n\t\twhen 1\n\t\t return 'Unit' \n\t\twhen 2\n\t\t return 'Consumer Pk.'\n\t\twhen 3\n\t\t return 'Case'\n\t\twhen 4\n\t\t return 'Pallet'\n\t\tend\n\tend", "def patch_tier1_interface_0_with_http_info(tier_1_id, locale_services_id, interface_id, tier1_interface, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_interface_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_interface_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_interface_0\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_interface_0\"\n end\n # verify the required parameter 'tier1_interface' is set\n if @api_client.config.client_side_validation && tier1_interface.nil?\n fail ArgumentError, \"Missing the required parameter 'tier1_interface' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_interface_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/interfaces/{interface-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s).sub('{' + 'interface-id' + '}', interface_id.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 = @api_client.object_to_http_body(tier1_interface)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi#patch_tier1_interface_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete_tier0_with_http_info(tier_0_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.delete_tier0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.delete_tier0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.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: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi#delete_tier0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def applyInheritedDefaults(kitten, type)\n return if !kitten.is_a?(Hash)\n kitten['cloud'] ||= @config['cloud']\n kitten['cloud'] ||= MU::Config.defaultCloud\n\n if !MU::Cloud.supportedClouds.include?(kitten['cloud'])\n return\n end\n\n cloudclass = MU::Cloud.cloudClass(kitten['cloud'])\n\n resclass = MU::Cloud.resourceClass(kitten['cloud'], type)\n\n schema_fields = [\"us_only\", \"scrub_mu_isms\", \"credentials\", \"billing_acct\"]\n if !resclass.isGlobal?\n kitten['region'] ||= @config['region']\n kitten['region'] ||= cloudclass.myRegion(kitten['credentials'])\n schema_fields << \"region\"\n end\n\n kitten['credentials'] ||= @config['credentials']\n kitten['credentials'] ||= cloudclass.credConfig(name_only: true)\n\n kitten['us_only'] ||= @config['us_only']\n kitten['us_only'] ||= false\n\n kitten['scrub_mu_isms'] ||= @config['scrub_mu_isms']\n kitten['scrub_mu_isms'] ||= false\n\n if kitten['cloud'] == \"Google\"\n# TODO this should be cloud-generic (handle AWS accounts, Azure subscriptions)\n if resclass.canLiveIn.include?(:Habitat)\n kitten[\"project\"] ||= MU::Cloud::Google.defaultProject(kitten['credentials'])\n schema_fields << \"project\"\n end\n if kitten['region'].nil? and !kitten['#MU_CLOUDCLASS'].nil? and\n !resclass.isGlobal? and\n ![MU::Cloud::VPC, MU::Cloud::FirewallRule].include?(kitten['#MU_CLOUDCLASS'])\n if MU::Cloud::Google.myRegion((kitten['credentials'])).nil?\n raise ValidationError, \"Google '#{type}' resource '#{kitten['name']}' declared without a region, but no default Google region declared in mu.yaml under #{kitten['credentials'].nil? ? \"default\" : kitten['credentials']} credential set\" \n end\n kitten['region'] ||= MU::Cloud::Google.myRegion\n end\n elsif kitten[\"cloud\"] == \"AWS\" and !resclass.isGlobal? and !kitten['region']\n if MU::Cloud::AWS.myRegion.nil?\n raise ValidationError, \"AWS resource declared without a region, but no default AWS region found\"\n end\n kitten['region'] ||= MU::Cloud::AWS.myRegion\n end\n\n\n kitten['billing_acct'] ||= @config['billing_acct'] if @config['billing_acct']\n\n kitten[\"dependencies\"] ||= []\n\n # Make sure the schema knows about these \"new\" fields, so that validation\n # doesn't trip over them.\n schema_fields.each { |field|\n if @@schema[\"properties\"][field]\n MU.log \"Adding #{field} to schema for #{type} #{kitten['cloud']}\", MU::DEBUG, details: @@schema[\"properties\"][field]\n @@schema[\"properties\"][type][\"items\"][\"properties\"][field] ||= @@schema[\"properties\"][field]\n end\n }\n end", "def create_or_replace_tier1_interface_0_with_http_info(tier_1_id, locale_services_id, interface_id, tier1_interface, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_or_replace_tier1_interface_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_or_replace_tier1_interface_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_or_replace_tier1_interface_0\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_or_replace_tier1_interface_0\"\n end\n # verify the required parameter 'tier1_interface' is set\n if @api_client.config.client_side_validation && tier1_interface.nil?\n fail ArgumentError, \"Missing the required parameter 'tier1_interface' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_or_replace_tier1_interface_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/interfaces/{interface-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s).sub('{' + 'interface-id' + '}', interface_id.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 = @api_client.object_to_http_body(tier1_interface)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Tier1Interface')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi#create_or_replace_tier1_interface_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def read_tier1_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.read_tier1\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.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(: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 => 'Tier1')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#read_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tier=(a_tier)\n if new_record?\n @tier_cache = a_tier\n else\n if @tier_cache\n self.kontexts.create(\n :kase => self,\n :tier => a_tier\n )\n @tier_cache = nil\n else\n if a_tier == nil\n self.kontexts.select {|k| k.tier || k.topic}.each {|k| k.destroy}\n self.tiers.reload\n elsif a_tier != self.tier\n self.kontexts.select {|k| k.tier || k.topic}.each {|k| k.destroy}\n self.kontexts.create(\n :kase => self,\n :tier => a_tier\n )\n self.tiers.reload\n end\n end\n end\n a_tier\n end", "def set_default\n end", "def patch_tier1_interface_with_http_info(tier_1_id, locale_services_id, interface_id, tier1_interface, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_interface ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_interface\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_interface\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_interface\"\n end\n # verify the required parameter 'tier1_interface' is set\n if @api_client.config.client_side_validation && tier1_interface.nil?\n fail ArgumentError, \"Missing the required parameter 'tier1_interface' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_interface\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/interfaces/{interface-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s).sub('{' + 'interface-id' + '}', interface_id.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 = @api_client.object_to_http_body(tier1_interface)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi#patch_tier1_interface\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tier1_gateway_reprocess_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.tier1_gateway_reprocess_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.tier1_gateway_reprocess_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}?action=reprocess'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#tier1_gateway_reprocess_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_tier_setting\n @tier_setting = TierSetting.find(params[:id])\n end", "def delete_tier0_0_with_http_info(tier_0_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.delete_tier0_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi.delete_tier0_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.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: PolicyNetworkingConnectivityTier0GatewaysTier0GatewaysApi#delete_tier0_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tier_id=(id)\n self.tier = Tier.find_by_id(id.to_i)\n end", "def patch_tier1_service_interface_0_with_http_info(tier_1_id, locale_service_id, interface_id, service_interface, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_service_interface_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_service_interface_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_service_interface_0\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_service_interface_0\"\n end\n # verify the required parameter 'service_interface' is set\n if @api_client.config.client_side_validation && service_interface.nil?\n fail ArgumentError, \"Missing the required parameter 'service_interface' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_service_interface_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/service-interfaces/{interface-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.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 = @api_client.object_to_http_body(service_interface)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi#patch_tier1_service_interface_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_default(id)\n @log.debug(\"Set default: #{id}\")\n response = @http_client.put(\"#{base_path}/#{id}/default\")\n resource_instance(response)\n end", "def set_default(id)\n @log.debug(\"Set default: #{id}\")\n response = @http_client.put(\"#{base_path}/#{id}/default\")\n resource_instance(response)\n end", "def create_or_replace_tier1_interface_with_http_info(tier_1_id, locale_services_id, interface_id, tier1_interface, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_or_replace_tier1_interface ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_or_replace_tier1_interface\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_or_replace_tier1_interface\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_or_replace_tier1_interface\"\n end\n # verify the required parameter 'tier1_interface' is set\n if @api_client.config.client_side_validation && tier1_interface.nil?\n fail ArgumentError, \"Missing the required parameter 'tier1_interface' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_or_replace_tier1_interface\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-services-id}/interfaces/{interface-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.to_s).sub('{' + 'interface-id' + '}', interface_id.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 = @api_client.object_to_http_body(tier1_interface)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'Tier1Interface')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi#create_or_replace_tier1_interface\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def default(name,value)\n @network.spec_factory.defaults[name]=value\n end", "def default_ttr=(v)\n @@default_ttr = v\n end", "def __default_network_host\n case version\n when /^0|^1/\n '0.0.0.0'\n when /^2/\n '_local_'\n when /^5|^6|^7/\n '_local_'\n else\n raise RuntimeError, \"Cannot determine default network host from version [#{version}]\"\n end\n end", "def delete_tier1_0_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.delete_tier1_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.delete_tier1_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.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: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#delete_tier1_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def network\n @network ||= Network.default\n end", "def create_tier1_service_interface_0_with_http_info(tier_1_id, locale_service_id, interface_id, service_interface, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_tier1_service_interface_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_tier1_service_interface_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_tier1_service_interface_0\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_tier1_service_interface_0\"\n end\n # verify the required parameter 'service_interface' is set\n if @api_client.config.client_side_validation && service_interface.nil?\n fail ArgumentError, \"Missing the required parameter 'service_interface' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_tier1_service_interface_0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/service-interfaces/{interface-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.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 = @api_client.object_to_http_body(service_interface)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ServiceInterface')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi#create_tier1_service_interface_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def network=(network)\n MultisigMoneyTree.network = @network = network.to_sym\n end", "def initialize network:\n super network[:type], network[:struct], act_fn: network[:act_fn]\n end", "def create_or_replace_tier1_segment_port_0_with_http_info(tier_1_id, segment_id, port_id, segment_port, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsPortsApi.create_or_replace_tier1_segment_port_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivitySegmentsPortsApi.create_or_replace_tier1_segment_port_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivitySegmentsPortsApi.create_or_replace_tier1_segment_port_0\"\n end\n # verify the required parameter 'port_id' is set\n if @api_client.config.client_side_validation && port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'port_id' when calling PolicyNetworkingConnectivitySegmentsPortsApi.create_or_replace_tier1_segment_port_0\"\n end\n # verify the required parameter 'segment_port' is set\n if @api_client.config.client_side_validation && segment_port.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_port' when calling PolicyNetworkingConnectivitySegmentsPortsApi.create_or_replace_tier1_segment_port_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/ports/{port-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s).sub('{' + 'port-id' + '}', port_id.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 = @api_client.object_to_http_body(segment_port)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SegmentPort')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentsPortsApi#create_or_replace_tier1_segment_port_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_or_patch_l3_vpn_0_with_http_info(tier_0_id, locale_service_id, l3vpn_id, l3_vpn, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_patch_l3_vpn_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_patch_l3_vpn_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_patch_l3_vpn_0\"\n end\n # verify the required parameter 'l3vpn_id' is set\n if @api_client.config.client_side_validation && l3vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l3vpn_id' when calling PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_patch_l3_vpn_0\"\n end\n # verify the required parameter 'l3_vpn' is set\n if @api_client.config.client_side_validation && l3_vpn.nil?\n fail ArgumentError, \"Missing the required parameter 'l3_vpn' when calling PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_patch_l3_vpn_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l3vpns/{l3vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l3vpn-id' + '}', l3vpn_id.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 = @api_client.object_to_http_body(l3_vpn)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi#create_or_patch_l3_vpn_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def switch_d_b_instance_net_type(connection_string_prefix, d_b_instance_id, optional={})\n\t\targs = self.class.new_params\n\t\targs[:query]['Action'] = 'SwitchDBInstanceNetType'\n\t\targs[:query]['ConnectionStringPrefix'] = connection_string_prefix\n\t\targs[:query]['DBInstanceId'] = d_b_instance_id\n\t\targs[:region] = optional[:_region] if (optional.key? :_region)\n\t\tif optional.key? :_method\n\t\t\traise ArgumentError, '_method must be GET|POST' unless 'GET|POST'.split('|').include? optional[:_method]\n\t\t\targs[:method] = optional[:_method]\n\t\tend\n\t\tif optional.key? :_scheme\n\t\t\traise ArgumentError, '_scheme must be http|https' unless 'http|https'.split('|').include? optional[:_scheme]\n\t\t\targs[:scheme] = optional[:_scheme]\n\t\tend\n\t\tif optional.key? :client_token\n\t\t\targs[:query]['ClientToken'] = optional[:client_token]\n\t\tend\n\t\tif optional.key? :owner_account\n\t\t\targs[:query]['OwnerAccount'] = optional[:owner_account]\n\t\tend\n\t\tif optional.key? :owner_id\n\t\t\targs[:query]['OwnerId'] = optional[:owner_id]\n\t\tend\n\t\tif optional.key? :port\n\t\t\targs[:query]['Port'] = optional[:port]\n\t\tend\n\t\tif optional.key? :resource_owner_account\n\t\t\targs[:query]['ResourceOwnerAccount'] = optional[:resource_owner_account]\n\t\tend\n\t\tif optional.key? :resource_owner_id\n\t\t\targs[:query]['ResourceOwnerId'] = optional[:resource_owner_id]\n\t\tend\n\t\tself.run(args)\n\tend", "def create_or_replace_policy_nat_rule_on_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.create_or_replace_policy_nat_rule_on_tier0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.create_or_replace_policy_nat_rule_on_tier0\"\n end\n # verify the required parameter 'nat_id' is set\n if @api_client.config.client_side_validation && nat_id.nil?\n fail ArgumentError, \"Missing the required parameter 'nat_id' when calling PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.create_or_replace_policy_nat_rule_on_tier0\"\n end\n # verify the required parameter 'nat_rule_id' is set\n if @api_client.config.client_side_validation && nat_rule_id.nil?\n fail ArgumentError, \"Missing the required parameter 'nat_rule_id' when calling PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.create_or_replace_policy_nat_rule_on_tier0\"\n end\n # verify the required parameter 'policy_nat_rule' is set\n if @api_client.config.client_side_validation && policy_nat_rule.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_nat_rule' when calling PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.create_or_replace_policy_nat_rule_on_tier0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/nat/{nat-id}/nat-rules/{nat-rule-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'nat-id' + '}', nat_id.to_s).sub('{' + 'nat-rule-id' + '}', nat_rule_id.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 = @api_client.object_to_http_body(policy_nat_rule)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PolicyNatRule')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi#create_or_replace_policy_nat_rule_on_tier0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def patch_tier1_0(tier_1_id, tier1, opts = {})\n patch_tier1_0_with_http_info(tier_1_id, tier1, opts)\n nil\n end", "def set_network\n @network = Network.find(params[:id])\n end", "def set_network\n @network = Network.find(params[:id])\n end", "def set_network\n @network = Network.find(params[:id])\n end", "def set_network\n @network = Network.find(params[:id])\n end", "def set_network\n @network = Network.find(params[:id])\n end", "def patch_policy_nat_rule_on_tier0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.patch_policy_nat_rule_on_tier0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.patch_policy_nat_rule_on_tier0\"\n end\n # verify the required parameter 'nat_id' is set\n if @api_client.config.client_side_validation && nat_id.nil?\n fail ArgumentError, \"Missing the required parameter 'nat_id' when calling PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.patch_policy_nat_rule_on_tier0\"\n end\n # verify the required parameter 'nat_rule_id' is set\n if @api_client.config.client_side_validation && nat_rule_id.nil?\n fail ArgumentError, \"Missing the required parameter 'nat_rule_id' when calling PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.patch_policy_nat_rule_on_tier0\"\n end\n # verify the required parameter 'policy_nat_rule' is set\n if @api_client.config.client_side_validation && policy_nat_rule.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_nat_rule' when calling PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.patch_policy_nat_rule_on_tier0\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/nat/{nat-id}/nat-rules/{nat-rule-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'nat-id' + '}', nat_id.to_s).sub('{' + 'nat-rule-id' + '}', nat_rule_id.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 = @api_client.object_to_http_body(policy_nat_rule)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi#patch_policy_nat_rule_on_tier0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def authorization_tier_attribute_name=(override)\n raise AuthorizedPersona::Error, \"authorization_tier_attribute_name must be a symbol\" unless override.is_a?(Symbol)\n\n @authorization_tier_attribute_name = override\n end", "def create_or_replace_l3_vpn_0_with_http_info(tier_0_id, locale_service_id, l3vpn_id, l3_vpn, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_replace_l3_vpn_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_replace_l3_vpn_0\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_replace_l3_vpn_0\"\n end\n # verify the required parameter 'l3vpn_id' is set\n if @api_client.config.client_side_validation && l3vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l3vpn_id' when calling PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_replace_l3_vpn_0\"\n end\n # verify the required parameter 'l3_vpn' is set\n if @api_client.config.client_side_validation && l3_vpn.nil?\n fail ArgumentError, \"Missing the required parameter 'l3_vpn' when calling PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_replace_l3_vpn_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l3vpns/{l3vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l3vpn-id' + '}', l3vpn_id.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 = @api_client.object_to_http_body(l3_vpn)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'L3Vpn')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi#create_or_replace_l3_vpn_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tier_id\n self.tier.id if self.tier\n end", "def network=(value)\n @root[\"network\"] = value\n end", "def set_defaults\n self.active = self.active.nil? ? true : self.active\n self.estimated_cost ||= 0\n self.anticipated_cost ||= 0\n end", "def product_rate_plan_charge_tier\n Zapi::Models::ProductRatePlanChargeTier.new\n end", "def create_or_patch_l3_vpn_with_http_info(tier_0_id, locale_service_id, l3vpn_id, l3_vpn, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_patch_l3_vpn ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_patch_l3_vpn\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_patch_l3_vpn\"\n end\n # verify the required parameter 'l3vpn_id' is set\n if @api_client.config.client_side_validation && l3vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l3vpn_id' when calling PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_patch_l3_vpn\"\n end\n # verify the required parameter 'l3_vpn' is set\n if @api_client.config.client_side_validation && l3_vpn.nil?\n fail ArgumentError, \"Missing the required parameter 'l3_vpn' when calling PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_patch_l3_vpn\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l3vpns/{l3vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l3vpn-id' + '}', l3vpn_id.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 = @api_client.object_to_http_body(l3_vpn)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi#create_or_patch_l3_vpn\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def patch_tier1_service_interface_with_http_info(tier_1_id, locale_service_id, interface_id, service_interface, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_service_interface ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_service_interface\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_service_interface\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_service_interface\"\n end\n # verify the required parameter 'service_interface' is set\n if @api_client.config.client_side_validation && service_interface.nil?\n fail ArgumentError, \"Missing the required parameter 'service_interface' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.patch_tier1_service_interface\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/service-interfaces/{interface-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.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 = @api_client.object_to_http_body(service_interface)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi#patch_tier1_service_interface\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete_tier1_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.delete_tier1 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.delete_tier1\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.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: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#delete_tier1\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def patch_tier1_segment_port_0_with_http_info(tier_1_id, segment_id, port_id, segment_port, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsPortsApi.patch_tier1_segment_port_0 ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivitySegmentsPortsApi.patch_tier1_segment_port_0\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivitySegmentsPortsApi.patch_tier1_segment_port_0\"\n end\n # verify the required parameter 'port_id' is set\n if @api_client.config.client_side_validation && port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'port_id' when calling PolicyNetworkingConnectivitySegmentsPortsApi.patch_tier1_segment_port_0\"\n end\n # verify the required parameter 'segment_port' is set\n if @api_client.config.client_side_validation && segment_port.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_port' when calling PolicyNetworkingConnectivitySegmentsPortsApi.patch_tier1_segment_port_0\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/ports/{port-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s).sub('{' + 'port-id' + '}', port_id.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 = @api_client.object_to_http_body(segment_port)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentsPortsApi#patch_tier1_segment_port_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_network\n @network = Network.find(params[:id])\n end", "def patch_tier0_locale_services_with_http_info(tier_0_id, locale_services_id, locale_services, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysTier0LocaleServicesApi.patch_tier0_locale_services ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysTier0LocaleServicesApi.patch_tier0_locale_services\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier0GatewaysTier0LocaleServicesApi.patch_tier0_locale_services\"\n end\n # verify the required parameter 'locale_services' is set\n if @api_client.config.client_side_validation && locale_services.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services' when calling PolicyNetworkingConnectivityTier0GatewaysTier0LocaleServicesApi.patch_tier0_locale_services\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-services-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.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 = @api_client.object_to_http_body(locale_services)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysTier0LocaleServicesApi#patch_tier0_locale_services\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_tier1_service_interface_with_http_info(tier_1_id, locale_service_id, interface_id, service_interface, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_tier1_service_interface ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_tier1_service_interface\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_tier1_service_interface\"\n end\n # verify the required parameter 'interface_id' is set\n if @api_client.config.client_side_validation && interface_id.nil?\n fail ArgumentError, \"Missing the required parameter 'interface_id' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_tier1_service_interface\"\n end\n # verify the required parameter 'service_interface' is set\n if @api_client.config.client_side_validation && service_interface.nil?\n fail ArgumentError, \"Missing the required parameter 'service_interface' when calling PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi.create_tier1_service_interface\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/locale-services/{locale-service-id}/service-interfaces/{interface-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'interface-id' + '}', interface_id.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 = @api_client.object_to_http_body(service_interface)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'ServiceInterface')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysInterfacesInterfacesApi#create_tier1_service_interface\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def network=(value)\n if value == @defaults['ai.device.network']\n @values.delete 'ai.device.network' if @values.key? 'ai.device.network'\n else\n @values['ai.device.network'] = value\n end\n end", "def patch_tier0_locale_services_0_with_http_info(tier_0_id, locale_services_id, locale_services, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysTier0LocaleServicesApi.patch_tier0_locale_services_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysTier0LocaleServicesApi.patch_tier0_locale_services_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier0GatewaysTier0LocaleServicesApi.patch_tier0_locale_services_0\"\n end\n # verify the required parameter 'locale_services' is set\n if @api_client.config.client_side_validation && locale_services.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services' when calling PolicyNetworkingConnectivityTier0GatewaysTier0LocaleServicesApi.patch_tier0_locale_services_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-services-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.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 = @api_client.object_to_http_body(locale_services)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PATCH, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysTier0LocaleServicesApi#patch_tier0_locale_services_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def tier1_gateway_reprocess_with_http_info(tier_1_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.tier1_gateway_reprocess ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi.tier1_gateway_reprocess\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}?action=reprocess'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s)\n\n # query parameters\n query_params = {}\n query_params[:'enforcement_point_path'] = opts[:'enforcement_point_path'] if !opts[:'enforcement_point_path'].nil?\n\n # header parameters\n header_params = {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = {}\n\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 if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier1GatewaysTier1GatewaysApi#tier1_gateway_reprocess\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_or_replace_l3_vpn_with_http_info(tier_0_id, locale_service_id, l3vpn_id, l3_vpn, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_replace_l3_vpn ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_replace_l3_vpn\"\n end\n # verify the required parameter 'locale_service_id' is set\n if @api_client.config.client_side_validation && locale_service_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_service_id' when calling PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_replace_l3_vpn\"\n end\n # verify the required parameter 'l3vpn_id' is set\n if @api_client.config.client_side_validation && l3vpn_id.nil?\n fail ArgumentError, \"Missing the required parameter 'l3vpn_id' when calling PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_replace_l3_vpn\"\n end\n # verify the required parameter 'l3_vpn' is set\n if @api_client.config.client_side_validation && l3_vpn.nil?\n fail ArgumentError, \"Missing the required parameter 'l3_vpn' when calling PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi.create_or_replace_l3_vpn\"\n end\n # resource path\n local_var_path = '/global-infra/tier-0s/{tier-0-id}/locale-services/{locale-service-id}/l3vpns/{l3vpn-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-service-id' + '}', locale_service_id.to_s).sub('{' + 'l3vpn-id' + '}', l3vpn_id.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 = @api_client.object_to_http_body(l3_vpn)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'L3Vpn')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesVPNIPSECSessionsTier0GatewaysApi#create_or_replace_l3_vpn\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def boot_network(arg=nil)\n set_or_return(:boot_network, arg, :kind_of => String)\n end", "def net_type\n if node_type.name == 'virtual' then\n 'eth'\n else\n 'vlan'\n end\n end", "def maximum_billing_tier\n @gapi.configuration.query.maximum_billing_tier\n end", "def set_password_tier\n @password_tier = PasswordTier.find(params[:id])\n end", "def patch_tier0(tier_0_id, tier0, opts = {})\n patch_tier0_with_http_info(tier_0_id, tier0, opts)\n nil\n end", "def create_or_replace_tier1_segment_port_with_http_info(tier_1_id, segment_id, port_id, segment_port, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsPortsApi.create_or_replace_tier1_segment_port ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivitySegmentsPortsApi.create_or_replace_tier1_segment_port\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivitySegmentsPortsApi.create_or_replace_tier1_segment_port\"\n end\n # verify the required parameter 'port_id' is set\n if @api_client.config.client_side_validation && port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'port_id' when calling PolicyNetworkingConnectivitySegmentsPortsApi.create_or_replace_tier1_segment_port\"\n end\n # verify the required parameter 'segment_port' is set\n if @api_client.config.client_side_validation && segment_port.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_port' when calling PolicyNetworkingConnectivitySegmentsPortsApi.create_or_replace_tier1_segment_port\"\n end\n # resource path\n local_var_path = '/global-infra/tier-1s/{tier-1-id}/segments/{segment-id}/ports/{port-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s).sub('{' + 'port-id' + '}', port_id.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 = @api_client.object_to_http_body(segment_port)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SegmentPort')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentsPortsApi#create_or_replace_tier1_segment_port\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def default_bank=(_arg0); end", "def create_or_replace_tier1_segment_port_with_http_info(tier_1_id, segment_id, port_id, segment_port, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivitySegmentsPortsApi.create_or_replace_tier1_segment_port ...'\n end\n # verify the required parameter 'tier_1_id' is set\n if @api_client.config.client_side_validation && tier_1_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_1_id' when calling PolicyNetworkingConnectivitySegmentsPortsApi.create_or_replace_tier1_segment_port\"\n end\n # verify the required parameter 'segment_id' is set\n if @api_client.config.client_side_validation && segment_id.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_id' when calling PolicyNetworkingConnectivitySegmentsPortsApi.create_or_replace_tier1_segment_port\"\n end\n # verify the required parameter 'port_id' is set\n if @api_client.config.client_side_validation && port_id.nil?\n fail ArgumentError, \"Missing the required parameter 'port_id' when calling PolicyNetworkingConnectivitySegmentsPortsApi.create_or_replace_tier1_segment_port\"\n end\n # verify the required parameter 'segment_port' is set\n if @api_client.config.client_side_validation && segment_port.nil?\n fail ArgumentError, \"Missing the required parameter 'segment_port' when calling PolicyNetworkingConnectivitySegmentsPortsApi.create_or_replace_tier1_segment_port\"\n end\n # resource path\n local_var_path = '/infra/tier-1s/{tier-1-id}/segments/{segment-id}/ports/{port-id}'.sub('{' + 'tier-1-id' + '}', tier_1_id.to_s).sub('{' + 'segment-id' + '}', segment_id.to_s).sub('{' + 'port-id' + '}', port_id.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 = @api_client.object_to_http_body(segment_port)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'SegmentPort')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivitySegmentsPortsApi#create_or_replace_tier1_segment_port\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def new\n @tier_setting = TierSetting.new(tier: @week.next_missing_tier)\n end", "def add_tier\n begin\n with_transaction do\n Tier.create!(\n name: params[:name],\n stage: params[:stage],\n pipeline_id: @pipeline.id\n )\n\n render json: tiers_for_pipeline_view\n end\n rescue Exception => e\n error = \"#{ConfluxErrors::TierCreationFailed} - #{e}\"\n logger.error { error }\n render json: { message: error }, status: 500\n end\n end", "def create_or_replace_policy_nat_rule_on_tier0_0_with_http_info(tier_0_id, nat_id, nat_rule_id, policy_nat_rule, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.create_or_replace_policy_nat_rule_on_tier0_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.create_or_replace_policy_nat_rule_on_tier0_0\"\n end\n # verify the required parameter 'nat_id' is set\n if @api_client.config.client_side_validation && nat_id.nil?\n fail ArgumentError, \"Missing the required parameter 'nat_id' when calling PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.create_or_replace_policy_nat_rule_on_tier0_0\"\n end\n # verify the required parameter 'nat_rule_id' is set\n if @api_client.config.client_side_validation && nat_rule_id.nil?\n fail ArgumentError, \"Missing the required parameter 'nat_rule_id' when calling PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.create_or_replace_policy_nat_rule_on_tier0_0\"\n end\n # verify the required parameter 'policy_nat_rule' is set\n if @api_client.config.client_side_validation && policy_nat_rule.nil?\n fail ArgumentError, \"Missing the required parameter 'policy_nat_rule' when calling PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi.create_or_replace_policy_nat_rule_on_tier0_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/nat/{nat-id}/nat-rules/{nat-rule-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'nat-id' + '}', nat_id.to_s).sub('{' + 'nat-rule-id' + '}', nat_rule_id.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 = @api_client.object_to_http_body(policy_nat_rule)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'PolicyNatRule')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingNetworkServicesNATRulesTier0GatewaysApi#create_or_replace_policy_nat_rule_on_tier0_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_or_replace_tier1_0(tier_1_id, tier1, opts = {})\n data, _status_code, _headers = create_or_replace_tier1_0_with_http_info(tier_1_id, tier1, opts)\n data\n end", "def create_or_replace_tier0_locale_services_0_with_http_info(tier_0_id, locale_services_id, locale_services, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyNetworkingConnectivityTier0GatewaysTier0LocaleServicesApi.create_or_replace_tier0_locale_services_0 ...'\n end\n # verify the required parameter 'tier_0_id' is set\n if @api_client.config.client_side_validation && tier_0_id.nil?\n fail ArgumentError, \"Missing the required parameter 'tier_0_id' when calling PolicyNetworkingConnectivityTier0GatewaysTier0LocaleServicesApi.create_or_replace_tier0_locale_services_0\"\n end\n # verify the required parameter 'locale_services_id' is set\n if @api_client.config.client_side_validation && locale_services_id.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services_id' when calling PolicyNetworkingConnectivityTier0GatewaysTier0LocaleServicesApi.create_or_replace_tier0_locale_services_0\"\n end\n # verify the required parameter 'locale_services' is set\n if @api_client.config.client_side_validation && locale_services.nil?\n fail ArgumentError, \"Missing the required parameter 'locale_services' when calling PolicyNetworkingConnectivityTier0GatewaysTier0LocaleServicesApi.create_or_replace_tier0_locale_services_0\"\n end\n # resource path\n local_var_path = '/infra/tier-0s/{tier-0-id}/locale-services/{locale-services-id}'.sub('{' + 'tier-0-id' + '}', tier_0_id.to_s).sub('{' + 'locale-services-id' + '}', locale_services_id.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 = @api_client.object_to_http_body(locale_services)\n auth_names = ['BasicAuth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => 'LocaleServices')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyNetworkingConnectivityTier0GatewaysTier0LocaleServicesApi#create_or_replace_tier0_locale_services_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def initialize(softlayer_client, network_hash, is_required)\n super(softlayer_client, network_hash)\n @is_required = is_required\n end", "def network(type, options=nil); end" ]
[ "0.77351016", "0.64955413", "0.5975011", "0.5937313", "0.58802915", "0.58199257", "0.579607", "0.5688632", "0.56367856", "0.5635349", "0.56249404", "0.5597112", "0.5568555", "0.5564882", "0.5563091", "0.5563091", "0.5545937", "0.55433923", "0.54807216", "0.5477234", "0.5445261", "0.5418335", "0.5339228", "0.531544", "0.527414", "0.5271003", "0.5250808", "0.5246551", "0.52434385", "0.524045", "0.5235853", "0.5234733", "0.5231675", "0.5204283", "0.5194608", "0.5181285", "0.5149837", "0.51430595", "0.51379806", "0.5132034", "0.507574", "0.50735575", "0.5069053", "0.5065044", "0.506369", "0.5048195", "0.5036956", "0.5036956", "0.5027338", "0.50138557", "0.50005525", "0.49935475", "0.49927217", "0.49909064", "0.49898484", "0.4977809", "0.49666864", "0.49577954", "0.49553978", "0.49413684", "0.4935156", "0.4931822", "0.49238187", "0.49238187", "0.49238187", "0.49238187", "0.49238187", "0.49161014", "0.4907886", "0.4904043", "0.49028042", "0.4895669", "0.48864657", "0.48839596", "0.48744583", "0.4870957", "0.48596027", "0.48535126", "0.48388362", "0.48294106", "0.48283476", "0.48227158", "0.48169872", "0.48092216", "0.4807606", "0.48067975", "0.48016903", "0.47991055", "0.4782582", "0.47759372", "0.47688732", "0.4766478", "0.47663677", "0.4762785", "0.4759315", "0.4757633", "0.47496685", "0.47440535", "0.47393927", "0.47279426" ]
0.7897389
0
Baseline implementation for the set_usage_export_bucket REST call
def set_usage_export_bucket request_pb, options = nil raise ::ArgumentError, "request must be provided" if request_pb.nil? uri, body, query_string_params = transcode_set_usage_export_bucket_request request_pb response = @client_stub.make_post_request( uri: uri, body: body, params: query_string_params, options: options ) result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true yield result, response if block_given? result end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def set_usage_export_bucket request_pb, options:, &block\n uri = \"/compute/v1/projects/#{request_pb.project}/setUsageExportBucket\"\n body = request_pb.usage_export_location_resource.to_json\n\n response = @client_stub.make_post_request(\n uri: uri,\n body: body,\n options: options,\n )\n\n result = ::Google::Cloud::Compute::V1::Operation.decode_json response.body, ignore_unknown_fields: true\n\n yield result, response if block_given?\n\n result\n end", "def create_bucket(bucket_key,access_token)\n response = RestClient.post(\"#{API_URL}/oss/v2/buckets\",\n { bucketKey: bucket_key, policyKey:'transient'}.to_json,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/json' })\n return response\nend", "def bucket(bucket)\n @task.bucket = bucket\n end", "def newBucket\n innerNewBucket \n end", "def get bucket=nil\n if bucket\n super [@resource , bucket].join('/') \n else \n super\n end\n end", "def bucket_stats(url, time)\n\n logger.info \"bucket_stats:start: url = #{url}, time = #{time.to_i}\"\n\n jsonResponse = rest_call(url)\n buckets = JSON.parse(jsonResponse)\n\n buckets.each do |bucket|\n bucket_name = bucket['name'].gsub(/\\./, '-')\n replica_num = bucket['replicaNumber']\n ram_quota = bucket['quota']['ram']\n ram_quota_raw = bucket['quota']['rawRAM']\n quota_percent_used = bucket['basicStats']['quotaPercentUsed']\n ops_per_sec = bucket['basicStats']['opsPerSec']\n disk_fetches = bucket['basicStats']['diskFetches']\n item_count = bucket['basicStats']['itemCount']\n disk_used = bucket['basicStats']['diskUsed']\n data_used = bucket['basicStats']['dataUsed']\n mem_used = bucket['basicStats']['memUsed']\n node_size = bucket['nodes'].length\n\n data_availability_pct = data_availability(node_size, replica_num, @healthy_nodes, @failover_nodes)\n\n write_to_graphite( construct_metric_name(\"#{bucket_name}.replica_num\", CONST_BUCKET_LEVEL), replica_num.to_s, time)\n write_to_graphite( construct_metric_name(\"#{bucket_name}.quota_percent_used\", CONST_BUCKET_LEVEL), quota_percent_used.to_s, time)\n write_to_graphite( construct_metric_name(\"#{bucket_name}.ops\", CONST_BUCKET_LEVEL), ops_per_sec.to_s, time)\n write_to_graphite( construct_metric_name(\"#{bucket_name}.mem_used\", CONST_BUCKET_LEVEL), mem_used.to_s, time)\n write_to_graphite( construct_metric_name(\"#{bucket_name}.item_cnt\", CONST_BUCKET_LEVEL), item_count.to_s, time)\n write_to_graphite( construct_metric_name(\"#{bucket_name}.disk_used\", CONST_BUCKET_LEVEL), disk_used.to_s, time)\n write_to_graphite( construct_metric_name(\"#{bucket_name}.disk_fetches\", CONST_BUCKET_LEVEL), disk_fetches.to_s, time)\n write_to_graphite( construct_metric_name(\"#{bucket_name}.data_used\", CONST_BUCKET_LEVEL), data_used.to_s, time)\n write_to_graphite( construct_metric_name(\"#{bucket_name}.ram_quota\", CONST_BUCKET_LEVEL), ram_quota.to_s, time)\n write_to_graphite( construct_metric_name(\"#{bucket_name}.ram_quota_raw\", CONST_BUCKET_LEVEL), ram_quota_raw.to_s, time)\n write_to_graphite( construct_metric_name(\"#{bucket_name}.data_availability_pct\", CONST_BUCKET_LEVEL), data_availability_pct.to_s, time)\n\n get_cmd_histogram(bucket_name, @hostname , @password, 11210, time)\n\n end\n\n logger.info 'bucket_stats:end: Completed'\n end", "def initialize _bucket, path = ''\n @bucket = _bucket\n @path = path \n end", "def bucket_field\n 'bucket'\n end", "def bucket=(bucket)\n @bucket = bucket\n self\n end", "def process_bucket(bucketname,options: {},logger: Logger.new(LOGFILE))\n \n client = Elasticsearch::Client.new(host: options.elasticsearch, log: false)\n indexer = ElasticIndexer.new(client: client, autocommit: 500,logger: logger)\n \n logger.info(\"Scanning #{bucketname}\")\n Aws::S3::Bucket.new(bucketname).objects.each {|objectsummary|\n logger.info(\"got key #{objectsummary.key}\")\n ct_major = \"\"\n ct_minor = \"\"\n parts = /^(.*)\\/(.*)$/.match(objectsummary.object.content_type)\n if parts\n ct_major = parts[1]\n ct_minor = parts[2]\n else\n logger.warn(\"Unable to parse content type '#{objectsummary.object.content_type}'\")\n end\n \n xtn = \"\"\n parts = /\\.([^\\.]+)$/.match(objectsummary.key)\n if parts\n xtn = parts[1]\n end\n \n ap objectsummary.object.metadata\n \n indexer.add_record({\n bucket: bucketname,\n etag: objectsummary.etag,\n path: objectsummary.key,\n last_modified: Date.parse(objectsummary.last_modified.to_s).iso8601,\n owner: {\n display_name: objectsummary.owner.display_name,\n id: objectsummary.owner.id\n },\n size: objectsummary.size,\n content_type: {\n major: ct_major,\n minor: ct_minor,\n raw: objectsummary.object.content_type\n },\n storage_class: objectsummary.storage_class,\n content_encoding: objectsummary.object.content_encoding,\n content_disposition: objectsummary.object.content_disposition,\n extra_data: objectsummary.object.metadata,\n file_extension: xtn\n })\n }\n indexer.commit\nrescue Aws::S3::Errors::PermanentRedirect=>e\n logger.error(e.message)\nend", "def set_bucket\n @bucket = Bucket.find(params[:id])\n end", "def set_bucket\n @bucket = Bucket.find(params[:id])\n end", "def set_bucket\n @bucket = Bucket.find(params[:id])\n end", "def finish\n # Look up our bucket, if there is one\n bucket\n super\n end", "def create_bucket(bucket_key, access_token)\n begin\n response = RestClient.post(\"#{API_URL}/oss/v2/buckets\",\n { bucketKey: bucket_key, policyKey:'transient'}.to_json,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/json' })\n return response\n rescue RestClient::Exception => e\n if e.response.code == 409\n then return 'Bucket already exists'\n else raise e\n end\n end\n end", "def apply(bucket = nil)\n bucket ||= export()\n catalog = bucket.to_catalog\n res = catalog.apply\n catalog.clear\n res\n end", "def bucket!(bucket)\n request = Riakpb::RpbGetBucketReq.new(:bucket => bucket)\n response = rpc.request(\n Util::MessageCode::GET_BUCKET_REQUEST,\n request\n )\n @bucket_cache[bucket].load(response)\n end", "def set_bucket(lower, upper)\n @base = \"#{@dirname}/#{lower}.#{upper}.#{@basename}\"\n end", "def write_to_bucket(payload, stack)\n raise NotImplementedError\n if bucket = config[:bucket]\n key_path = File.join(*[\n bucket_prefix(stack),\n export_file_name(stack),\n ].compact)\n file_store(payload, key_path, provider.service_for(:storage).directories.get(bucket))\n end\n end", "def default_bucket\n request(method: :get, path: '/v1/buckets')\n end", "def bucket_name=(value)\n (class << self; self; end).send(:define_method, :bucket_name){ value }\n end", "def update!(**args)\n @bucket_counts = args[:bucket_counts] if args.key?(:bucket_counts)\n @count = args[:count] if args.key?(:count)\n @exemplars = args[:exemplars] if args.key?(:exemplars)\n @explicit_buckets = args[:explicit_buckets] if args.key?(:explicit_buckets)\n @exponential_buckets = args[:exponential_buckets] if args.key?(:exponential_buckets)\n @linear_buckets = args[:linear_buckets] if args.key?(:linear_buckets)\n @maximum = args[:maximum] if args.key?(:maximum)\n @mean = args[:mean] if args.key?(:mean)\n @minimum = args[:minimum] if args.key?(:minimum)\n @sum_of_squared_deviation = args[:sum_of_squared_deviation] if args.key?(:sum_of_squared_deviation)\n end", "def bitbucket_sync_export_with_http_info(id, bitbucket_sync_export_parameters, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: BitbucketSyncApi.bitbucket_sync_export ...'\n end\n # verify the required parameter 'id' is set\n if @api_client.config.client_side_validation && id.nil?\n fail ArgumentError, \"Missing the required parameter 'id' when calling BitbucketSyncApi.bitbucket_sync_export\"\n end\n # verify the required parameter 'bitbucket_sync_export_parameters' is set\n if @api_client.config.client_side_validation && bitbucket_sync_export_parameters.nil?\n fail ArgumentError, \"Missing the required parameter 'bitbucket_sync_export_parameters' when calling BitbucketSyncApi.bitbucket_sync_export\"\n end\n # resource path\n local_var_path = '/bitbucket_syncs/{id}/export'.sub('{' + 'id' + '}', CGI.escape(id.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 header_params[:'X-PhraseApp-OTP'] = opts[:'x_phrase_app_otp'] if !opts[:'x_phrase_app_otp'].nil?\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(bitbucket_sync_export_parameters) \n\n # return_type\n return_type = opts[:return_type] || 'BitbucketSyncExportResponse' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Basic', 'Token']\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: BitbucketSyncApi#bitbucket_sync_export\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n response = ::Phrase::Response.new(data, headers)\n return response, status_code, headers\n end", "def set_bucket\n @bucket = Bucket.find(params[:id])\n has_authority\n end", "def add(bucket, obj)\n @buffer[bucket] << obj\n check_and_write bucket\n end", "def public_bucket=(value)\n class_variable_set(\"@@public_bucket\",value)\n end", "def bucket\n @bucket or raise NoBucketSpecified\n end", "def upload_file(bucket_key,file_location,file_name,access_token)\n file_uploaded = File.new(file_location, 'rb')\n response = RestClient.put(\"#{API_URL}/oss/v2/buckets/#{bucket_key}/objects/#{file_name}\",\n file_uploaded,\n { Authorization: \"Bearer #{access_token}\", content_type:'application/octet-stream'})\n return response\nend", "def update!(**args)\n @bucket = args[:bucket] if args.key?(:bucket)\n @generation_number = args[:generation_number] if args.key?(:generation_number)\n @object = args[:object] if args.key?(:object)\n end", "def bucket_params\n params.require(:bucket).permit(:experiment_id, :http_verb, :api_path, :uuid_key, :uuid_placeholder, :request_body, :timeout, :impression_id, :is_graph_query, :modular, :is_empty, :description, :variables)\n end", "def response_db_vbucket(method, database, vbucket_number, uuid)\n \n #5.times { puts }\n #puts \"#{method} requested [database] /#{database}/#{vbucket_number};#{uuid}\"\n \n if database == XDCR_BUCKET \n return [200]\n else\n return [404]\n end\nend", "def test_put_bucket_predefined_acl\n @client.put_bucket(new_bucket_name, :predefined_acl => \"publicRead\")\n end", "def update!(**args)\n @bucket_name = args[:bucket_name] if args.key?(:bucket_name)\n @generation = args[:generation] if args.key?(:generation)\n @object_name = args[:object_name] if args.key?(:object_name)\n end", "def upload(bucket, file); end", "def update!(**args)\n @bigquery_export = args[:bigquery_export] if args.key?(:bigquery_export)\n end", "def update!(**args)\n @bigquery_export = args[:bigquery_export] if args.key?(:bigquery_export)\n end", "def index_cloud_buckets_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: CloudBucketsApi.index_cloud_buckets ...'\n end\n # resource path\n local_var_path = '/cloud_buckets'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?\n query_params[:'offset'] = opts[:'offset'] if !opts[:'offset'].nil?\n query_params[:'sort_by'] = @api_client.build_collection_param(opts[:'sort_by'], :pipe) if !opts[:'sort_by'].nil?\n query_params[:'id'] = opts[:'id'] if !opts[:'id'].nil?\n query_params[:'cloud_connector_id'] = opts[:'cloud_connector_id'] if !opts[:'cloud_connector_id'].nil?\n query_params[:'pool_id'] = opts[:'pool_id'] if !opts[:'pool_id'].nil?\n query_params[:'name'] = opts[:'name'] if !opts[:'name'].nil?\n query_params[:'location'] = opts[:'location'] if !opts[:'location'].nil?\n query_params[:'price'] = opts[:'price'] if !opts[:'price'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\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] || 'CloudBucketCollection' \n\n # auth_names\n auth_names = opts[:auth_names] || ['BasicAuth', 'BearerAuth']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: CloudBucketsApi#index_cloud_buckets\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def update!(**args)\n @bigquery_export_result = args[:bigquery_export_result] if args.key?(:bigquery_export_result)\n end", "def update!(**args)\n @bigquery_export_result = args[:bigquery_export_result] if args.key?(:bigquery_export_result)\n end", "def update!(**args)\n @bigquery_export_result = args[:bigquery_export_result] if args.key?(:bigquery_export_result)\n end", "def bucket_function\n @bucket_function ||= _bucket_function\n end", "def initialize\n @bucket = []\n @bucket\n end", "def setup(resources)\n @bucket_size = Hash.new\n end", "def call\n # Note: will not change any of these instance variables unless we note breaking changes\n @bucket = @info[bucket_field]\n @key = @info[key_field] # key_field is INTERFACE METHOD IE: aws: key , google: prefix\n @folder = folder(@key) # useful as prefix for performance when listing objects in buckets\n @dest = dest(@bucket)\n # May change any of these instance variables that follow\n @dest_folder = \"#{@dest}/#{@folder}\"\n\n download_statefiles\n show_resources\n end", "def initialize(path,klass,options={:buckets_count => BUCKETS_COUNT})\n super(klass)\n @path = path + \"_idx/\"\n @buckets_count = options[:buckets_count] || BUCKETS_COUNT\n @buckets_ceil = Math::log2(@buckets_count).ceil\n @buckets = {}\n end", "def update!(**args)\n @bucket_uri = args[:bucket_uri] if args.key?(:bucket_uri)\n end", "def update!(**args)\n @bucket_uri = args[:bucket_uri] if args.key?(:bucket_uri)\n end", "def update!(**args)\n @bucket = args[:bucket] if args.key?(:bucket)\n @generation = args[:generation] if args.key?(:generation)\n @object = args[:object] if args.key?(:object)\n end", "def update!(**args)\n @last_month_bucket = args[:last_month_bucket] if args.key?(:last_month_bucket)\n @last_week_bucket = args[:last_week_bucket] if args.key?(:last_week_bucket)\n @last_year_bucket = args[:last_year_bucket] if args.key?(:last_year_bucket)\n @year_plus_bucket = args[:year_plus_bucket] if args.key?(:year_plus_bucket)\n end", "def perform_save\n api.bucket_save(self)\n end", "def get_cmd_histogram(bucket, node, bucket_password, memcache_port, time)\n\n logger.info \"get_cmd_histogram:start: bucket = #{bucket}, node = #{node}, memcache_port = #{memcache_port}, time = #{time.to_i}\"\n\n #host = node.sub(':8091', '').sub('http://', '')\n host = get_host(node)\n\n if host == nil\n logger.error \"get_cmd_histogram:exception: host #{node} cannot be null\"\n return\n end\n\n if (host == 'localhost')\n ip_address = IPSocket.getaddress(Socket.gethostname)\n otpNode = \"ns_1@#{ip_address.gsub('.','-')}\"\n else\n otpNode = \"ns_1@#{host.gsub('.','-')}\"\n end\n\n # Prepare cbstats command\n cbstatsCLI = CouchbaseStatsCLI.new\n response = cbstatsCLI.get_stats(bucket, bucket_password,\n host, memcache_port,\n main_command = 'timings', sub_command = 'get_cmd')\n #puts response.split('storage_age')[0]\n\n if (response.index('get_cmd') == nil)\n logger.info \"No results returned from cbstats command for bucket: #{bucket}\"\n return\n end\n\n current_get_ops_response = response.split('storage_age')[0].lines.to_a\n last_position = current_get_ops_response.length - 2\n\n # Extract total get ops performed\n current_total_get_ops = current_get_ops_response[0].split('(')[1].to_f\n current_get_ops_hash = Hash.new\n\n # Create hash of upper time limit as key and get ops as value\n current_get_ops_response[1..last_position - 1].each do |this_line|\n current_get_ops_hash[\"#{this_line.split(':')[0].split('-')[1].strip}\"] = this_line.split(')')[1].split(' ')[0].to_f\n end\n\n # puts \"===================================\"\n # puts current_get_ops_hash\n # puts \"Current total get ops = #{current_total_get_ops}\"\n # puts \"===================================\"\n\n current_running_total = 0.0\n previous_total_get_ops = 0.0\n\n # Check if cbstats file exists. This implies there's been a previous run\n previous_get_ops_hash = Hash.new\n fileName = CONST_CBSTATS_FILE_PREFIX + \"_#{bucket.downcase}.txt\"\n\n if (File.exist?(fileName))\n oldfile = File.open(fileName, 'r')\n metrics_str = oldfile.read\n oldfile.close\n previous_get_ops_hash = eval(metrics_str)\n previous_get_ops_hash.each {|key, value| previous_total_get_ops += value}\n # puts \"Previous get ops = #{metrics_str}\"\n # puts \"Previous total get ops = #{previous_total_get_ops}\"\n # puts \"===================================\"\n end\n\n # Compare previous and current get ops metrics\n if (current_get_ops_hash == previous_get_ops_hash)\n logger.info 'No ops between the last two runs'\n return\n end\n\n percentiles_hash = Hash.new\n\n current_get_ops_hash.each {|key, current_value|\n previous_value = previous_get_ops_hash.has_key?(key)? previous_get_ops_hash[key] : 0.0\n\n if (current_value != previous_value)\n current_running_total += current_value - previous_value\n percentile = (current_running_total / (current_total_get_ops - previous_total_get_ops) ) * 100\n percentiles_hash[key] = percentile.round(2)\n end\n }\n\n # Write hash to file\n file = File.open(fileName, 'w')\n file.write(current_get_ops_hash)\n file.close\n\n #puts \"Percentile Result = #{percentiles_hash}\"\n\n # Read the driver percentile ranges from config file. If the file doesn't exist, create it\n if File.exist?('percentile_ranges.txt')\n driver_percentile_range = eval(File.open('percentile_ranges.txt', 'r') { |file| file.readline })\n else\n driver_percentile_range = [25, 50, 75, 90, 95, 99, 100]\n conf_file = File.open('percentile_ranges.txt', 'w')\n conf_file.write(driver_percentile_range)\n conf_file.close\n end\n\n microsecond_percentile_hash = percentiles_hash.map {|key, value|\n [\n key.include?('us') ? key[0..key.index('us')-1].to_i : key[0..key.index('ms')-1].to_i * 1000,\n value\n ]\n }\n\n sorted_percentile_hash = microsecond_percentile_hash.sort\n\n driver_percentile_range.each { |percentile|\n metric_name = construct_metric_name(\"#{otpNode}.buckets.#{bucket}.cmd_get_timing.#{percentile}_pctile\", CONST_NODE_LEVEL)\n\n if percentile < 100\n key_value = sorted_percentile_hash.select {|key, value| value >= percentile}.first().join(':')\n else\n key_value = sorted_percentile_hash.select {|key, value| value >= percentile}.last().join(':')\n end\n\n #puts \"#{metric_name} = #{time_us}\"\n write_to_graphite(metric_name, time_us, time)\n }\n\n\n logger.info 'get_cmd_histogram: Completed'\n end", "def publish_s3_bucket\n DeliveryGolang::Helpers::Publish.publish_s3_bucket(node)\n end", "def object_content_by_bucket_unsigned_request(bucket_name, region)\r\n bucket_path = \"https://s3.#{region}.amazonaws.com/#{bucket_name}\"\r\n response = Net::HTTP.get(URI(bucket_path))\r\n puts \"Content of unsigned request to '#{bucket_path}':\\n\\n#{response}\\n\\n\"\r\nend", "def s3_gen_bucket\n s3_gen.bucket(App.aws_bucket,true)\n end", "def invoke_export_task_0_with_http_info(export_request_parameter, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyTaskApi.invoke_export_task_0 ...'\n end\n # verify the required parameter 'export_request_parameter' is set\n if @api_client.config.client_side_validation && export_request_parameter.nil?\n fail ArgumentError, \"Missing the required parameter 'export_request_parameter' when calling PolicyTaskApi.invoke_export_task_0\"\n end\n # resource path\n local_var_path = '/infra/settings/firewall/export'\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(export_request_parameter)\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 => 'ExportTask')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyTaskApi#invoke_export_task_0\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def delete(bucket, file); end", "def bucket\n @gapi[\"bucket\"]\n end", "def initialize(bucket, data)\n super\n @all_views = {}\n @views = @doc.has_key?('views') ? @doc['views'].keys : []\n @spatial = @doc.has_key?('spatial') ? @doc['spatial'].keys : []\n @views.each{|name| @all_views[name] = \"#{@id}/_view/#{name}\"}\n @spatial.each{|name| @all_views[name] = \"#{@id}/_spatial/#{name}\"}\n end", "def <<(data)\n @bucket << data\n end", "def run\n super\n\n opt_use_file = _get_option(\"use_file\")\n opt_filename = _get_option(\"brute_file\")\n\n if opt_use_file\n _log \"Using file: #{opt_filename}\"\n potential_buckets = File.read(\"#{$intrigue_basedir}/data/#{opt_filename}\").split(\"\\n\")\n else\n _log \"Using provided brute list\"\n potential_buckets = _get_entity_name.split(\",\")\n end\n\n potential_buckets.each do |pb|\n\n pb.chomp!\n\n # Check prefix\n potential_bucket_uri = \"https://#{pb}.s3.amazonaws.com?max-keys=1\"\n doc = Nokogiri::HTML(http_get_body(\"#{potential_bucket_uri}\"))\n next if ( doc.xpath(\"//code\").text =~ /NoSuchBucket/ ||\n doc.xpath(\"//code\").text =~ /InvalidBucketName/ ||\n doc.xpath(\"//code\").text =~ /AllAccessDisabled/ ||\n doc.xpath(\"//code\").text =~ /AccessDenied/ ||\n doc.xpath(\"//code\").text =~ /PermanentRedirect/)\n _create_entity(\"AwsS3Bucket\", {\"name\" => \"#{potential_bucket_uri}\", \"uri\" => \"#{potential_bucket_uri}\" })\n end\n\n potential_buckets.each do |pb|\n # Check postfix\n potential_bucket_uri = \"https://s3.amazonaws.com/#{pb}?max-keys=1\"\n doc = Nokogiri::HTML(http_get_body(\"#{potential_bucket_uri}\"))\n next if ( doc.xpath(\"//code\").text =~ /NoSuchBucket/ ||\n doc.xpath(\"//code\").text =~ /InvalidBucketName/ ||\n doc.xpath(\"//code\").text =~ /AllAccessDisabled/ ||\n doc.xpath(\"//code\").text =~ /AccessDenied/ ||\n doc.xpath(\"//code\").text =~ /PermanentRedirect/)\n _create_entity(\"AwsS3Bucket\", {\"name\" => \"#{potential_bucket_uri}\", \"uri\" => \"#{potential_bucket_uri}\" })\n end\n\n end", "def initialize(code_bucket, url_bucket = nil)\n @code_bucket = code_bucket\n @url_bucket = url_bucket || @code_bucket\n end", "def method_missing(method_name, *args, &block)\n if @bucket.respond_to? method_name.to_sym\n @bucket.__send__(method_name, *args, &block)\n else\n super\n end\n end", "def create_bucket(bucket_name)\n send_request(PUT, bucket_name)\n end", "def bucket_data(bucket, type = nil)\n bucket = bucket.name if Bucket === bucket\n bucket_type_data(type)[:buckets][bucket] ||= {:props => DEFAULT_BUCKET_PROPS.dup, :keys => {}}\n end", "def s3_info()\n verbose_or_debug_msg(\"Checking S3 resources in all regions for profile \\\"#{$profile}\\\"\")\n s3_resource=Aws::S3::Resource.new(region: \"eu-west-1\", credentials: $credentials)\n if $audit_mode\n opfile=File.open(\"#{$audit_dir}/all/s3_buckets\",\"w\")\n else\n opfile=$stdout\n end\n \n # If we've not specified details, then simply list the buckets and return.\n if ! $s3_details\n s3_resource.buckets.each do |b|\n if not $quiet\n opfile.print(\"\\\"#{$profile}\\\",\\\"S3 Bucket\\\",\\\"All\\\",\\\"#{b.name}\\\",\\\"#{b.creation_date}\\\"\\n\")\n end\n $bucket_count+=1\n end\n return\n end\n \n # get a list of buckets:\n debug_msg(\"Generating a list of all buckets:\\n\")\n all_buckets=Hash.new()\n s3_resource.buckets.each do |bucket|\n all_buckets[bucket.name] = false\n end\n all_buckets.each do |b|\n debug_msg (\"#{b}\")\n end\n\n # Attempt to show all objects in each bucket - this is region-dependent - see comment above\n $regions.each do |region|\n begin\n s3_resource=Aws::S3::Resource.new(region: region, credentials: $credentials)\n s3_resource.buckets.each do |bucket|\n total_size=0\n if all_buckets[bucket.name] == false\n bucket.objects.each do |object|\n total_size+=object.size\n end\n end\n if not $quiet\n print(\"\\\"#{$profile}\\\",\\\"s3 bucket\\\",\\\"#{region}\\\",\\\"#{bucket.name}\\\",\\\"#{total_size}\\\"\\n\")\n all_buckets[bucket.name]=true\n end\n end\n $bucket_count+=1\n rescue Aws::S3::Errors::ServiceError => err\n debug_msg(\"#{err.inspect()}\\n\")\n end\n end\nend", "def notify\n desc = MU::Cloud::AWS::Bucket.describe_bucket(@cloud_id, credentials: @config['credentials'], region: @config['region'])\n MU.structToHash(desc)\n end", "def write_and_flush(bucket)\n File.open(bucket, 'a+') do |o|\n @buffer[bucket].each do |v|\n o.write(v)\n end\n end\n clear_buffer!\n end", "def bucket_descriptor\n labels = {}\n MU::MommaCat.listStandardTags.each_pair { |name, value|\n if !value.nil?\n labels[name.downcase] = value.downcase.gsub(/[^a-z0-9\\-\\_]/i, \"_\")\n end\n }\n labels[\"name\"] = @mu_name.downcase\n\n params = {\n :name => @mu_name.downcase,\n :labels => labels,\n :storage_class => @config['storage_class'],\n }\n\n if @config['web']\n params[:website] = MU::Cloud::Google.storage(:Bucket)::Website.new(\n main_page_suffix: @config['web_index_object'],\n not_found_page: @config['web_error_object']\n )\n end\n\n if @config['versioning']\n params[:versioning] = MU::Cloud::Google.storage(:Bucket)::Versioning.new(enabled: true)\n else\n params[:versioning] = MU::Cloud::Google.storage(:Bucket)::Versioning.new(enabled: false)\n end\n\n if @config['bucket_wide_acls']\n params[:iam_configuration] = MU::Cloud::Google.storage(:Bucket)::IamConfiguration.new(\n bucket_policy_only: MU::Cloud::Google.storage(:Bucket)::IamConfiguration::BucketPolicyOnly.new(\n enabled: @config['bucket_wide_acls']\n )\n )\n else\n params[:iam_configuration] = MU::Cloud::Google.storage(:Bucket)::IamConfiguration.new(\n bucket_policy_only: MU::Cloud::Google.storage(:Bucket)::IamConfiguration::BucketPolicyOnly.new(\n enabled: false\n )\n )\n end\n\n MU::Cloud::Google.storage(:Bucket).new(params)\n end", "def viewBucketObjects\n begin\n puts params\n session[:s3bucket] = params[:selection][:bucket]\n\n #Get the list of buckets if a connection can be Established\n #Return an empty list of buckets if a connection cant be established\n @buckets_array = createEmptyBucketsArray if session[:s3connection] != \"Established\"\n @buckets_array = getBucketsList if session[:s3connection] == \"Established\"\n\n #Get the list of objects for the selected bucket.\n #Returns an empty list of objects if the selected bucket value is None\n @objects_array = createEmptyObjectsArray if session[:s3bucket] == \"No Bucket Selected\"\n @objects_array = getObjectsList if session[:s3bucket] != \"No Bucket Selected\"\n flash.now[:info] = \"<strong>Success!</strong>\".html_safe + \" Object list downloaded for account.\"\n rescue Exception => error\n @buckets_array = createEmptyBucketsArray if session[:s3connection] != \"Established\"\n @objects_array = createEmptyObjectsArray if session[:s3bucket] == \"No Bucket Selected\"\n flash.now[:danger] = \"<strong>Error!</strong>\".html_safe + \" Problem loading application: #{error}.\"\n end\n end", "def initialize bucket #:nodoc:\n @bucket = bucket.name\n @connection = bucket.connection\n @owners = nil\n @writers = nil\n @readers = nil\n end", "def initialize bucket #:nodoc:\n @bucket = bucket.name\n @connection = bucket.connection\n @owners = nil\n @writers = nil\n @readers = nil\n end", "def listBucketsTest()\n # Tests listBuckets api command by creating\n # new buckets from bucket_name_list\n\n # get random bucket names and create list\n bucket_name1 = get_random_bucket_name()\n bucket_name2 = get_random_bucket_name()\n bucket_name_list = [bucket_name1, bucket_name2]\n # Initialize hash table, 'log_output'\n log_output = initialize_log_output('listBuckets')\n # Prepare arg/value hash table and set it in log_output\n arg_value_hash = {}\n log_output[:args].each { |x| arg_value_hash[:\"#{x}\"] = eval x.to_s }\n log_output[:args] = arg_value_hash\n\n begin\n start_time = Time.now\n prev_total_buckets = listBucketsWrapper(log_output).length\n new_buckets = bucket_name_list.length\n bucket_name_list.each do |b|\n makeBucketWrapper(b, log_output)\n end\n new_total_buckets = prev_total_buckets + new_buckets\n if new_total_buckets >= prev_total_buckets + new_buckets\n log_output[:status] = 'PASS'\n else\n log_output[:error] = 'Could not find expected number of buckets'\n log_output[:status] = 'FAIL'\n end\n cleanUp(bucket_name_list, log_output)\n rescue => log_output[:error]\n log_output[:status] = 'FAIL'\n end\n\n print_log(log_output, start_time)\n end", "def show_bucket_path\n unless $list.curselection.empty?\n begin\n idx = $list.curselection\n idx = idx[0]\n $bucket = $bucket_list[idx]\n $lb_bucket_name.text = \"https://s3-#{$region}.amazonaws.com/#{$bucket}\"\n $lb_bucket_region.text = $s3.client.get_bucket_location(bucket: $bucket).location_constraint\n $open_button.state = 'normal'\n $delete_button.state = 'normal'\n $bucket_public_read.state = 'normal'\n $bucket_public_write.state = 'normal'\n resp = $s3.client.get_bucket_acl(bucket: $bucket)\n $bucket_files = $s3.bucket($bucket).objects(prefix: '', delimiter: '').collect(&:key)\n $lb_bucket_items_qty.text = $bucket_files.count\n if resp.grants[1]\n get_permission = resp.grants[1].permission\n if get_permission == 'READ'\n $bucket_public_read.select()\n end\n get_permission2 = resp.grants[2].permission\n if get_permission2 == 'WRITE'\n $bucket_public_write.select()\n end\n end\n rescue\n Tk.messageBox('type' => 'ok',\n 'icon' => 'error',\n 'title' => 'Object Select',\n 'message' => 'This Bucket is in a different Region')\n $open_button.state = 'disabled'\n $delete_button.state = 'disabled'\n $bucket_public_read.state = 'disabled'\n $bucket_public_write.state = 'disabled'\n $lb_bucket_name.text = ''\n $lb_bucket_items_qty.text = ''\n end\n else\n Tk.messageBox('type' => 'ok',\n 'icon' => 'error',\n 'title' => 'Object Select',\n 'message' => 'You need to select a Bucket')\n end\n end", "def bucket_params\n params.permit(:user_id, :product_id, :number)\n end", "def upload_bundle_command( bucket_name)\n super + ' --ec2certificate $EC2_CERT'\n end", "def get_usage_and_quota(origin:)\n {\n method: \"Storage.getUsageAndQuota\",\n params: { origin: origin }.compact\n }\n end", "def update!(**args)\n @integer_buckets = args[:integer_buckets] if args.key?(:integer_buckets)\n end", "def create_bucket(bucket_name, options={})\n options[:send_goog_project_id] = true\n resp = put(bucket_name, '/', options)\n if resp.code == \"200\"\n resp_obj = {}\n resp_obj[:success] = true\n resp_obj[:bucket_name] = bucket_name\n resp_obj[:message] = \"Bucket created\"\n\n else\n resp_obj = Crack::XML.parse(resp.body)\n resp_obj[:success] = false\n resp_obj[:bucket_name] = bucket_name\n resp_obj[:message] = resp_obj[\"Error\"][\"Message\"].to_s\n resp_obj[:code] = resp_obj[\"Error\"][\"Code\"]\n resp_obj[:raw] = Crack::XML.parse(resp.body)\n resp_obj.each_key {|key| resp_obj.delete(key) unless [:success, :bucket_name, :message, :code, :raw].include?(key) }\n\n end\n return resp_obj\n end", "def serialize(writer)\n raise StandardError, 'writer cannot be null' if writer.nil?\n super\n writer.write_collection_of_object_values(\"buckets\", @buckets)\n writer.write_collection_of_object_values(\"plans\", @plans)\n writer.write_collection_of_object_values(\"tasks\", @tasks)\n end", "def add_bucket(bucket_name, access_key_id)\n Result.new(call(CMD_ADD_BUCKET % [bucket_name, access_key_id]))\n end", "def bucket_name\n @timestamp + '.' + bucket_base_name\n end", "def get_usage_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: HistoricalApi.get_usage ...'\n end\n # unbox the parameters from the hash\n # resource path\n local_var_path = '/stats/usage'\n\n # query parameters\n query_params = opts[:query_params] || {}\n query_params[:'from'] = opts[:'from'] if !opts[:'from'].nil?\n query_params[:'to'] = opts[:'to'] if !opts[:'to'].nil?\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:debug_body]\n\n # return_type\n return_type = opts[:debug_return_type] || 'HistoricalUsageAggregateResponse'\n\n # auth_names\n auth_names = opts[:debug_auth_names] || ['token']\n\n new_options = opts.merge(\n :operation => :\"HistoricalApi.get_usage\",\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: HistoricalApi#get_usage\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def setup_bucket\n @bucket = Aws::S3::Resource.new(region: @s3_region).bucket(@aws_bucket_name)\n end", "def set_partition_usage(host, partition, usage)\n self.client.set(\"gh.storage.server.usage.percent.#{host}.#{partition}\", usage.to_s)\n end", "def storage_api(bucket_region)\n Miasma.api(\n :type => :storage,\n :provider => :aws,\n :credentials => config.get(:jackal_stack, :credentials, :storage).merge(\n :aws_bucket_region => bucket_region\n )\n )\n end", "def update!(**args)\n @buckets = args[:buckets] if args.key?(:buckets)\n @overflow_bucket = args[:overflow_bucket] if args.key?(:overflow_bucket)\n @underflow_bucket = args[:underflow_bucket] if args.key?(:underflow_bucket)\n end", "def buckets=(value)\n @buckets = value\n end", "def do_another_thing_on_another_bucket\n # ...\n puts \"done another thing again...\"\n puts \"event #{JSON.dump(event)}\"\n puts \"s3_event #{JSON.dump(s3_event)}\"\n puts \"s3_object #{JSON.dump(s3_object)}\"\n end", "def set_bucket_list\n @bucket_list = BucketList.find(params[:id])\n end", "def set_bucket_list\n @bucket_list = BucketList.find(params[:id])\n end", "def update!(**args)\n @bucket_id = args[:bucket_id] if args.key?(:bucket_id)\n @obj_id = args[:obj_id] if args.key?(:obj_id)\n end", "def invoke_export_task_with_http_info(export_request_parameter, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: PolicyTaskApi.invoke_export_task ...'\n end\n # verify the required parameter 'export_request_parameter' is set\n if @api_client.config.client_side_validation && export_request_parameter.nil?\n fail ArgumentError, \"Missing the required parameter 'export_request_parameter' when calling PolicyTaskApi.invoke_export_task\"\n end\n # resource path\n local_var_path = '/global-infra/settings/firewall/export'\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(export_request_parameter)\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 => 'ExportTask')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: PolicyTaskApi#invoke_export_task\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def initialize\n @buckets = {}\n end", "def download_benchmark_output\n if !ApplicationController.fire_cloud_client.services_available?('GoogleBuckets')\n head 503 and return\n end\n\n requested_file = ApplicationController.gcs_client.execute_gcloud_method(:get_workspace_file, 0, @user_workspace.namespace,\n @user_workspace.name, params[:filename])\n if requested_file.present?\n @signed_url = ApplicationController.gcs_client.execute_gcloud_method(:generate_signed_url, 0, @user_workspace.namespace,\n @user_workspace.name, params[:filename], expires: 15)\n redirect_to @signed_url\n else\n redirect_to user_workspace_path(project: @user_workspace.namespace, name: @user_workspace.name),\n alert: 'The file you requested was unavailable. Please try again.' and return\n end\n\n end", "def render_cache_bucket=(value)\n class_variable_set(\"@@render_cache_bucket\",value)\n end", "def put(params)\n bucket = params[:bucket]\n object = params[:object]\n value = params[:value]\n content_type = params[:content_type]\n cb = params[:cb]\n date = generate_date\n sign_string = generate_signed_string('PUT', 'private', bucket, object, content_type)\n signature = generate_signature(sign_string)\n auth = generate_auth(signature)\n headers = generate_put_headers(date, auth, 'private', content_type, value.size)\n path = \"/\" << object\n\n @req_options = {:method => :put, :head => headers, :path => path, :body => value}\n @cb = cb if cb\n @bucket = bucket\n try_request\n self\n end", "def update!(**args)\n @bucket_bounds = args[:bucket_bounds] if args.key?(:bucket_bounds)\n @requires_min_max = args[:requires_min_max] if args.key?(:requires_min_max)\n end", "def update!(**args)\n @bucket_bounds = args[:bucket_bounds] if args.key?(:bucket_bounds)\n @requires_min_max = args[:requires_min_max] if args.key?(:requires_min_max)\n end", "def force_to_bucket!(series_name, bucket_name, group_name)\n # Forcefully place inside the bucket\n in_bucket?(series_name, bucket_name, group_name, true)\n end", "def aws_test_bucket_resource\n Aws::S3::Resource.new(\n region: ENV['SHF_AWS_S3_TEST_BACKUP_REGION'],\n credentials: Aws::Credentials.new(ENV['SHF_AWS_S3_BACKUP_KEY_ID'],\n ENV['SHF_AWS_S3_BACKUP_SECRET_ACCESS_KEY']))\n end" ]
[ "0.7764203", "0.6104856", "0.6087291", "0.56268525", "0.5613061", "0.5583615", "0.5548671", "0.5513992", "0.54852957", "0.5484041", "0.54838175", "0.54838175", "0.54838175", "0.5476712", "0.54758847", "0.5384428", "0.5345993", "0.5324406", "0.5272792", "0.5270324", "0.5267032", "0.5261939", "0.52573025", "0.52504265", "0.5223531", "0.52177995", "0.5192826", "0.5173969", "0.51581585", "0.51554674", "0.5152663", "0.51526046", "0.5149196", "0.5142424", "0.51402795", "0.51402795", "0.5131583", "0.512435", "0.512435", "0.512435", "0.5122308", "0.51134074", "0.5096359", "0.5095116", "0.50906223", "0.50841624", "0.50841624", "0.505142", "0.5049886", "0.50345165", "0.50312024", "0.500877", "0.4978466", "0.4965652", "0.4953963", "0.49502972", "0.49502826", "0.49405703", "0.49403688", "0.49381283", "0.4933793", "0.49265122", "0.49210048", "0.4913553", "0.49096912", "0.49072325", "0.4899482", "0.48993072", "0.48927656", "0.48887837", "0.48887837", "0.48854443", "0.48797065", "0.4879563", "0.487813", "0.4875502", "0.48750064", "0.48705012", "0.4868014", "0.4850589", "0.48504275", "0.48491868", "0.48401275", "0.48373795", "0.48370498", "0.48316506", "0.4829065", "0.48204243", "0.4816969", "0.4816969", "0.481524", "0.4814696", "0.48081207", "0.48023605", "0.47985798", "0.47978073", "0.47896132", "0.4788567", "0.47847465", "0.47827542" ]
0.8040727
0
GET /index GET /index.json
def index $log.info "HomeController -> Index" @distances = {'1 Mile' => 1, '10 Miles' => 2, 'The World' => 3} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index\n get('')\n end", "def index\n respond_to do |format|\n format.html {index_html}\n format.json {index_json}\n end\n end", "def index\n get\n end", "def index\n\t\trespond_to do |format|\n\t\t\tformat.html {html_index}\n\t\t\tformat.json {json_index}\n\t\tend\n\tend", "def index\n @gets = Get.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @gets }\n end\n end", "def index\n @index\n end", "def index\n @index\n end", "def index; @index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index; end", "def index()\n @index\n end", "def index\n \n end", "def index\n \n end", "def index\n \n end", "def index\n @jsons = Json.all\n end", "def index\n @resources = Resource.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @resources }\n end\n end", "def index\n @index\n end", "def index\n \t\n end", "def index\n \t\n end", "def index\r\n end", "def index\r\n end", "def index\r\n end", "def index\n respond_to do |format|\n format.html\n format.json\n end\n end", "def index\n render\n end", "def index ; @index ; end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\r\n build_index unless @index\r\n @index\r\n end", "def index\n @items = Item.found\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @items }\n end\n end", "def index\n respond_to do |format|\n format.html { redirect_to(root_path) }\n format.json { render :index, status: :unprocessable_entity }\n end\n end", "def index\n render json: Client.all\n end", "def index\n recipes = Recipe.all\n render status: :ok, json: recipes\n end", "def index\n @jsons = Json.all\n\n\n end", "def index\n respond_to do |format|\n format.html\n format.json\n end \n end", "def index\n respond_to do |format|\n format.html\n format.json\n end \n end", "def index\n\n end", "def index\n\n end", "def index\n @documents = Document.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @documents }\n end\n end", "def index\n @searches = Search.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @searches }\n end\n end", "def index\n params[:index]\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end", "def index\n end" ]
[ "0.79490423", "0.7846905", "0.77262616", "0.768682", "0.7279624", "0.7236605", "0.7236605", "0.7210882", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.7185578", "0.71852726", "0.7183053", "0.71656036", "0.71656036", "0.71656036", "0.7152967", "0.7069641", "0.70614874", "0.7008543", "0.7008543", "0.7003237", "0.7003237", "0.7003237", "0.69986266", "0.6997652", "0.6992225", "0.6991225", "0.6991225", "0.6991225", "0.6991225", "0.6991225", "0.6991225", "0.6991225", "0.6991225", "0.69793785", "0.69732714", "0.69702554", "0.6963308", "0.69598037", "0.6943064", "0.693445", "0.6931215", "0.6929202", "0.6929202", "0.69288284", "0.6918405", "0.69168127", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013", "0.69159013" ]
0.0
-1
anagram("A", "a") Test for integer, nil, empty Length of Last Word Input: "Hello World" Output: 5 Input => " ", " abc"
def length_of_last_word(s) s = s.lstrip.split(" ") return 0 if s.empty? s.last.length end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def valid_anagram(text)\n\nend", "def anagram(s)\n if s.length.even?\n substring1 = s[0..s.length/2 - 1].split('')\n substring2 = s[s.length/2..s.length-1].split('')\n i = 0\n while i <= substring1.length\n if substring2.index(substring1[i])\n char = substring1[i]\n substring1.delete_at(i)\n substring2.delete_at(substring2.index(char))\n else\n i += 1\n end\n end\n return substring1.count\n else\n return -1\n end\nend", "def anagram(s)\n firstSubString=s[0...s.length/2]\n secondSubString=s[s.length/2..s.length].split('')\n \n \n if s.length.odd?\n return -1\n else \n firstSubString.each_char do |char1|\n secondSubString.each_with_index do |char2,ids|\n if char1==char2\n secondSubString.delete_at(ids)\n break\n end\n end\n end\n return secondSubString.length \n end\nend", "def anagram string\n mid = string.size/2 -1\n s1 = string.slice(0..mid).chars\n s2 = string.slice(mid+1..-1).chars\n freq = Hash.new(0)\n count = 0\n\n s1.each{ |key| freq[key]+=1 }\n\n s2.each do |letter|\n freq[letter] > 0 ? freq[letter] -=1 : count +=1\n end\n\n string.size.even? ? count : -1\nend", "def anagram(words)\r\n result = words.group_by { |word| word.chars.sort.join }\r\n result.each {|k, v| p v unless v.size == 1}\r\nend", "def panagram?(string)\n string.downcase.scan(/[a-z]/).uniq.size == 26\nend", "def is_anagram(s, t)\n s.chars.sort == t.chars.sort\nend", "def is_anagram?(word)\n#try determining if they are composed of the same letters.\n word.chars.sort == @word.chars.sort\n end", "def anagram (str1, str2)\n # to downcase and remove non alphanumeric characters \n str1_hash = str_to_hash(str1.downcase.gsub(/(\\W)/, \"\"))\n str2_hash = str_to_hash(str2.downcase.gsub(/(\\W)/, \"\"))\n\n if str1_hash == str2_hash\n return true\n else\n return false\n end\n\nend", "def anagram?(string)\n length_matches(string) && character_count_matches(string)\n end", "def anagram(string1, string2)\n puts \"Are #{string1} and #{string2} anagrams?\"\n if string1.length != string2.length\n return false\n else\n string1.length.times do |i|\n if !string2.include? string1[i] \n return false\n end\n end\n return true\n end\nend", "def panagram?(string)\n alphabet_hash = Hash.new()\n \"abcdefghijklmnopqrstuvwxyz\".split(\"\").each do |alphabet|\n alphabet_hash[alphabet] = nil\n end\n string.split(\"\").each do |char|\n alphabet_hash.delete(char.downcase)\n end\n alphabet_hash.length === 0\nend", "def first_anagram?(word1, word2)\n anagrams = []\n arr = word1.chars \n\n arr.permutation.each do |subArr|\n anagrams << subArr.join(\"\")\n end \n p anagram?(anagrams, word2) \nend", "def is_anagram(s, t)\n return s.chars.sort == t.chars.sort\nend", "def panagram?(string)\n \n \n #array a-z \n \n #split string, do .uniq \n \n #reject all punctuation and spaces \n\n #compare with a-z \n \n alphabet = [* \"a\"..\"z\"] \n\n \n if alphabet == string.downcase.gsub(/[^a-z\"\"]/, \"\").split(//).uniq.sort \n return true \n else \n return false \n end\n \n \n\nend", "def is_anagram(s, t)\n\n return s.split(\"\").sort == t.split(\"\").sort\n\nend", "def valid_anagram(str1, str2)\n str1 = str1.split('').sort\n str2 = str2.split('').sort\n if str1 == '' && str2 == ''\n true\n else\n str1 == str2\n end\nend", "def fifth_anagram?(first_word, second_word)\n hash = Hash.new(0)\n first_word.each_char do |char|\n hash[char] += 1\n end\n\n second_word.each_char do |char|\n hash[char] -= 1\n end\n hash.values.all? {|value| value == 0}\nend", "def fifth_anagram?(first_word, second_word)\n word_count = Hash.new(0)\n first_word.chars.each { |char| word_count[char] += 1 }\n second_word.chars.each { |char| word_count[char] -= 1 }\n\n word_count.all? {|_, val| val == 0}\nend", "def fifth_anagram?(str1, str2)\n\n char_hash = Hash.new(0)\n (0...str1.length).each do |idx|\n char1 = str1[idx]\n char2 = str2[idx]\n\n char_hash[char1] += 1\n char_hash[char2] -= 1\n end\n\n char_hash.values.all?(&:zero?)\n\nend", "def anagram?(a, b)\n return false unless a.length == b.length\n a.chars.sort == b.chars.sort\nend", "def fourth_anagram(first_word, second_word)\n hash1 = Hash.new {|h, k| h[k] = []}\n first_word.each_char do |char|\n hash1[char] << char\n end\n second_word.each_char do |char|\n hash1[char] << char\n end\n hash1.values.all? {|ele| ele.length.even?}\nend", "def fourth_anagram?(word1, word2)\n letters = Hash.new(0)\n word1.each_char do |char|\n letters[char] += 1\n end\n word2.each_char do |char2|\n letters[char2] -= 1\n end\n letters.all? {|k,v| v ==0}\nend", "def panagram?(string)\nend", "def third_anagram?(str, word)\n str.chars.sort == word.chars.sort\n end", "def panagram?(string)\n return false if string.length < 26\n\n letters = string.downcase.gsub(/[^a-z]/, '')\n letters.chars.uniq.count >= 26\nend", "def anagram(a,b)\n\ta = a.split('')\n\tb = b.split('')\n\n\ta_length = a.length-1\n\n\tmatch = []\n\tnon_match = 0\n\n\twhile a_length >= 0\n\t\tb.map do |i|\n\t\t\tif i == a[a_length]\n\t\t\t\tmatch << i\n\n\t\t\telse\n\t\t\t\tnext\n\t\t\tend\n\t\tend\n\t\ta_length -= 1\n\tend\n\n\tp match\n\tnon_match = (a.length - match.length).abs + (b.length - match.length).abs\n\n\tputs non_match\n\t\nend", "def anagram?(a, b)\n a.chars.sort == b.chars.sort\nend", "def panagram3?(string)\n string.downcase.scan(/[a-z]/).uniq.size == 26\nend", "def isAnagram(test, original)\n str1 = test.split(\"\").map{ |x| x.ord}.inject(:+)\n str2 = original.split(\"\").map{ |x| x.ord}.inject(:+)\n str1 == str2\nend", "def anagram?(word)\n normalize(word) == normalize(@word)\n end", "def panagram?(string)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n string = string.gsub(/[^A-Za-z]/, \"\")\n string.each_char do |chr|\n alphabet.gsub!(chr, \"\")\n end\n alphabet == \"\"\nend", "def second_anagram?(string1,string2)\n string1.each_char.with_index do |char, i|\n idx = string2.index(char)\n if idx != nil \n string2 = string2[0...idx] + string2[idx+1..-1]\n end\n end\n string2.length == 0\n\nend", "def fourth_anagram?(str1, str2)\n char_count = Hash.new(0)\n str1.each_char do |el|\n char_count[el] += 1\n end\n str2.each_char do |el|\n if char_count[el] == 0\n return false\n else\n char_count[el] -= 1\n end\n end\n str1.length == str2.length\nend", "def anagram str1, str2\n str1.downcase.chars.sort.join == str2.downcase.chars.sort.join\nend", "def second_anagram?(str1, str2) #better than the first ( n^2 )\n str1.each_char do |char|\n second_idx = str2.index(char)\n str2[second_idx] = \"\" unless second_idx == nil\n end\n str2.chars.empty?\nend", "def valid_anagram(s,t)\n\n if s.length != t.length\n return false\n end\n\n #create hashes\n hash_table1 = Hash.new(0)\n hash_table2 = Hash.new(0)\n\n #check frequency of letters in string\n\n s.each_char do |ch|\n if hash_table1[ch] == nil?\n hash_table1[ch] = hash_table1[ch] + 1\n else\n hash_table1[ch] = 1\n end\n\n p hash_table1\n\n end\n\n t.each_char do |ch|\n if hash_table2[ch] == nil?\n hash_table2[ch] = hash_table2[ch] + 1\n else\n hash_table2[ch] = 1\n end\n p hash_table2\n end\n\n #compare both hash table\n\n return hash_table1 == hash_table2\n\nend", "def fourth_anagram?(str1,str2)\n counter = Hash.new(0)\n str1.each_char { |chr| counter[chr] += 1 }\n str2.each_char { |chr| counter[chr] -= 1 }\n counter.all? { |k, v| v == 0 }\nend", "def second_anagram?(str, target)\n # debugger\n str.each_char do |char|\n target_idx = target.index(char) \n target[target_idx] = \"\" if target_idx != nil\n end\n\n target.length == 0\nend", "def anagram?(str1,str2)\r\n count = Hash.new(0)\r\n str1.each_char {|char| count[char] +=1}\r\n str2.each_char {|char| count[char] -=1}\r\n count.values.all?(0)\r\nend", "def third_anagram(str1, str2)\n str1.chars.sort == str2.chars.sort\nend", "def second_anagram?(first_str, second_str)\n first_str.each_char.with_index do |ele, i| # n * m\n idx = second_str.index(ele)\n second_str[idx] = \"\" unless idx.nil?\n end\n return true if second_str.length == 0\n false\nend", "def fourth_anagram?(string1, string2)\n chars_hash = Hash.new(0)\n string1.chars.each do |chr|\n chars_hash[chr] += 1\n end\n\n string2.chars.each do |chr|\n chars_hash[chr] -= 1\n end\n\n chars_hash.values.all? {|count| count == 0}\nend", "def third_anagram?(string1, string2)\n string1.chars.sort == string2.chars.sort\n \nend", "def is_anagram(test, original)\n test.downcase.chars.sort == original.downcase.chars.sort\nend", "def third_anagram?(first_word, second_word)\n first_word.chars.sort == second_word.chars.sort\nend", "def fourth_anagram?(str1, str2)\n helper(str1) == helper(str2)\nend", "def third_anagram?(string1,string2)\n string1.chars.sort == string2.chars.sort\nend", "def anagram(text)\n head, tail = [], text.split('')\n stack = [[head, tail]]\n result = []\n\n while stack.size > 0\n head, tail = stack.pop\n if tail.size.zero?\n result << head\n else\n tail.each_with_index do |_, i|\n _tail = tail.dup\n curr = _tail.delete_at(i)\n _head = head.dup\n _head << curr\n stack << [_head, _tail]\n end\n end\n end\n\n result.tap { |r| r.map! { |p| p.join('') }.uniq! }\n end", "def fourth_anagram?(string1, string2)\n hash = Hash.new(0)\n\n string1.each_char {|char| hash[char] += 1}\n string2.each_char {|char| hash[char] -= 1}\n hash.all? {|k,v| v.zero?}\n\nend", "def second_anagram?(string1, string2)\n arr = string2.chars\n string1.each_char do |char| # n \n result = arr.index(char) # n\n arr.delete_at(result) unless result.nil? \n \n end\n arr.empty? \nend", "def third_anagram?(word_1, word_2)\n word_1.chars.sort == word_2.chars.sort\nend", "def first_anagram?(string1, string2)\n all_anagrams(string1).include?(string2)\nend", "def anagram?(s1,s2)\n\ts1.chars.sort == s2.chars.sort\nend", "def fourth_anagram?(str1, str2)\n counter = Hash.new(0)\n (str1 << str2).each_char do |k, v|\n counter[k] += 1\n end\n !counter.values.any? { |ele| ele == 1 }\nend", "def first_anagram(word1, word2) #the worst \r\n word1.chars.permutation.to_a.any? { |sub| sub.join == word2 } \r\nend", "def first_anagram?(str1, str2)\r\n anagram_helper(str1).include?(str2) \r\n\r\nend", "def panagram?(str)\n alph = ('a'..'z').to_a\n\n str.downcase.chars.each do |char|\n if alph.include?(char)\n alph.delete(char)\n end\n end\n\n alph.empty?\nend", "def anagram3(string, string2)\n(string.chars.sort.join == string2.chars.sort.join) ? true : false\nend", "def panagram?(string)\n # enter your code here\n ans, key = [], []\n alph = (\"a\"..\"z\").to_a\n new = string.downcase.split(\"\")\n new.each {|x| ans.push(x) if alph.include?(x)}\n alph.each {|c| key.push(c) if ans.include?(c)}\n key.length == 26 ? true : false\nend", "def third_anagram?(string, strong)\n string.chars.sort == strong.chars.sort\nend", "def anagram_check(init_string, test_string)\n init_string = init_string.split(\" \").map(&:downcase).join(\"\")\n test_string = init_string.split(\" \").map(&:downcase).join(\"\")\n\n return false unless init_string.size == test_string.size\n\n init_or = 0\n test_or = 0\n\n (init_string.size).times do |i|\n init_or ^= init_string[i].ord\n test_or ^= test_string[i].ord\n end\n\n init_or == test_or\nend", "def third_anagram?(str,str2)\n str.chars.sort == str2.chars.sort\nend", "def third_anagram?(word1, word2)\n word1_chars = word1.split(\"\").sort\n word2_chars = word2.split(\"\").sort\n word1_chars == word2_chars\n\nend", "def anagram?\n chars1 = @input1.downcase.gsub(/[!@#$%^&*()-=_+|;':\",.<>?']/, '').split(\"\").sort\n chars2 = @input2.downcase.gsub(/[!@#$%^&*()-=_+|;':\",.<>?']/, '').split(\"\").sort\n if\n self.allwords?\n if\n chars1 == chars2\n return \"These words are anagrams!\"\n elsif\n self.antigrams?\n return \"These words are not anagrams but they are antigrams!\"\n elsif self.antigrams? == false\n return \"These words are neither anagrams nor antigrams!\"\n end\n else\n return \"You need to input actual words!\"\n end\n end", "def fourth_anagram?(str, target)\n hash = Hash.new(0)\n str.each_char{|char| hash[char] += 1}\n target.each_char{|char| hash[char] -=1}\n hash.values.all?(0)\n\nend", "def fourth_anagram?(str1, str2)\n count1 = Hash.new(0)\n \n\n str1.each_char{|char| count1[char] += 1}\n str2.each_char{|char| count1[char] -= 1}\n\n count1.values.all?{|value| value == 0}\nend", "def fourth_anagram?(word1, word2)\n letter_count = Hash.new { |hash, key| hash[key] = [] }\n\n split1= word1.chars\n split2 = word2.chars\n\n split1.each { |el| letter_count[el] << el }\n split2.each do |el2|\n if letter_count[el2].length > 0\n letter_count[el2].pop\n else\n return false\n end\n end\n\n return false if letter_count.any? { |key, value| value.count > 0 }\n true\n\nend", "def first_anagram?(str1, str2)\n str1.split(\"\").permutation.include?(str2.split(\"\"))\nend", "def third_anagram?(str1,str2)\n str1.chars.sort == str2.chars.sort\nend", "def detect_anagram(word, dictionary)\n letter_array = word.downcase.split(//)\n word_array = []\n letter_array.permutation(word.length){|word| word_array << word.join }\n word_array.select {|word| dictionary.include?(word)}\nend", "def fifth_anagram?(str1, str2)\n count = Hash.new(0)\n str1.each_char {|char| count[char] += 1}\n str2.each_char {|char| count[char] -= 1}\n\n count.all? {|k,v| v.zero? }\nend", "def anagram_3?(str1,str2)\n str1.chars.sort == str2.chars.sort\nend", "def third_anagram?(str1,str2)\r\n str1.chars.sort == str2.chars.sort\r\nend", "def anagrams(string, array)\n string_anagram = string.chars\n \n array.select! do |word|\n word.chars.all? do |letter|\n word.chars.count(letter) == string_anagram.count(letter)\n end\n end\n array\nend", "def anagrams(str1, str2)\n \nend", "def second_anagram?(str_1,str_2)\n str_1.each_char do |c|\n index = str_2.split(\"\").find_index(c)\n str_2 = str_2[0...index] + str_2[index + 1..-1] unless index.nil?\n end\n str_2.empty?\nend", "def third_anagram?(string1, string2)\n string1.chars.sort == string2.chars.sort\nend", "def third_anagram?(string1, string2)\n string1.chars.sort == string2.chars.sort\nend", "def third_anagram?(str1,str2)\n str1.split(\"\").sort == str2.split(\"\").sort # nlogn\nend", "def makeAnagram(a, b)\n # Remove characters present in both strings\n a.each_char do |chr|\n if b.include?(chr)\n a.sub!(chr,''); b.sub!(chr,'')\n end\n end\n b.each_char do |chr|\n if a.include?(chr)\n a.sub!(chr,''); bsub!(chr,'')\n end\n end\n # Return the length of both strings combined\n return (a+b).length\nend", "def is_anagram(s, t)\n return false if s.size != t.size\n\n s_dic = Array.new(26, 0)\n t_dic = Array.new(26, 0)\n\n a_ord = 'a'.ord\n s.each_char { |c| s_dic[c.ord - a_ord] += 1 }\n t.each_char { |c| t_dic[c.ord - a_ord] += 1 }\n\n s_dic == t_dic\nend", "def first_anagram?(str1, str2)\n anagrams = str1.split(\"\").permutation.to_a \n anagrams.include?(str2.split(\"\"))\nend", "def fourth_anagram(str1, str2)\n return false if str1.length != str2.length\n\n hash = Hash.new(0)\n str1.each_char do |let|\n hash[let] += 1\n end\n str2.each_char do |let|\n hash[let] -= 1\n end\n\n hash.values.all? { |el| el == 0 }\nend", "def fourth_anagram(str1, str2) \n str1_hash = Hash.new(0)\n str2_hash = Hash.new(0)\n\n str1.each_char { |char| str1_hash[char] += 1 }\n str2.each_char { |char| str2_hash[char] += 1 }\n\n str1_hash == str2_hash \nend", "def is_anagram? a,b\n canonical(a) == canonical(b)\nend", "def first_anagram?(str1, str2)\n str_1 = []\n str1.each_char do |char1|\n sub_str = \"\"\n str1.each_char do |char2|\n sub_str += char2\n end\n str_1 << sub_str\n end \n result = str_1.select {|ele| ele.length == str2.length}.first\n\n str2.chars.all? {|char| result.chars.include?(char)}\nend", "def fourth_anagram?(str1, str2)\n result = Hash.new(0)\n\n str1.chars.each do |letter|\n result[letter] += 1\n end\n\n str2.chars.each do |letter|\n result[letter] -= 1\n end\n\n result.values.all? { |v| v == 0 }\nend", "def third_anagram?(str1, str2)\n str1.chars.sort! == str2.chars.sort!\nend", "def anagrams(string, array)\nend", "def third_anagram?(word1, word2)\n word1.split(\"\").sort == word2.split(\"\").sort\nend", "def fourth_anagram?(string1, string2)\r\n counter = Hash.new(0)\r\n (0...string1.length).each do |i|\r\n increment = string1[i]\r\n decrement = string2[i]\r\n counter[increment] += 1\r\n counter[decrement] -= 1\r\n end\r\n # string1.each_char do |char|\r\n # counter[char] += 1\r\n # end\r\n\r\n # string2.each_char do |char|\r\n # counter[char] -= 1\r\n # end\r\n counter.values.all?(0)\r\nend", "def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend", "def fourth_anagram?(str_1, str_2)\n str_1_hash = Hash.new(0)\n str_2_hash = Hash.new(0)\n str_1.each_char { |char| str_1_hash[char] += 1 }\n str_2.each_char { |char| str_2_hash[char] += 1 }\n str_1_hash == str_2_hash\nend", "def fourth_anagram?(str_1, str_2)\n return false if str_1.length != str_2.length \n hash = Hash.new(0)\n str_1.each_char {|char| hash[char] += 1}\n str_2.each_char {|char| hash[char] -= 1}\n hash.all? {|k, v| v == 0}\nend", "def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend", "def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend", "def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend", "def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend", "def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend", "def third_anagram?(str1, str2)\n str1.chars.sort == str2.chars.sort\nend" ]
[ "0.77228796", "0.7393318", "0.7303564", "0.7229449", "0.7119977", "0.71055883", "0.70168483", "0.7015578", "0.69819427", "0.697843", "0.6961722", "0.6945478", "0.6944104", "0.6922502", "0.6912186", "0.68927425", "0.6884423", "0.68812084", "0.68798435", "0.68759716", "0.6874769", "0.68725693", "0.6872493", "0.68623835", "0.6852562", "0.6849133", "0.68364245", "0.6832841", "0.6831295", "0.68310696", "0.68265057", "0.6825064", "0.68109447", "0.6808021", "0.67989224", "0.6786815", "0.6784591", "0.67829597", "0.6780153", "0.6780092", "0.67778647", "0.6772999", "0.6759992", "0.67581046", "0.6748934", "0.67380047", "0.6734691", "0.67295784", "0.67290545", "0.6728992", "0.67204624", "0.67157125", "0.6715124", "0.67145383", "0.67128384", "0.6708802", "0.6707557", "0.6706345", "0.67052954", "0.6704586", "0.6698178", "0.6695646", "0.66916203", "0.66905534", "0.66887796", "0.6688676", "0.66883034", "0.6683401", "0.66794086", "0.6675758", "0.6675088", "0.6674357", "0.6669402", "0.6668391", "0.66683805", "0.6668208", "0.6665765", "0.6662767", "0.6662767", "0.66607654", "0.6658288", "0.6654037", "0.6646893", "0.66427416", "0.66386855", "0.66365904", "0.66226625", "0.6619194", "0.6618269", "0.66174424", "0.66162956", "0.6613605", "0.6611889", "0.6610071", "0.6609245", "0.66052395", "0.66052395", "0.66052395", "0.66052395", "0.66052395", "0.66052395" ]
0.0
-1
Implement strStr() Return the index of the first occurrence of needle in haystack, or 1 if needle is not part of haystack. Input: haystack = "hello", needle = "ll" Output: 2
def str_str(haystack, needle) return 0 if needle.empty? pattern_length = needle.length i = 0 while i <= (haystack.length - pattern_length) do return i if needle == haystack.slice(i, pattern_length) i += 1 end return -1 end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def str_str(haystack, needle)\n return 0 if needle == \"\"\n \n haystack.each_char.with_index do |char, idx|\n if char == needle[0]\n return idx if haystack[idx, needle.length] == needle\n end\n end\n -1\nend", "def str_str(haystack, needle)\n # 1. If needle is empty, return 0\n return 0 if needle.empty?\n\n # 2. If needle is not empty, iterate through haystack\n haystack.chars.each.with_index do |str, i|\n # 3. If the current character is the same as the first character of needle, check if the next characters\n if str == needle[0]\n # 4. If the next characters are the same as needle, return the index\n return i if haystack[i..(i + (needle.length - 1))] == needle\n end\n end\n\n -1\nend", "def str_str(haystack, needle)\n return 0 if needle == \"\"\n return -1 unless haystack.include?(needle)\n haystack.index(needle)\nend", "def str_str2(haystack, needle)\n return 0 if needle.empty?\n current_idx = haystack.index(needle[0])\n until current_idx .nil?\n if haystack[current_idx, needle.length] == needle\n return current_idx\n else\n previous_idx = current_idx\n current_idx = haystack[current_idx + 1..-1].index(needle[0])\n if current_idx\n current_idx = current_idx + previous_idx + 1\n end\n end\n end\n -1\nend", "def str_str(haystack, needle)\n return 0 if needle.empty?\n return -1 if haystack.length < needle.length\n\n pointer = 0\n window_size = needle.size\n\n while pointer + window_size <= haystack.length\n return pointer if haystack[pointer, window_size] == needle\n pointer += 1\n end\n\n -1\nend", "def str_index_of(str1, str2)\n if str_include(str1, str2)\n get_index(str1, str2)\n else\n return -1\n end\nend", "def index_str(str, substr)\n i = 0\n substrlength = substr.length\n while i < str.length\n if str[i, substrlength] == substr\n return i\n end\n i += 1\n end\n return nil\nend", "def find_needle(haystack)\n needle = haystack.index('needle')\n return \"found the needle at position #{needle}\"\nend", "def str_byte_index(haystack, needle, offset = 0)\n haystack.index(needle, offset)\n end", "def strstr(haystack, needle)\n i = 0\n while i < haystack.length do\n if haystack[i] == needle[0]\n found = true\n needle.length.times do |j|\n if haystack[i + j] != needle[j]\n found = false\n break\n end\n end\n return i if found\n end\n \n i += 1\n end\n \n false\nend", "def find_needle(haystack)\n \"found the needle at position #{haystack.index('needle')}\"\nend", "def index(str, *args)\n bidx = str.index(*args)\n bidx ? (str.slice(0...bidx).unpack(\"U*\").size) : nil\n end", "def custIndex(string, substring)\n return nil unless string.include?(substring)\n length = substring.length\n string.chars.each_with_index do |char, index|\n sequence = string[index, length]\n return index if sequence == substring\n end\nend", "def findMatch str, subStr\n n = 0\n (0..(str.length - subStr.length)).each do |i|\n if subStr == str[i, subStr.length] then n += 1 end\n end\n return n\nend", "def find_needle(haystack)\r\n index = haystack.find_index('needle')\r\n haystack.find_index('needle')? \"found the needle at position #{index}\" : nil\r\nend", "def costum_index(string, substring)\n return nil unless string.include?(substring)\n length = substring.length\n string.chars.each_with_index do |char, index|\n sequence = string[index, length]\n return index if sequence == substring\n end\nend", "def customIndex(string , substring)\n if string.include?(substring)\n length=substring.length\n string.chars.each_with_index do |ele , index|\n sequence=string[index , length]\n return index if sequence==substring\n end\n else\n return nil\n end\nend", "def find_needle(haystack, needle)\n i = 0\n loop do\n if haystack[i] == needle\n return i\n elsif i > haystack.length\n return nil\n end\n i += 1\n end\nend", "def custom_index(string, substring)\n return nil unless string.include?(substring)\n length = substring.length\n string.chars.each_with_index do |char, index|\n sequence = string[index, length]\n return index if sequence == substring\n end\nend", "def custom_index(string,substring)\n return nil unless string.include?(substring)\n length = substring.length\n string.chars.each_with_index do |char, index|\n sequence = string[index, length]\n return index if sequence == substring\n end\nend", "def string_search(main_string, sub_string)\n count = 0\n i = 0\n while i <= (main_string.length - sub_string.length) do # number of potential tests\n if main_string[i, sub_string.length] == sub_string # string slice is starting position, length\n count += 1;\n end\n i +=1;\n end\n return count\nend", "def naive_search(str, match_str)\n count = 0\n for i in 0...str.length do\n\n for j in 0...match_str.length do\n \n if(match_str[j] != str[i+j]) \n break\n end\n \n if(j == match_str.length - 1)\n count += 1\n end\n\n end\n\n end\n\n return count;\nend", "def index(str, pos)\n case\n when @left.size <= pos\n @right.index(str, pos - @left.size)\n when (ret = @left.index(str, pos))\n ret\n else\n self.each_char_from(pos){|c, i|\n }\n # Search is done for <= @left[]\n left_s = kkk\n left_p = pos\n end\n end", "def count_string(str, substr)\n i = 0\n matches = 0\n while i < str.length\n if str[i] == substr[0]\n index = i\n match = true\n j = 0\n while j < substr.length\n if str[i + j] != substr[j]\n match = false\n end\n j+=1\n end\n\n if match == true\n matches += 1\n end\n end\n i+=1\n end\n return matches\nend", "def indexof(string)\n return @container.index(string) \n end", "def nth_occurrence(str, substr, n)\n pos = -1\n if n > 0 && str.include?(substr)\n i = 0\n while i < n do\n pos = str.index(substr, pos + substr.length) if pos != nil\n i += 1\n end\n end\n pos != nil && pos != -1 ? pos + 1 : -1\nend", "def index_of_char(str, char)\n i = 0\n while i < str.length\n if str[i] == char\n return i\n end\n\n i += 1\n end\n\n return nil\nend", "def start_of_word(str, number)\n\treturn str[0, number]\nend", "def solve(str)\n idx = 0\n count = 0\n\n substr_1 = ''\n substr_2 = ''\n\n loop do\n substr_1 = str[0..idx]\n substr_2 = str[(idx + 1)..-1]\n\n substr_1.to_i.odd? ? count += 1 : nil \n substr_2.to_i.odd? ? count += 1 : nil \n \n idx += 1\n break if idx >= str.length\n end\n count\nend", "def index(substr)\n `var res = self.indexOf(substr);\n\n return res == -1 ? nil : res;`\n end", "def index(substr)\n `var res = self.indexOf(substr);\n\n return res == -1 ? nil : res;`\n end", "def find_number_of_first_chars(string1=\"First string\", string2=\"Second string\")\n arr1 = string1.split('')\n arr2 = string2.split('')\n counter = 0\n arr1.each_with_index do |el, i|\n if arr1[i] == arr2[i]\n counter +=1\n else next\n end\n end\n print counter\nend", "def index_of_the_first_vowel(str)\n #v = [\"a\",\"e\",\"i\",\"o\",\"u\"]\n #v.map { |c| [str.index(c)] }.first\n s = string.chars.count {|char| vowels.include? (char)}\nend", "def str_str(txt, pat)\n return 0 if pat.empty?\n\n m = pat.length\n n = txt.length\n return -1 if m > n\n\n p = 0\n t = 0\n h = 1\n q = 97\n d = 256\n\n (0..m - 2).each do\n h = (h * d) % q\n end\n\n (0..m - 1).each do |i|\n p = (p * d + pat[i].ord) % q\n t = (t * d + txt[i].ord) % q\n end\n\n (0..n - m).each do |i|\n if t == p && pat == txt[i..i + m - 1]\n return i\n elsif i != n - m\n t = (d * (t - h * txt[i].ord) + txt[i + m].ord) % q\n end\n end\n\n -1\nend", "def index_of(sentence, letter)\n\tcounter=0\n\tsentence_split=sentence.split(//)\n\twhile counter<sentence.length\n\t\tcounter=counter+1\n\t\tif sentence_split[counter] == letter\n\t\t\treturn counter\n\t\tend\n\tend\n\t-1\nend", "def start_of_word (str, num)\n\n str[0, num]\n\nend", "def index_of_char(string, character)\n i = 0\n position = nil\n while i < string.length\n if string[i] == character\n position = i\n break\n else\n i += 1\n end\n end\n return position\nend", "def wc_index(str, pat, start_idx)\n size = str.size - pat.size\n while start_idx <= size\n ridx = start_idx\n repls = ''\n pat.each_char do |ch|\n str_char = str[ridx]\n if str_char != ch\n if ch != '.'\n ridx = nil\n break\n else\n repls += str_char\n end\n end\n ridx += 1\n end\n return start_idx, repls unless ridx.nil?\n\n start_idx += 1\n end\n [nil, '']\nend", "def getCount(str)\n str.count(\"AEIOUaeiou\")\nend", "def chop(needle, haystack)\n index = 0 \n if !haystack.empty?\n haystack.each { |h|\n if h == needle\n return index\n else\n index += 1\n end\n }\n end\n index = -1\nend", "def line_index(pos=pos)\n p = n = 0\n string.each_line do |line|\n p += line.length\n return n if p >= pos\n n += 1\n end\n 0\n end", "def first_vowel\n @input_str.index(/[aeiouAEIOU]/) #Returns an Integer\n end", "def brute_search string, pattern\n pattern_length = pattern.length\n for string_index in (0... string.length)\n match_count = 0\n loop do\n # if a non-match is found, then break.\n break if string[string_index + match_count] != pattern[match_count]\n # if it wasn't a non-match, it must be a match!\n match_count += 1\n # if match_count reaches the length of the pattern, you've found your pattern!\n # return the index in string where the pattern begins\n return string_index if match_count == pattern_length\n end\n end\n return \"not found\"\nend", "def brute_search string, pattern\n pattern_length = pattern.length\n for string_index in (0... string.length)\n match_count = 0\n loop do\n # if a non-match is found, then break.\n break if string[string_index + match_count] != pattern[match_count]\n # if it wasn't a non-match, it must be a match!\n match_count += 1\n # if match_count reaches the length of the pattern, you've found your pattern!\n # return the index in string where the pattern begins\n return string_index if match_count == pattern_length\n end\n end\n return \"not found\"\nend", "def line_index(pos=pos())\n p = n = 0\n string.each_line do |line|\n p += line.length\n return n if p >= pos\n n += 1\n end\n 0\n end", "def first_pos(string)\n\tanswer = Hash.new\n\n\tarray = string.split(' ')\n\n\tarray.each do |x|\n\t answer[x] = array.index(x)\n end\n answer\nend", "def find_substring_indexes(other)\n Array.new.tap do |indexes|\n final_index_position = self.length - other.length\n i = 0\n while (i < final_index_position)\n index = self.to_s.index(other.to_s,i)\n break if index.nil?\n i = index + 1\n indexes << i\n end\n end\n end", "def start_of_word(str, l); l == 1 ? str[0] : str[0...l] end", "def custom_count(string, search_characters)\n str = string.chars\n searched = search_characters.chars\n p str\n p searched\n count = 0\n str.each do |item|\n if searched.include?(item)\n count = count + 1\n end\n end\n count\nend", "def start_of_word(str, n = 1)\n str[0, n]\nend", "def last_index(str, char)\n i = 0\n str.each_char.with_index do |ch,ind|\n if ch == char\n i = ind\n end\n end\n return i\nend", "def index_less_than_str?(index, str)\n index < str.length and yield(str[index..index+1])\n end", "def input_to_index(str)\nstr.to_i - 1\nend", "def find_needle(haystack)\n position = 0\n haystack.each do |element|\n if element == \"needle\"\n puts \"found the needle at position #{position}\"\n else\n position += 1\n end\n end\nend", "def index_of_char(string, letter)\n i = 0\n while i < string.length\n if string[i] == letter\n return i\n end\n i += 1\n end\n return nil\nend", "def to_index(string)\n /^\\d+/.match?(string) ? string.to_i : -1\n end", "def find(str)\n index = items.index {|i| i.index > current_row && i.name.start_with?(str)} || items.index {|i| i.name.start_with? str}\n move_cursor index if index\n end", "def substrings_at_start(str)\n str.chars.map.with_index { |_, idx| str[0, idx + 1] }\nend", "def find_guess_position(needle)\n get_index = lambda { |character, index| index if character == needle }\n indexes = @secret_word.split(\"\").map.with_index(&get_index).reject { |c| c.nil? }\n end", "def input_to_index(string)\n string.to_i - 1\nend", "def count_string s,ss\n s.downcase.scan(/(?=#{ss.downcase})/).count\nend", "def find_substring(string, substring)\n\n sub_len = substring.length\n # 3\n str_len = string.length\n # 5\n i = 0\n\n\n (str_len - sub_len).times do\n # 2\n if string[i] == substring[0]\n if string[i..(i+sub_len-1)] == substring\n # sublen -1 because starting on first letter\n return true\n end\n end\n i += 1\n end\n\n false\nend", "def input_to_index(string)\nstring.to_i-1\nend", "def _match_count (substr, text)\n return 0 if (!text || !substr)\n\n count = 0\n offset = 0\n while (result = text.index(substr, offset))\n count += 1\n offset = result + 1\n end\n count\n end", "def custom_start_with(string, substring)\n string[0, substring.length] == substring\nend", "def index_of_char(string, character)\n i = 0\n output = []\n while i < string.length\n if character == string[i]\n output << i\n end\n i += 1\n end\n if output == []\n output = nil\n end\n return output\nend", "def find_needle(needle, haystack)\r\n needle_index = 0\r\n haystack_index = 0\r\n\r\n while haystack_index < haystack.length\r\n if needle[needle_index] == haystack[haystack_index]\r\n found_needle = true\r\n\r\n while needle_index < needle.length\r\n if needle[needle_index] != haystack[haystack_index + needle_index]\r\n found_needle = false\r\n break\r\n end\r\n needle_index += 1\r\n end\r\n \r\n return true if found_needle\r\n needle_index = 0\r\n end\r\n\r\n haystack_index += 1\r\n end\r\n\r\n return false\r\nend", "def hasSubstring(find,y)\n find = find.split(//)\n y = y.split(//)\n if find == y\n return true\n end\n\n for i in 0..(y.length-1) do\n foundNonMatch = false\n for j in 0..(find.length-1) do\n puts i.to_s + \" and \" + j.to_s\n if y[i+j] != find[j]\n foundNonMatch = true\n break\n end\n end\n if !foundNonMatch\n return true\n end\n end\n false\nend", "def first_vowel_index(string)\n letter = first_vowel(string)\n if letter == nil\n return nil\n end\n string.index letter\nend", "def count_string(string, characters)\n i = 0\n size = characters.length\n hits = 0\n while i < string.length - size + 1\n if string[i,size] == characters\n hits += 1\n end\n i += 1\n end\n return hits\nend", "def custom_start(str, sub_str)\n str_plc, sub_len = str, sub_str.length\n #str_plc.slice(0, sub_len) == sub_str\n str_plc[0, sub_len] == sub_str\nend", "def search_prefixes(str, pos= 0, len= -1)\n end", "def string_counter(s, x)\n puts s.scan(/(?=#{x})/).count\nend", "def find_e(s)\n if s == \"\"\n \"\"\n elsif s.nil? \n nil\n elsif s.include?(\"e\") || s.include?(\"E\")\n s.count(\"e\" + \"E\").to_s\n else \n \"There is no \\\"e\\\".\"\n end \nend", "def palindrome_index(str)\n\nend", "def search_substr( fullText, searchText, allowOverlap = true )\n if searchText == ''\n 0\n else\n fullText.scan(allowOverlap ? Regexp.new(\"(?=(#{searchText}))\") : searchText).size\n end\nend", "def custCount(str, searchChars)\n # Return the number of total times that\n # the search characters are in the string\n delims = searchChars.chars\n count = 0\n letters = str.chars\n delims.each do |delim|\n letters.each { |i| count += 1 if delim == i }\n end\n puts \"#{searchChars} is found #{count} time(s).\"\nend", "def input_to_index(num_str)\n valid_str_arr = [\"1\", \"2\", \"3\", \"4\", \"5\", \"6\", \"7\", \"8\", \"9\"]\n num_str = num_str.strip\n \n if valid_str_arr.include?(num_str)\n return num_str.to_i - 1 \n else\n return -1\n end\nend", "def find_first_vowel (word)\n word.split('').each.with_index do |char, index|\n if is_vowel?(char)\n # Return the index of that vowel\n return index\n end\n end\n # Return index 0 if no vowel is found\n return 0\n end", "def matches (string, pattern)\n if string . length == 0 || pattern . length == 0\n return 0\n end\n\n count = matches string [1 .. -1], pattern\n\n if string [0] == pattern [0]\n if pattern . length == 1\n count += 1\n else\n count += matches string [1 .. -1], pattern [1 .. -1]\n end\n end\n\n return count\nend", "def on_call_substring(context, haystack, start, length = nil)\n haystack_str = on_call_string(context, haystack)\n start_index = on_call_number(context, start).to_i - 1\n\n if length\n length_int = on_call_number(context, length).to_i - 1\n stop_index = start_index + length_int\n else\n stop_index = -1\n end\n\n return haystack_str[start_index..stop_index]\n end", "def getCount(inputStr)\n return inputStr.count(\"aeiou\")\nend", "def first_vowel(str)\n regex = /[aeiouAEIOU]/\n str.index(regex)\nend", "def count_substrings(str)\n \nend", "def boyerMooreStringSearch(text,pattern,bad_symbol_shift,good_suffix_shift)\n\treturn nil if pattern.nil? or text.nil?\n text, pattern = text.unpack('U*'), pattern.unpack('U*')\n n=0 \n while (n <= text.length - pattern.length) do \n m = pattern.length - 1 \n while (pattern[m] == text[m+n]) do\n return n if m==0 \n m -= 1; \n end \n # If not found, shift based on our precomputed tables\n n += max(good_suffix_shift[m], m - bad_symbol_shift[text[n+m]]);\n end\n return nil \nend", "def index(letter,start=0)\n if start >= left.length\n left.length + right.index(letter,start-left.length)\n else\n left.index(letter,start) || left.length + right.index(letter)\n end\n rescue\n nil\n end", "def index_of_the_first_vowel(str)\n vowels_array = [\"a\", \"e\", \"i\", \"o\", \"u\"]\n\n def check_if_in_array(check, array)\n array.each do |i|\n if check.upcase == i.upcase\n return true\n end\n end\n\n return false\n end\n \n index = 0\n str.chars.each do |i|\n if check_if_in_array(i, vowels_array)\n return index\n end\n\n index += 1\n end\nend", "def input_to_index( inputString )\n index = inputString.to_i - 1\n #puts \"Index: #{index}\"\n if (index.between?(0,8) == true )\n return index\n else\n return -1\n end\n end", "def custom_count(string, search_chars)\n count = 0\n string.each_char { |chr|\n count += 1 if search_chars.include?(chr)\n }\n count\nend", "def substrings_at_start(str)\n str.each_char.map.with_index do |char, index|\n str[0..index]\n end\nend", "def word_counter(str, index = 0, hit_letter = false)\n return 0 if str.length.zero? || (index == str.length - 1 && str[index] == \"\\s\")\n return 1 if index == str.length - 1\n\n hit_letter = true if str[index] != \"\\s\"\n\n is_word = str[index] == \"\\s\" && str[index + 1] != \"\\s\" && hit_letter ? 1 : 0\n\n is_word = 0 if index.zero? && str[0] == \"\\s\" && !hit_letter\n\n is_word + word_counter(str, index + 1, hit_letter)\nend", "def soundex_str(str); end", "def soundex_str(str); end", "def find_item(str, arr)\n index = 0\n while index < arr.length\n if str == arr[index]\n arr[index]\n break\n end\n index += 1\n end\n arr[index]\nend", "def non_repeating_char_index(string) \n hash = {}\n\n string.length.times do |i|\n if !hash.has_key?(string[i])\n hash[string[i]] = 1\n else\n hash[string[i]] += 1\n end\n end\n\n char = hash.select { |char, occurence| occurence == 1}\n .map { |char, occurence| char }[0]\n\n return string.index(char) \nend", "def exact_beginning_length(search_word, string)\n regexp = Regexp.new(\"(?:\\\\b\" + search_word.gsub(/(?!^)./){ |e| \"#{Regexp.escape(e)}?\"}, \"i\")\n return ((string.scan(regexp) || [\"\"]).max{ |a, b| a.length <=> b.length} || 0) / search_word.length\n end", "def first_unique_character(string)\n idx1 = 0\n while idx1 < string.length\n idx2 = 0\n while idx2 < string.length\n break if string[idx1] == string[idx2] && idx1 != idx2\n idx2 += 1\n end\n\n return idx1 if idx2 == string.length\n\n idx1 += 1\n end\n\n # No unique character at all!\n nil\nend", "def duos(str)\n count = 0\n str.each_char.with_index do |char, idx|\n count += 1 if char == str[idx+1]\n end\n count\nend", "def substrings_at_start(str)\n str.chars.map.with_index do |_, i|\n str[0..i]\n end\nend", "def is_substring?(string1, string2)\n return true if string2.empty?\n return false if string2.length > string1.length\n\n string2_matchings = 0\n\n string1.each_char do |string1_char|\n if string2_matchings.zero?\n if string1_char == string2[0]\n string2_matchings += 1\n end\n else\n if string1_char == string2[string2_matchings]\n string2_matchings += 1\n else\n string2_matchings = 0\n end\n\n if string2_matchings == string2.length\n return true\n end\n end\n end\n\n false\nend" ]
[ "0.8743117", "0.8476452", "0.84484065", "0.8397843", "0.78311056", "0.7291298", "0.7257582", "0.70884967", "0.7051721", "0.7046752", "0.6984889", "0.6859701", "0.68522537", "0.67696816", "0.6744712", "0.6692133", "0.6664829", "0.66346425", "0.6586058", "0.65225255", "0.65189743", "0.637625", "0.6257148", "0.6179116", "0.6162663", "0.60867757", "0.6083336", "0.60756487", "0.6051601", "0.602927", "0.602927", "0.60127795", "0.5992115", "0.59890723", "0.5930285", "0.59294415", "0.5916432", "0.59070814", "0.5834038", "0.5808827", "0.5807411", "0.58008826", "0.5799714", "0.5799714", "0.579853", "0.5796616", "0.57935077", "0.5783029", "0.578286", "0.5749162", "0.574151", "0.57381016", "0.5725101", "0.57216585", "0.5710763", "0.5709475", "0.5686677", "0.5681607", "0.56747746", "0.56452745", "0.563877", "0.56108236", "0.56090873", "0.5604317", "0.5602532", "0.55908704", "0.5587684", "0.5571185", "0.55669487", "0.5560284", "0.55578965", "0.55439603", "0.55415106", "0.55401456", "0.5526894", "0.55261153", "0.55116194", "0.5510279", "0.55093795", "0.55061615", "0.5499222", "0.54968894", "0.54944974", "0.54793113", "0.5478554", "0.5478128", "0.5477227", "0.54765296", "0.54729414", "0.54722947", "0.5458562", "0.5451369", "0.5451369", "0.5449207", "0.54421204", "0.54387504", "0.54386425", "0.543587", "0.5433746", "0.54324955" ]
0.8221429
4
Power of Two Given an integer, write a function to determine if it is a power of two. Input: 1 Output: true Input: 16 Output: true Input: 218 Output: false
def is_power_of_two(n) return false if n < 1 return true if n == 1 power = 1 while power <= n power *= 2 return true if power == n end false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_power_of_two?(num)\n if(Math::log(num, 2) % 1 != 0)\n return false \n end \n return true\nend", "def power_of_two?(x)\n x > 0 && x & (x - 1) == 0\nend", "def power_of_two?(num)\n product = 1\n while product < num\n product *= 2\n end\n\n num == product\nend", "def power_of_two?(n)\n n & (n-1) == 0\nend", "def power_of_two?(number)\n quotient = number\n while quotient != 1\n if quotient % 2 == 0\n quotient /= 2\n else\n return false\n end\n end\n true\nend", "def is_power_of_2?(n)\n return (n & (n-1)) == 0 # can be written as \"n & (n-1) == 0\" as well. Parenthesis added for clarity.\nend", "def is_power_of_2(number)\n return false if number < 1\n\n # keep on shifting left until number equals one (power of 2) or has\n # one bit set but isn't one (not power of 2)\n while number > 1\n number >>= 1\n return false if ((number & 1) == 1 && number != 1)\n end\n true\nend", "def power_of_two?(number)\n (0..number).each do|num| \n # 2**num == 16\n if 2**num == number\n return true\n end \n if 2**num > number\n return false \n end\n end \n return \"problem\"\nend", "def is_power_of_two?(num)\n return true if num == 1 \n\n result = num\n while result > 2 \n if result % 2 == 0\n result = result / 2\n return true\n end \n end\nend", "def power_of_2?(n)\n n & (n - 1) == 0\nend", "def powersOfTwo(num)\n\treturn false if(num % 2 != 0)\n\treturn true if( num / 2 == 1)\n\tpowersOfTwo(num / 2)\n\nend", "def is_power_of_two?(num)\n \n if num < 1\n return false\n end\n \n while true \n if num == 1\n return true\n elsif num % 2 == 0\n num = num / 2 \n else\n return false \n end\n end\nend", "def is_power_of_two(n)\n\t# Test boundary conditions\n\tif n == 1\n\t\treturn true\n\telsif\tn <= 0 || n % 2 != 0\n\t\treturn false\n\n\telse\n\t\t# Divide the number by 2 continuous while the remainder is equal to zero\n\t\twhile ( n % 2 == 0 )\n\t\t\tn /= 2\n\t\tend\n\t\t# Test the remainder\n\t\tif n == 1\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend\nend", "def power_of_two?(num)\n\nend", "def power_of_two?(num)\n product = 1\n\n while product < num \n product *= 2\n end \n\n product == num \nend", "def power_of_2?(a) Math.log2(a.to_i).then { |x| x == x.to_i } == true end", "def is_power_of_two?(num)\n return false if num < 1\n\n loop do\n num, rem = num.divmod(2)\n break false if rem != 0\n break true if num == 1\n end\nend", "def power_of_two?(num)\n\n return true if num == 1\n (1..num).each do |n| \n if 2**n == num\n return true\n end\n end\n false\nend", "def is_power_of_two(n)\n\n if Math.sqrt(n) % 1 == 0\n puts \"#{n} is a power of 2\"\n else\n puts \"#{n} is not a power of 2\"\n end\nend", "def is_power_of_two?(num)\n power = 1\n loop do\n break false if power > num\n break true if num == power\n power *= 2\n end\nend", "def power_of_two?(num)\n until num.to_f <= 1\n num = num.to_f/2\n end\n num == 1\nend", "def powers_of_two(num)\n until num < 2 || num.odd?\n return true if num == 2\n num /= 2\n end\n false\nend", "def power_of_2?(number)\n !number.to_s(2).match(/\\A10*\\Z/).nil?\nend", "def PowersofTwo(num)\n\n is_power_two=true\nwhile(num >1)\n is_power_two=false if num%2!=0\n num=num/2\nend\nis_power_two\nend", "def power_of_two2( num )\n\n\n if num < 1\n return false\n end\n\n while true\n\n if num == 1\n return true\n\n elsif num % 2 == 0 # keep doing until remainder is not zero ( a factor of two )\n num = num / 2\n # puts( num ) # eventually num will equal to 1\n\n else\n return false\n end\n\n end # while\n\n\n\nend", "def power_of_two?(num)\n # i = 0\n # power = 2**i\n\n # while num >= power \n # if num == power\n # return true\n # else\n # i += 1 \n # power = 2**i\n # end \n # end\n # false\n\n (0..num).each do |ele|\n if 2**ele == num\n return true\n end\n end\n false\n\nend", "def is_power_of_two?(num)\nresult = []\n\ni = 0\nuntil i == num\n\tresult.push(2 ** i)\n\ti += 1\nend\nif result.include?(num)\n\treturn true\nelse return false\nend\nend", "def PowersofTwo(num)\n idx = 0\n\n while 2 ** idx <= num\n return true if 2 ** idx == num\n idx += 1\n end\n\n false\nend", "def is_power_of_two?(num)\r\n \r\n #if number is less than 2 return false otherwise go to while loop if true\r\n if num < 2\r\n puts num\r\n return false\r\n end\r\n\r\n \r\n #while loop if the number is \r\n while true\r\n# puts \"#{num}\"\r\n if num == 1\r\n# puts \"#{num}\"\r\n return true\r\n elsif num % 2 == 0\r\n puts \"#{num}\"\r\n num = num / 2\r\n else\r\n return false\r\n end \r\n end\r\nend", "def powers_of_2\r\n\t\tunless $powers_of_2\r\n\t\t\t$powers_of_2 = [1]\r\n\t\t\t((BASE_BYTE << 3) - 1).times do |i|\r\n\t\t\t\t$powers_of_2[i + 1] = $powers_of_2[i] << 1\r\n\t\t\tend\r\n\t\tend\r\n\r\n\t\treturn $powers_of_2\r\n\tend", "def pow_of_2(int)\n\tif int <= 0\n\t\treturn 1\n\tend\n\n\tint -= 1\n\treturn 2 * pow_of_2(int)\nend", "def pow2?\n return self > 0 && (self & (self - 1) == 0)\n end", "def nearest_two_power(num)\n return 1 if num == 0\n exp = Math.log(num, 2).ceil\n if exp == 0\n 1\n else\n 2**exp\n end\n end", "def powers_of_two(x)\n 0.upto(x) {|n| (2**n) if x >= (2**n)}.compact\nend", "def is_power_of_four(num)\n return false if num < 1\n return true if num == 1\n 0 == Math.log2(num)%2\nend", "def PowersofTwo(num)\n value = false\n \n (1..num).each do |x|\n if x**2 == num\n value = true\n end \n end\n \n # code goes here\n return value\n \nend", "def nearest_power_of_two(number)\n return 0 if number <= 0\n exponent = Math.log2 number\n higher_power = 2**exponent.ceil\n lower_power = 2**exponent.floor\n ((higher_power - number) <= (number - lower_power)) ? higher_power : lower_power\n end", "def exp_two(num, power)\n return 1 if power == 0\n return num if power == 1\n if power.odd?\n exp = exp_two(num, (power - 1) / 2)\n num * exp * exp\n else\n exp = exp_two(num, power / 2)\n exp * exp\n end\nend", "def nearest_power_of_2(num)\n temp = num\n temp -= 1\n temp |= temp >> 1\n temp |= temp >> 2\n temp |= temp >> 4\n temp |= temp >> 8\n temp |= temp >> 16\n temp += 1\n temp\nend", "def power_of_ten?(number)\n POWER_OF_TEN.keys.include? number\n end", "def is_power_of_four(num)\n s = num.to_s(2)\n zero_count = s[1..s.size - 1].count('0')\n if s[0] == '1' && zero_count == s.size - 1 && zero_count % 2 == 0\n return true\n end\n return false\nend", "def prime_power?(n)\r\n\t\tif n.even?\r\n\t\t\treturn n.power_of?(2) ? 2 : false\r\n\t\tend\r\n\r\n\t\tp = n\r\n\t\tloop do\r\n\t\t\trslt, witness = miller_rabin(p, 10, true)\r\n\t\t\tif rslt\r\n\t\t\t\t# Final test\r\n\t\t\t\tredo unless prime?(p)\r\n\t\t\t\treturn n.power_of?(p) ? p : false\r\n\t\t\tend\r\n\r\n\t\t\td = lehmer_gcd(power(witness, p, p) - witness, p)\r\n\t\t\treturn false if 1 == d or d == p\r\n\t\t\tp = d\r\n\t\tend\r\n\tend", "def exp2(base, power)\n return 1 if power == 0\n\n half = exp2(base, power / 2)\n\n if power.even?\n half * half\n else\n # note that (power / 2) == ((power - 1) / 2) if power.odd?\n base * half * half\n end\nend", "def exp2(base, power)\n puts \"exp2\"\n return 1 if power == 0\n return base if power == 1 #\n\n if power.even?\n exp2(base, power / 2) ** 2\n else\n base * ( exp2(base, (power - 1) / 2) ** 2 )\n end\nend", "def power(n1, n2)\n return n1**n2\nend", "def exp2(base, power)\n return 1 if power == 0\n half = exp2(base, power / 2)\n\n if power.even?\n half * half\n else\n # note that (power / 2) == ((power - 1) / 2) if power.odd?\n base * half * half\n end\nend", "def is_perfect_bit?(base_ten_num)\n is_perfect_square?(binary_ones_count(base_ten_num))\nend", "def power_it(number_1, number_2)\n number_1 ** number_2\nend", "def PowersofTwo(num)\n factors = []\n number = num\n output = []\n while number > 0\n factors << num/number if num % number == 0\n number -=1\n end\n factors.reject!{|n| n * n != num}\n (factors.empty?) ? \"false\" : \"true\"\nend", "def pow2(x, n)\n if n == 0\n return 1\n end\n temp = pow2(x, n/2)\n if n % 2 == 0\n return temp * temp\n else\n return x*temp*temp\n end\nend", "def even? num\n num.to_i % 2 == 0\n end", "def power (n1, n2)\n\tn = n1 ** n2\n\treturn n\nend", "def powers_of_two(n)\n (0..n).map{ |number| 2**number }\nend", "def evenNumber(number)\n # AND the last bit, resultant are \n # Odd is 1 and even is 0\n # Then XOR the result so that it returns 1 for even and 0 for odd\n return (number & 1) ^ 1 \nend", "def power_of_4(number)\np number\n i = 0\np number.class\n if number.class == Integer || Fixnum && number != 0 && number.class != String && number >= 1\n while 4**i <= number\n if 4**i == number\n x = true\n else x = false\n end\n i = i + 1\n end\n p x\n else p false\n end\n\n\n\n # best practice\n def power_of_4(n)\n n.is_a?(Integer) && n>0 ? Math.log(n, 4) % 1 == 0 : false\nend", "def powers_of_two(s)\n\tyield 1\n\ti = 2\n\twhile i < s\n\t\tyield i\n\t\ti = i * 2 \n\tend\nend", "def power(num1, num2)\n return num1**num2\nend", "def power(num1, num2)\n return num1**num2\nend", "def power(n1, n2)\r\n n1.to_i ** n2.to_i\r\nend", "def exp_ver_two(base, exponent)\n return 1 if exponent.zero?\n\n if exponent.even?\n n = exp_ver_two(base, exponent / 2)\n n * n\n else\n n = exp_ver_two(base, (exponent - 1) / 2)\n base * (n * n)\n end\nend", "def power(n1, n2)\n n1 ** n2\nend", "def test_powers_of_two\n 100.times do |p|\n n = 2 << p\n\n assert_equal n, n.to_ber.read_ber\n end\n end", "def even(numb)\n return true if numb % 2 == 0\n return false\nend", "def power(nb1, nb2)\n return nb1 ** nb2\nend", "def is_even(number)\n number.to_i\n if number%2 == 1\n return true\n else\n return false\n end\nend", "def bit_odd?(n)\n n&1 == 1\nend", "def power_of_four? n\n ((n&(n-1))== 0) && (n&0x55555555) != 0\nend", "def num_to_power(num, power)\n # count = 1\n return 1 if power == 0\n return num if power == 1\n num_multiply = power / 2\n product = 1\n num_multiply.times do\n product *= multiply(num, num)\n end\n if power % 2 == 1\n product *= num\n end\n product\nend", "def largest_power_of_2(n)\n if (n <= 0) #usage condition check\n return\n end\n exponent = 0\n current = BASE ** exponent\n while (current <= n)\n if (current == n)\n return exponent\n end\n exponent += 1\n current = BASE ** exponent # recalculate power\n end\n return exponent - 1\nend", "def is_power_of_three(n)\t\n\treturn false if n <= 0\n\treturn 3**(Math::log(n, 3)).round == n\nend", "def espar(num)\n (num % 2).zero?\nend", "def powers1(n)\n n.to_s(2).to_i.digits.map.with_index { |c, i| c.to_i * 2**i }.reject(&:zero?)\nend", "def power(a,b)\n a.to_i ** b.to_i\nend", "def power(n)\n n ** 2\nend", "def check_power(n)\n if n <= 1\n return [n, 1]\n end\n x = n\n b = 1\n c = 2\n while true\n found = false\n while c <= 8 * x.size\n res = NumberUtil::is_bth_power(x, c)\n if res\n x = res\n b *= c\n found = true\n break\n end\n if c >= 3\n c += 2\n else\n c += 1\n end\n end\n if found\n next\n else\n break\n end\n end\n return [x, b]\n end", "def odd_number_check_two(number)\r\n number % 2 == 1 || number % 2 == -1 \r\nend", "def perfect_power(n)\n\nend", "def is_odd2?(num)\n num.abs % 2 == 1\nend", "def check_powers(integer:)\n @powers.each do | number, position |\n if integer / number == 1\n @results[position] = 1\n integer -= number\n end\n end\n end", "def even(num)\n if num % 2 == 0\n return true\n end\n return false\nend", "def is_even(number)\n temp = number / 2\n if temp + temp == number\n return true\n else\n false\n end\nend", "def is_power_of_three(n)\n # Have[n] || false # <-- Way3\n #Power_3.include? n # <-- quicklier in practice\n n == Power_3.bsearch { |i| i-n+1 > 0 } # <-- quicklier in theoretically\n \nend", "def power_of_n(num, exponent)\n num ** exponent\nend", "def calc(n,k)\n # the expressions '(1<<n)-1' and '2**n-1' are equivalent\n (k & ((1<<n)-1)) == 2**n-1\nend", "def is_odd2?(num)\n num.remainder(2) != 0\nend", "def isEven(i)\n\t(i & 1) == 0\nend", "def iseven(siffra)\n output = false\n if siffra % 2 == 0\n output = true\n end\n\n return output\n\nend", "def self_powers_2\n (1..1000).map {|i| i**i}.reduce(:+) % (10**10)\nend", "def raise_to_power(x, y)\n #every shift left is like a * 2\n #11000\nend", "def power(a, b)\n return a**b\nend", "def exp2(num, exponent)\n return 1 if exponent == 0\n exp_recursion = exp2(num, (exponent / 2))\n if exponent.even?\n exp2(num, (exponent / 2)) * exp2(num, (exponent / 2))\n else\n num * exp2(num, (exponent - 1) / 2) * exp2(num, (exponent - 1) / 2)\n end\n\n\nend", "def power_to_the_n(number, power)\n return 1 if power == 0\n result = 1\n while power > 0\n result = multiply(result, number)\n power -= 1\n end\n result\nend", "def is_power_of_three(n)\n return true if n == 1\n return false if 0 != n%3\n return false if n <= 0\n return is_power_of_three(n/3)\nend", "def is_even(num)\n if num%2 ==0\n puts true\n else\n puts false\n end\nend", "def this_is_also_odd?(param_integer)\n param_integer.remainder(2) != 0\nend", "def mod_pow(base, power, mod)\n result = 1\n while power > 0\n result = (result * base) % mod if power & 1 == 1\n base = (base * base) % mod\n power >>= 1;\n end\n result\nend", "def power(num,pow)\n if pow == 0\n num\n else\n total = 1\n count = 0\n while count < pow\n total *= num\n count += 1\n end\n return total\n end\nend", "def power_of(num, exponent)\n product = multiply(num, num)\n \n (exponent - 2).times { product *= num }\n\n product\nend", "def power(n1, n2)\n output = n1\n i = 0\n \n while i < n2\n i += 1\n output = output * n1\n \n end\n return output\nend", "def pow(base, exponent) #(3, 4) ==> 3 * 3 * 3 * 3 = \n return 1 if exponent == 0 \n #return base if exponent == 1\n base * pow(base, exponent - 1)\nend" ]
[ "0.8393572", "0.83811665", "0.8316857", "0.82985485", "0.82923025", "0.82286066", "0.8220232", "0.82190204", "0.8190981", "0.81907594", "0.81744605", "0.81606585", "0.8158109", "0.81444865", "0.81435865", "0.8138326", "0.8118303", "0.8104718", "0.80180407", "0.79452604", "0.78831106", "0.78191185", "0.78112173", "0.77207273", "0.7689401", "0.75656843", "0.7531663", "0.7484682", "0.7220518", "0.71932477", "0.7186631", "0.7179378", "0.69017255", "0.6898749", "0.6841598", "0.67999387", "0.6783883", "0.6765586", "0.67022705", "0.6672838", "0.6633288", "0.65100795", "0.6407817", "0.6383679", "0.63799274", "0.63722295", "0.6353762", "0.6342534", "0.63220984", "0.6318569", "0.6278113", "0.62607807", "0.6217192", "0.6213353", "0.620997", "0.6192805", "0.6187865", "0.6187865", "0.6180939", "0.6149277", "0.61430436", "0.6115776", "0.6112714", "0.6094814", "0.6088403", "0.6081605", "0.6079193", "0.6073426", "0.60701704", "0.60690147", "0.6061683", "0.6055913", "0.6036558", "0.60322803", "0.602925", "0.6025496", "0.60156316", "0.59921366", "0.59865457", "0.59821534", "0.59796983", "0.59482497", "0.5898988", "0.5892985", "0.5884881", "0.5878238", "0.58781147", "0.58554643", "0.5838439", "0.58329564", "0.5831936", "0.5816232", "0.58154625", "0.5792934", "0.57913643", "0.5785529", "0.5781205", "0.5770145", "0.5766921", "0.5758333" ]
0.8241116
5
Check if a binary tree is a binary search tree
def check_if_bst(node) if node.left unless node.left.value < node.value throw 'not bst' end end if node.right unless node.right.value > node.value throw 'not bst' end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def is_balanced_binary_tree?(root)\n is_balanced_rec(root) != -1\nend", "def is_bst?(node)\nend", "def binary_search_tree?(root, lower_bound = -Float::INFINITY, upper_bound = Float::INFINITY)\n if !root\n true\n elsif root.value >= upper_bound || root.value <= lower_bound\n false\n else\n binary_search_tree?(root.left, lower_bound, root.value) && binary_search_tree?(root.right, root.value, upper_bound)\n end\nend", "def is_bst?(node)\n return true if node.nil?\n\n unless ( node.left.value < node.value ) &&\n ( node.right.value >= node.value )\n return false\n end\n\n return is_bst?(node.left) && is_bst?(node.right)\nend", "def valid_bst?(root)\n if in_order_traversal(root).sort == in_order_traversal(root)\n return true\n else\n return false\n end\n end", "def valid_binary_search_tree?(root_node)\n\n stack = [ ]\n\n # Setting lower and upper bounds\n stack << [root_node, -Float::INFINITY, Float::Infinity]\n\n while stack.length != 0\n node, lower_bound, upper_bound = stack.pop\n\n if node.value <= lower_bound || node.value <= upper_bound\n return false\n end\n\n if node.left\n stack << [node.left, lower_bound, node.value] # set upper_bound as node.value b/c left node has be less than current node's value\n end\n\n if node.right\n stack << [node.right, node.value, upper_bound] # set lower_bound as node.value b/c right node has be greater than current node's value\n end\n\n return true\n\n end\n\n\n\n\nend", "def is_bst(root)\n return true if root.nil?\n\n left, right = root.left, root.right\n left_valid = left.nil? || left.val < root.val\n right_valid = right.nil? || root.val < right.val\n\n return false unless left_valid && right_valid\n\n is_bst(left) && is_bst(right)\nend", "def valid_tree?\n false\n end", "def valid_tree?\n true\n end", "def valid_tree?\n true\n end", "def valid_tree?\n true\n end", "def is_valid_binary_tree(root)\n if !root\n return;\n end\n if root && root.left\n if root.val <= root.left.val\n raise Exception.new \"In binary tree the root value must be greater than its left child. Current root #{root.val} left child#{left.right.val}\"\n end\n end\n if root && root.right\n if root.val >= root.right.val\n raise Exception.new \"In binary tree the root value must be less than its right child. Current root #{root.val} right child #{root.right.val}\"\n end\n end\n\n is_valid_binary_tree(root.left)\n is_valid_binary_tree(root.right)\n end", "def is_subtree(root)\n\nend", "def is_valid_tree(tree)\n\nend", "def leaf_node?(tree_node)\n tree_node.left.nil? && tree_node.right.nil?\nend", "def valid_tree(current_node)\n return true if current_node.nil?\n\n return false if current_node.left != nil && current_node.left.key > current_node.key\n\n return false if current_node.right != nil && current_node.right.key < current_node.key\n\n return valid_tree(current_node.right) && valid_tree(current_node.left)\n end", "def is_subtree(root1, root2)\n # 1) if the main tree is null there are no subtrees\n return false if root1.nil?\n # 2) submethod checks if the two roots are equal trees\n return true if sub_tree_checker(root1, root2)\n\n # 7) go deeper in the main tree if we're not at the bottom and we haven't found a subtree\n is_subtree(root1.left, root2) || is_subtree(root1.right, root2)\nend", "def balanced?\n # tree is balanced if the difference between left and right depths is within 1\n (Tree.depth(root.left) - Tree.depth(root.right)).abs <= 1\n end", "def main8()\n t = Tree.new()\n arr = [1, 2, 3, 4, 5, 6, 7, 8, 9, 10]\n t.createBinarySearchTree(arr)\n print(t.ancestor(1, 10).value,\"\\n\")\n # 5\n print(t.ceilBST(5.5),\"\\n\")\n\t# 6\n print(t.floorBST(5.5),\"\\n\")\n\t# 5\n arr1 = [5, 2, 4, 6, 9, 10]\n arr2 = [5, 2, 6, 4, 7, 9, 10]\n print(t.isBSTArray(arr1),\"\\n\")\n print(t.isBSTArray(arr2),\"\\n\")\n # true\n # false\nend", "def is_balanced?(tree_node = @root)\n # byebug\n return true if tree_node.nil?\n left_depth = tree_node.left ? depth(tree_node.left) : -1 \n right_depth = tree_node.right ? depth(tree_node.right) : -1\n if ((left_depth - right_depth).abs <=1) && is_balanced?(tree_node.left) && is_balanced?(tree_node.right)\n return true \n end \n false\n end", "def balanced?\n difference_left_right = @root.left_child.depth - @root.right_child.depth\n difference_left_right.between?(-1, 1)\n end", "def balanced?(tree_root)\n return true unless tree_root\n depths = []\n nodes = []\n nodes << [tree_root, 0]\n until nodes.empty?\n node, depth = nodes.pop\n if !node.left && !node.right\n unless depths.include?(depth)\n depths.push(depth)\n if depths.length > 2 || depths.length == 2 && (depths[0] - depths[1]).abs > 1\n return false\n end\n end\n else\n nodes << [node.left, depth + 1] if node.left\n nodes << [node.right, depth + 1] if node.right\n end\n end\n true\nend", "def has_children?(tree_node)\n tree_node.left || tree_node.right\n end", "def is_a_leaf?\n self.left_child.nil? && self.right_child.nil?\n end", "def is_bst(bst = empty_tree)\n return isEmpty?(bst) || ( ( all_smaller(bst.left, bst.root.value) && is_bst(bst.left) ) && all_bigger(bst.right, bst.root.value) && is_bst(bst.right) )\nend", "def is_leaf?\n self.left_child == nil and\n self.right_child == nil\n end", "def valid_binary_search_tree_recursive(root_node, lower_bound = -Float::INFINITY, upper_bound = Float::INFINITY)\n if !root_node # This means recursive call was made with nothing fro root_node.left/root_node.right\n return true\n\n elsif root_node.value <= lower_bound || root_node.value >= upper_bound\n return false\n else\n valid_binary_search_tree_recursive(root_node.left, lower_bound, root_node.value) &&\n valid_binary_search_tree_recursive(root_node.right, root_node.value, upper_bound)\n # NOTE THE && -> THAT MEANS TO RETURN TRUE, BOTH MUST RETURN TRUE!\n end\nend", "def isSubtree(t1, t2)\n return true if t2.nil?\n return false if t1.nil?\n\n return true if(isIdentical(t1, t2))\n\n (isSubtree(t1.left, t2) || isSubtree(t1.right, t2))\nend", "def is_valid_bst(root)\r\n return true if root.nil?\r\n inorder_values = inorder_traversal(root)\r\n\r\n (1...inorder_values.size).each do |idx|\r\n return false if inorder_values[idx] <= inorder_values[idx-1]\r\n end\r\n\r\n return true\r\nend", "def bst?(node)\n result = true\n hopefully_sorted = inorder_traversal_node(node)\n hopefully_sorted.each_with_index do |item, index|\n break if hopefully_sorted[index + 1].nil?\n if hopefully_sorted[index] > hopefully_sorted[index + 1]\n return false\n end\n end\n true\nend", "def tree_nodes_valid?\n (root_tree_node.present? || top_nav_node_info_cd.zero?) &&\n (branch_tree_node.present? || sub_nav_node_info_cd.zero?) &&\n (leaf_tree_node.present? || trd_nav_node_info_cd.zero?)\n end", "def is_balanced(root)\n # 1) empty trees are balanced.\n return true if root.nil?\n\n # 2) find left and right depth\n left_bal = depth(root.left)\n right_bal = depth(root.right)\n\n #\n (left_bal - right_bal).abs <= 1 &&\n is_balanced(root.left) &&\n is_balanced(root.right)\nend", "def is_balanced(root)\n return true if root.nil?\n left_height = depth(root.left)\n right_height = depth(root.right)\n result = (left_height - right_height).abs\n return false if result > 1\n return is_balanced(root.left) && is_balanced(root.right)\nend", "def valid_search_tree(root)\n stack = []\n stack << [root, -Float::INFINITY, Float::INFINITY]\n\n until stack.empty?\n current_node,min_bound,max_bound = stack.pop\n\n if current_node.value <= min_bound || current_node.value >= max_bound\n return false\n end\n\n if current_node.left\n stack << [current_node.left, min_bound, current_node.value]\n end\n\n if current_node.right\n stack << [current_node.right, current_node.value, max_bound]\n end\n end\n\n true\nend", "def is_balanced?(tree_node = @root)\n left_depth = depth(tree_node.left)\n right_depth = depth(tree_node.right)\n\n return left_depth == right_depth\n\n end", "def leaf?\n left.nil? && right.nil?\n end", "def is_valid_BST?(root)\n min = -Float::Infinity\n max = Float::Infinity \n return is_valid_helper(root, min, max)\nend", "def is_leaf\n return @left == nil\n end", "def betterIsBST?(root_node, max, min) #O(n) time, checks each node once\n return true if root_node.nil?\n \n max_check = !max || root_node.val < max\n min_check = !min || root_node.val > min\n \n unless max_check && min_check\n return false #evaluate self first\n end\n \n left = betterIsBST?(root_node.left, root_node.val, min)\n right = betterIsBST?(root_node.right, max, root_node.val)\n \n return left && right #tell children to evaluate themselves\nend", "def is_valid_bst(root)\n result = []\n stack = []\n iterator = root\n\n while iterator || !stack.empty? do\n if iterator.nil?\n node = stack.pop\n\n if result.count > 0 && result.last >= node.val\n return false\n end\n\n result << node.val\n iterator = node&.right\n else\n stack << iterator\n iterator = iterator.left\n end\n end\n\n true\nend", "def is_balanced(root)\n return true if root.nil?\n\n depth_diff = max_depth(root.left) - max_depth(root.right)\n\n return depth_diff.abs <= 1 && is_balanced(root.left) && is_balanced(root.right)\nend", "def is_bst?(bst = empty_tree, min, max)\n if isEmpty?(bst)\n return true\n elsif (bst.root.value > min) && (bst.root.value < max) && is_bst?(bst.left, min, bst.root.value) && is_bst?(bst.right, bst.root.value, max)\n return true\n else\n return false\n end\nend", "def is_match?(root1, root2)\n return true if root1.nil? && root2.nil?\n return false if root1.nil? || root2.nil? || root1.val != root2.val\n\n is_match?(root1.left, root2.left) && is_match?(root1.right, root2.right)\nend", "def balanced?(node = root)\n return true if node.nil?\n\n left_height = height(node.left)\n right_height = height(node.right)\n\n return true if (left_height - right_height).abs <= 1 && balanced?(node.left) && balanced?(node.right)\n\n false\n end", "def check_subtree(small, large)\n start_node = bsearch(large.root, small.root.value)\n return false if start_node.nil?\n traverse_in_order(small.root) == traverse_in_order(start_node)\nend", "def is_balanced(tree_root)\n depths = [] # we short-circuit as soon as we find more than 2\n \n # we'll treat this array as a stack that will store pairs [node, depth]\n nodes = []\n nodes.push([tree_root, 0])\n \n while !nodes.empty?\n # pop a node and its depth from top of stack\n node, depth = nodes.pop\n \n # case: we found a leaf\n if !node.left && !node.right\n \n # we only care if it's a new depth\n if !depths.include? depth\n depths.push(depth)\n \n # two ways we might now have an unbalanced tree\n # 1. more than 2 different leaf depths\n # 2. 2 leaf depths that are more than 1 apart\n if (depths.length > 2) || \\\n (depths.length == 2 && (depths[0] - depths[1]).abs > 1)\n return false\n end\n end\n # case: this isn't a leaf - keep stepping down\n else\n if node.left\n nodes.push([node.left, depth + 1])\n end\n if node.right\n nodes.push([node.right, depth + 1])\n end\n end\n end\n return true\n \nend", "def is_node?(); @type == GRT_NODE; end", "def valid_bst?(root = self, min = -1.0/0.0, max = 1.0/0.0)\n if root.value > min && root.value < max\n if root.leaf?\n return true\n elsif root.right.nil?\n valid_bst?(root.left, min, root.value)\n elsif root.left.nil?\n valid_bst?(root.right, root.value, max)\n else\n valid_bst?(root.left, min, root.value) && valid_bst?(root.right, root.value, max)\n end\n else\n false\n end\n end", "def leaf?\n right - left == 1\n end", "def is_subtree(root, sub_root)\n subroot_traversal = recursive_inorder_traversal(sub_root)\n\n is_subtree_recursive(root, subroot_traversal)[0]\nend", "def is_valid_bst(node)\n\t@a = []\n\tinorder(node)\n\tfor i in 0..@a.size-2 do\n\t\tif @a[i] > @a[i+1]\n\t\t\treturn false\n\t\tend\n\tend\n\ttrue\nend", "def test_load_works\n tree = BinarySearchTree.new\n tree.load\n assert tree.root.left_node != nil\n assert tree.root.right_node != nil\n end", "def is_nodetype?(); @type == GRT_NODETYPE; end", "def leaf?(r)\n r.children.empty?\n end", "def is_bst\n is_bst_bool_hash = { is_bst_bool: true }\n is_bst_support(self.root, FIXNUM_MIN, FIXNUM_MAX, is_bst_bool_hash)\n print is_bst_bool_hash[:is_bst_bool]\n end", "def is_balanced?\n diff = (self.left.depth - self.right.depth).abs\n if diff <= 1\n true\n else\n false\n end\n end", "def is_root?\n \troot == id\n end", "def _is_root_node?\n @nodes.size == 1\n end", "def leaf?\n true\n end", "def is_registered?(st, params)\n is_node_registered?(st, params, full_path)\n# st = match_node_path(st, params)\n# return false unless st.is_a?(Tree::TreeNode)\n# true\n end", "def is_node?(obj)\n obj.respond_to?(:children) && obj.location.expression\n end", "def check_subtree(tree1, tree2)\n # due to the depth of T1 being much larger than T2 a BFS seems more logical\n bfs(tree1.head, tree2,head)\nend", "def alt_valid_bst?\n self.to_ll.sorted?\n end", "def has_root?\n @root != nil\n end", "def is_in(target_value, bst = empty_tree)\n if isEmpty?(bst)\n return false\n elsif bst.root.value == target_value\n return true\n elsif target_value < bst.root.value\n is_in(target_value, bst.left)\n else\n is_in(target_value, bst.right)\n end\nend", "def inconsistent_node?(node)\n return true if !root ||\n !node\n return false if node.tree_node?\n v2 = node.v2?\n return true unless !v2 || node.depth != 0\n return false if v2 == v2?\n\n #state = INVALID\n return true\n end", "def scanned_node?(node); end", "def leaf?\n !node?\n end", "def is_leaf\n true\n end", "def is_leaf\n true\n end", "def valid?\n inner_root.children.detect{|node| node.valid? == false} == nil # should be explicitely nil !!\n end", "def balanced?\n left = height(@root.left_node)\n right = height(@root.right_node)\n\n if (left - right).abs <= 1\n return true\n end\n\n return false\n end", "def is_bst(node = self.root, min = -1000, max = 1000)\n if node == nil\n true\n elsif node.key < min || node.key > max\n false\n else\n is_bst(node.left, min, node.key)\n is_bst(node.right,node.key,max)\n end\n end", "def is_valid_bst(root)\n helper(root, -Float::INFINITY, Float::INFINITY)\nend", "def super_balanced(tree)\n if !tree\n return true\n end\n \n depths = []\n nodes = []\n nodes.push([tree, 0])\n \n while !nodes.empty?\n node, depth = nodes.pop\n \n if !node.left && !node.right\n if !depths.include? depth\n depths.push(depth)\n \n if (depths.length > 2) || (depths.length == 2 && (depths[0] - depths[1]).abs > 1)\n return false\n end\n \n end\n else\n if node.left\n nodes.push([node.left, depth+1])\n end\n if node.right\n nodes.push([node.right, depth+1])\n end\n end\n end\n \n return true \nend", "def is_valid_bst_b(root)\n helper_b(root)\nend", "def children_are_leaves?\n unless leaf?\n @children[0].leaf?\n end\n end", "def is_valid_bst(root)\n is_valid_helper(root, -Float::INFINITY, Float::INFINITY)\nend", "def balanced?\n (height(@root.left) - height(root.right)).between?(-1, 1)\n end", "def tree_equal?(other)\n self == other && children == other.children\n end", "def is_valid_bst(root)\n is_valid_helper(root, -Float::INFINITY, Float::INFINITY)\nend", "def include_root?\n min_depth == 0\n end", "def valid_bst?(node, min = nil, max = nil)\n return true if node.nil?\n\n return false if (min && (min > node.val)) || (max && (max < node.val))\n\n valid_bst?(node.left, min, node.val) && valid_bst?(node.right, node.val, max)\n end", "def is_valid_bst(root, min = nil, max = nil)\n #base case\n return true if root.nil?\n\n #make sure that if min is not nil, value is greater than min, and smaller than max (could adapt to allow it to be equal to)\n if !min.nil? && root.val <= min || !max.nil? && root.val >= max\n return false\n end\n\n #if either true is both conditions hold for each side of tree\n return is_valid_bst(root.left, min, root.val) && is_valid_bst(root.right, root.val, max)\n\nend", "def root?\n depth == 1\n end", "def balanced?(current_node = root)\n depth(current_node) == -1 ? false : true\n end", "def question_1(root, target)\n return false if root.nil?\n stack = [root]\n until stack.empty?\n current = stack.pop\n return true if current.value == target.value\n stack << current.right if !current.right.nil?\n stack << current.left if !current.left.nil?\n end\n false\nend", "def test_tree_starts_empty\n tree = BinarySearchTree.new\n assert_nil tree.root\n end", "def allowed_type?(parent_node); end", "def root?\n self.depth.zero?\n end", "def root?\n self.depth.zero?\n end", "def bst?(node)\n min = -Float::INFINITY\n traverse_in_order(node) do |n|\n return false if n.val < min\n\n min = n.val\n end\n true\nend", "def leaf?\n children.empty?\n end", "def is_root?()\n return (name.nil? and parent.nil?) \n end", "def root?\n @type == ROOT\n end", "def check_bst\n if @left == nil and @right == nil\n return [@data, @data]\n elsif @left == nil\n res = @right.check_bst\n if ! res or @data > res[0]\n return false\n else\n return [@data, res[1]]\n end\n elsif @left == nil\n res = @right.check_bst\n if ! res or @data > res[0]\n return false\n else\n return [@data, res[1]]\n end\n else\n l = @left.check_bst\n if @data < l[1]\n return false\n end\n r = @right.check_bst\n if @data > r[0]\n return false\n end\n return [l[0], r[1]]\n end\n end", "def is_bst_support(node, min, max, is_bst_bool_hash)\n return true if node.nil?\n\n is_bst_support(node.left, min, node.value, is_bst_bool_hash)\n left_is_bst = valid_node_data?(node.left, min, node.value, :left)\n\n is_bst_support(node.right, node.value + 1, max, is_bst_bool_hash)\n right_is_bst = valid_node_data?(node.right, node.value + 1, max, :right)\n\n is_bst_bool_hash[:is_bst_bool] = false unless left_is_bst && right_is_bst\n end", "def hasChildren\n if (@left == nil) && (@right == nil)\n return 0\n elsif (@left != nil) && (@right != nil)\n return 2\n else\n return 1\n end\n end", "def no_children?(node)\n return true unless node\n node.left.nil? && node.right.nil?\n end", "def bst_search(tree, node)\n locator = tree\n parent = nil\n found = false\n while( !found && locator)\n if node.data < locator.node.data\n # descend left\n parent = locator\n locator = locator.left_child\n elsif node.data > locator.node.data\n # descend right\n parent = locator\n locator = locator.right_child\n else\n found = true\n end\n end\n return found, locator, parent\n end" ]
[ "0.7561033", "0.7424401", "0.7258297", "0.71575105", "0.71522766", "0.70561254", "0.70270354", "0.70202255", "0.6994458", "0.6994143", "0.6994143", "0.69706833", "0.6869991", "0.67910755", "0.67492497", "0.67078835", "0.66818887", "0.65670866", "0.6539834", "0.6525104", "0.65052235", "0.6504691", "0.64949584", "0.6493383", "0.648708", "0.64857227", "0.6478962", "0.6476073", "0.64647716", "0.645293", "0.6426904", "0.6404592", "0.6402817", "0.63882184", "0.6382377", "0.6379847", "0.637648", "0.6374941", "0.6372536", "0.632687", "0.6311987", "0.63008213", "0.62737846", "0.626822", "0.6249995", "0.62480456", "0.6245257", "0.62062865", "0.6169324", "0.61642474", "0.6156747", "0.61552405", "0.61352444", "0.6132663", "0.61238074", "0.6112502", "0.6110682", "0.6104467", "0.60833627", "0.6077009", "0.60709447", "0.60671806", "0.6063936", "0.6062822", "0.60537", "0.60490596", "0.6021733", "0.6016703", "0.60158664", "0.60158664", "0.60047567", "0.6003001", "0.6001069", "0.5996517", "0.5992313", "0.5988946", "0.597817", "0.59752494", "0.597369", "0.5950705", "0.5943471", "0.5938885", "0.59236735", "0.59163094", "0.59160995", "0.5903033", "0.58991647", "0.5894751", "0.5887736", "0.58859754", "0.58859754", "0.5882324", "0.5882038", "0.5871745", "0.5856091", "0.58508074", "0.58366036", "0.5829721", "0.582961", "0.5829162" ]
0.6890111
12
rename local variable rrlv
def rename_local_variable # Start on either 'asdf', and do viw<leader>rrlv asdf = 10 p asdf # TODO: make this work without 'v' end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rename_var(var_name, opts={})\n @renames[var_name] = scope.rename_var(var_name, opts)\n end", "def renamenx(old_name, new_name); end", "def renamenx(old_name, new_name); end", "def rename_to_bob\n name = 'Bob'\n end", "def _get_var(name)\n\t\treturn @replace_vars[name]\n\tend", "def relvar(name)\n r = @relvar.namespace.relvar(name, false)\n raise \"Unknown relvar #{name}\" unless r\n r\n end", "def initialize(vrn)\n @vrn = vrn&.delete(' ')&.upcase\n end", "def defvar(name, dwords=1)\n unless var?(name)\n @bss << \"#{name}: resd #{dwords}\\n\"\n @vars[name] = name\n else\n STDERR.puts \"[warning] attempted to redefine #{name}\"\n end\n end", "def process_lvar(exp)\n lvar = exp.shift\n\n lvar_name = @model.encode_local_variable(lvar)\n raise \"variable not available\" unless @local_variables.include?(lvar_name)\n\n resultify(\"#{lvar_name}\")\n end", "def issue_reassignments\n Pkg::Params::REASSIGNMENTS.each do |v|\n oldval = self.instance_variable_get(\"@#{v[:oldvar]}\")\n newval = self.instance_variable_get(\"@#{v[:newvar]}\")\n if newval.nil? && oldval\n self.instance_variable_set(\"@#{v[:newvar]}\", oldval)\n end\n end\n end", "def v(identifier)\n @variable_names = {} unless @variable_names\n unless @variable_names[identifier]\n @@variable_name_counter += 1\n @variable_names[identifier] = \"v_#{@@variable_name_counter}\"\n end\n @variable_names[identifier]\n end", "def rename new_name\n @name = new_name.to_sym\n end", "def rename new_name\n @name = new_name.to_sym\n end", "def ass(ex, val)\n begin\n ex.varStore.set @rname, val\n rescue => e\n raise #e.message.chomp+' at line '+@code_line.to_s\n end\n return nil\n end", "def refurbish variable_name\n Value.typed @vars[variable_name], variable_name.to_s.sub(/^\\@/, '') #.sub(/^\\$/, '')\n end", "def replace_vim_variable(variable)\n Vim::command(\"let snip_tmp = #{vim_mappings[variable]}\")\n result = Vim::evaluate(\"snip_tmp\")\n case variable\n when \"VI_SOFT_TABS\"\n result = (result == \"1\" ? \"YES\" : \"NO\")\n when \"VI_FILENAME\"\n result = File.basename(result)\n else\n result\n end\n end", "def var=(name)\n @var = if name == :random\n \"_#{rand(2000)}\"\n else\n name\n end\n end", "def set_vector_with_names_via_hash(r_var_name, hash)\n vals = array_to_r_vector(hash.values)\n nms = array_to_r_vector(hash.keys, :string_vals => true)\n\n command = \"#{r_var_name} <- #{vals}; names(#{r_var_name}) = #{nms}\"\n @con.eval(command)\n end", "def rename(old_name, new_name); end", "def rename(old_name, new_name); end", "def name_swap(real_name)\n\tnew_name = name_handler(real_name)\n puts new_name\n return new_name\nend", "def redefine_var\n $game_variables[Yuki::Var::Player_ID] = id\n $game_actors[1].name = name\n # redefinir les badges\n end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def name=(_); end", "def conv_ruby_var\n parts = @name.split(\"::\")\n mod = parts[0]\n n = parts[1][3..-1]\n # p parts, mod, n\n \n spchars = n.scan(/\\_[0-9A-F]{2}/)\n spchars.each do |sc|\n n.sub!(sc, sc[1..-1].to_i(16).chr)\n end\n\n return mod + \"::\" + n\n end", "def var_name()\n if self.id.start_with?(/\\Ah?l_/i)\n return self.id.downcase\n else\n return \"l_#{self.id.downcase}\"\n end\n end", "def conv_ruby_var\n return @name\n end", "def change_name!\n @project[:name] = \"#{@project[:name]}-PR#{@number}\" if @project[:name]\n @project[:value][:name] = \"#{@project[:value][:name]}-PR#{@number}\" if @project[:value][:name]\n end", "def makeCensoredVarname( varname )\n varname = basicCensor( varname )\n if( KEYWORD_TRANSLATIONS.has_key?( varname ))then\n varname = KEYWORD_TRANSLATIONS[ varname ];\n end\n return varname\nend", "def renamenx(old_name, new_name)\n send_command([:renamenx, old_name, new_name], &Boolify)\n end", "def normalise_defined_name(name) # :nodoc:\n name.sub(/^_xlnm./, '').downcase\n end", "def nameToJavaVar( name )\n return '' if( name.nil? )\n RAILS_DEFAULT_LOGGER.debug \"nameToJavaVar; name=#{name}\"\n name.strip!;\n s = name[0,1].downcase! \n RAILS_DEFAULT_LOGGER.debug \"new 1st char |#{s}|\";\n name[0]= s if( ! s.nil? ); \n RAILS_DEFAULT_LOGGER.debug \"output name |#{name}|\";\n name;\nend", "def old_name; end", "def on_lvasgn(node)\n super\n name, = *node\n position = find_local name\n # TODO: should be able to shadow variable scope\n unless position\n position = locals.length\n @locals << name\n end\n\n emit :FROMALTSTACK\n emit :DUP\n emit :TOALTSTACK\n emit_push position\n emit_push 2\n emit :ROLL\n emit :SETITEM\n end", "def helper_renames\r\n ## NB: for now user cannot override/extent renames\r\n @props_builtin['helper']['renames']\r\n end", "def visit_VarDeclNode(o)\n unless @preserved_identifiers.include?(o.name)\n o.name = JSObfu::Utils::random_var_encoding(rename_var(o.name))\n end\n\n super\n end", "def rename(new_filename)\n @filename = new_filename\n end", "def rename\n @rename ||= settings[:option] ? (settings[:as] || name) : name\n end", "def name=(val) @records.set(GRT_STRNAME, val); end", "def name=(p0) end", "def name=(p0) end", "def original_name; end", "def name_to_verilog(name)\n # name = name.to_s\n # # Convert special characters.\n # name = name.each_char.map do |c|\n # if c=~ /[a-z0-9]/ then\n # c\n # elsif c == \"_\" then\n # \"__\"\n # else\n # \"_\" + c.ord.to_s\n # end\n # end.join\n # # First character: only letter is possible.\n # unless name[0] =~ /[a-z_]/ then\n # name = \"_\" + name\n # end\n # return name\n name = name.to_s\n vname = @@hdr2verilog[name]\n unless vname then\n # Shall we change the string?\n if name.match?(/^[_a-zA-Z][_a-zA-Z0-9]*$/) then\n # No, just clone\n vname = name.clone\n else\n # Yes, ensure it is a verilog-compatible name.\n vname = \"_v#{@@hdr2verilog.size}_#{name.split(/[^a-zA-Z_0-9]/)[-1]}\"\n end\n @@hdr2verilog[name] = vname\n end\n return vname\n end", "def change_my_name\n name = \"John\"\n name.reverse\n return name\nend", "def replace_pid_in_vra(old_pid, new_pid)\r\n begin\r\n update_ref_id(new_pid)\r\n replace_locationset_display_pid(old_pid, new_pid)\r\n replace_locationset_location_pid(new_pid)\r\n rescue Exception => e\r\nx logger.error(\"Exception in replace_pid_in_vra:#{e.message}\")\r\n end\r\n end", "def rname\n\t\treturn @aname\n\tend", "def rename_this_name(name)\n name\n end", "def set_local(name, value_node)\n @locals << name unless @locals.include?(name)\n emit \"#{name} = \"\n value_node.compile(self)\n end", "def rename(renames)\n operations = renames.inject({}) do |ops, (old_name, new_name)|\n ops[old_name] = new_name.to_s\n ops\n end\n view.update_many(\"$rename\" => collect_operations(operations))\n end", "def rename_chr(chr)\n chr_id = { \"gi|366157031\" => 4,\n \"gi|366157028\" => 2,\n \"gi|366157039\" => 12,\n \"gi|366157038\" => 11,\n \"gi|366157037\" => 10,\n \"gi|366157036\" => 9,\n \"gi|366157035\" => 8,\n \"gi|366157034\" => 7,\n \"gi|366157033\" => 6,\n \"gi|366157032\" => 5,\n \"gi|366157030\" => 3,\n \"gi|366157029\" => 1 }\n id = /^(?<name>gi\\|\\d{9})/.match(chr)[:name]\n new_chr = chr_id[id]\n new_chr\nend", "def rename(name)\n url = prefix + \"rename&name=#{name}\" \n return response(url)\n end", "def relvar(*args, &bl)\n alf_connection.relvar(*args, &bl)\n end", "def rename_this_name(name)\n name\n end", "def bind_var_name(o)\n if in_local_var_context\n @bound_var_names[o] = make_next_var\n else\n o\n end\n end", "def var(name, value)\n @locals[name] = value\n end", "def rename!(name)\n @name = name\n @path = make_path\n end", "def rename(a, b)\n @@__name_sets[@@__defining][b] = :\"__#{a}\"\n @@__name_sets[:original][a] = :\"__#{a}\"\n\n class<<self\n self\n end.class_eval do\n alias_method :\"__#{a}\", a\n remove_method a\n end\n end", "def name = (name)", "def renamed_filename\n @renamed_filename ||= \"CCAZ_WhiteList_#{user.preferred_username}::#{Time.current.to_i}.csv\"\n end", "def mk_var(name, rname, type, transform=\"\", files=@files)\n f_hash=Hash[*files.zip((1..files.length).to_a).flatten]\n defs=files.map do |file|\n \"DEF:#{name}#{f_hash[file]}=#{file}:#{rname}:#{type.to_s.upcase}\"\n end\n cdef=\"CDEF:#{name}=0\"\n f_hash.values.each {|x| cdef += \",#{name}#{x},+\"}\n defs + [cdef + transform]\n end", "def mk_var(name, rname, type, transform=\"\", files=@files)\n f_hash=Hash[*files.zip((1..files.length).to_a).flatten]\n defs=files.map do |file|\n \"DEF:#{name}#{f_hash[file]}=#{file}:#{rname}:#{type.to_s.upcase}\"\n end\n cdef=\"CDEF:#{name}=0\"\n f_hash.values.each {|x| cdef += \",#{name}#{x},+\"}\n defs + [cdef + transform]\n end", "def setR(r)\r\n @r = r\r\n end", "def variable_name=(variable_name)\n self[:variable_name] = variable_name.downcase.gsub(/[^0-9a-z_ ]/i, \"\").strip.tr(\" \", \"_\")\n end", "def rename(new_name)\n json_body = { :name => new_name }.to_json\n HTTParty.put(base_request_uri, :body => json_body)\n @name = new_name\n end", "def rename(name)\n url = prefix + \"rename&name=#{name}\"\n return response(url)\n end", "def set_name(v)\n Saklient::Util::validate_type(v, 'String')\n @m_name = v\n @n_name = true\n return @m_name\n end", "def set_name(v)\n Saklient::Util::validate_type(v, 'String')\n @m_name = v\n @n_name = true\n return @m_name\n end", "def name=(label)\n row.worksheet.workbook.add_defined_name \"#{row.worksheet.name}!#{r_abs}\", name: label\n @name = label\n end", "def replace_var(raw, name, offset, pack)\n\t\tsuper\n\t\tif( name == 'EXITFUNC' )\n\t\t\tdatastore[name] = 'thread' if not datastore[name]\n\t\t\traw[offset, 4] = [ 0x5F048AF0 ].pack(pack || 'V') if datastore[name] == 'seh'\n\t\t\traw[offset, 4] = [ 0x60E0CEEF ].pack(pack || 'V') if datastore[name] == 'thread'\n\t\t\traw[offset, 4] = [ 0x73E2D87E ].pack(pack || 'V') if datastore[name] == 'process'\n\t\t\treturn true\n\t\tend\n\t\treturn false\n\tend", "def updateRelname(fromPT)\n\n relNames = JsonPath.on(fromPT.to_json, '$..RANGEVAR')\n # pp relNames\n \t# column has no relalias or relname \n \trelNames.each do |rel|\n \t\ttblName = rel['relname']\n tblAlias = rel['alias'].nil? ? nil : rel['alias']['ALIAS']['aliasname']\n # pp tblName\n # pp tblAlias\n # if @relaias already exists, we only query on matching relialia\n if not @relalias.to_s.empty? and tblName != @relalias and tblAlias != @relalias\n # pp 'searching for matching @relalias'\n # binding.pry\n next\n end\n query = QueryBuilder.find_cols_by_data_typcategory(tblName,'',@colname)\n res = DBConn.exec(query)\n # pp res\n if res.count()>0\n # pp res[0]\n r = res[0]\n @relname = tblName\n @datatype = r['data_type']\n @typcategory = r['typcategory']\n # puts 'rel'\n # pp rel\n if rel.has_key?('alias') \n unless rel['alias'].nil?\n @relalias = rel['alias']['ALIAS']['aliasname']\n else\n @relalias = nil\n end\n end\n return\n end\n \tend\n end", "def set_rdv\n @rdv = Rdv.find(params[:id])\n end", "def name= (nm)\n _c_set_name(Slaw._ensure_utf8(nm))\n end", "def rename_file\n\n end", "def namespace=(v); end", "def vm_rename\n requires :instance_uuid, :name\n service.vm_rename('instance_uuid' => instance_uuid, 'name' => name)\n end", "def unmiga_name\n gsub(/_(str|sp|subsp|pv)__/,\"_\\\\1._\").tr('_', ' ')\n end", "def vehicleVarName _args\n \"vehicleVarName _args;\" \n end", "def new_name; end", "def set_namel\n @name = Role.find(params[:movie_id])\n end", "def scope2(var)\r\n\tvar.upcase\r\nend", "def rename(_old_team, _new_team)\n # stub\n end", "def name=(o); end", "def set_version_name!\n if patterns = @name.match(/^(.*) \\[(.*)\\](.*)$/)\n @name = \"#{patterns[1]}#{patterns[3]}\"\n @version_name = patterns[2]\n end\n end", "def reload_name!\n clear_name_cache\n end", "def rename(a)\n File.rename(@file,a)\n @file = a\n end", "def renamenx(old_name, new_name)\n ensure_same_node(:renamenx, [old_name, new_name]) do |node|\n node.renamenx(old_name, new_name)\n end\n end", "def rename\n render\n end", "def rename(fl, sensor, channel, satellite, downlink, tm)\n time_bit = tm.strftime('%y%m%d_%H%M.%S')\n name = \"UAF_AWIPS_#{sensor}-AK_1KM_#{channel}_#{satellite}_#{downlink}_#{time_bit}\"\n FileUtils.mv(fl, name)\n name\n end", "def new_name(old_name)\n \"flexmock_original_behavior_for_#{old_name}\"\n end", "def new_name(old_name)\n \"flexmock_original_behavior_for_#{old_name}\"\n end", "def renamed(item, oldName, newName)\n end", "def alias_to(agent_name)\n #inverting names\n inverted_names = invert_names(agent_name)\n agent_alias = \"\"\n #for each char of the inverted names change to the next char if necessary\n inverted_names.chars.each do |char|\n agent_alias << next_char(char)\n end\n agent_alias\nend", "def class_name_to_variable_name(name)\n name.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end", "def class_name_to_variable_name(name)\n name.to_s.gsub(/::/, '/').\n gsub(/([A-Z]+)([A-Z][a-z])/,'\\1_\\2').\n gsub(/([a-z\\d])([A-Z])/,'\\1_\\2').\n tr(\"-\", \"_\").\n downcase\n end" ]
[ "0.6476713", "0.62236726", "0.62236726", "0.57593536", "0.562595", "0.5613587", "0.555546", "0.5552649", "0.5541816", "0.55172426", "0.55069834", "0.5469401", "0.5469401", "0.5453131", "0.5394255", "0.53650665", "0.535592", "0.53248", "0.5324194", "0.5324194", "0.53170234", "0.5306698", "0.5302496", "0.5302496", "0.5302496", "0.5302496", "0.5302496", "0.5302496", "0.5302496", "0.5302496", "0.5292347", "0.5288486", "0.5285035", "0.52670324", "0.5252785", "0.5200421", "0.5196777", "0.5175077", "0.51391554", "0.51007", "0.5096459", "0.5080845", "0.50795585", "0.5076639", "0.5072491", "0.5057636", "0.5057636", "0.5027", "0.5024117", "0.50069886", "0.50046617", "0.5004003", "0.49997875", "0.4983891", "0.49819836", "0.4976969", "0.4974732", "0.4969338", "0.49589118", "0.49393934", "0.49382034", "0.49324864", "0.49316892", "0.49311805", "0.49250478", "0.491814", "0.491814", "0.49068654", "0.49036333", "0.48895794", "0.4880526", "0.48706877", "0.48706877", "0.4869256", "0.48686785", "0.4864085", "0.48592734", "0.48560995", "0.4849146", "0.48463428", "0.48462325", "0.4844723", "0.48436773", "0.48423946", "0.48351374", "0.48285466", "0.4824762", "0.4821048", "0.4818416", "0.4817235", "0.48160145", "0.48153412", "0.48045433", "0.47982147", "0.47952923", "0.47952923", "0.4792417", "0.47898966", "0.47841227", "0.47841227" ]
0.72910327
0
but this one is safe
def add_parameter one # <leader>rap[name of param] from here # FIXME: make this work with g:ruby_refactoring_sans_superfluous_syntax and # ditch RAddParameterNB (would cause <leader>rap to respond immediately) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def private; end", "def safe; end", "def safe_by_default; end", "def schubert; end", "def probers; end", "def suivre; end", "def safelist; end", "def awaken!\n\t\traise 'Not implemented'\n\tend", "def safe=(_arg0); end", "def semact?; false; end", "def escaper=(_); end", "def used?; end", "def anchored; end", "def placebo?; false end", "def big_bad; end", "def same; end", "def valid; end", "def refutal()\n end", "def issn; end", "def safelists; end", "def specie; end", "def specie; end", "def specie; end", "def specie; end", "def sharded?; false; end", "def sharded?; true; end", "def usable?; end", "def name_safe?; end", "def probers=(_arg0); end", "def guard; end", "def escaper; end", "def safe_by_default=(_arg0); end", "def internal; end", "def internal?; end", "def pausable; end", "def safe(safe = T.unsafe(nil)); end", "def ibu; end", "def internship_passed; end", "def overload; end", "def too_many_hops?; end", "def make_safe!\n return false\n end", "def lock; end", "def lock; end", "def lock; end", "def check ; true ; end", "def final; end", "def isolated; end", "def isolated; end", "def berlioz; end", "def prepareForReuse; end", "def celebration; end", "def hiss; end", "def checked=(_arg0); end", "def intern() end", "def transient?; end", "def normal(p)\n return nil # FIX ME\n end", "def missing?; end", "def wrapper; end", "def safely\n yield\n rescue Exception\n nil\n end", "def reserved=(_arg0); end", "def fallbacks=(_arg0); end", "def temporary?; self.temporary; end", "def result=(_); end", "def final?; end", "def weber; end", "def cop=(_); end", "def cop=(_); end", "def modifier_if_safe_navigation_candidate(param0 = T.unsafe(nil)); end", "def if_needs_rekey?; end", "def ignores; end", "def offences_by=(_arg0); end", "def PO114=(arg)", "def custom; end", "def custom; end", "def bs; end", "def strict; end", "def access_locked?; end", "def tainted?() end", "def maybe; end", "def explicit; end", "def raw=(_arg0); end", "def raw=(_arg0); end", "def sharp; accidental; end", "def whiny=(_arg0); end", "def explicit?; end", "def stderrs; end", "def treat_reserved_as_conflict=(_arg0); end", "def reserved; end", "def checks; end", "def malts; end", "def extra=(_arg0); end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def valid?; end", "def treat_reserved_as_conflict; end", "def autofinish=(_arg0); end", "def dematerialize ; end", "def terpene; end", "def value_read=(_arg0); end" ]
[ "0.66718733", "0.630874", "0.5742951", "0.57395977", "0.57022834", "0.5695599", "0.56697464", "0.5625682", "0.56201065", "0.555713", "0.5528059", "0.55205166", "0.55148107", "0.5438746", "0.5414883", "0.5360013", "0.5339953", "0.53297186", "0.5303258", "0.5260695", "0.5251869", "0.5251869", "0.5251869", "0.5251869", "0.5250691", "0.52393085", "0.52202517", "0.5218851", "0.52153325", "0.5199051", "0.5198946", "0.5198649", "0.51848567", "0.5179484", "0.51768386", "0.51642543", "0.5157891", "0.515529", "0.5140041", "0.5128792", "0.51278985", "0.512413", "0.512413", "0.512413", "0.5110254", "0.51007926", "0.5093478", "0.5093478", "0.5084948", "0.5078332", "0.5075435", "0.5073926", "0.50707525", "0.50620145", "0.50604475", "0.5058597", "0.50488675", "0.50319237", "0.50287795", "0.50249743", "0.50161856", "0.5010285", "0.5009603", "0.50065553", "0.5002217", "0.50018567", "0.50018567", "0.50007653", "0.4988968", "0.4987178", "0.49755195", "0.49638346", "0.496115", "0.496115", "0.49578893", "0.4955004", "0.49459794", "0.49442616", "0.49423203", "0.49411952", "0.4939676", "0.4939676", "0.49393085", "0.49373782", "0.49309692", "0.49305123", "0.4929625", "0.49286112", "0.492834", "0.49283335", "0.49243286", "0.49230692", "0.49230692", "0.49230692", "0.49230692", "0.49230692", "0.49219182", "0.4921174", "0.49209645", "0.49189073", "0.49042565" ]
0.0
-1
Note that meeting the requirements of said algorithm does not necessarily mean the card number is active.
def isvalid?(cc_num) cc_num = cc_num.reverse.split("").map! {|x| x.to_i} checkdig = cc_num[0] cc_num.delete_at(0) odds = [] sd_evens = [] dd_evens = [] total = 0 dd_evs_spl = [] cc_num.each_index { |x| if x % 2 == 1 odds << cc_num[x] elsif cc_num[x] < 5 sd_evens << cc_num[x] else dd_evens << cc_num[x] end } sd_evens.map! {|x| x * 2} dd_evens.map! {|x| (x * 2).to_s} dd_evens = dd_evens.join("").split("") dd_evens.map! {|x| x.to_i} odds.each {|x| total += x} sd_evens.each {|x| total += x} dd_evens.each {|x| total += x} check_dig = (total * 9) % 10 if checkdig == check_dig puts "The number is valid." else puts "The number is invalid." end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def card_detection\n end", "def active_credit_card\n self.credit_cards.find_by(active: true)\n end", "def isAce(card_number)\n return true if (card_number % 13) == 1\nend", "def ace_check\n cards[index_of_11][:points] = 1 if index_of_11 && (total > 21)\n end", "def card\n false\n end", "def get_new_card\n \n #Assign a random number between 1 and 13 as the value of the card being \n #created\n card = 1 + rand(13)\n \n #A value of 1 is an ace, so reassign the card a value of 11\n return 11 if card == 1 \n\n #A value of 10 or more equals a face card so reassign the card a value\n #of 10 \n return 10 if card >= 10\n \n return card #Return the value assigned to the new card\n \n end", "def get_new_card\r\n\r\n #Assign a random number between 1 and 13 as the value of the card being\r\n #created\r\n card = 1 + rand(13)\r\n\r\n #A value of 1 is an ace, so reassign the card a value of 11\r\n return 11 if card == 1\r\n\r\n #A value of 10 or more equals a face card so reassign the card a value\r\n #of 10\r\n return 10 if card >= 10\r\n\r\n return card #Return the value assigned to the new card\r\n\r\n end", "def active_credit_card\n if organization && (organization.owner_id != id) && organization.owner\n return organization.owner.active_credit_card\n else\n customer.card\n end\n end", "def blackjack?; value == 21 && @cards.length == 2; end", "def checkforAce(card)\n if card.value = 1\n return true\n else\n return false\n end\n end", "def checkforAce(card)\n if card.value = 1\n return true\n else\n return false\n end\n end", "def open_card\n card_in_game\n return $hash_7_card\n end", "def blackjack?(cards)\n\nend", "def card_number_secure\n @card.display_number\n end", "def assigned_to_card?\n self.card_id != 0\n end", "def card_value_determiner(card)\n string_nums = (2..10).to_a.map { |i| i.to_s}\n if string_nums.include?(card.face)\n card.value = card.face.to_i\n elsif card.face == 'Ace'\n card.value == 11\n else\n card.value = 10\n end\nend", "def charge_credit_card(amount)\n true\n end", "def charge_credit_card(amount)\n true\n end", "def hit?(card_total)\n # code hit? here\n\n \nend", "def state\n card_state\n end", "def get_card\n end", "def valid_credit_card?(num)\r\n# Split the string into an array so we can work with each digit\r\n# Reverse the string so we can double every other number\r\n\tcard = num.split(//).reverse.each_with_index.map do |num, index| \r\n\t\tif index % 2 != 0 then\r\n\t\t\tnum.to_i * 2\r\n\t\telse\r\n\t\t\tnum.to_i\r\n\t\tend\r\n\tend\t\r\n\r\n# There must be a better way to do this, but the idea is to turn the array into a string\r\n# and back into an array to turn the double digit numbers into single digits.. /sigh\r\n\tcard.to_s\r\n\t.gsub(/,/,'')\r\n\t.gsub(/\\[/,'')\r\n\t.gsub(/\\]/,'')\r\n\t.gsub(/ /,'')\r\n\t.split('')\r\n\t.map {|i| i.to_i}\r\n\t.reduce(:+) % 10 == 0\r\nend", "def check_card\r\n double_every_other\r\n @double_array.inject(0) { |initial, number| initial + number.to_i } % 10 == 0\r\n end", "def credit_card_number; end", "def busted?(cards)\n\nend", "def use_card\n waiting_to_confirm_placement = true\n waiting_to_use_card = true\n invalid_usage = nil\n invalid_confirmation = nil\n remind_cannot_discard = nil\n \n while waiting_to_confirm_placement\n while waiting_to_use_card\n DisplayManager.prepare_ingame_display\n show_state\n puts \"Newest Card: #{@selected_card.to_s} #{'* you cannot discard this card' if @drew_from_discard}\" unless @selected_card.nil?\n puts \"You cannot discard this card because you drew it from the discard pile.\" if remind_cannot_discard\n remind_cannot_discard = false\n \n @card_to_replace = nil\n @card_to_discard = nil\n\n puts InputManager.input_options({ negative: 'Discard this Card', rack_positions: 'Switch With Card at Position' }, invalid_usage)\n invalid_usage = nil\n\n @placement_response = InputManager.get\n\n # If player chooses a location in their rack\n # Get ready to exchange those cards\n if InputManager::INPUTS[:rack_positions].include?(@placement_response)\n prep_place_card_in_rack(@placement_response)\n waiting_to_use_card = false\n\n # If player chooses to discard their card\n # get ready to discard their card\n # Disallow discard if card was drawn from the discard pile\n elsif InputManager.negative?(@placement_response)\n if @drew_from_discard\n remind_cannot_discard = true\n else\n prep_discard_drawn_card\n waiting_to_use_card = false\n end\n else\n invalid_usage = @placement_response\n end\n end\n\n DisplayManager.prepare_ingame_display\n show_state\n puts \"Newest Card: #{@selected_card.to_s}\"\n\n if @card_to_replace\n puts \"You want to exchange #{@card_to_replace.to_s} with #{@selected_card.to_s}.\"\n else\n puts \"You do not want to use #{@selected_card.to_s}.\"\n end\n\n puts \"You are discarding #{@card_to_discard.to_s}.\"\n\n puts InputManager.input_options({ affirmative: 'Save and Complete Turn', negative: 'Do Something Different' }, invalid_confirmation)\n invalid_confirmation = nil\n confirm_response = InputManager.get\n\n # If player confirms their decision\n # persist their decision\n if InputManager.affirmative?(confirm_response)\n save_and_discard(@placement_response)\n waiting_to_confirm_placement = false\n \n # If player changes their mind\n # allow them to choose how to use their card again \n elsif InputManager.negative?(confirm_response)\n waiting_to_use_card = true\n else\n invalid_confirmation = confirm_response\n end\n end\n end", "def remaining_number\n card.remaining_number\n end", "def generate_card_number\n self.number = set_card_number\n generate_card_number if Card.exists?(number: self.number)\n end", "def highest_card?\n single_cards = Array.new(5, -1)\n single_count = 0\n (12).downto(0) do |i|\n if @ranks[i] == 1 and single_count < 5\n single_cards[single_count] = i\n single_count += 1\n end\n end\n return [1] + single_cards\n end", "def check_card\n\t\tsplit_cc = @cc.to_s.split(\"\")\n\n# -- Convert string to an array of integers\n\t\t\tl = split_cc.length - 1\n\t\tfor num in 0..l\n\t\t\t@split_cc_integers << split_cc[num].to_i\n\t\tend\n\n# -- Now we split the original array of integers into two arrays of even indices and odd indices \n\t\tl_half = l/2\n\n\n# ------ EVENS -------\n\t\tfor num in 0..l_half\n\t\t\tevens = 2*num + 1\n\t\t\t@even_cc_integers << @split_cc_integers[evens]\n\t\tend\n\n\t\ttotal_of_evens = @even_cc_integers.each {|x| \n\t\t\t@sum_evens = @sum_evens + x\n\t\t\t}\n\n# ------ ODDS -------\n\t\tfor num in 0..l_half\n\t\t\todds = 2*num\n\t\t\t@odd_cc_integers << @split_cc_integers[odds]\n\t\tend\n\n\t\t@odd_cc_integers.each {|odd|\n\t\todd = 2*odd\n\t\tif odd < 10\n\t\t\t@modified_results_from_odd_cc_integers << odd\n\t\telse\n\t\t\ttens = odd/10\n\t\t\t@modified_results_from_odd_cc_integers << tens\n\t\t\tones = odd%10\n\t\t\t@modified_results_from_odd_cc_integers << ones\n\t\tend\n\t\t\t}\n\n\t\ttotal_of_odds = @modified_results_from_odd_cc_integers.each {|odd| \n\t\t\t@sum_odds = @sum_odds + odd\n\t\t\t}\n\n# ------ ODDS DONE -------\n# ------ Validation DONE -------\n\t\tgrand_total = @sum_evens + @sum_odds\n\n\t\tif grand_total%10 == 0\n\t\t\treturn true\n\t\telse\n\t\t\treturn false\n\t\tend\n\tend", "def get_card_value(card)\n card_number = get_card_number(card)\n if card_number == 'K' || card_number == 'J' || card_number == 'Q'\n card_number = 10\n elsif card_number == 1\n card_number = 11\n end\n return card_number\nend", "def card_value(card)\n basic_value = card.to_i\n if card.start_with?(\"A\")\n basic_value = 11\n elsif basic_value == 0\n basic_value = 10\n end\n basic_value\n end", "def pick_player_card\n # TODO: Use Random to get a new random card\n rand(1..11)\nend", "def poor_card\n\tatm = AtmMachine.new(100, PinValidator)\n\tcard = CreditCard.new(1234, 30)\n\tatm.insert_card(card, 1234)\n\tatm.withdraw(50)\n\tatm.display_card_balance\nend", "def check_card\n\t\tsplit_cc = @cc.to_s.split(\"\")\n\n# -- Convert string to an array of integers\n\t\t\tl = split_cc.length - 1\n\t\tfor num in 0..l\n\t\t\t@split_cc_integers << split_cc[num].to_i\n\t\tend\n\n# -- Now we split the original array of integers into two arrays of even indices and odd indices \n\t\tl_half = l/2\n\n\n# ------ EVENS -------\n\t\tfor num in 0..l_half\n\t\t\tevens = 2*num + 1\n\t\t\t@even_cc_integers << @split_cc_integers[evens]\n\t\tend\n\n\t\ttotal_of_evens = @even_cc_integers.each {|x| \n\t\t\t@sum_evens = @sum_evens + x\n\t\t\t}\n\n# ------ ODDS -------\n\t\tfor num in 0..l_half\n\t\t\todds = 2*num\n\t\t\t@odd_cc_integers << @split_cc_integers[odds]\n\t\tend\n\n\t\t@odd_cc_integers.each {|odd|\n\t\todd = 2*odd\n\t\tif odd < 10\n\t\t\t@modified_results_from_odd_cc_integers << odd\n\t\telse\n\t\t\ttens = odd/10\n\t\t\t@modified_results_from_odd_cc_integers << tens\n\t\t\tones = odd%10\n\t\t\t@modified_results_from_odd_cc_integers << ones\n\t\tend\n\t\t\t}\n\n\t\ttotal_of_odds = @modified_results_from_odd_cc_integers.each {|odd| \n\t\t\t@sum_odds = @sum_odds + odd\n\t\t\t}\n\n# ------ ODDS DONE -------\n# ------ Validation DONE -------\n\t\tgrand_total = @sum_evens + @sum_odds\n\n\t\tif grand_total%10 == 0\n x = \"valid\"\n puts \"This is a #{x} number!\"\n\t\t\treturn true\n\t\telse\n y = \"invalid\"\n puts \"This is an #{y} number!\"\n\t\t\treturn false\n\t\tend\n\tend", "def deal_card\n card = rand(11) + 1\nend", "def valid?\r\n card_sum = compare_num.sum\r\n if \r\n card_sum % 10 == 0\r\n true\r\n else\r\n false\r\n end\r\n end", "def play_as_master_first\r\n @pending_points = 0\r\n w_cards = []\r\n curr_points_me = @team_mates.inject(0){ |result, name_pl| result + @points_segno[name_pl] }\r\n @cards_on_hand.each do |card_lbl|\r\n card_s = card_lbl.to_s # something like '_Ab'\r\n segno = card_s[2,1] # character with index 2 and string len 1\r\n is_card_lbl_briscola = card_s[2] == @briscola.to_s[2] \r\n curr_w = 0\r\n curr_w += 70 if is_card_lbl_briscola\r\n # check if it is an asso or 3\r\n curr_w += 220 if card_s[1] == \"A\"[0]\r\n curr_w += 200 if card_s[1] == \"3\"[0] \r\n if card_s =~ /[24567]/\r\n # liscio value\r\n lisc_val = (card_s[1] - '0'[0]).to_i\r\n curr_w += 50 + lisc_val\r\n end\r\n curr_w += 60 if card_s[1] == \"F\"[0]\r\n # check horse and king cards\r\n if card_s[1] == \"C\"[0]\r\n if is_mariazz_possible?(segno)\r\n curr_w += 90 + 70\r\n else\r\n curr_w += 30\r\n end\r\n end \r\n if card_s[1] == \"R\"[0]\r\n if is_mariazz_possible?(segno)\r\n curr_w += 100 + 70\r\n else\r\n curr_w += 20\r\n end\r\n end\r\n # penalty for cards wich are not stroz free\r\n curr_w += 10 * @strozzi_on_suite[segno].size\r\n if (curr_points_me + @deck_info.get_card_info(card_lbl)[:points]) > @target_points\r\n curr_w -= (@deck_info.get_card_info(card_lbl)[:points] + 100)\r\n curr_w -= 200 if is_card_lbl_briscola\r\n curr_w -= 1000 if is_card_lbl_briscola and card_s[1] == \"A\"[0]\r\n end\r\n \r\n w_cards << [card_lbl, curr_w ] \r\n end\r\n # find a minimum\r\n #p w_cards\r\n min_list = w_cards.min{|a,b| a[1]<=>b[1]}\r\n @log.debug(\"Play as first: best card#{min_list[0]}, (w_cards = #{w_cards.inspect})\")\r\n return min_list[0]\r\n end", "def find_matching\n numbers_array = numbers_in_hand\n match_num = numbers_array.find do |card|\n numbers_array.count(card) > 1\n end\n play_pairs(match_num) if match_num\n end", "def valid?\n last_found = suit_foundation.last\n return @card.ace? if last_found.nil?\n\n @card.sequentially_larger_than?(last_found)\n end", "def affordable_cards\n answer = Array.new()\n (@game.all_displayed_cards + @player.tableau.reserved_cards).each do |card|\n @cost = @player.tableau.tokens_required(card)\n answer << card if !@cost==false\n end\n answer\n end", "def blackjack?\n score == 21\n end", "def check_card\n \t@card.map!.with_index do |element,index|\n\t\t\tif index.even? == true\n\t\t\t\telement * 2\n \telse\n\t\t\t\telement\n\t\t\tend\n \tend\n \t# using the reduce method instead of inject may be a bit easier to read\n \tsum = @card.join.chars.map(&:to_i).reduce(:+)\n \t# just like the puts statements we use in driver code, it's enough to try to evaluate the statement\n \t# and it will return true or false.\n \treturn sum % 10 == 0\n end", "def card_in_game\n (2..14).each {|r| (1..4).each { |i| @pack_of_card << [i, r] }}\n @cards = @pack_of_card.shuffle.take(7)\n # @hash_7_card is hash prepared for analyze combinations and the highest combination to win\n $hash_7_card = array_suit_rank\n end", "def deal_card\n return rand(1..11)\nend", "def play_like_a_dummy\r\n # very brutal algorithm , always play the first card\r\n card = @cards_on_hand.pop\r\n return card\r\n end", "def credit_card_needed?\n credit_card_required?\n end", "def credit_card_missing?\n credit_card_needed? && !credit_card_stored?\n end", "def valid_card_number\n return if self.number.blank? or not self.member\n return if self.club && self.club.uses_citylife?\n\n # Only check the rules of current cards\n if self.academic_year == Member.current_academic_year\n range = self.member.club.card_range_for self.card_type\n if !range.include?(self.number)\n errors.add(:number, \"valt niet in het toegekende bereik\")\n end\n end\n end", "def blackjack (total)\n if total == 21\n return true\n else \n return false\n end\nend", "def check_points(cards)\n points = []\n point = 0\n\n cards.each do |card|\n if %w(J K Q).include?(card[:value])\n point += 10\n elsif card[:value] == 'A'\n point += 11\n else\n point += card[:value].to_i\n end\n end\n\n points << point if point <= 21\n\n cards.select { |ele| ele[:value] == 'A' }.count.times do\n point -= 10\n points << point if point <= 21\n end\n\n points\nend", "def check\n containAce = false\n i = 0\n sum = 0\n while i < @hand.length\n if 1 == num_to_value(@hand[i])\n containAce = true\n end\n sum += num_to_value(@hand[i])\n i += 1\n end\n\n if containAce\n if sum < 7\n @value = sum + 10\n elsif sum < 11\n @value = sum + 10\n @status = \"finished\"\n elsif 11 == sum\n if 2 == @hand.length \n @value = 50 # 50 means it's BLACKJACK\n @status = \"finished\"\n else\n @value = 21\n @status = \"finished\"\n end\n elsif sum < 17\n @value = sum\n else sum <= 21\n @value = sum\n @status = \"finished\"\n end\n else\n if sum < 17\n @value = sum\n else\n @value = sum\n @status = \"finished\"\n end\n end\n end", "def card_number\n card = full_card_number.scan(/(\\d{4})/)\n card[2] = card[1] = 'X' * 4\n card.join\n end", "def validCreditCard(cardNumber)\n sum = 0\n nums = cardNumber.to_s.split(\"\")\n nums.each_with_index do |n, i|\n sum += if (i % 2 == 0)\n n.to_i * 2 >9 ? n.to_i*2-9 : n.to_i*2\n else\n n.to_i\n end\n end\n if (sum % 10) == 0\n return true\n else\n return false\n end\nend", "def current_card\n deck.cards[@number_correct]\n end", "def high_card?\n cards_by_rank.count == @size\n end", "def has_card? test_card \n @card_list.has_card? test_card\n end", "def addCard(card)\n\t\t@cards << card\n\t\t@value += getValue(card.rank)\n\t\tif card.rank == 'Ace'\n\t\t\t@hasAce = true\n\t\tend\n\t\tif @cards.length == 2 and @value == 21 and @hasAce # updates should be in different method\n\t\t\t@blackjack = true\n\t\tend\n\t\tif @value > 21 and @hasAce\n\t\t\t@value -= 10\n\t\t\t@hasAce = false\n\t\tend\n\tend", "def is_ace?(card)\n\t\tcard == \"A\" ? true : false\n\tend", "def hit\n new_card = @deck.cards.pop\n @current_hand << new_card\n @total += new_card.value\n puts \"drew #{@current_hand[-1].card_id}\"\n\n @current_hand.each do |card|\n if @total > 21\n if card.value == 11 && card.ace_low == false\n @total -= 10\n card.ace_low = true\n end\n end\n end\n end", "def next_card\n if [\"pass\",\"fail\"].include?(params[:card_status])\n quiz = Quiz.find(params[:quiz_id])\n user = quiz.user\n card = Card.find(params[:card_id])\n\n card.pass(user) if params[:card_status] == \"pass\"\n card.fail(user) if params[:card_status] == \"fail\"\n\n cv = CardView.find_or_create(user, card)\n quiz.shuffle_card_into_queue(cv)\n\n current_card = quiz.current_card\n redirect_to quiz_card_path(quiz, current_card)\n else\n flash[:error] = \"Couldn't figure out whether you passed or failed that particular card... try again?\"\n redirect_to :back\n end\n end", "def isCreditCard(payload)\n cardNo = getCreditCard(payload)\n if cardNo.nil? # indicates no card found\n return false\n else\n return true\n end\nend", "def credit_card_type; end", "def complete?\n @cards.length == 5\n end", "def has_ace\n for card in @cards\n return 1 if card.is_ace\n end\n return nil\n end", "def eval_7_card_hand( cards )\n 1\n end", "def blackjack(hand)\n value(hand) == 21 && hand.length == 2\n end", "def color_changing_cards(card)\n @prob_cache[4000 + card.code] ||= @stack.select { |c| (c.figure == card.figure && c.color != card.color) || c.special_card? }.length\n end", "def value \r\n value = 0\r\n @cards.each do |card|\r\n value += card.value\r\n end\r\n if value > 21\r\n value = 0\r\n @cards.each do |card|\r\n if card.value == 11\r\n value += 1\r\n else\r\n value += card.value\r\n end\r\n end\r\n end\r\n value\r\n end", "def get_card\n @card ||= @user.get_valid_card\n end", "def current_card\n @deck.cards[@turns.count]\n end", "def card_number\n s1 = s2 = 0\n cc_number = @record.cc_number.gsub(/\\D/, '') # remove all white space\n\n cc_number.to_s.reverse.chars.each_slice(2) do |odd, even|\n s1 += odd.to_i\n\n double = even.to_i * 2\n double -= 9 if double >= 10\n s2 += double\n end\n\n if (s1 + s2) % 10 != 0\n @record.errors[:cc_number] << 'is invalid'\n end\n end", "def remaining_cards\r\n @deck_of_cards.each do |card|\r\n card.output_card\r\n end\r\n end", "def has_card? test_card\r\n @card_list.has_card? test_card\r\n end", "def smart_aces hand\n# Adjusts the value of \"Ace\" elements to be either 1 or 11 depending on the hand total\n\thand_total = hand.reduce :+\n\tif hand_total < 12 && hand_total > 2\n\t\thand.map! do |card|\n\t\t\tif card == 1\n\t\t\t\t11\n\t\t\telse\n\t\t\t\tcard\n\t\t\tend\n\t\tend\n\telsif hand_total > 21\n\t\thand.map! do |card|\n\t\t\tif card == 11\n\t\t\t\t1\n\t\t\telse\n\t\t\t\tcard\n\t\t\tend\n\t\tend\n\telsif hand_total == 2\n\t\thand[0] = 11\n\tend\n\nend", "def get_a_card(card_number)\n @cards[card_number]\n end", "def high_ranking_cards\n\n cards.select do |card|\n card.rank >= 11\n end\n\n end", "def soft?\n self.cards.each do |card|\n return card if card.soft_ace?\n end\n nil\n end", "def play_like_a_dummy\r\n # very brutal algorithm , always play the first card\r\n #card = @cards_on_hand.pop\r\n #p @cards_on_hand.size\r\n card = @cards_on_hand[0]\r\n if card\r\n # check if the played card take something\r\n #@table_cards\r\n \r\n #@log.debug \"Alg: cards on table #{@table_cards}\"\r\n list = @core_game.which_cards_pick(card, @table_cards)\r\n #p \"which cards pick: card #{card}, table #{@table_cards.join(\",\")}, list #{list.size}\"\r\n result = [card, list[0]].flatten\r\n return result\r\n end\r\n raise \"Error cards on hand #{@cards_on_hand.join(',')}\" \r\n end", "def getValue(card_number)\n # get card rank\n rank = case card_number % 13\n when 0, 11, 12 then 10\n when 1 then 11\n else card_number % 13 \n end\n \n return rank\n \nend", "def high_ranking_cards\n\n cards.find_all do |card|\n card.rank >= 11\n end\n end", "def blackjack?\n no_21 = true\n if @player_score == 21\n @messages << \"21! You Win!!!!\"\n no_21 = false\n else @dealer_score == 21\n @messages << \"21! Dealer Wins!!!!\"\n no_21 = false\n end\n return no_21\n end", "def credit_card_number_check \n if self.credit_card_number != nil\n if self.credit_card_number.to_s.match(/^4/) and (self.credit_card_number.to_s.length == 16 or self.credit_card_number.to_s.length == 13)\n \"Visa Card\"\n elsif self.credit_card_number.to_s.match(/^5[1-5]/) and (self.credit_card_number.to_s.length == 16)\n \"Master Card\"\n elsif self.credit_card_number.to_s.match(/^6011|65/ ) and (self.credit_card_number.to_s.length == 16)\n \"Discovery Card\"\n elsif self.credit_card_number.to_s.match(/^30[0-5]/) and (self.credit_card_number.to_s.length == 14)\n \"Diners Club\"\n elsif self.credit_card_number.to_s.match(/^3[47]/) and (self.credit_card_number.to_s.length == 15)\n \"Amex\"\n else \n \"credit card number invalid\"\n end \n end \n end", "def cards_to_score(cards)\n \n total = 0\n cards_num = []\n\n cards.each { |card| cards_num.push(card % 13) }\n\n cards_num.sort.reverse.each do |num|\n if num >= 9 #9, 10, 11, 12 means 10, J, Q, K\n total = total + 10\n elsif num > 0 #which means 2, 3, 4, 5, 6, 7, 8, 9\n total = total + num + 1\n end\n end\n\n a_count = cards_num.count(0)\n\n total = total + a_count\n\n a_count.times do\n total = total + 10 if total <= 11\n end\n\n return total\nend", "def get_credit_card\n end", "def mostly_hidden_credit_card_number\n cc_number_hidden = self.credit_card_number.dup\n cc_length = cc_number_hidden.length\n (1..cc_length-5).each{|x_it| cc_number_hidden[x_it] = 'X'}\n\n cc_number_hidden\n end", "def identify\n \n return if @value > 0 # no need to do it twice!\n return if @cards.size < 5 # need at least 5 cards\n \n @cards.sort!\n \n #puts \"@total_face_value = #{@total_face_value}\"\n \n if is_flush? then \n #puts 'have a flush of some kind...' \n \n if @total_face_value == 60 then\n #puts \"it's a royal flush!\"\n @rank = ROYAL_FLUSH\n @value = @cards.max.face_value\n return\n end\n \n if is_straight? then\n #puts \"it's straight flush!\"\n @rank = STRAIGHT_FLUSH\n @value = @cards.max.face_value\n return\n end\n \n #puts \"it's a regular flush!\"\n @rank = FLUSH\n @value = @cards.max.face_value\n return\n end\n \n #puts 'not a flush'\n \n if is_straight? then\n #puts \"it's a straight!\"\n @rank = STRAIGHT\n @value = @cards.max.face_value\n return\n end\n \n # look for pairs\n (pairs, @unpaired_cards) = find_pairs()\n if pairs.empty? then\n # high card!\n #puts \"high card \" + high_card.to_s\n @rank = HIGH_CARD\n @value = @cards.max.face_value\n return\n end\n \n if pairs.size == 1 then\n paired_cards = pairs[0].size\n @value = pairs[0].max.face_value\n if paired_cards == 2 then\n #puts \"it's a single pair!\"\n @rank = PAIR\n elsif paired_cards == 3 then\n #puts \"it's a three of a kind!\"\n @rank = THREE_KIND\n elsif paired_cards == 4 then\n @rank = FOUR_KIND\n end\n return\n \n elsif pairs.size == 2 then\n paired_cards = pairs[0].size + pairs[1].size\n a = pairs[0].max.face_value\n b = pairs[1].max.face_value\n if a > b then\n @value = a\n elsif b > a then\n @value = b\n else\n # should never happen since it means the\n # pairs are of the same face value\n # e.g., two pairs of 6s\n @value = a\n end\n if paired_cards == 4 then\n #puts \"it's two pair!\"\n @rank = TWO_PAIR\n elsif paired_cards == 5 then\n #puts \"it's a full house!\"\n @rank = FULL_HOUSE\n # add faces of each pair for value\n if a > b then\n @value = a * 100 + b\n elsif b > a then\n @value = b * 100 + a\n end\n end\n return\n \n end\n \n # should never get here\n raise \"oh no, should never have come to this!\"\n \n end", "def pair?\n single_cards = Array.new(4, -1)\n single_count = 0\n pair_rank = -1\n (12).downto(0) do |i|\n if @ranks[i] == 2\n pair_rank = i\n elsif @ranks[i] == 1 && single_count < 3\n single_cards[single_count] = i\n single_count += 1\n end\n end\n if pair_rank != -1\n return [2, pair_rank] + single_cards\n end\n return false\n end", "def receive_revealed_card(position, value)\n # debugger\n @known_cards[position] = value\n end", "def value(card)\n suit = card.to_s.split(//).first\n value = card.to_s.delete(suit)\n if value.to_i == 0\n value == \"A\" ? value = 11 : value = 10\n else\n value = value.to_i\n end\n value\nend", "def dealer_sequence d_cards, p_cards\r\n deal_dealer d_cards, p_cards\r\n value = card_total d_cards\r\n while value <= 21\r\n if value < 17\r\n\t deal_dealer d_cards, p_cards\r\n value = card_total d_cards\r\n \t else\r\n \t\t return value\r\n \t end\r\n end\r\n\treturn value\t\r\nend", "def transfer_card_num(pick_num)\n num = pick_num % 13\n case num\n when 0\n 'A'\n when 10\n 'J'\n when 11\n 'Q'\n when 12\n 'K'\n else\n num + 1\n end\n end", "def isOver?\n @deck.cardsRemaining < MIN_CARDS\n end", "def receive_revealed_card(pos, value)\n if @visited_first[value] == nil \n @visited_first[value] = pos\n elsif @visited_first[value] != pos\n @visited_second[value] = pos\n end\n end", "def calculate_total(cards)\n #create a new array card_values to just contain the values of the cards\n card_values = cards.map {|value| value[1]}\n total = 0\n\n #loop through these card values. If the value is an Ace, give it 11, if it is J, Q, or K, give it a value of 10. Otherwise just use the face value\n card_values.each do |card|\n if card == 'Ace'\n total += 11\n elsif card.to_i == 0 \n total = total + 10\n else\n total += card.to_i\n end\n end\n\n #count all the Aces we have using the select and count methods. And then go through the loop the number of times Ace is in the array and subtract 10 each time the total value is over 21.\n\n card_values.select {|e| e == \"A\"}.count.times do\n if total > 21\n total -= 10\n end\n end\n total\n end", "def value(hand)\n ace_count = 0\n hand_value = 0\n\n hand.each do |card|\n if card == :ace\n ace_count += 1\n hand_value += 11\n else\n hand_value += card\n end\n end\n\n # flip aces from being worth 11 to being worth 1 until we get <= 21\n # or we run out of aces\n while hand_value > 21 && ace_count > 0\n hand_value -= 10\n ace_count -= 1\n end\n\n hand_value\nend", "def current_card\n @deck.cards[count]\n end", "def check_ace?(hand_array, deck_hash)\n hand_array.each { |card|\n return true if deck_hash[card] == 11\n }\n false\nend", "def calculate_total\n #create a new array card_values to just contain the values of the cards\n card_values = cards.map {|value| value[1]}\n total = 0\n\n #loop through these card values. If the value is an Ace, give it 11, if it is J, Q, or K, give it a value of 10. Otherwise just use the face value\n card_values.each do |card|\n if card == 'Ace'\n total += 11\n elsif card.to_i == 0 \n total = total + 10\n else\n total += card.to_i\n end\n end\n\n #count all the Aces we have using the select and count methods. And then go through the loop the number of times Ace is in the array and subtract 10 each time the total value is over 21.\n\n card_values.select {|e| e == \"A\"}.count.times do\n if total > 21\n total -= 10\n end\n end\n @total = total\n end", "def play_like_a_master\r\n card = nil\r\n #TODO\r\n return card\r\n end", "def shouldHit\n # If 17 or above, lock the hand so it cannot receive any more cards\n \tif @hands[0].checkHand > 16 or @hands[0].checkHand < 0\n \t @hands[0].lock\n \tend\n \t@hands[0].canGetCards\n end" ]
[ "0.71533257", "0.67501724", "0.66322875", "0.6628957", "0.65874517", "0.6577928", "0.6561504", "0.6542816", "0.6511552", "0.6468263", "0.6468263", "0.6461372", "0.64234483", "0.6412235", "0.63891506", "0.6375983", "0.62880963", "0.62880963", "0.6269367", "0.62391484", "0.62313426", "0.62291956", "0.62269187", "0.6220457", "0.6199882", "0.6144057", "0.61327726", "0.613243", "0.6110051", "0.61065274", "0.60935324", "0.60882497", "0.60646874", "0.6051982", "0.60484767", "0.6040046", "0.6038076", "0.6034988", "0.60287637", "0.59950906", "0.5986017", "0.59852684", "0.59794515", "0.5977342", "0.5970413", "0.5965063", "0.5962593", "0.59604555", "0.59524894", "0.5949085", "0.59441876", "0.59384084", "0.5933499", "0.5900484", "0.5893375", "0.58908683", "0.5874929", "0.5870429", "0.58703935", "0.58619356", "0.585587", "0.58456486", "0.5843228", "0.583994", "0.5837017", "0.58180106", "0.5801691", "0.57923603", "0.57904994", "0.5789491", "0.5788227", "0.57876986", "0.5781465", "0.57624173", "0.5750535", "0.57504165", "0.574974", "0.57494926", "0.57429636", "0.57378477", "0.5736322", "0.5734474", "0.5720855", "0.5716717", "0.57144463", "0.5707855", "0.5706606", "0.570515", "0.5697478", "0.569372", "0.56817025", "0.5677637", "0.56730807", "0.56730723", "0.56709504", "0.56660354", "0.5660942", "0.56602806", "0.5653772", "0.5652716", "0.5652481" ]
0.0
-1
to keep our routines simple, we encrypt it also (needs to be tested... :D)
def initialize(comm) Puppet.debug("creating new object Puppet::PinasDNS") @dns = comm[:dns] @dnss = comm[:dnss] @dnsh = comm[:dnsh] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def encrypt; end", "def decrypt; end", "def _encrypt\n cryptor_files(@encrypting)\n end", "def crypt(p0) end", "def cipher; end", "def encrypt\n self\n end", "def encrypt(alg, password, string)\n \n begin\n case alg\n when \"3DES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'des3')\n when \"AES\" then key = EzCrypto::Key.with_password(password, $system_salt, :algoritmh => 'aes256')\n when \"Blowfish\" then key =EzCrypto::Key.with_password(password, $system_salt, :algoritmh => 'blowfish')\n when 'Plaintext' then return string\n else key = EzCrypto::Key.with_password(password, $system_salt, :algorithm => 'aes256') \n end\n encrypted_text = key.encrypt64(string)\n rescue => e\n p e.message\n end\n return encrypted_text\n \n end", "def encryption_server; end", "def encrypt\n self\n end", "def vigenere_cipher(string, key_sequence)\n\nend", "def vigenere_cipher(string, key_sequence, alphabet)\n #\n # your code goes here\n #\nend", "def encryption_oracle\n # From an early-on AES-128-ECB exercise. 'YELLOW SUBMARINE' is the 128-bit key.\n ciphertext = URL::decode64('http://cryptopals.com/static/challenge-data/25.txt')\n plaintext = AES_128.decrypt(ciphertext, 'YELLOW SUBMARINE', :mode => :ECB)\n\n AES_128.encrypt(plaintext, AES_KEY, :mode => :CTR)\nend", "def encrypt(secret_password)\n# Create a character index\n index = 0\n# Create an empty string to have a return value\n encrypted_string = \"\"\n# Loop until you get to the last letter in the password\n while index < secret_password.length do\n encrypted_string += secret_password[index].next\n# Call the index plus 1\n index += 1\n end\n #return the implicit empty response at the end\n encrypted_string\n# end encryption method\nend", "def encryption_client; end", "def encrypt(string)\n CRYPTO.encrypt_string(string).to_64\nend", "def vigenere_cipher(message, keys)\n alphabetic = (\"a\"..\"z\").to_a\n encrypted = \"\"\n\n message.each_char.with_index do |char, i|\n num = keys[i % keys.length]\n index = alphabetic.index(char)\n encrypted += alphabetic[(index + num) % 26]\n end\n \n encrypted\nend", "def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n encrypted = \"\"\n\n message.each_char.with_index do |char, idx|\n shift = keys[idx % keys.length]\n encrypted += alphabet[(alphabet.index(char) + shift) % 26]\n end\n\n encrypted\nend", "def vigenere_cipher(string, key_sequence, alphabet)\r\n\r\nend", "def encryptFile(fileIn,conf)\n\nsalt_len = 8\nbuf=''\npassword = conf[:passphrase]\ncipher = 'aes-128-cbc'\nputs aktTime()+' encrypting archive...'\nSTDOUT.flush #write out immediately\nsalt= OpenSSL::Random::pseudo_bytes(salt_len)\n\nc = OpenSSL::Cipher::Cipher.new(cipher)\nc.encrypt\n#generate key + IV from given password\nc.pkcs5_keyivgen(password, salt, 1)\nFile.open(CRYPT_TMP,'wb') do |fo|\n \n fo.write(MAGIC) #write magic string \n fo.write(salt) #write 8 bytes random salt\n File.open(fileIn,'rb') do |fi|\n while fi.read(4096,buf) \n fo.write c.update(buf)\n end\n fo.write( c.final)\n end\nend\n\n#overwrite archive with crypted archive\nputs aktTime()+' archive encrypted '\nFile.rename(CRYPT_TMP,fileIn)\nend", "def read_encrypted_secrets=(_arg0); end", "def read_encrypted_secrets=(_arg0); end", "def vigenere_cipher(message, keys)\n alpha = \"abcdefghijklmnopqrstuvwxyz\"\n new_str = \"\"\n if keys.length == 1\n message.each_char do |char|\n alpha_idx = alpha.index(char)\n new_idx = (alpha_idx + keys[0]) % 26\n new_str += alpha[new_idx]\n end\n else\n new_keys = keys\n message.each_char do |char|\n alpha_idx = alpha.index(char)\n new_idx = (alpha_idx + new_keys[0]) % 26\n new_str += alpha[new_idx]\n new_keys.rotate!(1)\n end\n end\n new_str\n \nend", "def encrypt phrase, key\n alphabet = \"ABCDEFGHIJKLMNOPQRSTUVWXYZ\".split(\"\")\n cipherbet = get_cipherbet key\n result = \"\"\n phrase.each_char do |letter|\n encrypted_letter = encrypt_letter alphabet, cipherbet, letter\n result = result + encrypted_letter\n end\n return result\nend", "def encrypt (string)\n\treturnarray = []\n\tkey_hash =\n {\t\"a\"=> \"e\",\"e\" =>\"i\", \"i\"=> \"o\", \"o\" =>\"u\", \"u\" =>\"a\",'b' =>'c','c' =>'d','d' =>'f','f' =>'g','g' =>'h','h' =>'j','j' =>'k','k' =>'l','l' =>'m','m' =>'n','n' =>'p','p' =>'q','q' =>'r','r' =>'s','s' =>'t','t'=> 'v','v' =>'w','w'=> 'x','x' =>'y','y' =>'z','z'=>'b' }\n\tencode = string.downcase.split('')\n\t#p encode\n\n\n\tencode.each_index do |x|\n\t\t\tif key_hash.has_key?(encode[x])\n\t\t\t\t#p key_hash[encode[x]]\n\t\t\t\treturnarray.push( key_hash[encode[x]])\n\t\t\t\t#p returnarray\n\t\t\telse\n\t\t\t\treturnarray.push(encode[x])\n\t\t end\n \tend\n\treturn returnarray.join\nend", "def encrypt string\n string\n end", "def signed_or_encrypted; end", "def crypt(text,key,operator = :+)\n index = 0\n text.upcase.each_byte.reduce(\"\") do |res, c|\n res << (65 + (c.send(operator, key[index % key.length].ord)) % 26).chr\n index += 1\n res\n end\nend", "def encrypt(string)\n secure_hash(\"#{salt}--#{string}\") \n\tend", "def vigenere_cipher(message, keys)\n chars = message.split('')\n i = -1\n enc_chars = chars.map do |char|\n i = (i + 1) % keys.length\n encrypt_char(char, keys[i])\n end\n enc_chars.join\nend", "def caesar_guesser(encrypted_string, alphabet)\r\n\r\nend", "def validate\n encrypt\n end", "def ceaser_encrypt\n\n\t\t@alphabet = [*'A'..'Z',*'a'..'z',*' '..'?', *\"\\n\"].to_a.join\n \t@chars = @alphabet.chars.to_a\n \n\t\t@string = params[\"string\"]\n\t\t@shift = params[\"offset\"].to_i \n\t\t\n\t\t@encrypter = Hash[@chars.zip(@chars.rotate(@shift))]\n\t\tif request.xhr?\n render :json => {\n :encrypted => @encrypter.values_at(*@string.chars)\n }\n \tend\n\tend", "def translate_to_cipher(sentence) #defines a variable that accepts a sentence as an argument\n alphabet = ('a'..'z').to_a #defines a variable that contains an array with all the letters of the alphabet\n cipher = Hash[alphabet.zip(alphabet.rotate(4))] #this line defines a new hash \"cipher\" which will contain the equivalencies of coded and decoded\n # characters. This is achieved with the zip method which creates an array out of whatever argument we input and then merges that new array with self\n # In this case the argument is alphabet rotate count 4, which means the new array will be comprised by the alphabet but starting in th letter 'e'\n spaces = [\"@\", \"#\", \"$\", \"%\", \"^\", \"&\", \"*\"] #creates an array comprised by a number of special characters\n \n original_sentence = sentence.downcase #creates a variable in which all of the sentence passed is changed into lower case\n encoded_sentence = [] #creates a new empty array\n original_sentence.each_char do |element| #starts a loop that will iterate through each character of original_sentence\n if cipher.include?(element) #if said character is in the cipher hash it will be changed to the rotated value and pushed into 'encoded_sentence'\n encoded_sentence << cipher[element]\n elsif element == ' '#otherwise, if what we meet is a space, replace it randomly with any of the symbols in spaces array\n encoded_sentence << spaces.sample\n else \n encoded_sentence << element #finally, if it isn't neither of them, the original character will be passed into the encoded sentence, without encoding it\n end\n end\n \n return encoded_sentence.join #this takes all the elements in the array and turns them into a string\nend", "def scramble( data )\n cipher = OpenSSL::Cipher::Cipher.new( @@algorithm )\n cipher.encrypt\n cipher.pkcs5_keyivgen( @@key, @@salt )\n @@salt + cipher.update( data ) + cipher.final\n end", "def encrypt(keys, plain)\n ::Fernet.generate(keys.last, plain)\n end", "def vigenere_cipher(message, keys)\n alpha = (\"a\"..\"z\").to_a\n new_string = \"\"\n message.each_char.with_index do |char, i|\n old_i = alpha.index(char)\n new_i = (old_i + keys[i % keys.length]) % 26\n new_string += alpha[new_i]\n end\n new_string\nend", "def vigenere_cipher(message, key)\n key_index = 0 \n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n\n message.each_char.with_index do|char,idx|\n new_str += alpha[(alpha.index(char) + key[key_index % key.length])%26]\n key_index += 1\n end\n new_str\nend", "def translate_to_cipher(sentence) #def method \n alphabet = ('a'..'z').to_a #create array of alphabet\n cipher = Hash[alphabet.zip(alphabet.rotate(4))]#creates a hash w/4letter rotation\n spaces = [\"@\", \"#\", \"$\", \"%\", \"^\", \"&\", \"*\"] # array of potential encoded space chars\n \n original_sentence = sentence.downcase #new var and set to downcase param\n encoded_sentence = [] #new array\n original_sentence.each_char do |element| #iterating through sentence.downcase by char\n if cipher.include?(element) #check to see if the element matches any of the hash keys\n encoded_sentence << cipher[element] # passes new array the hash value by calling the key\n elsif element == ' ' #checks for a space in sentence\n encoded_sentence << spaces.sample #sends in a random char from spaces array\n else\n encoded_sentence << element #if nothing else then just pass the encoded message the char\n end\n end\n \n return encoded_sentence.join #return encoded sentence array as one value\nend", "def caesar_cipher(str, shift)\n\nend", "def vigenere_cipher(message, keys)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n vigenere = \"\"\n\n message.each_char.with_index do |char, i|\n index = alphabet.index(char)\n key = keys[i % keys.length].to_i\n new_char = alphabet[(index + key) % 26] \n vigenere += new_char\n end\n\n vigenere\nend", "def encryption_oracle(input)\n #Hardcoded, secret string\n append = 'Um9sbGluJyBpbiBteSA1LjAKV2l0aCBteSByYWctdG9wIGRvd24gc28gbXkg'\n append << 'aGFpciBjYW4gYmxvdwpUaGUgZ2lybGllcyBvbiBzdGFuZGJ5IHdhdmluZyBq'\n append << 'dXN0IHRvIHNheSBoaQpEaWQgeW91IHN0b3A/IE5vLCBJIGp1c3QgZHJvdmUg'\n append << 'YnkK'\n append = append.unpack('m')\n\n str = input + append.join\n\n cipher = OpenSSL::Cipher.new('AES-128-ECB') \n cipher.encrypt \n cipher.key = 'O' * Blocksize;\n \n enc = cipher.update(str) + cipher.final\n #Hex encoded return\n return enc.unpack('H*').join\nend", "def encrypt()\n cipher_type = \"aes-128-ecb\"\n data = password;\n key = master_password;\n \n self.encrypted_password = aes_encrypt(data,key,nil,cipher_type).to_s\n end", "def encrypt(pass)\n \t\tDigest::SHA2.hexdigest(\"#{self.salt}--#{pass}\")\n \tend", "def encrypt(pass)\n \t\tDigest::SHA2.hexdigest(\"#{self.salt}--#{pass}\")\n \tend", "def encrypt(pass)\n \t\tDigest::SHA2.hexdigest(\"#{self.salt}--#{pass}\")\n \tend", "def encrypt(pass)\n \t\tDigest::SHA2.hexdigest(\"#{self.salt}--#{pass}\")\n \tend", "def encrypt(pass)\n \t\tDigest::SHA2.hexdigest(\"#{self.salt}--#{pass}\")\n \tend", "def encrypt(str)\n\n def name_swapper(str)\n str = str.split()\n str[0], str[1] = str[1], str[0]\n str.join(\" \")\n end\n\n # p name_swapper(\"Bob Henry\")\n # p name_swapper(\"Alexander Rowland\")\n\n\n def shift(str)\n cap_vowels = \"AEIOUA\"\n lower_vowels = \"aeioua\"\n cap_consonants = \"BCDFGHJKLMNPQRSTVWXYZB\"\n lower_consonants = \"bcdfghjklmnpqrstvwxyzb\"\n letter_array = []\n shifted_string = \"\"\n\n str = str.split\n letter_array += str[0].split(\"\")\n letter_array += [\" \"]\n letter_array += str[1].split(\"\")\n letter_array.each do |letter|\n if cap_vowels.include? letter\n shifted_string += cap_vowels[cap_vowels.index(letter) + 1]\n elsif lower_vowels.include? letter\n shifted_string += lower_vowels[lower_vowels.index(letter) + 1]\n elsif cap_consonants.include? letter\n shifted_string += cap_consonants[cap_consonants.index(letter) + 1]\n elsif lower_consonants.include? letter\n shifted_string += lower_consonants[lower_consonants.index(letter) + 1]\n elsif letter == \" \"\n shifted_string += \" \"\n end\n end\n shifted_string\n end\n shift(name_swapper(str))\nend", "def encrypt(string)\n secure_hash(\"#{salt}--#{string}\")\n end", "def vigenere_cipher(message, keys)\n key_idx = 0\n new_message = \"\"\n message.each_char do |char|\n new_message += cipher(char, keys[key_idx])\n key_idx = (key_idx + 1) % keys.length\n end\n\n new_message\nend", "def vigenere_cipher(message, keys)\n alphabet = \"abcdefghijklmnopqrstuvwxyz\"\n cycle = 0\n result = \"\"\n\n message.each_char do |char|\n result += alphabet[(alphabet.index(char) + keys[cycle % keys.length]) % alphabet.length]\n cycle += 1\n end\n\n return result\nend", "def encrypt_message plaintext\n key_pair.encrypt plaintext\n end", "def vigenere_cipher(message, keys)\n alphabet = ('a'..'z').to_a\n vigenere_str = \"\"\n\n message.each_char.with_index do |char, idx|\n old_idx = alphabet.index(char)\n temp_key = keys.shift\n keys.push(temp_key)\n new_idx = (old_idx + temp_key) % 26\n vigenere_str += alphabet[new_idx]\n end\n vigenere_str\nend", "def translate_to_cipher(sentence) # Defining method as translate_to_cipher, takes argument sentence\n alphabet = ('a'..'z').to_a # Sets variable alphabet, turns range into array \n cipher = Hash[alphabet.zip(alphabet.rotate(4))] # Creates a hash in which it takes the alphabet elements as keys and sets up values as 4 letters from the key\n spaces = [\"@\", \"#\", \"$\", \"%\", \"^\", \"&\", \"*\"] # Sets an array \"spaces\" \n \n original_sentence = sentence.downcase # Sets variable original_sentece to be argument but in lower case\n encoded_sentence = [] # Creates empty array encoded_sentence\n original_sentence.each_char do |element| # Begins a loops through each element of the original_sentence array \n if cipher.include?(element) # Checks to see if each element is present\n encoded_sentence << cipher[element] # If present, pushes the key from the cipher hash \n elsif element == ' ' # Checks to see if element is ''\n encoded_sentence << spaces.sample #If present, selects one of the elements from spaces and pushses to encoded_sentence\n else \n encoded_sentence << element #Otherwise, it pushes the element into the encoded_sentence\n end\n end\n \n return encoded_sentence.join #takes encoded sentence and joins it together\nend", "def caesar_cipher(message, n)\n\nend", "def vigenere_cipher(message, keys)\n alphabet = ('a'..'z').to_a\n array = []\n\n i = 0\n\n message.each_char do |char|\n idx = alphabet.index(char)\n array << alphabet[(idx + keys[i]) % 26]\n if i < keys.length - 1\n i += 1\n else\n i = 0\n end\n end\n array.join('')\n \nend", "def encrypt(data)\n\tarray = splitencrypt(data)\n\tencryptedBlock = ''\n\tfor i in 0...array.length\n\t encryptedBlock << @blowfish.encrypt_block(array[i])\n\tend\n\treturn encryptedBlock\n end", "def encrypt(string, times = 65536)\n # You can change times to how much you like. but pay attention please!\n # Larger numbers will take more time to encrypt.\n # For example, if you use a large number such as 2^32, it'll be about\n # 5 billion times! It will take a very long time (maybe hours and days)\n # and damage your CPU.\n n = 0\n code = string\n while n < times\n code = Digest::SHA2.hexdigest(code)\n # You also can use MD5 or SHA1 algorithms. for more information,\n # check my project https://github.com/prp-e/rsha256 .\n n += 1\n end\n return code\n # Here, you can reverse the coded string, to make it more 'coded', or\n # You can code it in a different algorithm, too.\nend", "def encrypt(password)\r\n #needs to be a string when being nested in another method\r\n\tindex = password.to_s.length\r\n\ti = 0\r\n\twhile i < index\r\n #conditional for edge cases\r\n\t\tif password[i] == \"z\"\r\n\t\t\tpassword[i] = \"a\"\r\n elsif password[i] == \" \"\r\n password[i] = \" \"\r\n\t\telse\r\n\t\t\tpassword[i] = password[i].next!\r\n\t\tend\r\n\t\ti += 1\r\n\tend\r\n<<<<<<< HEAD\n\treturn password\r\n=======\n\tp password\r\n>>>>>>> 0c7a712b88e73bdee1929aa9db36019c3903c448\nend", "def vigenere_cipher(str,keys)\n alpha = (\"a\"..\"z\").to_a\n new_str = \"\"\n\n str.each_char.with_index do |char,idx|\n old_pos = alpha.index(char)\n new_pos = old_pos + keys[idx % keys.length]\n new_str += alpha[new_pos % alpha.length]\n end\n\n new_str\n\nend", "def vigenere_cipher(message, keys)\n alpha = (\"a\"..\"z\").to_a\n count = 0\n message.each_char.with_index do |char, idx|\n pos = alpha.index(char)\n #rather than count we can do key alpha[(pos + key[idx % key.length] )% 26]\n message[idx] = alpha[(pos + keys[count]) % alpha.length]\n count += 1\n count = 0 if count == keys.length\n end\n message\nend", "def encrypt (password)\n # Uppercase and spaces will be ignored!\n ## Because we are getting rid of them...\n password.delete!(\" \")\n password.downcase!\n encrypted_password = \"\"\n while password != \"\"\n ## We're retrieving the next letter\n pass_var = password[0].next\n ## Creating our exception for 'z'\n if pass_var == \"aa\"\n pass_var = \"a\"\n end\n ## Recycling our old letters\n password = password[1..-1]\n ## Now adding them with our new letter!\n encrypted_password += pass_var\n end\n ## And now we're implicitly returning it\n encrypted_password\nend", "def encrypt(secrets)\n \n index = 0\n\nwhile index < secrets.length\n\tsecrets[index] = secrets[index].next\n\t\tif \n\t\tsecrets.include? '!'\n\t\tsecrets.gsub!('!', ' ')\n\t\tend\n\tindex += 1\nend\n\tif \n\t\tsecrets.include? 'ab'\n\t\tsecrets.gsub!('b', '')\n\tend\nputs secrets\nend", "def read_encrypted_secrets; end", "def read_encrypted_secrets; end", "def translate_to_cipher(sentence)\n # creates array alphabet including all letters a through z\n alphabet = ('a'..'z').to_a\n # creates a hash by merging alphabet and the rotated alphabet array,\n # in which each element of alphabet is the key\n # for the element at the same index in the rotated array\n # (see explanation of Array#rotate in Questions)\n cipher = Hash[alphabet.zip(alphabet.rotate(4))]\n # creates array spaces including all special characters named\n spaces = [\"@\", \"#\", \"$\", \"%\", \"^\", \"&\", \"*\"]\n # converts all characters in sentence to lowercase and\n # creates a new variable original_sentence to modify the input string\n original_sentence = sentence.downcase\n # creates an empty array encoded_senteece\n encoded_sentence = []\n # loops through each character of the string original_sentence\n original_sentence.each_char do |element|\n # checks to see if the hash cipher includes the current character\n # as a key\n if cipher.include?(element)\n # if so, pushes the character's value in the hash cipher to\n # the end of the array encoded_sentence\n encoded_sentence << cipher[element]\n # checks to see if the element is a space\n elsif element == ' '\n # if so, pushes a randomly selected element of the array\n # spaces (i.e. special characters) to the end of the\n # array encoded_sentence\n encoded_sentence << spaces.sample\n # if neither of the above conditions are true\n else \n # simply pushes the unmodified element to the end of the array\n # encoded_spaces\n encoded_sentence << element\n # closes the if/else logic\n end\n # closes the each loop\n end\n # joins each element of encoded_sentence and returns the resulting string\n return encoded_sentence.join\n# closes the method\nend", "def caesarCipherEncryptor(string, key)\n new_letters = []\n new_key = key % 26\n alphabet = (\"abcdefghijklmnopqrstuvwxyz\").chars\n\n string.each_char do |letter|\n new_letters.append(get_new_letter(letter, new_key, alphabet))\n end\n return new_letters.join\nend", "def encrypt(val)\n #Usage self.encrypt(val)\n return Digest::SHA1.hexdigest(val.to_s) \n end", "def caesar_guesser(encrypted_string, alphabet)\nend", "def caesar_cipher(string, shift)\nend", "def encrypt(content, offset)\n # Decrypting and crypting contains more or less the exact same code.\n # The difference between those two methods is that decrypting by default takes a positive offset\n # as negative in its calculations. That is why we, when calling the decrypting method, turn our offset\n # around. With that being said, we go from + to - or - to + before executing our method call.\n # As our encrypting method is supposed to return the encrypted content uppercase, \n # and decrypt returns the decrypted content lowercase, we call string's member method upcase.\n\n return decrypt(content, offset * -1).upcase\nend", "def textEncryptor(keyword, cipherKey)\n cipherText = \"\"\n\n\n #algorithm that uses key to shift letters encrypting given word\n keyword.each_char do |letter|\n \n oldIndex = $alphabet.find_index(letter)\n newIndex = (oldIndex + cipherKey) % $alphabet.count\n cipherText += $alphabet[newIndex]\n \n end\n\n puts \"The cipher text is: #{cipherText}\"\n\n #begin deciphiring encoded text for human readable original word\n textDecryptor(cipherText, cipherKey)\n\nend", "def caesar_cipher text, shift = 5 #shifts letters by 5 - by default\nletters = text.split(//)\nncrypted_string = \"\"\nletters.each do |x|\nif (x =~ /\\w/) && (x =~ /\\D/) && (x != \"_\") ##Checks with RegEx's whether the current array index' value is a word character + a non-digit character + not an underscore '_', so only a-z & A-Z letters pass the test and are affected by the following code.\nif x == x.upcase ##<-I do this so I can wrap back to A when Z's #ord index is exceeded. \"A\".ord == 65, \"Z\".ord == 90\nx = x.ord + shift\nif x > 90\nx -= 90\nx += 64\nend\nelsif x == x.downcase ##Same is done here for downcases as is done above for upcases. \"a\".ord == 97, \"z\".ord == 122\nx = x.ord + shift\nif x > 122\nx -= 122\nx += 96\nend\nend\nx.chr\nend\nncrypted_string << x\nend\nputs ncrypted_string\nend", "def vigenere(key, txt)\n shift_array = key.get_shift\n count = 0\n\n txt_array = txt.split('')\n ciph=[]\n\n txt_array.each do |a|\n a = a.ord\n shift = shift_array[count % shift_array.size]\n case a\n when (64..90) \n new_char = ((a - 64 + shift) % 26) + 64 \n count += 1\n when (97..122)\n new_char = ((a- 97 + shift) % 26) + 97\n count += 1\n else \n new_char = a \n end\n ciph.push(new_char.chr)\n end\n\n ciph = ciph.join('')\n puts \"#{ciph}\"\nend", "def translate_to_cipher(sentence) #creates a method, with an array \n alphabet = ('a'..'z').to_a # sets alphabet equal to the letters a to z in an array\n cipher = Hash[alphabet.zip(alphabet.rotate(4))] #creates a hash with the values of the alphabet +4\n spaces = [\"@\", \"#\", \"$\", \"%\", \"^\", \"&\", \"*\"] #replaces the spaces with symbols \n original_sentence = sentence.downcase #makes the whole sentence downcase\n encoded_sentence = [] #creates an empty hash\n original_sentence.each_char do |element| #each character does...\n if cipher.include?(element)\n encoded_sentence << cipher[element] # puts the cipher element into the encoded_sentence\n elsif element == ' '\n encoded_sentence << spaces.sample # puts the spaces samples into the encoded_sentence\n else \n encoded_sentence << element #puts the elements into the encoded_sentence\n end\n end\n \n return encoded_sentence.join #returns the encoded_sentence decoded!\nend", "def encrypt(data)\n cipher = OpenSSL::Cipher.new(\"AES-256-CBC\")\n cipher.encrypt\n cipher.iv = @enc_iv\n cipher.key = @enc_key\n encrypted = cipher.update(data) + cipher.final\n enc = Base64.strict_encode64(encrypted)\nend", "def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n new_msg = \"\"\n\n message.each_char.with_index do |char|\n old_pos = alphabet.index(char)\n new_pos = old_pos + keys[idx % keys.length]\n new_msg += alphabet[new_pos % alphabet.length]\n end\n\n new_msg\nend", "def encode(plaintext, key)\n cipher = key.chars.uniq + (('a'..'z').to_a - key.chars)\n ciphertext_chars = plaintext.chars.map do |char|\n (65 + cipher.find_index(char)).chr\n end\n puts ciphertext_chars.join\nend", "def vigenere_cipher(string, key_sequence)\n alphabet = ('a'..'z').to_a\n keys = key_sequence.dup\n result = \"\"\n while result.length < string.length\n c = string[result.length] \n offset = (alphabet.index(c) + keys.first) % 26 \n result += alphabet[offset]\n keys.push(keys.shift)\n end\n result\nend", "def encrypt_file(filename)\n #open the file by passing it the name and ..\n input = File.open(filename, 'r')\n #this is a string now so\n contents = input.read\n encrypted_contents = encrypt_string(contents)\n input.close\n output = File.open(filename + '.encrypted', 'w')\n output.write(encrypted_contents)\n output.close\n\n end", "def translate_to_cipher(sentence)\n alphabet = ('a'..'z').to_a #creates an array of each lowercase letter from a to z.\n cipher = Hash[alphabet.zip(alphabet.rotate(4))] #alphabet.rotate(4) creates a new array, where the 4th index item shifts to the 0th place\n # zip creates a 2 dimensional array, where alphabet is the 0th item, and the rotated array is the second item\n #cipher is a new hash where alphabet is the key, and the rotated array is the value.\n spaces = [\"@\", \"#\", \"$\", \"%\", \"^\", \"&\", \"*\"] #you don't need to assign a variable to this array...it's only called once\n \n original_sentence = sentence.downcase #this isn't neccessary either...just downcase original_sentence when it is called.\n encoded_sentence = [] # creates an empty container for the encoded sentence\n original_sentence.each_char do |element| #iterates through the original sentence.\n if cipher.include?(element) # if element is the cipher hash...\n encoded_sentence << cipher[element] #shove the encoded character into the encoded sentence container\n elsif element == ' ' # if the non-encoded character is a space\n encoded_sentence << spaces.sample #throw a random symbol into the encoded sentence\n else \n encoded_sentence << element #if the elements isn't a space or lowercase letter, just add the element.\n end\n end\n \n return encoded_sentence.join #don't need the explicit return\nend", "def encrypt_password(password, password_seed)\n\t\t\tpass_to_hash=password + \"Securasaurus\" + password_seed\n\t\t\t\n\t\t\tcase AUTHENTASAURUS[:hashing] \n when \"SHA2\"\n Digest::SHA2.hexdigest(pass_to_hash)\n when \"SHA1\"\n Digest::SHA1.hexdigest(pass_to_hash)\n when \"MD5\"\n Digest::MD5.hexdigest(pass_to_hash)\n else\n Digest::SHA2.hexdigest(pass_to_hash)\n end\n\t\t\t\n\t\tend", "def translate_to_cipher(sentence) # defining a method named, \"translate_to_cipher\" and passing a single argument to it\n alphabet = ('a'..'z').to_a # converting all alphabets to an array\n cipher = Hash[alphabet.zip(alphabet.rotate(4))] # creating a Hash\n spaces = [\"@\", \"#\", \"$\", \"%\", \"^\", \"&\", \"*\"] # creating an array of special characters\n \n original_sentence = sentence.downcase # setting the input sentence to all lowercase\n encoded_sentence = [] # creates an empty array\n original_sentence.each_char do |element| # iterate over each character in a string\n if cipher.include?(element) #if an element in the Cipher Hash == an element in the input sentence\n encoded_sentence << cipher[element] # push that element from the cipher Hash to an array named, \"encoded_sentence\"\n elsif element == ' ' # if there is a space in the input sentence\n encoded_sentence << spaces.sample # push one of the elements from spaces array to encoded_sentence array\n else # if not\n encoded_sentence << element #push the original sentence into encoded sentence array\n end # end the if\n end # end the iteration\n \n return encoded_sentence.join # return the encoded sentence as a string\nend", "def encryptor(msg)\n\ti = 0\n\twhile i < msg.length\n\t\tif msg[i] == \"z\"\n\t\t\tmsg[i] = \"a\"\n\t\telsif !\"abcdefghijklmnopqrstuvwxyz\".include?(msg[i])\n\t\t\tmsg[i] = msg[i]\n\t\telse\n\t\t\tmsg[i] = msg[i].next\n\t\tend\n\t\ti += 1\n\tend\n\tmsg\nend", "def show\n @cipher = OpenSSL::Cipher.new 'AES-256-CBC'\n @cipher.decrypt\n\n @pwd = current_user.encrypted_password\n @salt = '0123asdf;lkj9876'\n @iter = 20000\n @key_len = @cipher.key_len\n @digest = OpenSSL::Digest.new('SHA256')\n\n puts \"========================\"\n puts \"salt: #{@salt}\" \n puts \"iter: #{@iter}\" \n puts \"key_len: #{@key_len}\"\n puts \"digest: #{@digest}\" \n\n @key = OpenSSL::PKCS5.pbkdf2_hmac(@pwd, @salt, @iter, @key_len, @digest)\n @cipher.key = @key\n \n puts \"key: #{@key}\"\n\n #Now decrypt the data:\n @decoded = Base64.decode64(@secure_password.password).encode('ascii-8bit')\n @decrypted = @cipher.update @decoded\n @decrypted << @cipher.final\n puts \"decrypted password: #{@decrypted}\"\n puts \"========================\"\n\n end", "def vigenere_cipher(message, keys)\n alphabet = (\"a\"..\"z\").to_a\n indices = message.split(\"\").map {|char| alphabet.index(char)}\n \n ciphered_message = \"\"\n indices.each_with_index do |n, i|\n shift_amount = keys[i % keys.length]\n new_index = (n + shift_amount) % alphabet.length\n ciphered_message += alphabet[new_index]\n end\n\n ciphered_message\nend", "def encrypt(str)\n aes = OpenSSL::Cipher::Cipher.new($alg)\n iv = aes.random_iv\n iv64 = Base64.urlsafe_encode64(iv)\n\n aes.encrypt\n aes.key = $key\n aes.iv = iv\n\n cipher = aes.update(str) + aes.final\n\n { :cipher => Base64.urlsafe_encode64(cipher),\n :iv => iv64 }\nend", "def encryption_oracle(data)\n # prepend and append some random chars to the data\n # (why are we doing this?)\n pre = rand(6)+5\n post = rand(6)+5\n plain_text = data\n plain_text.prepend( (1..pre).map {rand(256).chr}.join )\n plain_text.concat( (1..post).map {rand(256).chr}.join )\n plain_text = CBCEncryptor.pad(plain_text, KEYSIZE)\n\n key = (1..16).map {rand(256).chr}.join\n\n if rand(2) > 0\n puts \"[Oracle using ECB]\"\n ecb = ECBEncryptor.new(key)\n ecb.encrypt(plain_text)\n else\n puts \"[Oracle using CBC]\"\n iv = (1..16).map {rand(256).chr}.join\n cbc = CBCEncryptor.new(key)\n cbc.encrypt(plain_text, iv)\n end\nend", "def enVigenere(plain, key)\n cipher = \"\"\n\n n = plain.length\n while key.length < n\n key += key\n end\n key = key[0...n]\n\n for i in 0...n\n p = plain[i].upcase\n k = key[i].upcase\n if letter?(p)\n row = find_row(p, 0)\n col = find_col(k)\n cipher += $TABLE[row][col]\n if p != plain[i]\n cipher[-1] = cipher[-1].downcase\n end\n else\n cipher += p\n end\n end\n\n return cipher\nend", "def encrypt!(block) \n Bes.new(material).encrypt block\n end", "def translate_to_cipher(sentence) #Defining the method and the input\n alphabet = ('a'..'z').to_a #creating a variable, alphabet and making it an array\n cipher = Hash[alphabet.zip(alphabet.rotate(4))] # creating variable, cipher. #zip method takes the\n # alphabet variable and generates a sequence of arrays that correspond to the .length of the arguments. \n #The #rotate method will rotate the elements of the array to create a new array. I don't exactly now what \n # they do when put together like this.\n spaces = [\"@\", \"#\", \"$\", \"%\", \"^\", \"&\", \"*\"] #creating variable, spaces, that includes an array of symbols.\n \n original_sentence = sentence.downcase #making the input lowercase\n encoded_sentence = [] #creating a new array, encoded_sentence\n original_sentence.each_char do |element| #loops through the original sentence and takes each character and impliments element\n if cipher.include?(element)\n encoded_sentence << cipher[element] # if the cipher includes the element, the loop returns the encoded_sentence including the cipher.\n elsif element == ' '\n encoded_sentence << spaces.sample # if the element is a space, the encoded_sentence includes the space.\n else \n encoded_sentence << element #otherwise the encoded sentence just includes the element.\n end\n end\n \n return encoded_sentence.join\nend", "def encrypted_string\n blocks = initial_string.chars.each_slice(16).map(&:join)\n\n nonce = SecureRandom.random_bytes(8)\n counter = [0] * 8\n counter_bytes = counter.pack('C*')\n encryption = nonce + counter_bytes\n\n blocks.each do |block|\n cipher_block = block ^ encrypt_block(nonce + counter_bytes)\n encryption << cipher_block\n counter[-1] += 1\n counter_bytes = counter.pack('C*')\n end\n\n encryption\n end", "def envigenerate(plain, key)\n boundary = plain == plain.upcase ? \"Z\" : \"z\"\n cipher = plain.ord + (key.ord - 65)\n cipher -= 26 if cipher > boundary.ord\n cipher.chr\nend", "def encrypt_message pub_key, message\n p_key = pub_key.shuffle[0 .. pub_key.length / 2] # randomly select half the values\n sum = 0\n p_key.each{ |i| sum += i}\n return sum + message\nend", "def decrypt_letter alphabet, cipherbet, letter\ndecrypt_letter = encrypt_letter cipherbet, alphabet, letter\nreturn decrypt_letter\nend", "def vigenere_cipher(message, keys)\n new_string = ''\n alphabet = 'abcdefghijklmnopqrstuvwxyz'\n\n message.each_char.with_index do |char, idx|\n old_idx = alphabet.index(char)\n if keys.length == 1\n new_idx = keys[0]\n end\n new_idx = keys[idx % keys.length]\n new_pos = old_idx + new_idx\n new_string += alphabet[new_pos % 26]\n end\n\n new_string\nend", "def encrypt(msg_array, rotor)\n encrypted_msg = []\n msg_array.each do |x|\n rotor.each do |key, value| \n if key == x\n encrypted_msg << value\n end\n end\n end\n encrypted_msg\nend", "def encrypt(password)\n end_password = password.length\n encrypt_counter = 0\n e_string = \"\"\n while encrypt_counter < end_password\n if password[encrypt_counter].next == \"aa\"\n e_string += \"a\"\n elsif password[encrypt_counter].next == \"!\"\n \t\te_string += \" \"\n else \n e_string += \"#{password[encrypt_counter]}\".next\n end\n encrypt_counter += 1\n end\n e_string\nend", "def encrypt(*args, &block)\n crypt :encrypt, *args, &block\n end", "def encrypt(pass)\n counter = 0\n password = \"\"\n\n until counter == pass.length\n alphabet = \"abcdefghijklmnopqrstuvwxyza\"\n letter = alphabet.index(pass[counter]) + 1\n counter += 1\n password = alphabet[letter] + password\n\n end\n password.reverse\n end", "def vigenere_cipher(msg, arr)\n alphabet = (\"a\"..\"z\").to_a\n new_msg = \"\"\n msg.each_char.with_index do |char, i|\n pos= alphabet.index(char)\n key = arr[i % arr.length]\n new_pos = (pos + key) % alphabet.length\n new_msg += alphabet[new_pos]\n end\n new_msg\nend" ]
[ "0.84360874", "0.74974084", "0.73315173", "0.72048116", "0.7124951", "0.70508885", "0.70360696", "0.69936615", "0.68230575", "0.68140155", "0.6813903", "0.6787745", "0.67809486", "0.67221636", "0.6704601", "0.66761625", "0.6668785", "0.6642568", "0.66328055", "0.66307056", "0.66307056", "0.66065913", "0.6596987", "0.6592275", "0.65342146", "0.65310484", "0.6526931", "0.6524109", "0.6511973", "0.65078497", "0.6500692", "0.6479612", "0.6477593", "0.64574045", "0.64450735", "0.6442091", "0.6431606", "0.6431133", "0.64301306", "0.6423499", "0.641421", "0.64059085", "0.64053136", "0.64053136", "0.64053136", "0.64053136", "0.64053136", "0.63904184", "0.6370552", "0.6370299", "0.63588053", "0.6355686", "0.6344444", "0.6343278", "0.634078", "0.6324289", "0.6318402", "0.6314105", "0.63117146", "0.6308494", "0.6307262", "0.63035154", "0.6297262", "0.62958455", "0.62958455", "0.62956", "0.62857896", "0.6278395", "0.62659895", "0.6263191", "0.625458", "0.6253618", "0.62521195", "0.6230232", "0.62291914", "0.6223489", "0.6222938", "0.62220675", "0.6211408", "0.62096554", "0.62096035", "0.6207251", "0.62071955", "0.6195274", "0.6195165", "0.61948025", "0.6194225", "0.6192807", "0.6188316", "0.6187244", "0.61870223", "0.6178499", "0.6177763", "0.61706513", "0.61704826", "0.6167692", "0.6164422", "0.61624837", "0.6146142", "0.61449957", "0.61377954" ]
0.0
-1
lookup a dns name by ip, if we find a mapped ip, give us the name.
def reverse_name_lookup(ip, type = :A) # look for all the zones type = type.to_sym if type.class != Symbol dns_name = String.new @dns.domains.each do |zone| @dns.domains.get(zone.id).records.each do | record | if record.data == ip and record.type.to_sym == type dns_name = record.name break end end end return dns_name end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ptr(ip)\n # use cache if ip was already resolved\n return @cache[ip] if @cache[ip]\n\n begin\n name = @hypedns.getname(ip).to_s\n @cache[ip] = name\n return name\n rescue Resolv::ResolvError, SocketError\n return nil\n end\n end", "def reverse_dns_lookup (ip)\n\t\tputs \"Retrieve the hostname by the reverse DNS lookup on IP: #{ip}\"\n\t\thostname = ip\n\t\tbegin\n\t\t\thostname = Socket.gethostbyaddr(ip.split('.').collect{ |x| x.to_i}.pack(\"CCCC\"))[0]\n\t\t\treturn hostname.downcase\n\t\trescue => ee\n\t\t\tputs \"Exception on method reverse_dns_lookup: #{ee}\" if @verbose\n\t\t\treturn hostname\n\t\tend\n\tend", "def local_ip_2_host (ip)\n\t\tputs \"Reverse DNS lookup from the local host repository\" if @verbose\n\t\tip=ip.strip unless ip.nil?\n\t\tif @known_hosts.key?(ip)\n\t\t\treturn @known_hosts[ip]\n\t\telse\n\t\t\treturn nil\n\t\tend\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\t\treturn nil\n\tend", "def get_fqdn(ip)\n begin\n resp = Socket.getaddrinfo(ip, nil)\n rescue\n return nil\n end\n fqdn = resp[0][2]\n nip = resp[0][3]\n return nil if (fqdn == nip)\n return fqdn\nend", "def get_fqdn(ip)\n begin\n resp = Socket.getaddrinfo(ip, nil)\n rescue\n return nil\n end\n fqdn = resp[0][2]\n nip = resp[0][3]\n return nil if (fqdn == nip)\n return fqdn\nend", "def hostname\n if resolution = CloudModel::AddressResolution.where(ip: ip).first\n resolution.name\n else\n begin\n Resolv.getname(ip)\n rescue\n ip\n end\n end\n end", "def lookup_device(ip)\n\t\t@map[ip]\n\tend", "def get_netname (ip)\n\t\tputs \"Perform whois lookup on an IP address. Then extract the netname from the query result for the IP: #{ip}\" if @verbose\n\t\tbegin \n\t\t\tip.strip!\n\t\t\traise \"Unknown IP/CIDR format: #{ip}\" unless is_ip?(ip) or is_cidr?(ip)\n\t\t\tcontent_to_parse=query(ip).to_s\n\t\t\tif content_to_parse =~ /^netname:(.+)\\n/i\n\t\t\t\treturn $1.strip\n\t\t\telsif content_to_parse =~ /^.+\\((NET\\-.+)\\).+\\n/i\n\t\t\t\treturn $1.strip\n\t\t\telse\n\t\t\t\treturn \"UNKNOWN\"\n\t\t\tend\n\t\t\treturn \"UNKNOWN\"\n\t\trescue Exception => ee\n\t\t\tputs \"Exception on method get_netname: #{ee}\" if @verbose\n\t\t\treturn \"UNKNOWN\"\t\t\n\t\tend\n\tend", "def hostname(ip_address)\n @resolver.getname(ip_address).to_s\n rescue\n 'IP address not found'\n end", "def cidr_lookup (ip)\n\t\tputs \"Lookup the CIDR name from the known CIDR list for the IP: #{ip}\" if @verbose\n\t\treturn nil if @known_cidr_blks==nil\n\t\tputs \"CIDR Lookup: #{ip} ...\" if @verbose\n\t\t@known_cidr_blks_desc_index.each do |line|\n\t\t\tfirst_octet_ip = ip.split('.').first.to_i\n\t\t\tfirst_octet_blk = line.split('.').first.to_i\n\t\t\tnext if first_octet_blk > first_octet_ip\n\t\t\tcidr4 = NetAddr::CIDR.create(line)\n\t\t\tknown = cidr4.contains?(ip+'/32')\n\t\t\treturn line if known\n\t\tend\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\" if @verbose\n\t\treturn nil\n\tend", "def resolve_name(lookup_name, lookup_types=[Dnsruby::Types::A, Dnsruby::Types::CNAME, Dnsruby::Types::PTR])\n resolve_names(lookup_name,lookup_types).first\n end", "def resolve_node(result)\n begin\n return Resolv.getname(result[:ip])\n rescue => detail\n Puppet.err _(\"Could not resolve %{ip}: %{detail}\") % { ip: result[:ip], detail: detail }\n end\n result[:ip]\n end", "def lookup(ip)\n uri = Addressable::URI.parse(\"https://ip-api.com/xml/#{ip}\")\n res = Net::HTTP.get_response(uri.normalize)\n MetaData.parse(res.body, single: true).freeze\n end", "def resolve_node(result)\n begin\n return Resolv.getname(result[:ip])\n rescue => detail\n Puppet.err \"Could not resolve #{result[:ip]}: #{detail}\"\n end\n result[:ip]\n end", "def resolve_name(lookup_name, lookup_types=[Dnsruby::Types::AAAA, Dnsruby::Types::A, Dnsruby::Types::CNAME, Dnsruby::Types::PTR])\n resolve_names(lookup_name,lookup_types).first\n end", "def kvm_ip(name)\n addr = ip_by_mac(node_mac(name))\n addr.empty? ? ip_by_mount(name) : addr\nend", "def hostname\n Resolv.getname(ip_address) rescue nil\n end", "def get_dns_ipaddr(host)\n dns = Dnsruby::DNS.new({\n :nameserver => [ IWMNns ],\n :search => [ 'canishe.com' ],\n :ndots => 1\n })\n\n answer = dns.getaddress(host)\n\n return answer.to_s\nend", "def local_host_2_ip (host)\n\t\tputs \"DNS lookup from the local host repository\" if @verbose\n\t\thost=host.strip unless host.nil?\n\t\tif @known_hosts.key?(host)\n\t\t\treturn @known_hosts[host]\n\t\telse\n\t\t\treturn nil\n\t\tend\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\t\treturn nil\n\tend", "def get_clientname(ip_or_name)\n query = \"hostname:%<address>s\"\n query = \"ipaddress:%<address>s\" if ip?(ip_or_name)\n query = \"fqdn:%<address>s\" if fqdn?(ip_or_name)\n result = get_search(:node, format(query, address: ip_or_name))\n logger.debug format(\"Automatic lookup of node name (IPv4 or hostname) returned: %s\", result&.fetch(\"name\") || \"(nothing)\")\n\n # Try EC2 lookup, if nothing found (assuming public IP)\n unless result\n query = \"ec2_public_ipv4:%<address>s OR ec2_public_hostname:%<address>s\"\n result = get_search(:node, format(query, address: ip_or_name))\n logger.debug format(\"Automatic lookup of node name (EC2 public IPv4 or hostname) returned: %s\", result&.fetch(\"name\"))\n end\n\n # This will fail for cases like trying to connect to IPv6, so it will need extension in the future\n\n result&.fetch(\"name\") || raise(format(\"Unable too lookup remote Chef client name from %s\", ip_or_name))\n end", "def ip\n ip = nil\n\n unless valid?\n return nil\n end\n\n begin\n case name\n when /\\.in-addr\\.arpa$/\n name_without_suffix = name.sub(/\\.in-addr\\.arpa$/, '')\n quads = name_without_suffix.split('.')\n if quads.size == 4\n quads.reverse!\n ip = quads.join('.')\n end\n when /\\.ip6\\.arpa$/\n name_without_suffix = name.sub(/\\.ip6\\.arpa$/, '')\n nibbles = name_without_suffix.split('.')\n nibbles.each do |nibble|\n if nibble.empty?\n raise DnsRecord::EmptyNibbleError\n end\n end\n if nibbles.size == 32\n n = nibbles.reverse!\n ip = \\\n n[0..3].join('') + \":\" +\n n[4..7].join('') + \":\" +\n n[8..11].join('') + \":\" +\n n[12..15].join('') + \":\" +\n n[16..19].join('') + \":\" +\n n[20..23].join('') + \":\" +\n n[24..27].join('') + \":\" +\n n[28..31].join('')\n \n ip = NetAddr::CIDR.create(ip).ip(:Short => true)\n end\n end\n rescue DnsRecord::EmptyNibbleError\n ip = nil\n end\n\n ip\n end", "def search_host\n begin\n if @host_search\n @host = Resolv.getname self.ip.to_s\n else\n @host = nil\n end\n rescue Resolv::ResolvError\n @host = nil\n end\n end", "def checkip?(ip)\n if ip =~ %r=^172.|^192.168.|^10.$=\n return \"Private Class C IP Range\"\n elsif ip =~ %r=^127.$=\n return \"Local Loopback\"\n end\n end", "def get_ip_address(name, eth)\n if eth_iface = network[:interfaces][eth]\n eth_iface[:addresses].each do |key, info|\n jpc2[name] = key if info['family'] == 'inet'\n end\n end\nend", "def get_network_name(ip)\n cmd_out = `netsh interface ip show config`\n network_details = cmd_out.split(/^$/).reject(&:empty?).select do |settings|\n begin\n lines = settings.split(/\\n/).reject(&:empty?)\n subnet = lines[3]\n next false unless subnet =~ /Subnet Prefix/\n\n mask = IPAddr.new(subnet.match(%r{.* (\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}.\\d{1,3}/\\d{1,3}).*}).captures[0])\n address = IPAddr.new(ip)\n\n mask.include?(address)\n rescue StandardError\n false\n end\n end\n return nil if network_details[0].nil? || network_details[0].empty?\n\n network_details[0].split(/\\n/).reject(&:empty?)[0].match(/Configuration for interface \"(.*)\"/).captures[0].strip\n end", "def dns_find(key)\n \n end", "def ip?(ip_or_name)\n # Get address always returns an IP, so if nothing changes this was one\n Resolv.getaddress(ip_or_name) == ip_or_name\n rescue Resolv::ResolvError\n false\n end", "def interface_by_ip(ip)\n return `ifconfig |grep -B 2 -e \\\"#{ip} \\\" | awk '/Link encap/ {split ($0,A,\" \"); print A[1]}'`.chomp\n end", "def host_2_ip (hostname)\n\t\tputs \"Perform DNS query on host: #{hostname}\" if @verbose\n\t\tbegin\n\t\t\tips=Array.new\n\t\t\tif is_ip?(hostname)\n\t\t\t\tputs \"No change - same IP is returned. \" if @verbose\n\t\t\t\treturn hostname.strip\n\t\t\telse\n\t\t\t\tips=Resolv.getaddresses(hostname)\n\t\t\t\tif (ips.empty?) then\n\t\t\t\t\tputs \"Failed to resolve #{hostname}\" if @verbose\n\t\t\t\t\treturn nil\n\t\t\t\telse\n\t\t\t\t\tputs \"IP found: #{ips.first}\" if @verbose\n\t\t\t\t\treturn ips.first.strip\n\t\t\t\tend\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method host_2_ip for host #{hostname}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend", "def name\n ip_address\n end", "def lookup_hostname(endpoint)\n @resolved_hostnames.select{ |k,v| v.include?(endpoint) }.shift[0]\n end", "def lookup(hostname, ttl)\n return unless @lookups.key?(hostname)\n\n @lookups[hostname] = @lookups[hostname].select do |address|\n address[\"TTL\"] > ttl\n end\n ips = @lookups[hostname].flat_map do |address|\n if address.key?(\"alias\")\n lookup(address[\"alias\"], ttl)\n else\n IPAddr.new(address[\"data\"])\n end\n end\n ips unless ips.empty?\n end", "def description\n \"Query for the ip address of the given DNS name\"\nend", "def parse_dns(address)\n fwd_entries={}\n aliases=nil\n begin\n Socket.getaddrinfo(address,nil).each do |addr_struct|\n addr=addr_struct[2]\n ip=addr_struct[3]\n if fwd_entries[addr].nil?\n fwd_entries[addr]=[ip]\n elsif !fwd_entries[addr].include?(ip)\n fwd_entries[addr] << ip\n end\n end\n rescue SocketError =>e\n end\n ret_arr=[]\n if fwd_entries.empty? then\n puts \"[warning] Could not determine an IP address for \\\"#{address}\\\"\"\n else\n fwd_entries.each do |fwd,ips|\n ips.each do |ip|\n ret_arr << {:ip=>ip, :addr=>fwd}\n end\n end\n end\n return ret_arr\n end", "def findByAddr(ip, port)\n @peersByAddr[ip + port.to_s]\n end", "def name\n if ipv4?\n \"[#{ip_address}]\"\n elsif ipv6?\n \"[IPv6:#{ip_address}]\"\n elsif @config[:host_encoding] && @config[:host_encoding] == :unicode\n ::SimpleIDN.to_unicode(host_name)\n else\n dns_name\n end\n end", "def fetch_dns_ptr(zone_name)\n \n @o = ''\n # find out the range we are parsing in this zone.\n ranges = []\n zone_name.split(\".\").map{|a| \n # Make sure it's request for arpa zone which should be all number\n if ! (a =~ /^\\d+$/).nil?\n if ranges.empty?\n ranges << a\n else\n ranges.insert(0, a)\n end\n end\n }\n \n # After look through zone name, if it's not a arpa zone, we'll return nil\n if ranges.empty?\n return @o\n end\n \n # Use later to determine how many number from ip we need\n zone_class = ranges.length\n \n # Now we have the range from zone name, let's use Networking class to help us find all interfaces\n # Find out wether it's class a, b, c or d\n netmask = 32 # start with D class netmask\n for i in (ranges.length..4-1)\n # Get the netmask correctly\n netmask = netmask - 8\n # Set the empty ip slot to 0\n ranges[i] = 0;\n end\n \n # Build the address\n range_address = ranges.join(\".\") + \"/#{netmask}\"\n \n # Call in cidr, find all interface under this range.\n interfaces = Networking.get_interfaces_in_range(range_address).sort{|a,b| a.ip <=> b.ip}\n\n # Find asset for each interface\n # If asset is Server, we need to look up two things\n # 1. If ip is drac, we will add \"-d\" to the hostname\n # 2. Maybe for vip, we need to ptr to it, but on the second thought, that shouldn't be. \n for interface in interfaces\n\n # Build the ip correct for this zone\n ips = []\n ip_parts = interface.ip_to_string.split(\".\")\n for i in (zone_class..4-1)\n # Insert reversely\n ips.insert(0, ip_parts[i])\n end\n ip = ips.join(\".\")\n \n # If it's a drac and type = server, we transform the hostname\n if ( interface.drac_ip? && interface.asset.resource_type == 'Server')\n name = convert_to_drac_name(interface.asset.name)\n else\n # Check to see if there is multiple vips poing to this ip, if so raise exception.\n # If only one ip, then we'll point PTR record to that vip.\n if interface.vips.length > 1\n #raise \"#{interface.ip_to_string} has more than one vip \" + interface.vips.collect{|a| a.name}.inspect + \" pointing to it\"\n @o += \";#{interface.ip_to_string} has more than one vip \" + interface.vips.collect{|a| a.name}.inspect + \" pointing to it.\\n\"\n @o += \";Picking the first one.\\n\"\n name = interface.vips[0].name \n elsif interface.vips.length == 1\n name = interface.vips[0].name\n # Network asset with named interface\n elsif interface.asset.resource_type == 'Network' and interface.name and interface != interface.asset.primary_interface and ! interface.name.empty?\n name = interface.name + '.' + interface.asset.name\n else\n name = interface.asset.name \n end\n \n end\n \n @o += \"#{ip}\\t\\tPTR\\t\\t#{name}.\\n\"\n\n end\n\n return @o\n\n rescue Exception => exc\n flash[:interface] = \"##ERROR## Fetch failed following reason: #{exc.message}\\n\"\n\n \n end", "def get_ip_address(name, eth)\n network[:interfaces][eth][:addresses].each do |key, info|\n rackspace[name] = key if info['family'] == 'inet'\n end\nend", "def geoiplookup(ip, geo=false)\n checkip?(ip)\n t = country(ip, geo)\n city(ip, geo)\n unless t == false\n # Check if @longitude / @latitude exists for Reverse Geocoding options\n if instance_variable_defined?(\"@latitude\") and instance_variable_defined?(\"@longitude\")\n res = [@latitude, @longitude]\n else\n res = \"(#{@continent_name}) - \\n\"\n @country_name.each {|n|\n res << \"[ #{n} ]\" unless n == \"\"\n }\n @city_name.each {|n|\n res << \"[ #{n} ] \" unless n == \"\"\n }\n initialize\n end\n else\n res = \"Not Available\"\n end\n return res\n end", "def get_ip(ip_name, resource_group = armrest_configuration.resource_group)\n get(ip_name, resource_group).properties.ip_address\n end", "def search_node(ip)\n found = nil\n @known_nodes.each do |node|\n if node.is_you? ip\n found = node\n end\n end\n return found\n end", "def lookup_hostname(host)\n Socket.getaddrinfo(host, nil, nil, Socket::SOCK_STREAM)[0][3]\n rescue SocketError\n raise(InvalidHostname, Errstr::INVALID_HOST % host)\n end", "def lookup(label, limit=nil)\n $stderr.puts \"DEBUG: #{self.class.name}.lookup(#{label})\" if @debug\n Timeout::timeout(@timeout) {\n url = nil\n if label =~ /^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}(\\/\\d{1,2})?$/\n label = label.gsub(/\\//,',')\n url = \"#{@base}/rdata/ip/#{label}\"\n else\n url = \"#{@base}/rrset/name/#{label}\"\n end\n url = URI.parse url\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = (url.scheme == 'https')\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.verify_depth = 5\n path = url.path\n if limit\n path << \"?limit=#{limit}\"\n end\n request = Net::HTTP::Get.new(path)\n request.add_field(\"User-Agent\", \"Ruby/#{RUBY_VERSION} passivedns-client rubygem v#{PassiveDNS::Client::VERSION}\")\n request.add_field(\"X-API-Key\", @key)\n request.add_field(\"Accept\", \"application/json\")\n t1 = Time.now\n response = http.request(request)\n if response.code.to_i == 404\n $stderr.puts \"DEBUG: empty response from server\" if @debug\n return\n end \n t2 = Time.now\n $stderr.puts response.body if @debug\n parse_json(response.body,t2-t1)\n }\n rescue Timeout::Error\n $stderr.puts \"#{self.class.name} lookup timed out: #{label}\"\n end", "def name\n ip_address\n end", "def find_for_ip(string)\n begin\n ip = IPAddr.new(string)\n type = ip.ipv4? ? TYPE_IPV4 : TYPE_IPV6\n _definitions(type).each do |_, definition|\n return factory(type, *definition) if IPAddr.new(definition.first).include?(ip)\n end\n rescue ArgumentError\n # continue\n nil\n end\n raise AllocationUnknown, \"IP Allocation for `#{string}' unknown\"\n end", "def check(ip_addr)\n ip = IPAddr.new(ip_addr)\n\t\tquery = \"#{@key}.#{ip.reverse.gsub(\"in-addr.arpa\", \"dnsbl.httpbl.org\")}\"\n\n\t\tbegin\n\t\t\tlookup = Resolv.getaddress(query)\n\t\t\tvalues = lookup.split(\".\")\n\t\t\t{ :last_activity => values[1],\n\t\t\t :threat => values[2],\n\t\t\t :type => TYPE[values[3]],\n\t\t\t :raw_data => lookup\n\t\t\t}\n\t\trescue\n\t\t\treturn { :type => [:error] }\n\t\tend\n\tend", "def get(ip)\n return @cache[ip] if @cache.key?(ip)\n url = format(URL_FORMAT, ip)\n response = Curl.get(url).body_str\n ipapi = SimpleGeolocator::IPAPIResponse.new(Oj.load(response))\n @cache[ip] = ipapi\n end", "def lookup_name(place_id)\n one.get_name(place_id).values.first\n end", "def lookup_name(arg)\n all_by_name[arg]\n end", "def getname(address)\n names = getnames(address)\n if names.empty?\n raise ResolvError.new(\"no name for #{address}\")\n else\n names.first\n end\n end", "def get_net_desc (ip)\n\t\tputs \"Perform whois lookup on an IP address. Then extract the netname description from the query result for the IP: #{ip}\" if @verbose\n\t\tbegin \n\t\t\tip.strip!\n\t\t\traise \"Unknown IP/CIDR format: #{ip}\" unless is_ip?(ip) or is_cidr?(ip)\n\t\t\tdesc=String.new\n\t\t\tcontent_to_parse=query(ip).to_s\n\t\t\tcontent_to_parse.scan(/^descr:(.+)\\n/i).flatten.map do |entry|\n\t\t\t\tdesc=desc + \" \" + entry.strip\n\t\t\tend\n\t\t\tif desc.empty?\n\t\t\t\tif content_to_parse =~ /^(.+)\\((NET\\-.+)\\).+\\n/i\n\t\t\t\t\tdesc=$1.strip\n\t\t\t\telsif content_to_parse =~ /^OrgName:(.+)\\n/i\n\t\t\t\t\tdesc=$1.strip\n\t\t\t\telse\n\t\t\t\t\tdesc=\"UNKNOWN\"\n\t\t\t\tend\n\t\t\tend\n\t\t\treturn desc\n\t\trescue Exception => ee\n\t\t\tputs \"Exception on method get_net_desc: #{ee}\" if @verbose\n\t\t\treturn \"UNKNOWN\"\t\t\n\t\tend\n\tend", "def add_forward_lookup(_ip, _hostname)\n end", "def get_ip_address(name, eth)\n if ( eth_iface = network[:interfaces][eth] )\n eth_iface[:addresses].each do |key, info|\n linode[name] = key if info[\"family\"] == \"inet\"\n end\n end\n end", "def info(ip:, key:)\n record = reader.get(ip)\n return unless record\n\n case key.to_sym\n when :country\n return record['country']['names'][lang] if record['country']\n when :continent\n return record['continent']['names'][lang] if record['continent']\n end\n end", "def locate\n @result ||= self.class.get(\n \"/\",\n :query => {:ip => @ip},\n :format => :xml\n )['HostipLookupResultSet']['gml:featureMember']\n end", "def get_ipaddr(dns_query, parsed_dns, length)\n address = \"\"\n case length\n when IPV4_ADDR_LENGTH\n address = dns_query[parsed_dns[:index], length].unpack(\"CCCC\").join('.')\n when IPV6_ADDR_LENGTH\n address = dns_query[parsed_dns[:index], length].unpack(\"nnnnnnnn\").map{|v| sprintf(\"%x\", v)}.join(':')\n end\n parsed_dns[:index] += length\n return address\n end", "def do_lookup(args)\n if args[\"qname\"] == \"example.com\" and args[\"qtype\"].downcase == \"soa\"\n @result = [\n record(\"example.com\", \"SOA\", \"sns.dns.icann.org noc.dns.icann.org 2013012485 7200 3600 1209600 3600\"),\n ]\n elsif args[\"qname\"] == \"example.com\" and args[\"qtype\"].downcase == \"any\"\n @result = [ \n record(\"example.com\", \"SOA\", \"sns.dns.icann.org noc.dns.icann.org 2013012485 7200 3600 1209600 3600\"),\n record(\"example.com\", \"NS\", \"sns.dns.icann.org\"),\n record_prio(\"example.com\", \"MX\", \"test.example.com\",10)\n ]\n elsif args[\"qname\"] == \"test.example.com\" and args[\"qtype\"].downcase == \"any\"\n @result = [\n record(\"test.example.com\", \"A\", \"127.0.0.1\")\n ]\n elsif args[\"qname\"] =~ /(.*)\\.example\\.com$/ and args[\"qtype\"].downcase == \"any\"\n ip = 0\n $1.downcase.each_byte do |b| ip = ip + b end\n ip_2 = ip/256\n ip = ip%256\n @result = [\n record(args[\"qname\"], \"A\", \"127.0.#{ip_2}.#{ip}\")\n ]\n end\n end", "def check_hostname_dns_reverse_lookup\n my_fqdn = %x{hostname -f}.chomp\n if !$?.success?\n opoo \"You can't run 'hostname -f'!? I can't check your hostname dns reverse lookup.\"\n elsif %x{traceroute -m 2 \"#{my_fqdn}\" 2>/dev/null}.chomp.lines.to_a.size != 1 || !$?.success?\n # Actually, passing this check only proves that the name is bound to someone in your subnet.\n opoo \"Your effective FQDN (#{my_fqdn}) doesn't seem to traceroute to yourself.\"\n end\n end", "def resolve_fqdn\n hostname = from_cmd(\"hostname\")\n addrinfo = Socket.getaddrinfo(hostname, nil).first\n iaddr = IPAddr.new(addrinfo[3])\n Socket.gethostbyaddr(iaddr.hton)[0]\n rescue\n nil\n end", "def lookup(name)\n begin\n eval(sanitize(name));\n rescue NameError\n return nil\n end\n end", "def fqdn_correct?(host_name, domain_name, ip_addr)\n cmd_if %{egrep -q '^#{ip_addr}[[:space:]]+#{host_name}.#{domain_name}' /etc/hosts >/dev/null}\nend", "def lookup(label, limit=nil)\n $stderr.puts \"DEBUG: #{self.class.name}.lookup(#{label})\" if @debug\n Timeout::timeout(@timeout) {\n url = nil\n params = {\"rrType\" => \"\", \"maxResults\" => limit || 1000}\n \n if label =~ /^\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}$/\n url = @url+\"/dns/data\"\n params[\"ip\"] = label \n else\n resource = api_settings[@version][:resource]\n param = api_settings[@version][:param]\n url = @url+\"/dns/#{resource}\"\n params[param] = label\n end\n url << \"?\"\n params.each do |k,v|\n url << \"#{k}=#{v}&\"\n end\n url.gsub!(/\\&$/,\"\")\n \n $stderr.puts \"DEBUG: #{self.class.name} url = #{url}\" if @debug\n url = URI.parse url\n http = Net::HTTP.new(url.host, url.port)\n http.use_ssl = (url.scheme == 'https')\n http.verify_mode = OpenSSL::SSL::VERIFY_NONE\n http.verify_depth = 5\n request = Net::HTTP::Get.new(url.request_uri)\n request.add_field(\"User-Agent\", \"Ruby/#{RUBY_VERSION} passivedns-client rubygem v#{PassiveDNS::Client::VERSION}\")\n request.add_field('Accept', 'Application/JSON')\n request.add_field('Content-Type', 'Application/JSON')\n request.basic_auth(@token, @privkey)\n t1 = Time.now\n response = http.request(request)\n t2 = Time.now\n recs = parse_json(response.body, label, t2-t1)\n if limit\n recs[0,limit]\n else\n recs\n end\n }\n rescue Timeout::Error\n $stderr.puts \"#{self.class.name} lookup timed out: #{label}\"\n end", "def resolve( hostname )\n if( not hostname.empty? )\n begin\n return Rex::Socket.addr_itoa( Rex::Socket.gethostbyname( hostname )[3].unpack( 'N' ).first )\n rescue ::SocketError\n return nil\n end\n end\n return nil\n end", "def check_dns_available(vm_name)\n begin\n dns_ip = Resolv.getaddress(vm_name)\n rescue Resolv::ResolvError\n # this is the expected case, swallow the error\n # eg \"no address for blah-daisy.example.com\"\n return ['', true]\n end\n [dns_ip, false]\n end", "def fqdn?(ip_or_name)\n # If it is not an IP but contains a Dot, it is an FQDN\n !ip?(ip_or_name) && ip_or_name.include?(\".\")\n end", "def names_for(ip)\n resolvers.each do |r|\n names = r.getnames(ip)\n\n return names unless names.nil? || names.empty?\n end\n\n []\n end", "def hostip(ip)\n if GeoLocation::dev.nil? || GeoLocation::dev.empty?\n url = \"http://api.hostip.info/?ip=#{ip}\"\n uri = URI.parse(url) \n data_from_hostip_http_response(ip, Net::HTTP.get_response(uri).body)\n else\n data_from_maxmind_http_response(ip, GeoLocation::dev)\n end\n end", "def set_nameserver(domain, ip)\n adminrun(\"netsh\", \"interface ip set dns \\\"VMware Network Adapter VMnet8\\\" static #{ip}\")\n end", "def search(ip)\n ip_value = self.class.ip_to_int(ip)\n find_rec(ip_value)\n end", "def get_ip_address\n items = `ifconfig | grep \"inet addr\"`.split\n addresses = []\n items.each do |item|\n addresses << item if item =~ /addr:/\n end\n ip = \"\"\n addresses.each do |address|\n ip = address.split(':')[1]\n if ip != '127.0.0.1'\n break\n end\n end\n ip\nend", "def hostname_to_ip hostname\n begin \n ip = Resolv.getaddress(config[:host])\n rescue Resolv::ResolvError => resolv_err\n raise Exception.new(\"Resolver error: #{resolv_err}\")\n end\n return ip\n end", "def ip_by_mount(name)\n dev = available_dev unless mounted?(name)\n loc = mount(name, dev)\n addr = %x{cat #{File.join(loc, 'etc', 'network', 'interfaces')} | grep address}.split(' ').last.to_s.strip\n unmount_kvm_volume(name, dev) if dev\n addr\nend", "def dig_ptr\n begin\n Resolv.new.getname(self.downcase)\n rescue Resolv::ResolvError\n nil\n end\n end", "def ip\n arp = Cheetah.run([\"arp\", \"-n\"], stdout: :capture)\n entry = arp.lines.find { |a| a.include?(mac) }\n return nil if entry.nil?\n entry.split(\" \")[0]\n end", "def dns_a_record\n @_dns_a_record = \"0.0.0.0\" if @config[:dns_lookup] == :off\n @_dns_a_record ||= Socket.gethostbyname(dns_name)\n rescue SocketError # not found, but could also mean network not work\n @_dns_a_record ||= []\n end", "def get_ip(ip)\n\n #Recorremos todas las reservaciones del usuario\n Reservation.all.each do |reservation|\n #Si la ip de la reservacion es igual a la ip solicitante y tiene un asiento reservado\n # entonces le asigna una ip\n if reservation.ip == ip && (reservation.seat.reserved)\n #se le asigna una nueva ip\n ip = get_ip(add_number(ip))\n end\n end\n return ip\n end", "def location(ip, v = nil)\n r = db.look_up(ip)\n return v if r.nil?\n if v\n v.ip_latitude = r[:latitude]\n v.ip_longitude = r[:longitude]\n v.ip_country_code = r[:country_code]\n v.ip_country_name = r[:country_name]\n v.ip_city = r[:city]\n v.ip_dma_code = r[:dma_code]\n v.ip_area_code = r[:area_code]\n v.ip_region = r[:region]\n v\n else\n r\n end\n end", "def get_instance_by_dns_name(dns_name)\n @groups.each_value { |instances|\n instances.each do |instance|\n if instance.dns_name == dns_name\n return instance\n end\n end\n }\n raise \"unknown dns name: #{dns_name}\"\n end", "def full_host_record(ip:)\n load_cnames\n \n @forward_host_record ||= {} # Global, as we want to do name lookups.\n return_record = []\n unless( (host_records = @infoblox.get_host_by_ip(ip_address: ip)).nil? )\n host_records.each do |hosts|\n hosts.each do |hn|\n # Assign an empty record, if we haven't seen this host before\n @forward_host_record[hn] ||= { hostname: hn, ip: '', aliases: [], cnames: [] }\n \n # Record the IP. There may be multiple IPs with one hostname.\n @forward_host_record[hn][:ip] = ip\n \n # The hostname might have CNAMES point to it\n unless @reverse_cnames[hn].nil?\n @reverse_cnames[hn].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n \n # The hostname may have alternate hostname A records, stored in IPAM as ALIASES\n @infoblox.get_alias(hostname: hn) do |a| \n short_alias = a.split('.',2)[0]\n @forward_host_record[hn][:aliases] << short_alias\n \n # The ALIASes might have CNAME records pointing to it\n unless @reverse_cnames[a].nil?\n # Record the ALIAS CNAMES against the parent hostname.\n @reverse_cnames[a].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n end\n return_record << @forward_host_record[hn]\n \n # Add forward lookup entries for each ALIAS\n host_domain = hn.split('.',2)[1]\n @forward_host_record[hn][:aliases].each do |a|\n @forward_host_record[\"#{a}.#{host_domain}\"] = @forward_host_record[hn]\n end\n \n # Add forward lookup entries for each CNAME\n @forward_host_record[hn][:cnames].each do |cn|\n @forward_host_record[cn] = @forward_host_record[hn]\n end\n \n end\n end\n end\n return return_record\nend", "def set_ip_name\n @ip_name = IpName.find(params[:id])\n end", "def address(public_ip)\n addresses(public_ip)[0]\n end", "def get_host_info(s)\n\n # Prepare response array of aliases (IP and addresses)\n aliases = []\n\n # Get information from the given IP or name\n begin\n resp = Socket.getaddrinfo(s, nil)\n rescue\n aliases << s\n else\n\n fqdn = resp.first[2]\n ip = resp.first[3]\n aliases << fqdn\n\n if fqdn != ip\n host_dom = fqdn.split('.', 2)\n if $local_domain && host_dom.length == 2 && host_dom.last == $local_domain\n aliases << host_dom.first\n end\n aliases << ip\n end\n\n end\n\n return aliases\n\nend", "def arp_saddr_ip= ip\n\t\tself[:arp_src_ip].read_quad(ip)\n\tend", "def extract_ip(addrinfo)\n addrinfo[2]\n end", "def resolve(node)\n begin\n Timeout::timeout(@timeout) do\n Resolv.each_address(host) do |ip|\n if ip =~ Resolv::IPv4::Regex\n @ip ||= ip\n break\n end\n end\n raise Resolv::ResolvError unless @ip\n end\n @resolved ||= \"#{ip}:#{port}\"\n rescue Timeout::Error, Resolv::ResolvError\n Loggable.warn(\" MOPED:\", \"Could not resolve IP for: #{original}\", \"n/a\")\n node.down! and false\n end\n end", "def dns_name instance\n instance.dns_name\n end", "def get_arpa(c,ip)\narpa = ip\n\tif c >= 8 && c < 16\n\t\tarpa = ip.split(\".\")\n\t\tarpa = arpa.last(3).reverse\n\t\tarpa = arpa.join(\".\").to_s\n\telsif c >= 16 && c < 24\n\t\tarpa = ip.split(\".\").last(2).reverse\n\t\tarpa= arpa.join(\".\").to_s\n\telse c >= 24\n\t\tarpa = arpa.split(\".\").last\n\t\treturn arpa\n\t\t\n\tend\n\t\t \nend", "def zone_id_from_name(name)\n route53_client.list_hosted_zones_by_name(dns_name: name).hosted_zones.collect { |x| x.id if x.name == name }.first\n end", "def zone_id_from_name(name)\n route53_client.list_hosted_zones_by_name(dns_name: name).hosted_zones.collect { |x| x.id if x.name == name }.first\n end", "def lookup_name(namecase = nil)\n if namecase == :underscore\n name(namecase)\n else\n @lookup_name ||= class_name.tr('::', '')\n end\n end", "def resolver(fqdn)\n dns = Resolv.new([Resolv::DNS.new( :nameserver => @resolvers, :search => [] )])\n\n # attempt to get address of fqdn\n x = dns.getaddresses(fqdn)\n rescue Resolv::ResolvError\n # move on\n rescue Errno::ENETUNREACH \n raise DomainError.new \"Host #{fqdn} unreachable\"\n else\n x\n end", "def query_ip_address(ip, params={})\n Validation.validate_ip! ip\n query ip, params\n end", "def ip_info(ip,\r\n reverse_lookup = false)\r\n # Prepare query url.\r\n _path_url = '/ip-info'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n\r\n # Prepare form parameters.\r\n _parameters = {\r\n 'output-case' => 'camel',\r\n 'ip' => ip,\r\n 'reverse-lookup' => reverse_lookup\r\n }\r\n _parameters = APIHelper.form_encode_parameters(_parameters)\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.post(\r\n _query_url,\r\n headers: _headers,\r\n parameters: _parameters\r\n )\r\n CustomQueryAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n IPInfoResponse.from_hash(decoded)\r\n end", "def old_ip_address?\n dns.any? do |answer|\n answer.class == Net::DNS::RR::A && LEGACY_IP_ADDRESSES.include?(answer.address.to_s)\n end if dns?\n end", "def site_ip_known?(ip)\n\t\tip=ip.chomp.strip\n\t\tknown=false\n\t\tif is_ip?(ip)\n\t\t\t@known_sites.keys.map do |site|\n\t\t\t\tif @known_sites[site]['ip']==ip\n\t\t\t\t\treturn true\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tmyDis=nil\n\t\treturn known\n\trescue => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\t\treturn false\n\tend", "def domain_name_label\n label = nil\n entries.each do |entry|\n entry.ip_configurations.each do |ip_config|\n if ip_config['public_ipaddress']['attached']\n label = ip_config['public_ipaddress']['domain_name_label']\n end\n end\n end\n\n label\n end", "def get_lookup(name)\n @lookups = {} unless defined?(@lookups)\n @lookups[name] = spawn_lookup(name) unless @lookups.include?(name)\n @lookups[name]\n end", "def ip_by_mac(mac)\n %x{arp -a | grep #{mac}}.split(' ')[1].to_s.sub('(', '').sub(')', '')\nend", "def unused_ip args = {}\n # first check if we already have a record for this host\n # if we do, we can simply reuse the same ip address.\n if args[:mac] and r=has_mac?(args[:mac], :all) and valid_range(args).include?(r.ip)\n logger.debug \"Found an existing dhcp record #{r}, reusing...\"\n return r.ip\n end\n\n free_ips = valid_range(args) - records.collect{|r| r.ip}\n if free_ips.empty?\n logger.warn \"No free IPs at #{to_s}\"\n return nil\n else\n @index = 0\n begin\n # Read and lock the storage file\n stored_index = get_index_and_lock(\"foreman-proxy_#{network}_#{cidr}.tmp\")\n\n free_ips.rotate(stored_index).each do |ip|\n logger.debug \"Searching for free IP - pinging #{ip}\"\n if tcp_pingable?(ip) or icmp_pingable?(ip)\n logger.info \"Found a pingable IP(#{ip}) address which does not have a Proxy::DHCP record\"\n else\n logger.debug \"Found free IP #{ip} out of a total of #{free_ips.size} free IPs\"\n @index = free_ips.index(ip)+1\n return ip\n end\n end\n logger.warn \"No free IPs at #{to_s}\"\n rescue Exception => e\n logger.debug e.message\n ensure\n # ensure we unlock the storage file\n set_index_and_unlock @index\n end\n nil\n end\n end", "def resolve!\n Resolv.each_address(host) do |address|\n return @ip = address if address =~ pattern\n end\n end" ]
[ "0.7518146", "0.7421847", "0.7065777", "0.69774175", "0.69774175", "0.6577427", "0.6483836", "0.6450193", "0.6407519", "0.6296571", "0.6146351", "0.61182237", "0.6105767", "0.6038563", "0.6034028", "0.60202956", "0.5984889", "0.59845454", "0.590961", "0.5900563", "0.5853043", "0.58120203", "0.57907933", "0.5771983", "0.56981754", "0.5681976", "0.56780195", "0.5670774", "0.5651625", "0.5643273", "0.56346464", "0.56148565", "0.56048167", "0.5599606", "0.55983007", "0.55838346", "0.55826646", "0.5580715", "0.55627424", "0.55618536", "0.55582947", "0.5546986", "0.5540132", "0.5535251", "0.55326736", "0.55271673", "0.5509709", "0.5508732", "0.5490143", "0.54901314", "0.5470684", "0.54673076", "0.5461801", "0.5461795", "0.5455672", "0.5453373", "0.54494673", "0.54479975", "0.5442799", "0.54392934", "0.54338676", "0.5414161", "0.5413414", "0.53906155", "0.538325", "0.53784835", "0.53770024", "0.537678", "0.5368721", "0.53557676", "0.5353889", "0.5335526", "0.53270566", "0.53078073", "0.5303605", "0.53026503", "0.52976584", "0.52847904", "0.528201", "0.52752477", "0.5274441", "0.5254267", "0.52539045", "0.5251811", "0.52350736", "0.52320194", "0.52114123", "0.5208217", "0.5208217", "0.520532", "0.51968765", "0.51930666", "0.5180507", "0.5176436", "0.5167636", "0.51661223", "0.51599777", "0.51503855", "0.51417273", "0.5139773" ]
0.738275
2
create a dns record
def create_record(fqdn, type, ipdata) unless @dnss.is_valid? Puppet.crit dns.cstatus end priority = {} # TODO: research how to implement priority for puppet # priority = priority[0] # if priority.nil? # priority = {} # else # priority = { :priority => priority.to_i } # end record = @dnss.create_record(fqdn, type, ipdata, priority) if record.nil? Puppet.err dns.cstatus end Puppet.notice "Created dns record '#{fqdn}' with id '#{record[:id]}'." end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create_dns_record(domain, hostname, type, content, ttl, priority = nil)\n body = {\n 'hostname' => hostname,\n 'type' => type,\n 'content' => content,\n 'ttl' => ttl\n }\n body.update!(:priority => priority) if priority\n connection.post \"/dns/create/#{domain}\", body\n end", "def makeARecord(machine, ttl: Config::TTL_A_RECORD)\n return DnsRecord.new(name: machine.dns_record(),\n type: \"A\",\n content: machine.static_ip(),\n ttl: ttl)\nend", "def create\n Puppet.debug \"starting create #{self.class.to_s}\"\n dns_service = get_dns_service(get_fqdn)\n dns_service.create_record(get_fqdn, get_type, get_ip) if dns_service != nil\n Puppet.debug \"done with create #{self.class.to_s}\"\n end", "def add_domain_record_aaaa(params)\n post('dns/recordaaaa', params)\n end", "def add_domain_record_a(params)\n post('dns/recorda', params)\n end", "def create_single_dns_record(app_name,\n stack_name,\n zone_name,\n record_name,\n ttl: 300,\n type: 'A',\n healthcheck: nil,\n zone_id: nil,\n alias_target: {},\n resource_records: [])\n if type && !RECORD_TYPE.include?(type)\n fail(\"Route53 record type can only be one of the following: #{RECORD_TYPE.join(',')}\")\n end\n if healthcheck && (!healthcheck.is_a?(Hash) || !healthcheck.include?(:Ref))\n fail('healthcheck must be a valid cloudformation Ref function')\n end\n if alias_target && (!alias_target.is_a?(Hash))\n fail('AliasTarget must be a Hash')\n end\n\n name = app_name || stack_name.titleize.remove(/\\s/)\n properties = {\n Name: record_name,\n Comment: \"#{type} record for #{[app_name, 'in '].join(' ') if app_name}#{stack_name} stack\",\n Type: type\n }\n\n # HostedZoneId and HostedZoneName options are mutually exclusive\n if zone_id && !zone_id.nil?\n properties[:HostedZoneId] = zone_id\n else\n properties[:HostedZoneName] = zone_name\n end\n\n if !alias_target.blank?\n fail('AliasTarget can be created only for A or AAAA type records') unless %w(A AAAA).include?(type)\n unless alias_target.key?(:HostedZoneId) && alias_target.key?(:DNSName)\n fail('AliasTarget must have HostedZoneId and DNSName properties')\n end\n properties[:AliasTarget] = alias_target\n else\n properties[:TTL] = ttl\n properties[:HealthCheckId] = healthcheck if healthcheck\n properties[:ResourceRecords] = resource_records.empty? ? ref(\"#{app_name}PublicIpAddress\") : resource_records\n end\n\n resource \"#{name}Hostname\",\n Type: 'AWS::Route53::RecordSet',\n Properties: properties\n end", "def add_domain_record_ns(params)\n post('dns/recordns', params)\n end", "def create\n @dns_record = @zone.dns_records.build(dns_record_params)\n @dns_record.ttl = (30 * 60) if @dns_record.ttl.nil?\n respond_to do |format|\n if @dns_record.save\n format.html { redirect_to zone_path(@zone), notice: 'DNS Record was successfully created.' }\n format.json { render :show, status: :created, location: @zone }\n else\n puts \"failed to save DNS record: #{@dns_record.errors.to_json}\"\n format.html { render 'zones/show' }\n format.json { render json: @dns_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_record(record_type, zone_id, name, data, options = {})\n optional_tags= ''\n options.each { |option, value|\n case option\n when :ttl\n optional_tags+= \"<ttl type='integer'>#{value}</ttl>\"\n when :active\n optional_tags+= \"<active>#{value}</active>\"\n when :aux\n optional_tags+= \"<aux>#{value}</aux>\"\n end\n }\n\n request(\n :body => %Q{<?xml version=\"1.0\" encoding=\"UTF-8\"?><record><record_type>#{record_type}</record_type><zone_id type=\"integer\">#{zone_id}</zone_id><name>#{name}</name><data>#{data}</data>#{optional_tags}</record>},\n :expects => 201,\n :method => 'POST',\n :parser => Fog::Parsers::DNS::Slicehost::CreateRecord.new,\n :path => 'records.xml'\n )\n end", "def create_record(name, value, type = \"A\", ttl = 300)\n # Delete existing record because you can't update records\n delete_record_by_name(name, type, false)\n\n # Create new record\n begin\n @route53.client.change_resource_record_sets({\n :hosted_zone_id => @hosted_zone_id, \n :change_batch => {\n :changes => [ \n {\n :action => \"CREATE\", \n :resource_record_set => { \n :name => name, \n :type => type,\n :ttl => ttl, \n :resource_records => [ { :value => value } ]\n }\n }\n ]\n }\n })\n rescue StandardError => bang\n @log.error \"Error creating A record from Route53: #{bang}\"\n end\n end", "def create_record(zone_id, type, name, content, options={})\n body = %Q{<?xml version=\"1.0\" encoding=\"UTF-8\"?><record><type>#{type}</type><name>#{name}</name><content>#{content}</content>}\n options.each do |k,v|\n body += %Q{<#{k}>#{v}</#{k}>}\n end\n body += %Q{</record>}\n request(\n :body => body,\n :expects => 202,\n :method => 'POST',\n :parser => Fog::Parsers::DNS::Bluebox::CreateRecord.new,\n :path => \"/api/domains/#{zone_id}/records.xml\"\n )\n end", "def new_record(template, domain, record)\n r = Record.new\n\n r.domain_id = domain.id\n r.name = subst(domain, template.name)\n\n if template.type == \"A\" || template.type == \"CNAME\" || template.type == \"AAAA\"\n r.name += \".\" unless template.name.empty?\n r.name += domain.name\n end\n\n r.type = template.type\n\n if template.type == \"A\" || template.type == \"AAAA\"\n unless record[1].empty?\n r.content = record[1]\n else\n r.content = template.content\n record[1] = template.content\n end\n else\n r.content = subst(domain, template.content)\n end\n\n r.ttl = template.ttl\n r.prio = template.prio\n r.change_date = Time.now.to_i\n\n r.save\n return r\n end", "def makeSoaRecord(cluster, ttl: Config::TTL_SOA)\n return DnsRecord.new(name: cluster.nameservers()[0].dns_record(),\n type: \"SOA\",\n content: cluster.hostmasters()[0].dns_record(),\n ttl: ttl)\nend", "def makeARecordGroup(name, machines, ttl: Config::TTL_A_RECORD)\n return DnsRecord.new(name: name,\n type: \"A\",\n content: machines.map(&:static_ip).join(\",\"),\n ttl: ttl)\nend", "def add_domain_record_srv(params)\n post('dns/recordsrv', params)\n end", "def create(options={})\n check_required_keys options, :name, :content, :type, :ttl\n \n r = post(\"/domains/#{@@parent_id}/records\", :query => { \"record[name]\" => options[:name],\n \"record[ttl]\" => options[:ttl],\n \"record[content]\" => options[:content],\n \"record[prio]\" => options[:prio],\n \"record[type]\" => options[:type] })\n r[\"errors\"] and raise StandardError, r[\"errors\"][\"error\"].to_a.join(\", \")\n if r.code == 201\n Record.new r[\"record\"]\n else\n raise StandardError, 'Could not create the record'\n end \n end", "def create_zone(zone, email, ttl)\n @dnsh.name = zone\n @dnsh.email = email\n @dnsh.ttl = ttl\n if @dnsh.save == true\n Puppet.notice \"Created dns zone #{zone} with id #{@dnsh.id}\"\n else\n Puppet.err @dnsh.cstatus\n raise @dnsh.cstatus\n end\n end", "def create\n name, type = resource[:name].split('/')\n rdata = resource[:rdata]\n ttl = resource[:ttl]\n case type\n when 'MX'\n Array(rdata).each_with_index do |exchange, index|\n preference = Array(resource[:preference])[index]\n nsupdate(\"server #{server}\n update add #{name} #{ttl} MX #{preference} #{exchange}\n send\")\n end\n when 'SRV'\n Array(rdata).each_with_index do |target, index|\n port = Array(resource[:port])[index]\n weight = Array(resource[:weight])[index]\n priority = Array(resource[:priority])[index]\n nsupdate(\"server #{server}\n update add #{name} #{ttl} SRV #{priority} #{weight} #{port} #{target}\n send\")\n end\n else\n nsupdate(\"server #{server}\n update add #{name} #{ttl} #{type} #{Array(rdata).first}\n send\")\n end\n end", "def create_domain_record(domainName = nil, hostName = nil, recordType = nil, data = nil, ttl = 0, priority = 0)\n valid_ttls = [0, 1, 60, 300, 600, 900, 1800, 2700, 3600, 7200, 14400, 28800, 43200, 64800, 86400, 172800]\n raise \"Ttl must be one of #{valid_ttls.join(',')}\" if ttl && ! valid_ttls.include?(ttl)\n\n mx_prio = [5, 10, 20, 30, 40, 50, 60, 70, 80, 90]\n f_prio = [1, 2, 3]\n raise \"MX priority must be one of #{mx_prio.join(',')}\" if recordType == \"MX\" and ! mx_prio.include?(priority)\n raise \"F priority must be one of #{f_prio.join(',')}\" if recordType == \"F\" and ! f_prio.include?(priority)\n\n valid_types = [\"A\", \"CNAME\", \"MX\", \"F\", \"TXT\", \"SRV\"]\n raise \"Record type must be one of #{valid_types.join(',')}\" if recordType && ! valid_types.include?(recordType)\n\n DomainRecord.new(domainName, hostName, recordType, data, ttl, priority)\n end", "def new_mx_record(domain, content, ttl, prio)\n r = Record.new\n\n r.domain_id = domain.id\n r.name = domain.name\n r.type = \"MX\"\n r.content = content\n r.ttl = ttl\n r.prio = prio\n r.change_date = Time.now.to_i\n\n r.save\n return r\n end", "def add_record(domain, host, type, value, mx_priority='', ttl=7200)\n domain = find_domain!(domain)\n raise IncorrectDomainType, \"Domain #{host} is a #{domain.type} domain\" unless domain.can_have_records?\n record = Record.new(domain, host, type, value, mx_priority, ttl)\n response = post('/dns.php', record.create_options)\n if response_status_message(response) == RESPONSE_MESSAGES[:RECORD_ADDED]\n clear_domain_records_cache!(domain)\n true\n else\n false\n end\n \n end", "def add(record)\n unless exist?(record[0])\n domain = new_domain(record[0])\n zone = new_zone(domain.id)\n for t in @templates\n new_record(t, domain, record)\n end\n\n if(record[4] == \"yes\")\n @mxgoogle.each do |content, ttl_prio|\n new_mx_record(domain, content, ttl_prio[\"ttl\"], ttl_prio[\"prio\"])\n end\n\n new_txt_record(domain, record[5]) unless record[5].empty?\n end\n\n return record\n else\n update(record)\n end\n\n return nil\n end", "def add_domain_record_cname(params)\n post('dns/recordcname', params)\n end", "def create\n \n dns_entry_response = RestClient.post('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n\n if JSON.parse(dns_entry_response)[\"success\"]\n @dns_entry = DnsEntry.new(dns_entry_params)\n\n respond_to do |format|\n if @dns_entry.save\n format.html { redirect_to @dns_entry, notice: \"Dns entry was successfully created.\" }\n format.json { render :show, status: :created, location: @dns_entry }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @dns_entry.errors, status: :unprocessable_entity }\n end\n end \n\n end\n\n\n end", "def create_multiple_dns_records\n fail('method \"create_multiple_dns_records\" is not implemented')\n end", "def add_domain_record_mx(params)\n post('dns/recordmx', params)\n end", "def create_networksolutions_records\n dme.create_mx_record(params[:domain], '', '0', \"inbound.#{params[:domain]}.netsolmail.net.\", {} )\n\n dme.create_record(params[:domain], 'mail', 'CNAME', \"mail.#{params[:domain]}.netsolmail.net.\", {})\n dme.create_record(params[:domain], 'mail', 'CNAME', \"smtp.#{params[:domain]}.netsolmail.net.\", {})\n end", "def dns_a_record\n @_dns_a_record = \"0.0.0.0\" if @config[:dns_lookup] == :off\n @_dns_a_record ||= Socket.gethostbyname(dns_name)\n rescue SocketError # not found, but could also mean network not work\n @_dns_a_record ||= []\n end", "def create\n Puppet.debug \"starting create #{self.class.to_s}\"\n dns_service = get_dns_service(get_zone)\n dns_service.create_zone(get_zone, get_email, get_ttl) if dns_service != nil\n Puppet.debug \"done with create #{self.class.to_s}\"\n end", "def create_default_records\n dme.create_record(params[:domain], '', 'ANAME', 'www', {})\n dme.create_record(params[:domain], 'www', 'CNAME', 'lb.moxiworks.com', {})\n end", "def add_domain_record_txt(params)\n post('dns/recordtxt', params)\n end", "def create_godaddy_records\n dme.create_mx_record(params[:domain], '', '0', 'smtp.secureserver.net.', {} )\n dme.create_mx_record(params[:domain], '', '5', 'mailstore1.secureserver.net.', {} )\n\n dme.create_record(params[:domain], 'email', 'CNAME', 'email.secureserver.net.', {})\n dme.create_record(params[:domain], 'imap', 'CNAME', 'imap.secureserver.net.', {})\n dme.create_record(params[:domain], 'mail', 'CNAME', 'pop.secureserver.net.', {})\n dme.create_record(params[:domain], 'mobilemail', 'CNAME', 'mobilemail-v01.prod.mesa1.secureserver.net.', {})\n dme.create_record(params[:domain], 'pda', 'CNAME', 'mobilemail-v01.prod.mesa1.secureserver.net.', {})\n dme.create_record(params[:domain], 'pop', 'CNAME', 'pop.secureserver.net.', {})\n dme.create_record(params[:domain], 'smtp', 'CNAME', 'smtp.secureserver.net.', {})\n dme.create_record(params[:domain], 'webmail', 'CNAME', 'webmail.secureserver.net.', {})\n end", "def dns_entry(name, value, type = 'A')\n # FIXME: don't hardcode aws or tiptap.com\n\n conflict_types = {'A' => 'CNAME', 'CNAME' => 'A'}\n\n name = canonicalize(name)\n value = canonicalize(value) if type == 'CNAME'\n zone = Fog::DNS[:aws].zones.all(:domain => 'tiptap.com.').first\n records = Fog::DNS[:aws].records(:zone => zone).all\n record = records.find{|r| r.name == name and r.type == type}\n\n if record and record.value != [value]\n puts \"Deleting old #{type} record (#{name} -> #{record.value})\"\n record.destroy\n record = nil\n @changed = true\n end\n\n # Automatically delete CNAME when creating an A record or vice versa - any other types, you're on your own\n if conflict_types[type]\n conflict_record = records.find{|r| r.name == name and r.type == conflict_types[type]}\n if conflict_record\n puts \"Deleting old, conflicting #{conflict_record.type} record (#{name} -> # conflict_record.value})\"\n conflict_record.destroy\n conflict_record = nil\n @changed = true\n end\n end\n\n unless record\n puts \"Creating #{type} record (#{name} -> #{value})\"\n Fog::DNS[:aws].records(:zone => zone).create(:name => name, :value => value, :type => type, :ttl => 300)\n @changed = true\n end\n\n @changed\n end", "def set_dns_record\n @dns_record = DnsRecord.find(params[:id])\n end", "def dns_record_params\n params.require(:dns_record).permit(:dtype, :name, :ttl, :value, :domain_id)\n end", "def insert_record(name, type, ttl, content)\n records_table.insert(\n :domain_id => domain.id,\n :name => name,\n :type => type, \n :ttl => ttl, \n :content => content,\n :change_date => Time.now.to_i\n )\n end", "def fetch_zone\n \n # zone name pass from url\n zone_name = params[:src]\n # Record type, A or PTR\n record_type = params[:type]\n # zone name pass from url\n network_type = params[:net]\n \n # Output Buffer\n @o = ''\n \n if network_type == 'int'\n dns_zone = DnsZone.find_by_name(zone_name + \"-int\")\n else\n dns_zone = DnsZone.find_by_name(zone_name)\n end\n \n # If can't find the specified zone, we'll return with some useful text\n if dns_zone.nil?\n @o += \"; ##ERROR## Invalid zone name specified.\\n\"\n @o += \"; Valid names can be one of the following:\\n\"\n \n @o += DnsZone.find(:all, :order => :name, :select => :name).collect{|a| \"; \" + a.name}.join(\"\\n\")\n else\n # Our rules for dns record generation. \n # 1. Only generate a record once\n # 2. Generate record in closest zone defined.\n # 3. If nothing match, generate nothing.\n # 4. Record will be specified in absolute name, include the \".\" at the end\n # For ex: ads1.vip.sc9.yahoo.com should match zone, \"vip.sc9.yahoo.com\" first, if not found,\n # try sc9.yahoo.com, then yahoo.com, then .com. If no zone match, then this record is ignored.\n # @o += \"; Generated zone for #{zone_name} on #{Time.new.to_s}\\n\"\n # Dont think we need ORIGIN, will find out when deploy internal DNS\n #@o += \"$ORIGIN #{dns_zone.name}.\\n\"\n @o += \"$TTL #{dns_zone.my_ttl}\\n\"\n \n # In order to make sure we only generate one record, we actually have get all asset and zone\n # then put them in appropriate places. It kinda suck, but one http call can't get us multiple file\n # Unless we get everything into one file, then have the local script to parse it into multiple\n # files, but that sounds a bit too hacky. So instead, we let AST do the expensive work.\n\n # Alright, let's build the SOA first.\n @o += \"@ \\t IN \\t SOA #{dns_zone.my_soa} (\\n\"\n @o += \"\\t\\t\\t #{Time.new.to_i} \\t;serial\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_refresh} \\t;refresh\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_retry} \\t;retry\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_expire} \\t;expire\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_minimum} \\t;minimum\\n\"\n @o += \");\\n\"\n # NS\n for ns in dns_zone.my_dns_ns_records\n @o += \"\\t\\tNS\\t\\t#{ns.name}.\\n\" \n end\n # MX\n for mx in dns_zone.my_dns_mx_records\n @o += \"\\t\\tMX\\t\\t#{mx.priority} #{mx.name}.\\n\"\n end\n \n @o += \"\\n\"\n \n # use appropriate function for each type of record\n if record_type == 'a'\n \t# If master A record is not null, put it in here\n \tif ! dns_zone.mastera.nil?\n @o += \"\\t\\t\\t\\t#{dns_zone.mastera}\\n\\n\"\n end\n @o += fetch_dns_a(zone_name) \n elsif record_type == 'ptr'\n @o += fetch_dns_ptr(zone_name)\n end\n #@o += assets.collect{|a| a.primary_interface.ip_to_string rescue nil}.join(\"<br/>\")\n end\n \n render(:partial => \"output\",:object => @o) \n\n end", "def create_cnames(domain, cname_records)\n account_id = ENV['DNSIMPLE_ACCOUNT']\n cname_records.each do |record|\n cname_name = record.name.chomp(\".#{domain}.\")\n cname_value = record.value.chomp('.')\n\n puts \"#{record.name} => #{record.value}\"\n $dns_client.zones.create_zone_record(account_id, domain, name: cname_name, type: \"cname\", content: cname_value)\n end\nend", "def parse_dns(dns_raw)\n dns_records = {}\n dns_raw.each do |line|\n arr = line.split(\", \")\n if(arr[0] == \"A\" || arr[0] == \"CNAME\")\n dns_records[arr[1]] = {:type => arr[0], :target => arr[2].strip}\n end\n end\n \n return dns_records\n end", "def setup_dns(domain)\n# TODO should we just use the ID instead of the full href?\n owner=@deployment.href\n @dns = SharedDns.new(domain)\n raise \"Unable to reserve DNS\" unless @dns.reserve_dns(owner)\n @dns.set_dns_inputs(@deployment)\n end", "def create_gmail_records\n dme.create_mx_record(params[:domain], '', '1', 'aspmx.l.google.com.', {} )\n dme.create_mx_record(params[:domain], '', '5', 'alt1.aspmx.l.google.com.', {} )\n dme.create_mx_record(params[:domain], '', '5', 'alt2.aspmx.l.google.com.', {} )\n dme.create_mx_record(params[:domain], '', '10', 'aspmx2.l.google.com.', {} )\n dme.create_mx_record(params[:domain], '', '10', 'aspmx3.l.google.com.', {} )\n\n dme.create_record(params[:domain], 'calendar', 'CNAME', 'ghs.google.com.', {})\n dme.create_record(params[:domain], 'docs', 'CNAME', 'ghs.google.com.', {})\n dme.create_record(params[:domain], 'mail', 'CNAME', 'ghs.google.com.', {})\n dme.create_record(params[:domain], 'start', 'CNAME', 'ghs.google.com.', {})\n end", "def setup_dns(domain)\n # TODO should we just use the ID instead of the full href?\n owner=@deployment.href\n @dns = SharedDns.new(domain)\n raise \"Unable to reserve DNS\" unless @dns.reserve_dns(owner)\n @dns.set_dns_inputs(@deployment)\n end", "def setup_dns(domain)\n # TODO should we just use the ID instead of the full href?\n owner=@deployment.href\n @dns = SharedDns.new(domain)\n raise \"Unable to reserve DNS\" unless @dns.reserve_dns(owner)\n @dns.set_dns_inputs(@deployment)\n end", "def dns_update(zone, records)\n update = Dnsruby::Update.new(zone)\n records.each do |r|\n if r.type.upcase == 'ADD'\n s = \"#{Domain} 3600 #{Type} #{RDATA}\"\n rr = Dnsruby::RR.create(s)\n update.add(rr)\n else\n update.delete(r['Domain'], r['Type'], r['RDATA'])\n end\n end\n update\n end", "def update_dns(ad_dns_server, zone, ad_dns_ttl, record_type, value1, value2)\n begin\n # log what we are doing\n log(:info, \"Creating dynamic DNS entry to server: <#{ad_dns_server}>\")\n log(:info, \"DNS Update Values: Zone <#{zone}>, TTL <#{ad_dns_ttl}>, Record Type <#{record_type}>, Value1 <#{value1}> Value2 <#{value2}>\")\n \n # NOTE: this is generic for both forward and reverse record updates\n # A record: value1 = fqdn, value2 = ipaddress\n # PTR record: value1 = reverse ip, value2 = fqdn\n IO.popen(\"nsupdate\", 'r+') do |f|\n f << <<-EOF\n server #{ad_dns_server}\n zone #{zone}\n update add #{value1} #{ad_dns_ttl} #{record_type} #{value2}\n send\nEOF\n\n f.close_write\n end\n \n # log a successful completion message\n log(:info, \"Successfully added #{record_type} record for #{value1}\")\n return true\n rescue => err\n # log failure message\n log(:error, \"#{err.inspect}\")\n log(:error, \"Unable to successfully add #{record_type} record for #{value1}\")\n return false\n end\n end", "def new_txt_record(domain, content)\n r = Record.new\n\n r.domain_id = domain.id\n r.name = domain.name\n r.type = \"TXT\"\n r.content = content\n r.ttl = 3600\n r.prio = 0\n r.change_date = Time.now.to_i\n\n r.save\n return r\n end", "def create(domain_name, type:nil, name:nil, content:nil, ttl:nil, failover:false, failover_content:nil, geozone:'World')\n state_changed = false\n\n domain_id = get_domain_by_name(domain_name)\n geo_region_id = get_geozone_by_name(geozone)\n\n # pull down the list to make sure we're not already matching\n result = match_records(domain_id,\n 'type' => type,\n 'name' => name,\n 'content' => content,\n 'geo_region_id' => geo_region_id\n )\n\n if result.empty?\n url_cmd = \"https://secure.rage4.com/rapi/createrecord/#{domain_id}?name=#{name}&content=#{content}&type=#{type}&geozone=#{geo_region_id}\"\n\n # optional parameters (sent only if specified)\n url_cmd += \"&ttl=#{ttl}\" unless ttl.nil?\n url_cmd += \"&failover=#{failover}\" unless failover.nil?\n url_cmd += \"&failovercontent=#{failover_content}\" unless failover_content.nil?\n\n buffer = open(url_cmd, http_basic_authentication: [@auth_id, @auth_key]).read\n result = JSON.parse(buffer)\n if result['status']\n state_changed = true\n Chef::Log.info \"Created record #{result['id']} #{type} #{name} #{content} #{ttl} #{geozone}\"\n else\n Chef::Log.error(\"Rage4 API error: #{result['error']}\")\n end\n else\n # There's a possibility that there is an existing, at least in terms of region and basic info.\n # optional parameters such as TTL and failover will need to be updated in that case.\n\n result.each do |record|\n # Note that the record result structure has slightly different fields than the api fields.\n options_update = {}\n options_update['ttl'] = { oldvalue: record['ttl'], newvalue: ttl } unless ttl.nil?\n options_update['failover_enabled'] = { oldvalue: record['failover_enabled'], newvalue: failover } unless failover.nil?\n options_update['failover_content'] = { oldvalue: record['failover_content'], newvalue: failover_content } unless failover_content.nil?\n\n rejected_fields = options_update.select { |_criteria, value| value[:oldvalue] != value[:newvalue] }\n unless rejected_fields.empty?\n Chef::Log.info(\"Updating fields #{rejected_fields}\")\n\n url_cmd = \"https://secure.rage4.com/rapi/updaterecord/#{record['id']}?name=#{name}&content=#{content}&geozone=#{geo_region_id}\"\n\n # optional parameters (sent only if specified)\n url_cmd += \"&ttl=#{ttl}\" unless ttl.nil?\n url_cmd += \"&failover=#{failover}\" unless failover.nil?\n url_cmd += \"&failovercontent=#{failover_content}\" unless failover_content.nil?\n\n buffer = open(url_cmd, http_basic_authentication: [@auth_id, @auth_key]).read\n result = JSON.parse(buffer)\n\n if result['status']\n state_changed = true\n Chef::Log.info(\"Overwrite record #{record['id']} #{record['type']} #{record['content']} #{record['name']} #{geozone}\")\n else\n Chef::Log.error(\"Rage4 API error: #{result['error']}\")\n end\n end\n end\n end\n\n state_changed\n end", "def rec_new(zone, type, name, content, ttl, prio = nil, service = nil, srvname = nil, protocol = nil, weight = nil, port = nil, target = nil, service_mode = '1')\n send_req({\n a: :rec_new,\n z: zone,\n type: type,\n name: name,\n content: content,\n ttl: ttl,\n prio: prio,\n service: service,\n srvname: srvname,\n protocol: protocol,\n weight: weight,\n port: port,\n target: target,\n service_mode: service_mode\n })\n end", "def build(domain_name)\n domain = Domain.new(:name => domain_name,\n :ttl => self.ttl,\n :authority_type => Domain::MASTER)\n\n record_templates.dup.each do |template|\n record = template.build(domain_name)\n\n domain.records << record\n domain.soa_record = record if record.is_a?(SOA)\n end\n\n domain\n end", "def create\n\t\t@domain = Domain.new(:hostname => params[:hostname])\n\n\t\t# Attempt to save the domain, and return the appropriate JSON or Error\n\t\trespond_to do |format|\n\t\t\tif @domain.save\n\t\t\t\tformat.json { render json: @domain, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: @domain.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\t\t\n\t\t# Fetch the hostname IP address and update the record in a new thread\n\t\tt1=Thread.new{fetch_origin_ip()}\n\t\tt1.join\n\tend", "def create\n @domain = Domain.friendly.find(params[:domain_id])\n @dns_zone = @domain.dns_zones.create(dns_zone_params.merge({:version => 1}))\n if @dns_zone.save\n redirect_to @domain, notice: 'Dns zone was successfully created.'\n else\n render action: 'edit', @errors => @dns_zone.errors, alert: \"Dns zone validation failed.\"\n end\n end", "def lsepoch_create_host_record(params, record, _host)\n# site_id is valid, since the operation is invoked from the \"Site\" screen - inherited!!!\n _host = Host.new(params[:host])\n _host[:site_id] = record[:site_id]\n# ironically record[:host_id] holds the hostname value parsed from the epoch table (at this time)\n _host[:hostname] = record[:host_id] \n _host[:os] = \"Unknown\"\n _host[:description] = \"Orphaned from the epoch table\"\n _host.save\n return _host\n end", "def rr(type, name, rdata)\n ttl = 3600\n klass = 'IN'\n string = [name, ttl, klass, type, rdata].join(' ')\n Dnsruby::RR.new_from_string(string)\n end", "def domain_create(args)\n raise ArgumentError, \"You can't create a domain with ns records, you must do an update afterwards\" if args.key?(:ns)\n raise ArgumentError, \"You can't create a domain with ds or key records, you must do an update afterwards\" if args.key?(:dsData) || args.key?(:keyData)\n super\n end", "def record(qname,qtype,content,auth=1)\n record_prio_ttl(qname,qtype,content,0,@ttl,auth)\n end", "def convert_record(line)\n record = line.split(' ')\n if record[1] == 'A' || record[1] == 'AAAA'\n ip = IPAddr.new record[2]\n name = ip.reverse\n puts name + \". PTR \" + record[0]\n end\nend", "def parse_dns(dns_raw)\n raw_data=dns_raw.reject { |line| line.empty? or line[0] == \"#\" }#removing hash and empty lines,string\n split_data=raw_data.map { |line| line.strip.split(\", \") }#split the entry into columns using ','\n clean_data=split_data.reject { |record| record.length < 3 }# discarding false entries in zone file\n clean_data.each_with_object({}) do |record, records|# preparing hash for dns entries\n records[record[1]] = {\n type: record[0],\n target: record[2],\n }\n end\n end", "def push\n res = Dnsruby::Resolver.new(self.server)\n res.dnssec=false\n tsig=Dnsruby::RR.create({:name=>zone.domain,:type=\"TSIG\",key=>self.key})\n update=Dnsruby::Update.new(zone.domain)\n #addtotheupdate\n tsig.apply(update) \n response=res.send_message(update)\n end", "def parse_dns(dns_raw)\n hash= {}\n dns_raw.each do |record|\n record = record.split(\",\")\n if record.length() > 1 && record[0] != \"# RECORD TYPE\"\n hash[record[1].strip()] = record[2].strip()\n end\n end\n return hash\n end", "def parse_dns(raw)\n # Filtering Lines with Comments and Empty Lines\n dns_filter = raw.select {|x| x[0]!= \"#\" && x != \"\\n\" }\n\n # Creating a List with 3 Columns\n dns_filter_list = []\n dns_filter.each {|x| dns_filter_list.push(x.split(\", \"))}\n\n # Creating the List each DNS for Hash\n record_type_list = []\n source_list = []\n destination_list = []\n\n dns_filter_list.each do |x|\n record_type_list.push(x[0])\n source_list.push(x[1])\n destination_list.push(x[2])\n end\n\n # Building the Hash\n dns_hash = {\n \"RECORDTYPE\".to_sym => record_type_list,\n \"SOURCE\".to_sym => source_list,\n \"DESTINATION\".to_sym => destination_list,\n }\n return dns_hash\nend", "def parse_dns(dns_raw)\n dns = []\n dns_records = {}\n record_type_A = []\n record_type_A_IP = []\n record_type_CNAME = []\n record_type_CNAME_alias = []\n\n #adds each line to dns array and splipt them with \",\"\n dns_raw.each do |lines_in_files|\n dns.push([lines_in_files.split(\",\")])\n end\n\n #Checks for recordA,IP or recordCNAME and adds them to the respected array\n dns.each do |words_in_files|\n if words_in_files[0][0] == \"A\"\n record_type_A.push(words_in_files[0][1].strip)\n record_type_A_IP.push(words_in_files[0][2].strip)\n elsif words_in_files[0][0] == \"CNAME\"\n record_type_CNAME.push(words_in_files[0][1].strip)\n record_type_CNAME_alias.push(words_in_files[0][2].strip)\n end\n end\n\n #record_A hash stores values of recordA\n record_A = {\n :source => record_type_A,\n :ip => record_type_A_IP,\n }\n\n #recordCNAME hash stores values of recordCNAME\n record_CNAME = {\n :source => record_type_CNAME,\n :alias => record_type_CNAME_alias,\n }\n\n #dns_records gets both Hashes\n dns_records = {\n :A => record_A,\n :CNAME => record_CNAME,\n }\n\n #returns record dns_record with two hashes.\n return dns_records\nend", "def parse_dns(dns_raw)\n dns_records = {}\n dns_raw.each do |rec|\n rec=rec.chomp\n unless rec[0] == \"#\" || rec.empty?\n records = rec.split(/,/)\n records = records.map {|recd| recd.strip()}\n unless dns_records.has_key?(records[0])\n dns_records.store(records[0],[[records[1],records[2]]])\n else\n dns_records[records[0]].push([records[1],records[2]])\n end\n end\n end\n return dns_records\nend", "def create_record\n if @email.to_s.empty? or @server.to_s.empty? or @username.to_s.empty? or @port.to_s.empty?\n raise ArgumentError.new(\"Mandatory arguments are not set\")\n end\n \n params = {}\n params['email'] = @email.to_s\n params['server'] = @server.to_s\n params['username'] = @username.to_s\n params['use_ssl'] = @use_ssl.to_s\n params['port'] = @port.to_s\n params['type'] = @source_type.to_s\n\n # Optional parameters\n params['service_level'] = @service_level if @service_level\n params['sync_period'] = @sync_period if @sync_period\n params['password'] = @password if @password\n params['provider_token'] = @provider_token if @provider_token\n params['provider_token_secret'] = @provider_token_secret if @provider_token_secret\n params['provider_consumer_key'] = @provider_consumer_key if @provider_consumer_key\n\n response = post(\"/2.0/accounts/#{@account_id}/sources\", params)\n response['success']\n end", "def to_dns\n [name, ttl, 'IN', type, supports_prio? ? prio : nil, content].compact.join(' ')\n end", "def parse_dns(raw)\n # Filtering Lines with Comments and Empty Lines\n dns_filter = raw.select { |x| x[0] != \"#\" && x != \"\\n\" }\n\n # Creating a List with 3 Columns\n dns_filter_list = []\n dns_filter.each { |x| dns_filter_list.push(x.split(\", \")) }\n\n # Creating the List each DNS for Hash\n record_type_list = []\n source_list = []\n destination_list = []\n\n dns_filter_list.each do |x|\n record_type_list.push(x[0])\n source_list.push(x[1])\n destination_list.push(x[2])\n end\n\n # Building the Hash\n dns_hash = {\n \"RECORDTYPE\".to_sym => record_type_list,\n \"SOURCE\".to_sym => source_list,\n \"DESTINATION\".to_sym => destination_list,\n }\n return dns_hash\nend", "def pull\n zt=Dnsruby::ZoneTransfer.new\n zt.transfer_type=Dnsruby::Types.AXFR\n zt.server=self.server\n zone=zt.transfer(self.zone.domain)\n zone.tsig=self.zone.domain+\".\", self.key\n soa=zone[0]\n recl=zone[1]\n for record in zone\n src,type,target=record.to_s.match(/([A-z\\.0-9]*)[0-9\\t ]*(IN\\t[A-z]*)\\t([A-z0-9\\. ]*)/).captures\n if type=='IN\\tMX' or type=='IN\\tA' or type=='IN\\tCNAME'\n\tcreateRecord(record)\n elsif type=='IN\\tSOA'\n updateSerial(record)\n end\n end\nend", "def create(domain)\n \n r = whoisgem(domain) # returns the ruby whois response aka the Whois::Record object\n \n # preparing the contact objects\n registrant = Contact.new(r.registrant_contact)\n admin = Contact.new(r.admin_contact)\n tech = Contact.new(r.technical_contact)\n \n # preparing the nameservers\n dns = Nameservers.new(r.nameservers)\n \n # building the record that will be inserted in couch\n #@_id = domain\n @domain_id = r.domain_id\n @domain_name = r.domain\n @status = r.status\n @available = r.available?\n @registered = r.registered?\n @created_on = r.created_on\n @updated_on = r.updated_on\n @expires_on = r.expires_on\n @last_update = r.last_update\n @registrar = Registrar.new(r.registrar.id,\n r.registrar.name,\n r.registrar.organization)\n @registrant = registrant\n @admin = admin\n @technical = tech\n @nameservers = dns\n \n # not implemented yet\n @watchlist = nil\n \n CouchPotato.database.save_document! self\n \n # the boolean is an indicator wether the insertion succeeded or not\n # return boolean\n end", "def dynamic_dns(rule_name, info)\n\n # Get to the advanced page.\n\tself.goto_advanced(rule_name, info)\n \n \t# Get to the \"Dynamic DNS\" page.\n \tbegin\n \t\t@ff.link(:text, 'Dynamic DNS').click\n \t \tself.msg(rule_name, :info, 'Dynamic DNS', 'Reached page \\'Dynamic DNS\\'.')\n\trescue\n\t \tself.msg(rule_name, :error, 'Dynamic DNS', 'Did not reach \\'Dynamic DNS\\'.')\n\t \t return\n \tend\n\n \t# Check the key.\n \tif ( info.has_key?('section') && info.has_key?('subsection') ) then\n \t# Right,go on;\n \telse\n \tself.msg(rule_name,:error,'Dynamic DNS', 'Some key NOT found.')\n \t\treturn\n \tend # End of if\n\n # ###############################################\n # The operation key are divided from three cases;\n # case one : delete a record;\n # two : add a record;\n # three : add multi-record;\n # four : upate the status of recor;\n # ###############################################\n if info.has_key?('Operation')\n\t\n case info['Operation']\n\t \n\t# ########################## \n \t# case one: delete a record;\n \t# ##########################\n\twhen 'delete'\n\n\t\tif @ff.text.include?info['Host Name'] and info['Host Name'] != \" \" then\n\n\t \t\tstr_href = @ff.link(:text,info['Host Name']).href\n\t\t\tstr_href.gsub!('edit','remove')\n\t\t\t@ff.link(:href,str_href).click\n\t\telse\n\t\t\tself.msg(rule_name,:error,'Host Name','Con NOT find the value in \\'Host Name\\'.')\n\t\tend\n\t# ##########################\t\n \t# Case two: add a record;\n \t# ##########################\n \twhen 'add'\n\n\t\t# Delete the same Entry,'Remove')\n \t\tif @ff.text.include?info['Host Name'] and info['Host Name'] != \" \" then\n\t \t\tstr_href = @ff.link(:text,info['Host Name']).href\n\t\t\tstr_href.gsub!('edit','remove')\n\t\t\t@ff.link(:href,str_href).click\n\t\tend # End of if\t\n \t \n\t\t# Add an new Dynamic DNS Entry;\n\t \t@ff.link(:text,'New Dynamic DNS Entry').click\n\t \tself.msg(rule_name,:info,'Add Dynamic DNS Entry','CLICKED')\n\n\t \t# Fill in the \"Host Name\"\n\t \tif info.has_key?('Host Name') \n\t \n\t \t@ff.text_field(:name,'ddns_host').value = info['Host Name']\n\t \tself.msg(rule_name,:info,'Host Name',info['Host Name'])\n\t \telse\n\t \tself.msg(rule_name,:error,'Host Name','Con NOT find the value in \\'Host Name\\'.')\n\t \tend # End of if\n\n\t \t# Select list in the \"Connection\"\n\t \tif info.has_key?('Connection')\n\t\n\t case info['Connection']\n\t \n\t \twhen 'Broadband Connection (Ethernet)'\n\n\t\t \t\t# Set connection is 'Broadband Connection (Ethernet)'\n\t \t\t@ff.select_list(:name,'ddns_device').select(\"Broadband Connection (Ethernet)\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\t \t\n\t \twhen 'WAN Ethernet' \n\n\t\t \t\t# Set connection is 'Broadband Connection (Ethernet)'\n\t \t\t@ff.select_list(:name,'ddns_device').select(\"WAN Ethernet\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\t \t\n\t\t\twhen 'Broadband Connection (Coax)'\n\t \t\t\n\t\t\t\t# Set connection is 'Broadband Connection (Coax)'\n\t \t\t@ff.select_list(:name,'ddns_device').select(\"Broadband Connection (Coax)\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\n\t \twhen 'WAN PPPoE'\n\n\t \t\t# Set connection is 'WAN PPPoE'\n\t \t\t@ff.select_list(:name,'ddns_device').select(\"WAN PPPoE\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\n\t \twhen 'WAN PPPoE 2'\n\n\t \t\t# Set connection is 'WAN PPPoE 2'\n\t \t\t@ff.select_list(:name,'ddns_device').select(\"WAN PPPoE 2\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\t else \n\n\t\t \t \t# Wrong\n\t\t \t \tself.msg(rule_name,:error,'connection','Did NOT find the value in \\'Connection\\'.')\n\t\t \t\t return\n\t \n\t \t \tend # End of case connection;\n\n\t \tend # End of if connection;\n\n\t \t# Select list in the \"provider\"\n\t \tif info.has_key?('Provider')\n\t\n\t \t case info['Provider']\n\t \n\t \t\twhen 'dyndns.org'\n\n\t\t\t\t# Set provider to 'dyndns.org'\n\t \t\t\t@ff.select_list(:name,'ddns_provider').select(\"dyndns.org\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'no-ip.com'\n\n\t\t\t\t# Set provider to 'no-ip.com'\n\t \t\t@ff.select_list(:name,'ddns_provider').select(\"no-ip.com\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'changeip.com'\n\n\t\t\t\t# Set provider to 'changeip.com '\n\t \t\t@ff.select_list(:name,'ddns_provider').select(\"changeip.com \")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'tzo.com'\n\n\t\t\t\t# Set provider to 'tzo.com'\n\t \t\t\t@ff.select_list(:name,'ddns_provider').select(\"tzo.com\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'ods.org'\n\n\t\t\t\t# Set provider to 'ods.org'\n\t \t\t@ff.select_list(:name,'ddns_provider').select(\"ods.org\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'easydns.com'\n\n\t\t\t\t# Set provider to 'easydns.com'\n\t \t\t\t@ff.select_list(:name,'ddns_provider').select(\"easydns.com\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'zoneedit.com'\n\n\t\t\t\t# Set provider to 'zoneedit.com'\n\t \t\t@ff.select_list(:name,'ddns_provider').select(\"zoneedit.com\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\telse \n\t\t\t\t# Wrong\n\t\t\t\tself.msg(rule_name,:error,'connection','Did NOT find the value in \\'Provider\\'.')\n\t\t\t\treturn\n\t \n\t \t\tend # End of case provider;\n\n\t\tend # End of if provider;\n\n\t\tif info.has_key?('User Name') then\n\t \n\t \t\t@ff.text_field(:name,'ddns_username').value = info['User Name']\n\t \t\tself.msg(rule_name,:info,'User Name',info['User Name'])\n\t\tend # end of if\n\n\t\tif info.has_key?('Password') then\n\t \t\t@ff.text_field(:type,'password').set(info['Password'])\n\t \t\tself.msg(rule_name,:info,'Password',info['Password'])\n\t\tend # end of if\n\t\n\n\t\t# Select list in the \"Dynamic DNS System\"\n\t\tif info.has_key?('Dynamic DNS System')\n\t\n\t \t case info['Dynamic DNS System']\n\t \n\t \t\twhen 'Dynamic DNS'\n\n\t\t\t\t# Set 'Dynamic DNS'\n\t \t\t@ff.select_list(:name,'ddns_system').select(\"Dynamic DNS\")\n\t \t\tself.msg(rule_name,:info,'Dynamic DNS System',info['Dynamic DNS System'])\n\t\n\t \t\twhen 'Static DNS'\n\n\t\t\t\t# Set 'Static DNS'\n\t \t\t@ff.select_list(:name,'ddns_system').select(\"Static DNS\")\n\t \t\tself.msg(rule_name,:info,'Dynamic DNS System',info['Dynamic DNS System'])\n\n\t \t\twhen 'Custom DNS'\n\n\t\t\t\t# Set 'Custom DNS'\n\t \t\t@ff.select_list(:name,'ddns_system').select(\"Custom DNS\")\n\t \t\tself.msg(rule_name,:info,'Dynamic DNS System',info['Dynamic DNS System'])\n\n \t \t\telse \n\n\t\t\t\t# Wrong\n\t\t\t\tself.msg(rule_name,:error,'Dynamic DNS System','Did NOT find the value in \\'Dynamic DNS System\\'.')\n\t\t\t\treturn\n\t \n\t \t\tend # End of case Dynamic DNS system;\n\n\t\tend # End of if Dynamic DNS system;\n\n\t\t# Set wildcard to 'on' or 'off'\n\t\tif info.has_key?('Wildcard')\n \n\t \t\t# Enable wildcard \n\t \t case info['Wildcard']\n\t \n\t \t\twhen 'on'\n\t \n\t\t\t\t@ff.checkbox(:name,'dyndns_wildcard').set\n\t\t\t\tself.msg(rule_name,:info,'Wildcard',info['Wildcard']) \n\t \n\t \t\t# Disable wildcard\n\t \t\twhen 'off'\n\t\n\t\t\t\t@ff.checkbox(:name,'dyndns_wildcard').clear\t\n\t\t\t\tself.msg(rule_name,:info,'Wildcard',info['Wildcard'])\n\t \t\telse\n\t\t\t\t# wrong here\n\t\t\t\tself.msg(rule_name,:error,'Wildcard','Did NOT find the value in \\'Wildcard\\'.')\n\t\t\n\t \t end # End of case wildcard\n\n\t\tend # End of if wildcard\n\n\t\t# Set backup mx to 'on' or 'off'\n\t\tif info.has_key?('Backup MX')\n \n\t \t# Enable backup mx\n\t \tcase info['Backup MX']\n\t \n\t \t\twhen 'on'\n\t \n\t\t\t\t@ff.checkbox(:name,'dyndns_backup_mx').set\n\t\t\t\tself.msg(rule_name,:info,'backup mx',info['Backup MX']) \n\t \n\t \t\t# Disable backup mx\n\t \t\twhen 'off'\n\t\n\t\t\t\t@ff.checkbox(:name,'dyndns_backup_mx').clear\t\n\t\t\t\tself.msg(rule_name,:info,'backup mx',info['Backup MX'])\n\t \t\telse\n\t\t\t\t# wrong here\n\t\t\t\tself.msg(rule_name,:error,'Backup MX','Did NOT find the value in \\'backup MX\\'.')\n\t\t\n\t \t end # End of case backup mx\n\n\t\t end # End of if backup Mx\n\n\t\t# Set offline to 'on' or 'off'\n\t\tif info.has_key?('Backup MX')\n \n\t \t# Enable backup mx\n\t \tcase info['Offline']\n\t \n\t \t\twhen 'on'\n\t \n\t\t\t\t@ff.checkbox(:name,'dyndns_offline').set\n\t\t\t\tself.msg(rule_name,:info,'offline',info['Offline']) \n\t \n\t \t\t# Disable offline\n\t \t\twhen 'off'\n\t\n\t\t\t\t@ff.checkbox(:name,'dyndns_offline').clear\t\n\t\t\t\tself.msg(rule_name,:info,'offline',info['Offline'])\n\t \t\telse\n\t\t\t\t# wrong here\n\t\t\t\tself.msg(rule_name,:error,'Offline','Did NOT find the value in \\'Offline\\'.')\n\t\t\n\t \t end # End of case offline\n\n\t\t end # End of if offline\n\n\t\t# Apply for the change;\n\t\t@ff.link(:text,'Apply').click\n if @ff.text.include?'Input Errors'\n # Error here.\n \n # Find the table.\n sTable = false\n @ff.tables.each do |t|\n\t\t\tif ( t.text.include? ':' and \n\t\t\t\t( not t.text.include? 'Input Errors') and\n\t\t\t\t( not t.text.include? 'Cancel') and\n\t\t\t\tt.row_count >= 1 )then\n\t\t\t\t\tsTable = t\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n \n\t\tif sTable == false\n # Wrong here\n\t\t\tself.msg(rule_name,:error,'System Settings','Did NOT find the target table.')\n\t\t\treturn\n\t\tend\n \n\t\tsTable.each do |row|\n \n\t\t\tif row[1] == \"\" or row[2] == nil\n\t\t\tnext\n\t\t\tend\n \n\t\t\tself.msg(rule_name,:error,row[1],row[2])\n \n\t\tend\n \n\t\t# Click the \"cancel\"\n\t\t@ff.link(:text,'Cancel').click\n \n\t\treturn\n \n end \n\t\t# Jump out the \"Input Errors\"?\n\t\tif @ff.text.include?'Input Errors' then\n\n\t\t\t@ff.link(:text,'Cancel').click\n \t \t\tself.msg(rule_name,:error,'Dynamic_DNS','Input content may not correct.')\n\t \t\treturn\n\t\telse\n\t \t\tself.msg(rule_name,:info,'Dynamic DNS','SUCCESS')\n\t\n\t\tend # End of case\n\n\n\t # Add Dynamic DNS entry ok.\n\t #\n\t # close the page\n\t #@ff.link(:text,'Close').click\n\t# ##########################\t\n \t# Case three: add multi record;\n \t# ##########################\n \twhen 'multihost'\n\t\t\n\t if info.has_key?('Loop Number')\n\t\t\t\n\t for i in 1..info['Loop Number'].to_i\t\n\t\t\n\t\t# Delete the Entry as same,'Remove')\n \t\t#if @ff.text.include? info['Host Name'] and info['Host Name'] != \" \" then\n\t \t#\tstr_href = @ff.link(:text,info['Host Name']).href\n\t\t#\tstr_href.gsub!('edit','remove')\n\t\t#\t@ff.link(:href,str_href).click\n\t\t#end # End of if\t\n\n\t\t# Add an new Dynamic DNS Entry;\n\t \t@ff.link(:text,'New Dynamic DNS Entry').click\n\t \tself.msg(rule_name,:info,'Add Dynamic DNS Entry','CLICKED')\n\n\t \t# Fill in the \"Host Name\"\n\t \tif info.has_key?('Host Name') \n\t \n\t \t@ff.text_field(:name,'ddns_host').value = info['Host Name'] + i.to_s\n\t \tself.msg(rule_name,:info,'Host Name',info['Host Name'] + i.to_s)\n\t \telse\n\t \tself.msg(rule_name,:error,'Host Name','Con NOT find the value in \\'Host Name\\'.')\n\n\t \tend # End of if\n\n\t \t# Select list in the \"Connection\"\n\t \tif info.has_key?('Connection')\n\t\n\t case info['Connection']\n\t \n\t \twhen 'WAN Ethernet'\n\n\t\t \t\t# Set connection is 'Broadband Connection (Ethernet)'\n\t \t\t@ff.select_list(:name,'ddns_device').select(\"WAN Ethernet\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\t\t\twhen 'Broadband Connection (Ethernet)'\t \t\n\n\t\t \t\t# Set connection is 'Broadband Connection (Ethernet)'\n\t \t\t@ff.select_list(:name,'ddns_device').select(\"Broadband Connection (Ethernet)\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\n\t \twhen 'Broadband Connection (Coax)'\n\n\t \t\t# Set connection is 'Broadband Connection (Coax)'\n\t \t\t@ff.select_list(:name,'ddns_device').select(\"Broadband Connection (Coax)\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\n\t \twhen 'WAN PPPoE'\n\n\t \t\t# Set connection is 'WAN PPPoE'\n\t \t\t@ff.select_list(:name,'ddns_device').select(\"WAN PPPoE\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\n\t \twhen 'WAN PPPoE 2'\n\n\t \t\t# Set connection is 'WAN PPPoE 2'\n\t \t\t@ff.select_list(:name,'ddns_device').select(\"WAN PPPoE 2\")\n\t \t\tself.msg(rule_name,:info,'Connection',info['Connection'])\n\t else \n\n\t\t \t \t# Wrong\n\t\t \t \tself.msg(rule_name,:error,'connection','Did NOT find the value in \\'Connection\\'.')\n\t\t \t\t return\n\t \n\t \t \tend # End of case connection;\n\n\t \tend # End of if connection;\n\n\t \t# Select list in the \"provider\"\n\t \tif info.has_key?('Provider')\n\t\n\t \t case info['Provider']\n\t \n\t \t\twhen 'dyndns.org'\n\n\t\t\t\t# Set provider to 'dyndns.org'\n\t \t\t\t@ff.select_list(:name,'ddns_provider').select(\"dyndns.org\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'no-ip.com'\n\n\t\t\t\t# Set provider to 'no-ip.com'\n\t \t\t@ff.select_list(:name,'ddns_provider').select(\"no-ip.com\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'changeip.com'\n\n\t\t\t\t# Set provider to 'changeip.com '\n\t \t\t@ff.select_list(:name,'ddns_provider').select(\"changeip.com \")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'tzo.com'\n\n\t\t\t\t# Set provider to 'tzo.com'\n\t \t\t\t@ff.select_list(:name,'ddns_provider').select(\"tzo.com\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'ods.org'\n\n\t\t\t\t# Set provider to 'ods.org'\n\t \t\t@ff.select_list(:name,'ddns_provider').select(\"ods.org\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'easydns.com'\n\n\t\t\t\t# Set provider to 'easydns.com'\n\t \t\t\t@ff.select_list(:name,'ddns_provider').select(\"easydns.com\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\twhen 'zoneedit.com'\n\n\t\t\t\t# Set provider to 'zoneedit.com'\n\t \t\t@ff.select_list(:name,'ddns_provider').select(\"zoneedit.com\")\n\t \t\tself.msg(rule_name,:info,'Provider',info['Provider'])\n\n\t \t\telse \n\t\t\t\t# Wrong\n\t\t\t\tself.msg(rule_name,:error,'connection','Did NOT find the value in \\'Provider\\'.')\n\t\t\t\treturn\n\t \n\t \t\tend # End of case provider;\n\n\t\tend # End of if provider;\n\n\t\tif info.has_key?('User Name') then\n\t \n\t \t\t@ff.text_field(:name,'ddns_username').value = info['User Name']\n\t \t\tself.msg(rule_name,:info,'User Name',info['User Name'])\n\t\tend # end of if\n\n\t\tif info.has_key?('Password') then\n\t \t\t@ff.text_field(:type,'password').set(info['Password'])\n\t \t\tself.msg(rule_name,:info,'Password',info['Password'])\n\t\tend # end of if\n\t\n\n\t\t# Select list in the \"Dynamic DNS System\"\n\t\tif info.has_key?('Dynamic DNS System')\n\t\n\t \t case info['Dynamic DNS System']\n\t \n\t \t\twhen 'Dynamic DNS'\n\n\t\t\t\t# Set 'Dynamic DNS'\n\t \t\t@ff.select_list(:name,'ddns_system').select(\"Dynamic DNS\")\n\t \t\tself.msg(rule_name,:info,'Dynamic DNS System',info['Dynamic DNS System'])\n\t\n\t \t\twhen 'Static DNS'\n\n\t\t\t\t# Set 'Static DNS'\n\t \t\t@ff.select_list(:name,'ddns_system').select(\"Static DNS\")\n\t \t\tself.msg(rule_name,:info,'Dynamic DNS System',info['Dynamic DNS System'])\n\n\t \t\twhen 'Custom DNS'\n\n\t\t\t\t# Set 'Custom DNS'\n\t \t\t@ff.select_list(:name,'ddns_system').select(\"Custom DNS\")\n\t \t\tself.msg(rule_name,:info,'Dynamic DNS System',info['Dynamic DNS System'])\n\n \t \t\telse \n\n\t\t\t\t# Wrong\n\t\t\t\tself.msg(rule_name,:error,'Dynamic DNS System','Did NOT find the value in \\'Dynamic DNS System\\'.')\n\t\t\t\treturn\n\t \n\t \t\tend # End of case Dynamic DNS system;\n\n\t\tend # End of if Dynamic DNS system;\n\n\t\t# Set wildcard to 'on' or 'off'\n\t\tif info.has_key?('Wildcard')\n \n\t \t\t# Enable wildcard \n\t \t case info['Wildcard']\n\t \n\t \t\twhen 'on'\n\t \n\t\t\t\t@ff.checkbox(:name,'dyndns_wildcard').set\n\t\t\t\tself.msg(rule_name,:info,'Wildcard',info['Wildcard']) \n\t \n\t \t\t# Disable wildcard\n\t \t\twhen 'off'\n\t\n\t\t\t\t@ff.checkbox(:name,'dyndns_wildcard').clear\t\n\t\t\t\tself.msg(rule_name,:info,'Wildcard',info['Wildcard'])\n\t \t\telse\n\t\t\t\t# wrong here\n\t\t\t\tself.msg(rule_name,:error,'Wildcard','Did NOT find the value in \\'Wildcard\\'.')\n\t\t\n\t \t end # End of case wildcard\n\n\t\tend # End of if wildcard\n\n\t\t# Apply for the change;\n\t\t@ff.link(:text,'Apply').click\n\t \n\t\t# need to logout when multi-login \n\t\t#@ff.select_list(:name,'logout').select(\"Logout\")\n\t\t#self.msg(rule_name,:info,'Logout','Logout the page of DUT.')\n\t\t#@ff.link(:name,'logout').click\t\n\t\t#self.msg(rule_name,:info,'Logout','Logout the page of DUT.')\n\t\n\t\t# Jump out the \"Input Errors\"?\n\t\tif @ff.text.include?'Input Errors' then\n\n\t\t\t@ff.link(:text,'Cancel').click\n \t \t\tself.msg(rule_name,:error,'Dynamic_DNS','Input content may not correct.')\n\t \t\treturn\n\t\telse\n\t \t\tself.msg(rule_name,:info,'Dynamic DNS','SUCCESS')\n\t\n\t\tend # End of if\n\t\t\n\t\t \n\t end # End of loop;\n\n\t # Add Dynamic DNS entry ok.\n\t #\n\t # close the page\n\t @ff.link(:text,'Close').click\n\t end # End of case\n \t\n\t# ###########################\n \t# case four: update a record;\n \t# ###########################\n\twhen 'update'\n\n\t if @ff.text.include?info['Host Name'] then\n\n\t begin\n \t\t@ff.link(:href, 'javascript:mimic_button(\\'ddns_host_update: 0..\\', 1)').click\n\t\t\tself.msg(rule_name,:info,'update','Update the status of host name') \n \t\trescue\n\t\t\tself.msg(rule_name,:error,'update','Con NOT find the link of update ')\n \t\treturn\n \t\tend \n \n \t\t# Waiting for update\n \t\tsleep 10\n\n \t\t# To Click Refresh to see if the status has been changed\n \t\tbegin\n \t\t@ff.link(:text, \"Refresh\").click\n\t\t\tself.msg(rule_name,:info,'refresh','refrash the status of host name') \n \t\trescue\n \t\tself.msg(rule_name,:error,'refresh','Con NOT find the link of refresh ')\n \t\treturn\n \t\tend\n\n \t\tif @ff.text.match 'Updated' then\n \t\tself.msg(rule_name,:info,'status','The status of \\'hostname\\' is successful')\n \t\telse\n \t\tself.msg(rule_name,:error,'status','The status of \\'hostname\\' is fail ')\n \t\tend\n\n\t\t\t\n\t else\n\t\tself.msg(rule_name,:error,'Host Name','Con NOT find the value in \\'Host Name\\'.')\n\t end\n\t #################################\n\t ##read the dns server's status###\n\t #################################\n\twhen 'read the status'\n\t sTable = false\n\t @ff.tables.each do |t|\n\t\tif ( t.text.include? 'Host Name' and\n\t\t ( not t.text.include? 'Domain Name Server') and\n\t\t t.row_count > 1 )then\n\t\t sTable = t\n\t\t break\n\t\tend\n\t end\n\t if sTable == false\n # Wrong here\n\t\tself.msg(rule_name,:error,'read ddns status','Did NOT find the target table.')\n\t else\n\t\tsTable.each do |row|\n\t\t if ((not row.text.include? 'Host Name') and (not row.text.include? 'New Dynamic DNS Entry'))\n\t\t self.msg(rule_name,:info,row[1].to_s.gsub(':',''),row[2].to_s);\n\t\tend\n\t end\n\tend\n \n # Find the row\n \n\n\telse\n \t\tself.msg(rule_name,:error,'dns_server','Not right the operation to execute')\n \t\treturn\n \t\n\tend # End of case;\n\n end # End of operation;\n\t\n end", "def create\n @dns_device_assoc = DnsDeviceAssoc.new(params[:dns_device_assoc])\n\n respond_to do |format|\n if @dns_device_assoc.save\n format.html { redirect_to @dns_device_assoc, notice: 'Dns device assoc was successfully created.' }\n format.json { render json: @dns_device_assoc, status: :created, location: @dns_device_assoc }\n else\n format.html { render action: \"new\" }\n format.json { render json: @dns_device_assoc.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_system_record(sys_name, ks_label, ip, mac)\n netdev = { 'ip' => ip, 'mac' => mac, 'name' => 'eth0' }\n netdevs = [netdev]\n @connection.call('system.create_system_record', @sid, sys_name, ks_label, '', '', netdevs)\n end", "def gen_hostrecord(host:, rack:, u:, net:, ip: nil, extra_aliases: [], switch: false, **_ignore)\n set_rack_ip_offsets\n set_subnets\n rack.downcase!\n if u.is_a?(String)\n u_str = u\n u = ( /\\A\\D.*\\z/ =~ u ? 0 : u.to_i )\n else\n u_str = \"%02d\"%u\n end\n aliases = []\n # puts \"#{host} #{rack} #{u} #{net}\"\n #\n # Legacy Cop node names and legacy adm nodes\n if @cop_index.key?(host)\n if net == 'api' # Want the default hostname to be on this interface\n hostname = \"ntr-#{host}.nectar.auckland.ac.nz\" # ntr-copXX\n aliases = [\n \"#{host}\", # copXX\n \"akld2#{rack}u#{u_str}\", # akld2h18uXX\n \"#{rack}u#{u_str}\", # h18uXX\n \"ntr-#{host}-#{net}\", # ntr-copXX-api\n \"#{host}-#{net}\", # copXX-api\n \"akld2#{rack}u#{u_str}-#{net}\", # akld2h18uXX-api\n \"#{rack}u#{u_str}-#{net}\", # h18uXX-api\n ]\n extra_aliases.each do |ea|\n aliases << ea unless aliases.include?(ea)\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n else\n hostname = \"ntr-#{host}-#{net}.nectar.auckland.ac.nz\" # ntr-copXX-net\n aliases = [\n \"#{host}-#{net}\", # copXX-net\n \"akld2#{rack}u#{u_str}-#{net}\", # akld2h18uXX-net\n \"#{rack}u#{u_str}-#{net}\" # h18uXX-net\n ]\n extra_aliases.each do |ea|\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n end\n ip ||= ( @ip_subnet[net] + IPv4.new(@cop_index[host]).to_i ).to_s\n #\n # Legacy storage node naming\n elsif @sto_index.key?(host) \n if net == 'ceph' # Want the default hostname to be on this interface\n hostname = \"ntr-#{host}.nectar.auckland.ac.nz\" # ntr-stoXX\n aliases = [ \n \"akld2#{rack}u#{u_str}\", # akld2h18uXX\n \"#{rack}u#{u_str}\", # h18uXX\n \"ntr-#{host}-#{net}\", # ntr-stoXX-ceph\n \"#{host}-#{net}\", # stoXX-ceph\n \"akld2#{rack}u#{u_str}-#{net}\", # akld2h18uXX-ceph\n \"#{rack}u#{u_str}-#{net}\", # h18uXX-ceph\n ] \n extra_aliases.each do |ea|\n aliases << ea unless aliases.include?(ea)\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n else\n hostname = \"ntr-#{host}-#{net}.nectar.auckland.ac.nz\" # ntr-stoXX-net\n aliases = [ \n \"#{host}-#{net}\", # stoXX-net\n \"akld2#{rack}u#{u_str}-#{net}\", # akld2h18uXX-net\n \"#{rack}u#{u_str}-#{net}\", # h18uXX-net\n ] \n extra_aliases.each do |ea|\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n end\n ip ||= (@ip_subnet[net] + IPv4.new(@sto_index[host]).to_i ).to_s\n #\n # new storage node naming, with legacy aliases\n elsif @new_sto_index.key?(host)\n if net == 'ceph' # Want the default hostname to be on this interface\n hostname = \"akld2#{rack}u#{u_str}.nectar.auckland.ac.nz\"# akld2h18uXX\n aliases = [\n \"ntr-#{@new_sto_index[host]}\", # ntr-stoXX\n \"#{@new_sto_index[host]}\", # stoXX\n \"#{rack}u#{u_str}\", # h18uXX\n \"ntr-#{@new_sto_index[host]}-#{net}\",# ntr-stoXX-ceph\n \"#{@new_sto_index[host]}-#{net}\", # stoXX-ceph\n \"akld2#{rack}u#{u_str}-#{net}\", # akld2h18uXX-ceph\n \"#{rack}u#{u_str}-#{net}\", # h18uXX-ceph\n ] \n extra_aliases.each do |ea|\n aliases << ea unless aliases.include?(ea)\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n else\n hostname = \"akld2#{rack}u#{u_str}-#{net}.nectar.auckland.ac.nz\" # akld2h18uXX-net\n aliases = [ \n \"ntr-#{@new_sto_index[host]}-#{net}\", # ntr-stoXX-net\n \"#{@new_sto_index[host]}-#{net}\", # stoXX-net\n \"#{rack}u#{u_str}-#{net}\", # h18uXX-net\n ] \n extra_aliases.each do |ea|\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n end\n ip ||= (@ip_subnet[net] + @ip_offset[rack] + u).to_s\n #\n # All other hosts should be named by rack and u\n elsif switch\n if net == 'm' # Want the default hostname to be on this interface\n hostname = \"akld2#{rack}x#{u_str}.nectar.auckland.ac.nz\"# akld2h18xXX\n aliases = [\n \"#{rack}x#{u_str}\", # h18xXX\n \"akld2#{rack}x#{u_str}-#{net}\", # akld2h18xXX-api\n \"#{rack}x#{u_str}-#{net}\", # h18xXX-api\n ]\n # Add in extra aliases\n extra_aliases.each do |ea|\n aliases << ea unless aliases.include?(ea)\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n else\n hostname = \"akld2#{rack}x#{u_str}-#{net}.nectar.auckland.ac.nz\" # akld2h18uXX-net\n aliases = [\n \"#{rack}x#{u_str}-#{net}\" # h18xXX-net\n ]\n # Add in extra aliases\n extra_aliases.each do |ea|\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n end\n ip ||= (@ip_subnet[net] + @ip_offset[rack] + u).to_s\n else\n if net == 'api' # Want the default hostname to be on this interface\n hostname = \"akld2#{rack}u#{u_str}.nectar.auckland.ac.nz\"# akld2h18uXX\n aliases = [\n \"#{rack}u#{u_str}\", # h18uXX\n \"akld2#{rack}u#{u_str}-#{net}\", # akld2h18uXX-api\n \"#{rack}u#{u_str}-#{net}\", # h18uXX-api\n ]\n extra_aliases.each do |ea|\n aliases << ea unless aliases.include?(ea)\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n else\n hostname = \"akld2#{rack}u#{u_str}-#{net}.nectar.auckland.ac.nz\" # akld2h18uXX-net\n aliases = [\n \"#{rack}u#{u_str}-#{net}\" # h18uXX-net\n ]\n extra_aliases.each do |ea|\n aliases << \"#{ea}-#{net}\" unless aliases.include?(\"#{ea}-#{net}\")\n end\n end\n ip ||= (@ip_subnet[net] + @ip_offset[rack] + u).to_s\n end\n \n \n return { hostname: hostname, ip: ip, aliases: aliases, cnames: [] }\nend", "def add(record, zone)\n new_answers = [{ answer: build_api_answer_from_record(record) }]\n\n record_fqdn = record.fqdn.sub(/\\.$/, '')\n\n existing_record = client.record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type\n )\n\n if existing_record.nil?\n client.create_record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type,\n params: {\n answers: new_answers,\n ttl: record.ttl,\n use_client_subnet: false, # only required for filter chains that are not supported by record_store\n }\n )\n return\n end\n\n existing_answers = existing_record['answers'].map { |answer| symbolize_keys(answer) }\n client.modify_record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type,\n params: { answers: existing_answers + new_answers, ttl: record.ttl }\n )\n end", "def create_zone attrs\n ZerigoDNS::Zone.create({follow_template: 'follow', zone_template_id: id}.merge(attrs))\n end", "def create\n @dns_zone = DnsZone.new(params[:dns_zone])\n\n respond_to do |format|\n if @dns_zone.save\n flash[:notice] = 'DnsZone was successfully created.'\n format.html { render :action => \"edit\" }\n #format.html { redirect_to(@dns_zone) }\n format.xml { render :xml => @dns_zone, :status => :created, :location => @dns_zone }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dns_zone.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create_domain_string(dns_query, parsed_dns, domain_str_num)\n buf = \"\"\n dns_query[parsed_dns[:index] + 1, domain_str_num].unpack(\"C*\").each{|c| buf << sprintf(\"%c\", c)} unless domain_str_num == 0\n buf = nil if buf == \"\"\n parsed_dns[:domain_name_dictionary] << {:first_index => parsed_dns[:index], :domain_name => buf}\n parsed_dns[:index] += domain_str_num + 1\n return buf\n end", "def parse_dns(dns_raw)\n\tdns_records = {}\n\n\n\tdns_raw.\n\tmap{|line| line.strip }.\n\treject {|line| line.empty?}.\n\treject {|line| line[0] == \"#\" }.\n\n\teach{|line|\n\t\tinfo = line.split \",\"\n\t\tdns_records[info[1].strip] = { :type => info[0].strip, :val => info[2].strip }\n\t}\n\treturn dns_records\nend", "def get_parsed_dns( dns_query )\n begin\n parsed_dns = {\n :index => 0,\n :domain_name_dictionary => [],\n :dns_header_field => Hash.new(),\n :question_section => Hash.new(),\n :answer_section => Hash.new(),\n :authority_section => Hash.new(),\n :additional_section => Hash.new()\n }\n\n parsed_dns[:dns_header_field] = get_header_section(dns_query)\n parsed_dns[:index] = QUESTION_FIELD_START_INDEX\n parsed_dns[:question_section] = get_question_section(dns_query, parsed_dns)\n parsed_dns[:answer_section] = get_answer_resource_record(dns_query, parsed_dns)\n parsed_dns[:authority_section] = get_authority_resource_record(dns_query, parsed_dns)\n parsed_dns[:additional_section] = get_additional_resource_record(dns_query, parsed_dns)\n rescue\n end\n parsed_dns\n end", "def build( domain = nil )\n record_class = self.record_type.constantize\n\n # make a clean copy of ourself\n attrs = self.attributes.dup\n attrs.delete_if { |k,_| !record_class.columns.map(&:name).include?( k ) }\n attrs.delete('id')\n\n # parse each attribute for %ZONE%\n unless domain.nil?\n attrs.keys.each do |k|\n attrs[k] = attrs[k].gsub( '%ZONE%', domain.name ) if attrs[k].is_a?( String )\n end\n end\n\n record_class.new( attrs )\n end", "def create_certificate(domain_name)\n token = Digest::MD5.hexdigest(domain_name)\n response = $acm.request_certificate(\n domain_name: \"*.#{domain_name}\", \n validation_method:\"DNS\", \n subject_alternative_names: [domain_name], \n idempotency_token: token\n ) \n cert_data = $acm.describe_certificate certificate_arn: response.certificate_arn\n\n cname_records = cert_data.certificate.domain_validation_options.map do |rec|\n OpenStruct.new(name: rec.resource_record.name, value: rec.resource_record.value)\n end\n\n cname_records.uniq\nend", "def get_record_type(dns_name, dns_values)\n # default to CNAME\n record_type = 'cname'\n # if the value is an IP then it is an 'A' record\n ips = dns_values.grep(/\\d+\\.\\d+\\.\\d+\\.\\d+/)\n record_type = 'a' unless ips.empty?\n record_type = 'ptr' if dns_name =~ /^\\d+\\.\\d+\\.\\d+\\.\\d+$/\n record_type\n end", "def generate_dns_file(conf_file=nil)\n project_info = self.details\n domain = project_info[:domain]\n case conf_file\n## named.conf\n when nil, \"named\"\n forwarders = Lab.find(self.lab_id).nameservers.join(\";\")\n base_file = File.open(Rails.root + \"lib/configurations/named.conf_base\", 'rb')\n conf = base_file.read\n base_file.close\n conf+=<<EOF\ninclude \"apps.#{domain}.key\";\n\nacl \"openstack\" { 192.168.1.0/24; };\n\nview \"internal\" {\n match-clients { \"openstack\"; };\n include \"/etc/named.rfc1912.zones\";\n recursion yes;\n forwarders { #{forwarders}; };\n\n zone \"#{domain}\" IN {\n type master;\n file \"static/#{domain}-internal.db\";\n };\n\n zone \"apps.#{domain}\" IN {\n type slave;\n masters { 127.0.0.1; };\n file \"dynamic/apps.#{domain}-slave.db\";\n allow-notify { #{project_info[:named_ip]}; };\n allow-update-forwarding { \"openstack\"; };\n };\n\n zone \"1.168.192.in-addr.arpa\" IN {\n type master;\n file \"static/192.168.1.db\";\n };\n};\n\nview \"global\" {\n match-clients { any; };\n include \"/etc/named.rfc1912.zones\";\n recursion no;\n\n zone \"apps.#{domain}\" IN {\n type master;\n file \"dynamic/apps.#{domain}.db\";\n allow-update { key \"apps.#{domain}\" ; };\n allow-transfer { 127.0.0.1; #{project_info[:named_ip]}; };\n also-notify { #{project_info[:named_ip]}; };\n };\n\n zone \"#{domain}\" IN {\n type master;\n file \"static/#{domain}-global.db\";\n };\n};\nEOF\n\n## STATIC GLOBAL\n when \"static-global\"\n conf=<<EOF\n$ORIGIN .\n$TTL 60 ; 1 minute\n#{domain} IN SOA #{project_info[:named_hostname]}. hostmaster.#{domain}. (\n 2011112941 ; serial\n 60 ; refresh (1 minute)\n 15 ; retry (15 seconds)\n 1800 ; expire (30 minutes)\n 10 ; minimum (10 seconds)\n )\n NS #{project_info[:named_hostname]}.\n$ORIGIN #{domain}.\napps IN NS #{project_info[:named_hostname]}.\n\nEOF\n project_info[:named_entries].each do |entry|\n host = entry.split(\":\")[0]\n ip = entry.split(\":\")[1]\n conf += \"#{host} A #{ip}\\n\"\n end\n\n## STATIC INTERNAL\n when \"static-internal\"\n conf=<<EOF\n$ORIGIN .\n$TTL 60 ; 1 minute\n#{domain} IN SOA #{project_info[:named_hostname]}. hostmaster.#{domain}. (\n 2011112941 ; serial\n 60 ; refresh (1 minute)\n 15 ; retry (15 seconds)\n 1800 ; expire (30 minutes)\n 10 ; minimum (10 seconds)\n )\n NS #{project_info[:named_hostname]}.\n$ORIGIN #{domain}.\napps IN NS #{project_info[:named_hostname]}.\n\nEOF\n project_info[:internal_named_entries].each do |entry|\n host = entry.split(\":\")[0]\n ip = entry.split(\":\")[1]\n conf += \"#{host} A #{ip}\\n\"\n end\n\n## DYNAMIC\n when \"dynamic-master\", \"dynamic-slave\", \"dynamic\"\n conf=<<EOF\n$ORIGIN .\n$TTL 10 ; 10 seconds\napps.#{domain} IN SOA #{project_info[:named_hostname]}. hostmaster.#{domain}. (\n 2012113117 ; serial\n 60 ; refresh (1 minute)\n 15 ; retry (15 seconds)\n 1800 ; expire (30 minutes)\n 10 ; minimum (10 seconds)\n )\n NS #{project_info[:named_hostname]}.\n$ORIGIN apps.#{domain}.\n$TTL 60 ; 1 minute\nEOF\n project_info[:named_entries].each do |entry|\n host = entry.split(\":\")[0]\n conf += \"#{host} CNAME #{host}.#{domain}\\n\"\n end\n\n## STATIC IPS\n when \"static-ips\"\n conf=<<EOF\n$TTL 60 ; 1 minute\n; 192.168.1.0/24\n; 1.168.192.in-addr.arpa.\n@ IN SOA #{project_info[:named_hostname]}. hostmaster.#{domain}. (\n 2011112942 ; serial\n 60 ; refresh (1 minute)\n 15 ; retry (15 seconds)\n 1800 ; expire (30 minutes)\n 10 ; minimum (10 seconds)\n )\n NS #{project_info[:named_hostname]}.\n\nEOF\n project_info[:internal_named_entries].each do |entry|\n host = entry.split(\":\")[0]\n ip_end = entry.split(\":\")[1].split(\".\").last\n conf += \"#{ip_end} IN PTR #{host}.#{domain}.\\n\"\n end\n else\n raise \"Unrecognized dns configuration file requested.\"\n end\n conf\n end", "def new_domain(domain)\n d = Domain.new\n d.name = domain\n d.type = \"NATIVE\"\n\n d.save\n return d\n end", "def to_dnsruby_message # this should actually be a monkeypatch to Dnsruby::Message \"new_from_json\"?\n throw SyntaxError unless defined? self[:header] and defined? self[:question] and defined? self[:answer] and defined? self[:authority]\n msg = Message.new\n header = Header.new\n self[:header].each do |k,v|\n key = \"@#{k}\"\n next unless header.instance_variable_defined?(key)\n if k == :opcode\n header.opcode = v\n elsif k == :rcode\n header.rcode = v\n else\n header.instance_variable_set(key,v)\n end\n end\n msg.header = header\n \n self[:question].each do |q|\n msg.add_question(Question.new(q[:qname],q[:qtype],q[:qclass]))\n end\n \n self[:answer].each do |rr|\n msg.add_answer(RR.new_from_string(rr.to_rdata_string))\n end\n \n self[:authority].each do |rr|\n msg.add_authority(RR.new_from_string(rr.to_rdata_string))\n end\n \n self[:additional].each do |rr|\n msg.add_additional(RR.new_from_string(rr.to_rdata_string))\n end\n msg\n end", "def create_agent_domain\n return false unless validate_params\n puts '########## CREATING DOMAIN ##########'\n dme.create_domain(params[:domain])\n puts '########## CREATING DEFAULT RECORDS ##########'\n create_default_records\n puts '########## CREATING ADDITIONAL RECORDS ##########'\n create_additional_records\n puts '########## RENDERING DATA TO CLIENT##########'\n show_domain\n end", "def domain_create(domain, fields)\n unless ([ :period, :registrant, :admin, :tech, :billing, :nservers ] - fields.keys).empty?\n raise ArgumentError, \"Required fields not found\"\n end\n query :domain_register, {\n domain: domain,\n period: (fields[:period] * 12),\n owner_c: fields[:registrant],\n admin_c: fields[:admin],\n tech_c: fields[:tech],\n billing_c: fields[:billing],\n ns_list: fields[:nservers].join(':')\n }\n end", "def create(rec)\n @name = rec.fields[\"name\"]\n @address = rec.fields[\"address\"]\n @city = rec.fields[\"city\"]\n @state = rec.fields[\"state\"]\n @zip = rec.fields[\"zip\"]\n @phone << rec.fields[\"phone\"] if !rec.fields[\"phone\"].nil?\n @fax << rec.fields[\"fax\"] if !rec.fields[\"fax\"].nil?\n @email << rec.fields[\"email\"] if !rec.fields[\"email\"].nil?\n end", "def create_record(body, opts = {})\n data, _status_code, _headers = create_record_with_http_info(body, opts)\n data\n end", "def start\n # These \"Just copy assignment\" is not preventable ...\n\n records = @database[:dns_records]\n esc_dnssuffix = Regexp.escape(DNS_SUFFIX)\n upstreamdns = RubyDNS::Resolver.new([\\\n [:udp, UPSTREAM_1_IP, UPSTREAM_1_PO], \\\n [:tcp, UPSTREAM_1_IP, UPSTREAM_1_PO], \\\n [:udp, UPSTREAM_2_IP, UPSTREAM_2_PO], \\\n [:tcp, UPSTREAM_2_IP, UPSTREAM_2_PO] \\\n ])\n RubyDNS.run_server(listen: [[:udp, '::', DNS_BIND], [:tcp, '::', DNS_BIND]]) do\n # Catch Localhost Request\n match(/localhost/, IN::A) do |transaction|\n transaction.respond!('127.0.0.1')\n end\n\n # Catch Localhost Request, on IPv6\n match(/localhost/, IN::AAAA) do |transaction|\n transaction.respond!('::1')\n end\n\n # This is used to match the DNS Suffix of the internal zone\n match(/(.+)\\.#{esc_dnssuffix}/, IN::A) do |transaction, match_data|\n begin\n answers = records.where(name: match_data[1], type: 'A')\n if answers.nil? || answers.empty?\n transaction.fail!(:NXDomain)\n else\n answers.each do |answer|\n transaction.respond!(answer[:ipv4address], ttl: TTL_VALUE)\n end\n end\n rescue Sequel::Error\n # deal with unavailable db\n transaction.fail!(:ServFail)\n end\n end\n\n match(/(.+)\\.#{esc_dnssuffix}/, IN::AAAA) do |transaction, match_data|\n begin\n answers = records.where(name: match_data[1], type: 'A')\n if answers.nil? || answers.empty?\n transaction.fail!(:NXDomain)\n else\n answers.each do |answer|\n transaction.respond!(answer[:ipv6address], ttl: TTL_VALUE)\n end\n end\n rescue Sequel::Error\n # Deal with unavailable db\n transaction.fail!(:ServFail)\n end\n end\n\n match(/(.+)\\.#{esc_dnssuffix}/, IN::CNAME) do |transaction, match_data|\n begin\n answers = records.first(name: match_data[1], type: 'CNAME')\n if answers.nil? || answers.empty?\n transaction.fail!(:NXDomain)\n else\n transaction.respond!(answer[:cname], ttl: TTL_VALUE)\n end\n rescue Sequel::Error\n # Deal with unavailable DB\n transaction.fail!(:ServFail)\n end\n end\n\n match(/(.+)\\.#{esc_dnssuffix}/, IN::MX) do |transaction, match_data|\n begin\n answers = records.where(name: match_data[1], type: 'MX')\n if answers.nil? || answers.empty?\n transaction.fail!(:NXDomain)\n else\n answers.each do |answer|\n transaction.respond!(answer[:cname], ttl: TTL_VALUE)\n end\n end\n rescue Sequel::Error\n # Deal with unavailable DB\n transaction.fail!(:ServFail)\n end\n end\n\n # Handling PTR Record (IP to Hostname)\n match(/(.+)\\.in-addr.arpa/, IN::PTR) do |transaction, match_data|\n realip = match_data[1].split('.').reverse.join('.')\n if IPAddress.valid_ipv4?(realip)\n begin\n answers = records.where(ipv4address: realip)\n if answers.nil? || answers.empty?\n transaction.passthrough!(upstreamdns)\n else\n answers.each do |answer|\n transaction.respond!(Name.create(answer[:name] + '.' + DNS_SUFFIX), ttl: TTL_VALUE)\n end\n end\n rescue Sequel::Error\n # Deal with unavailable DB, Fallback to External Provider\n transaction.passthrough!(upstreamdns)\n end\n else\n # Refusing inappropiate requests, inappropiate IPv6 requests also goes here.\n transaction.fail!(:Refused)\n end\n end\n\n # Handling IPv6 PTR Record\n match(/(.+)\\.ip6.arpa/, IN::PTR) do |transaction, match_data|\n incoming = match_data[1].split('.').reverse.join\n if incoming =~ /^[0-9a-fA-F]+$/\n realip6 = IPAddress::IPv6.parse_hex(incoming).to_s\n realip4 = (IPAddress::IPv6::Mapped.new(realip6).mapped? ? '::FFFF:' + IPAddress::IPv6::Mapped.new(realip6).ipv4.address : '').to_s\n begin\n answers = records.where(ipv6address: [realip6, realip4])\n if answers.nil? || answers.empty?\n transaction.passthrough!(upstreamdns)\n else\n answers.each do |answer|\n transaction.respond!(Name.create(answer[:name] + '.' + DNS_SUFFIX), ttl: TTL_VALUE)\n end\n end\n rescue Sequel::Error\n # Deal with unavailable DB, Fallback to External Provider\n transaction.passthrough!(upstreamdns)\n end\n else\n # Refusing inappropiate requests, inappropiate IPv6 requests also goes here.\n transaction.fail!(:Refused)\n end\n end\n\n # Default DNS handler, forward outside address to upstream DNS\n otherwise do |transaction|\n transaction.passthrough!(upstreamdns)\n end\n end\n end", "def required_dns_records\n all_ingress_hostnames + SPECIAL_A_RECORD_NAMES\nend", "def parse_dns(dns_raw)\r\n\r\n dns_raw1 = []\r\n len = dns_raw.length-1\r\n i = 0\r\n for r in 0..len do\r\n str1 = dns_raw[r]\r\n if dns_raw[r][0] != '#'\r\n dns_raw1[i] = dns_raw[r]\r\n i = i + 1\r\n end\r\n end\r\n dns_raw = dns_raw1\r\n\r\n b=[]\r\n dns_raw.each do |item|\r\n str = item == \"\\n\"\r\n if !str\r\n b.push(item.split(','))\r\n end\r\n end\r\n\r\n len = b.length-1\r\n dns_records ={}\r\n\r\n for r in 0 .. len do\r\n dkey = {}\r\n dkey[:type] = b[r][0].strip\r\n dkey[:target] = b[r][2].strip.chomp\r\n dns_records[b[r][1].strip] = dkey\r\n end\r\n\r\n return dns_records\r\n end", "def initialize\n @hostname = Socket.gethostname()\n @dns_port = 53\n @ttl = 7200\n @priority = 1\n @weight = 5\n @resolver = nil\n @ipv4 = nil\n @ipv6 = nil\n @sleep_time = 60\n @max_dns_response_time=10\n @zone = \"\"\n @transport = :udp\n end", "def set_dns_entry\n @dns_entry = DnsEntry.find(params[:id])\n end", "def do_lookup(args)\n if args[\"qname\"] == \"example.com\" and args[\"qtype\"].downcase == \"soa\"\n @result = [\n record(\"example.com\", \"SOA\", \"sns.dns.icann.org noc.dns.icann.org 2013012485 7200 3600 1209600 3600\"),\n ]\n elsif args[\"qname\"] == \"example.com\" and args[\"qtype\"].downcase == \"any\"\n @result = [ \n record(\"example.com\", \"SOA\", \"sns.dns.icann.org noc.dns.icann.org 2013012485 7200 3600 1209600 3600\"),\n record(\"example.com\", \"NS\", \"sns.dns.icann.org\"),\n record_prio(\"example.com\", \"MX\", \"test.example.com\",10)\n ]\n elsif args[\"qname\"] == \"test.example.com\" and args[\"qtype\"].downcase == \"any\"\n @result = [\n record(\"test.example.com\", \"A\", \"127.0.0.1\")\n ]\n elsif args[\"qname\"] =~ /(.*)\\.example\\.com$/ and args[\"qtype\"].downcase == \"any\"\n ip = 0\n $1.downcase.each_byte do |b| ip = ip + b end\n ip_2 = ip/256\n ip = ip%256\n @result = [\n record(args[\"qname\"], \"A\", \"127.0.#{ip_2}.#{ip}\")\n ]\n end\n end", "def create_domain\n debug(\"Creating domain #{domain_name}\")\n debug(\"Using options: #{domain_options}\")\n domain = client.servers.create(domain_options)\n prepare_domain(domain)\n domain\n end", "def create\n @nad = Nad.new(params[:nad])\n #automatically infer domain from outboundlink\n dname = URI.parse( \"http://\" + @nad.outboundlink).host\n \n #if the domain doesn't exists\n @domain = Domain.find_by_name(dname)\n if @domain\n @nad.domain_id = @domain.id\n else\n @domain = Domain.new(:name => dname)\n @domain.save!\n #build automatically assigns domain_id to the nad\n @nad = @domain.nads.build(:outboundlink => @nad.outboundlink, :imgurl => @nad.outboundlink, :head => @nad.head, :caption => @nad.caption, :approved => 0)\n end\n \n respond_to do |format|\n if @nad.save\n format.html { redirect_to(@nad, :notice => 'Nad was successfully created.') }\n format.xml { render :xml => @nad, :status => :created, :location => @nad }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @nad.errors, :status => :unprocessable_entity }\n end\n end\n end", "def description\n \"DNS TXT Record Lookup\"\nend", "def dns_entry_params\n params.require(:dns_entry).permit(:type, :name, :content, :ttl)\n end", "def initialize(domain, host, type, value, mx='', ttl=7200, rid=nil)\n raise ArgumentError, \"domain must be an instance of EveryDNS::Domain\" unless domain.is_a? EveryDNS::Domain\n @domain = domain\n @host = host\n @value = value\n @type = type.to_s.upcase.intern\n @mx = mx\n @ttl = ttl\n @id = rid.to_i\n raise ArgumentError, \"Invalid type \\\"#{type}\\\", valid types are #{VALID_TYPES.join(', ')}\" unless VALID_TYPES.include?(@type)\n raise ArgumentError, \"Records of type \\\"#{type}\\\" must provide and mx value\" if @type == :MX && @mx.empty?\n end", "def create_record!(record)\n @created += 1\n begin\n ar_record = target_class.new(record_attributes(record))\n ar_record.save!\n return ar_record\n rescue ActiveRecord::RecordInvalid => e \n ar_record.save!(:validate => false)\n @invalid_records += 1\n raise e\n end\n end", "def add_dnsbl(name, domain, type = 'ip', codes = { '0' => 'OK', '127.0.0.2' => 'Blacklisted' })\n @dnsbls[name] = codes\n @dnsbls[name]['domain'] = domain\n @dnsbls[name]['type'] = type\n end" ]
[ "0.79111874", "0.7601401", "0.751647", "0.74093896", "0.7280565", "0.7247105", "0.715277", "0.7105436", "0.7097465", "0.70457083", "0.70249116", "0.69983387", "0.69115025", "0.68434876", "0.67359436", "0.66986054", "0.6695808", "0.66878504", "0.65433764", "0.65114814", "0.6510672", "0.65060955", "0.64843386", "0.64564985", "0.6411821", "0.64098233", "0.639597", "0.6393249", "0.6385046", "0.6344962", "0.63201374", "0.6302257", "0.6291026", "0.6273977", "0.6247418", "0.6212775", "0.62121814", "0.6166252", "0.6160272", "0.6131625", "0.6115182", "0.60946923", "0.60946923", "0.6092814", "0.6086787", "0.6066761", "0.60652924", "0.6022454", "0.60020876", "0.60011744", "0.59983045", "0.5993972", "0.5987802", "0.59363997", "0.59113115", "0.59106594", "0.5903136", "0.5899694", "0.58938074", "0.58901197", "0.58890605", "0.5858844", "0.5841405", "0.58387244", "0.58342093", "0.579139", "0.5787838", "0.5777052", "0.5768705", "0.57616687", "0.5749205", "0.5739442", "0.5714511", "0.57023466", "0.5689829", "0.5685065", "0.5681434", "0.56749636", "0.56424373", "0.56335765", "0.5620036", "0.5616679", "0.56128776", "0.5609353", "0.55951947", "0.5588152", "0.5587923", "0.5567067", "0.55546826", "0.5552398", "0.554347", "0.554335", "0.55238324", "0.55215335", "0.55131567", "0.5511949", "0.55104464", "0.5506748", "0.5488959", "0.54884267" ]
0.80369395
0
get list of managed dns names does dns name exist
def zone_exist?(name) match = find_match(@dns.domains, name) if match != nil Puppet.notice "found dns zone #{match.name}" return true else Puppet.debug "zone not found : #{name}" return false end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def list\n cf_get(path: \"#{uri_prefix}/virtual_dns\")\n end", "def get_nameservers (host)\n\t\tputs \"Retrieve a list of authoritative name server for: #{host}\" if @verbose\n\t\tbegin\n\t\t\tdomain=get_domain_root(host)\n\t\t\tw=Wmap::Whois.new\n\t\t\tns = w.query(domain).nameservers.map! { |x| x.name }\n\t\t\tif ns.empty?\n\t\t\t\tputs \"No name server found for domain root: #{domain}\" if @verbose\n\t\t\t\treturn nil\n\t\t\telse\n\t\t\t\treturn ns\n\t\t\tend\n\t\trescue => ee\n\t\t\tputs \"Exception on method get_nameservers for #{host}: #{ee}\" if @verbose\n\t\t\treturn nil\n\t\tend\n\tend", "def dns?\n !dns.nil? && !dns.empty?\n end", "def dnsbls\n @dnsbls.keys\n end", "def resolve_names(lookup_name, lookup_types=[Dnsruby::Types::AAAA, Dnsruby::Types::A, Dnsruby::Types::CNAME, Dnsruby::Types::PTR])\n\n names = []\n x = resolve(lookup_name, lookup_types)\n x.each {|y| names << y[\"name\"] }\n\n names.uniq\n end", "def resolve_names(lookup_name, lookup_types=[Dnsruby::Types::A, Dnsruby::Types::CNAME, Dnsruby::Types::PTR])\n\n names = []\n x = resolve(lookup_name, lookup_types)\n x.each {|y| names << y[\"name\"] }\n\n names.uniq\n end", "def resolve_names(lookup_name, lookup_types=[Dnsruby::Types::A, Dnsruby::Types::CNAME, Dnsruby::Types::PTR])\n\n names = []\n x = resolve(lookup_name, lookup_types)\n x.each {|y| names << y[\"name\"] }\n\n names.uniq\n end", "def blacklisted?(dx)\n domain = dx.split('.').reverse.join('.')+\".\"+self\n a = []\n Resolv::DNS.open do |dns|\n begin\n a = dns.getresources(domain, Resolv::DNS::Resource::IN::A)\n rescue Resolv::NXDomainError\n a=[]\n end\n end\n if a.size>0 then true else false end\n end", "def dns\n @dns ||= @node.search('DNS/listEntry').map do |entry|\n DomainName.new(entry.inner_text)\n end\n end", "def check_dns_available(vm_name)\n begin\n dns_ip = Resolv.getaddress(vm_name)\n rescue Resolv::ResolvError\n # this is the expected case, swallow the error\n # eg \"no address for blah-daisy.example.com\"\n return ['', true]\n end\n [dns_ip, false]\n end", "def required_dns_records\n all_ingress_hostnames + SPECIAL_A_RECORD_NAMES\nend", "def dns\n @dns ||= select { |type,value| type == :dns }.map do |(type,value)|\n value\n end\n end", "def what_should_my_dns_be?\n get_mongo_dns_endpoint(get_instance_id)\n end", "def get_whois_nameservers(domain)\n whois_output = `whois #{domain}`\n soa = nil\n whois_lines = whois_output.split(/\\n+/)\n nameserver_lines = whois_lines.select { |line| line =~ /^Name Server:/ }\n nameservers = nameserver_lines.map { |line| line.split.last.downcase }.uniq\n # whois records don't have trail '.'; NS records do; add trailing '.'\n nameservers.map { |ns| ns << '.' }\n nameservers\nend", "def dns\n doc = request(\"dns-list_records\")\n api_error?(doc)\n (doc/:data).inject([]) { |records, dns| records << Dns.new_from_xml(dns); records }\n end", "def domains_list\n call('domains.list')[:domains]\n end", "def does_resolve_to_host?\n mx_records.include? Socket.gethostname\n end", "def getNameserverIPs(domain, addrtype = Resolv::DNS::Resource::IN::A)\n myresolv = Resolv::DNS.new()\n\n nameserver_addresses=Array.new\n myresolv.each_resource(domain, Resolv::DNS::Resource::IN::NS) do |nsrsc|\n nameserver_addresses.push(myresolv.getresource(nsrsc.name, addrtype).address)\n end\n\n myresolv.close()\n\n return nameserver_addresses\nend", "def domains_master_names\n self.domains.pluck(:name)\n end", "def domains_master_or_reverse_or_slave_names\n domains_names = []\n self.domains.master_or_reverse_or_slave.each do |domain|\n domains_names.push domain.name\n end\n domains_names\n end", "def dns_a_record\n @_dns_a_record = \"0.0.0.0\" if @config[:dns_lookup] == :off\n @_dns_a_record ||= Socket.gethostbyname(dns_name)\n rescue SocketError # not found, but could also mean network not work\n @_dns_a_record ||= []\n end", "def valid_dns?\n @host.exchanger.has_dns_a_record?\n end", "def dns_name\n [\"public\", fqdn].join(\".\")\n end", "def check_hostnames\n all_good = true\n \n @check_groups.each do |group|\n group.checks.each do |check|\n unless check.hostname && Dnsruby::Resolv.getaddress(check.hostname)\n puts \"Error: check #{check.name} has invalid hostname '#{check.hostname}'\"\n all_good = false\n end\n end\n end\n \n all_good\n end", "def dnskey_already_present?\n domain.dnskeys.pluck(:public_key).map { |key| key.gsub(/\\s+/, '') }.include? dnskey.public_key\n end", "def manage_dns\n config_dns unless new_resource.dns.nil? || current_resource.dns == new_resource.dns\n config_dns_domain unless new_resource.dns_domain.nil? || current_resource.dns_domain == new_resource.dns_domain\n config_ddns unless new_resource.ddns.nil? || current_resource.ddns == new_resource.ddns\n end", "def all_names(hostname)\n ret = []\n\n if hostname.local == hostname.fqdn\n ret << hostname.fqdn\n else\n ret << hostname.fqdn << hostname.local\n end\n\n ret\n end", "def all_names(hostname)\n ret = []\n\n if hostname.local == hostname.fqdn\n ret << hostname.fqdn\n else\n ret << hostname.fqdn << hostname.local\n end\n\n ret\n end", "def hostnames(nodes)\n @referenced_nodes ||= ObjectList.new\n nodes = listify(nodes)\n nodes.each_node do |node|\n @referenced_nodes[node.name] ||= node\n end\n return nodes.values.collect {|node| node.domain.name}\n end", "def parse_dns(nodeList)\n find_if_exists = 0\n domain = Hash.new{|hsh,key| hsh[key] = []}\n address = Hash.new{|hsh,key| hsh[key] = []}\n cname = Hash.new{|hsh,key| hsh[key] = []}\n\n nodeArr = []\n # To remove null values for '.split' method to work\n nodeList.each do |node|\n if node == ''|| node.empty? || node == \"\\n\"\n next\n end\n nodeArr.push(node.strip.split(','))\n end\n # Creating the key value Hash\n nodeArr.each do |(type,domain,source)|\n if type == \"CNAME\"\n cname[domain.strip.to_sym].push(source.strip)\n elsif type == \"A\"\n address[domain.strip.to_sym].push(source.strip)\n end\n end\n # Adding CNAME hash and ADDRESS hash into domain hash\n domain[:CNAME].push(cname)\n domain[:ADDRESS].push(address)\n return domain\nend", "def domain_check(name)\n options = { \"domains\" => [ {\"dname\" => name} ] }\n request_v2(\"domain\", \"check\", options)\n if is_success?\n record = response[\"answer\"][\"domains\"].first\n record && record[\"error_code\"].nil? && record[\"result\"] == \"Available\"\n end\n end", "def names_for(ip)\n resolvers.each do |r|\n names = r.getnames(ip)\n\n return names unless names.nil? || names.empty?\n end\n\n []\n end", "def dns\n @gapi.dns_name\n end", "def getnames(address)\n @resolvers.each do |resolver|\n names = []\n resolver.each_name(address) { |name| names << name }\n return names unless names.empty?\n end\n []\n end", "def hostnames_for_machine machine\n # Cast any Symbols to Strings\n machine_name = machine.name.to_s\n hostname = machine.config.vm.hostname || machine_name\n\n hostnames = [hostname]\n # If the hostname is a fqdn, add the first component as an alias.\n hostnames << hostname.split('.').first if hostname.index('.')\n # Also add the machine name as an alias.\n hostnames << machine_name unless hostnames.include? machine_name\n\n hostnames\n end", "def fqdn_correct?(host_name, domain_name, ip_addr)\n cmd_if %{egrep -q '^#{ip_addr}[[:space:]]+#{host_name}.#{domain_name}' /etc/hosts >/dev/null}\nend", "def dns_enabled?\n return false if @config[:dns_lookup] == :off\n return false if @config[:host_validation] == :syntax\n true\n end", "def parse_dns(address)\n fwd_entries={}\n aliases=nil\n begin\n Socket.getaddrinfo(address,nil).each do |addr_struct|\n addr=addr_struct[2]\n ip=addr_struct[3]\n if fwd_entries[addr].nil?\n fwd_entries[addr]=[ip]\n elsif !fwd_entries[addr].include?(ip)\n fwd_entries[addr] << ip\n end\n end\n rescue SocketError =>e\n end\n ret_arr=[]\n if fwd_entries.empty? then\n puts \"[warning] Could not determine an IP address for \\\"#{address}\\\"\"\n else\n fwd_entries.each do |fwd,ips|\n ips.each do |ip|\n ret_arr << {:ip=>ip, :addr=>fwd}\n end\n end\n end\n return ret_arr\n end", "def dns_check\n gen_host_records # These are the hosts we have\n load_all_subnets # These are the DNS entries\n \n # We want a standard layout, with the hypervisor API entries being \n @host_record.each do |hr| # Array of host record Hash's\n hn = hr[:hostname]\n shn = hn.split('.',2)[0] # Remove the domain\n forward_hr = @forward_host_record[hn] # Find Host Record\n if forward_hr.nil?\n # We have no IPAM entry for this hostname\n if (rhr = @reverse_host_records[hr[:ip]])\n puts \"Only Reverse IPAM entry for #{shn}: #{rhr}\"\n @infoblox.create_host_record(ip_address: hr[:ip], hostname: hn, aliases: hr[:aliases])\n else\n puts \"No IPAM entry for hostrecord: #{hr}\"\n @infoblox.create_host_record(ip_address: hr[:ip], hostname: hn, aliases: hr[:aliases])\n end\n else\n # We have an IPAM record for this hostname\n if forward_hr[:ip] != hr[:ip]\n puts \"IP mismatch #{shn} #{hr[:ip]} != #{forward_hr[:ip]} for IPAM: #{forward_hr}\"\n elsif forward_hr[:hostname] != hn\n # Reference must be via ALIASES or CNAMES\n if forward_hr[:aliases].include?(shn)\n puts \"Hostname #{shn} is an ALIAS. IPAM: #{forward_hr}\"\n elsif forward_hr[:cnames].include?(hn)\n puts \"Hostname #{shn} is a CNAME. IPAM: #{forward_hr}\"\n end\n end\n end\n end\n \n # We want to find IPAM entries, not matching existing @host_record entries\n @reverse_host_records.each do |ip, ahr| # Hash to array of host records from IPAM, indexed by IP\n ahr.each do |hr| # One IP can have multiple host records, with associated ALIAS and CNAME records\n local_hr = @host_record_index[hr[:hostname]]\n if local_hr.nil?\n puts \"No local entry #{hr[:hostname]} for #{hr}\"\n end\n end\n end\nend", "def domains_forward_names\n domains_names = []\n self.domains.forward.each do |domain|\n domains_names.push domain.name\n end\n domains_names\n end", "def exists?\n name, type = resource[:name].split('/')\n # Create the resolver, pointing to the nameserver\n r = Resolv::DNS.new(:nameserver => server)\n # Do the look-up\n begin\n @dnsres = r.getresources(name, typeclass(type))\n rescue Resolv::ResolvError\n return false\n end\n # MX and SRV lookups will return empty arrays\n if @dnsres.is_a? Array\n return false if @dnsres.empty?\n end\n # The record exists!\n return true\n end", "def enterprise_network_domain_names\n return @enterprise_network_domain_names\n end", "def nsqlookupd_http_endpoints\n @nsqlookupd.map { |lookupd| \"http://#{lookupd.host}:#{lookupd.http_port}\" }\n end", "def nsqlookupd_http_endpoints\n @nsqlookupd.map { |lookupd| \"http://#{lookupd.host}:#{lookupd.http_port}\" }\n end", "def non_baculized_hosts\n hosts.not_baculized.pluck(:name)\n end", "def domains\n @domains ||= ldap.search_domains.map { |base| ldap.domain(base) }\n end", "def domains\n @domains ||= ldap.search_domains.map { |base| ldap.domain(base) }\n end", "def exists?\n\t\tbegin\n\t\t\tdom\n\t\t\tdebug \"Domain %s exists? true\" % [resource[:name]]\n\t\t\ttrue\n\t\trescue Libvirt::RetrieveError => e\n\t\t\tdebug \"Domain %s exists? false\" % [resource[:name]]\n\t\t\tfalse # The vm with that name doesnt exist\n\t\tend\n\tend", "def domains\n\tfetch(\"/Domain.List\")\nend", "def domains\n get_proxy_bypass_domains(resource[:name])\n end", "def domains_slave_names\n domains_names = []\n self.domains.slave.each do |domain|\n domains_names.push domain.name\n end\n domains_names\n end", "def domains\n connection.list_domains[:domains]\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 exists?\n\n\t\tbegin\n\t\t\tdom\n\t\t\tdebug \"Domain %s exists? true\" % [resource[:name]]\n\t\t\ttrue\n\t\trescue Libvirt::RetrieveError => e\n\t\t\tdebug \"Domain %s exists? false\" % [resource[:name]]\n\t\t\tfalse # The vm with that name doesnt exist\n\t\tend\n\n\tend", "def get_name(dns_query, parsed_dns)\n domain_array = []\n for l in 0 .. MAX_DOMAIN_NAME\n domain_str_num = dns_query[parsed_dns[:index]].unpack(\"C\")[0]\n if (domain_str_num & 0xc0) == 0xc0\n buf = compression_domain_name(dns_query, parsed_dns)\n parsed_dns[:domain_name_dictionary] << {:first_index => parsed_dns[:index], :domain_name => buf}\n domain_array << buf\n parsed_dns[:index] += SHORT_LENGTH\n break\n else\n break unless create_domain_array(dns_query, parsed_dns, domain_str_num, domain_array)\n end\n end\n return create_domain_name(domain_array)\n end", "def dns_find(key)\n \n end", "def list_known_names\n end", "def name_servers\n Array(@gapi.name_servers)\n end", "def cname_record?\n dns.first.class == Net::DNS::RR::CNAME if dns?\n end", "def find_hosts( fqdn, zone_id = nil)\n if zone_id.nil?\n #look for matching host across all zones\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::FindHosts.new,\n :path => \"/api/1.1/hosts.xml?fqdn=#{fqdn}\"\n )\n else\n #look for hosts in a specific zone\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::FindHosts.new,\n :path => \"/api/1.1/zones/#{zone_id}/hosts.xml?fqdn=#{fqdn}\"\n )\n end\n end", "def baculized_hosts\n hosts.in_bacula.pluck(:name)\n end", "def domains\n []\n end", "def show\n name = @application.fqdn\n begin\n nameservers = NameServerCache.get_name_servers\n rescue Exception => e\n return render_error(:not_found, \"Could not resolve DNS #{name}: #{e.message}\", 170, \"DNS_RESOLVABLE\")\n end\n\n dns = Dnsruby::Resolver.new(:nameserver => nameservers[rand(nameservers.length)]) if nameservers\n begin\n dns.query(name, Dnsruby::Types.A)\n render_success(:ok, \"boolean\", true, \"Resolved DNS #{name}\")\n rescue Exception => e\n render_error(:not_found, \"Could not resolve DNS #{name}: #{e.message}\", 170)\n end\n end", "def wildcard_check\n wildcard_ips = []\n\n # look for wildcard IP addresses\n 4.times do\n # random subdomain string\n sub = (0..20).map { (65 + rand(26)).chr }.join.downcase\n random_fqdn = \"#{sub}.#{@suffix}\"\n\n # if this resolves then we have a wildcard IP\n resolved = resolver(random_fqdn)\n wildcard_ips << resolved unless resolved.empty?\n end\n # return all unique wildcard IP addresses\n # this will return an empty array if none are found\n wildcard_ips.compact.uniq\n end", "def valid_dns?\n return true unless dns_enabled?\n bool = dns_a_record.size > 0 || set_error(:domain_unknown)\n if localhost? && !@config[:host_local]\n bool = set_error(:domain_no_localhost)\n end\n bool\n end", "def get_aliases(hostname)\n headers = { Authorization: \"Bearer #{@token}\", 'Content-Type': 'application/json' }\n response = HTTParty.get(\"https://#{NETDB_SERVER}/nodes/#{hostname.fully_qualify}\",\n :headers => headers)\n if response.code != 200\n raise \"no node found for #{hostname}\"\n end\n\n # Parse through the response to find any aliases, and make sure that this is\n # the main hostname.\n node_json = JSON.parse(response.body)\n aliases = []\n node_json['names'].each do |n|\n if n['name'] != hostname\n raise \"#{hostname} is an alias for #{n['name']}. Please rerun with hostname #{n['name']}.\"\n elsif n.key?('aliases')\n aliases = (aliases + n['aliases'])\n end\n end\n\n aliases\nend", "def add_domain_list(name)\n configure \"ip domain-list #{name}\"\n end", "def public_dns_name\n data[:public_dns_name]\n end", "def domain_name_label\n label = nil\n entries.each do |entry|\n entry.ip_configurations.each do |ip_config|\n if ip_config['public_ipaddress']['attached']\n label = ip_config['public_ipaddress']['domain_name_label']\n end\n end\n end\n\n label\n end", "def host_exists?(host)\n # :nocov:\n # Patch for BZ840938 to support Ruby 1.8 on machines without /etc/resolv.conf\n dns = Resolv::DNS.new((Resolv::DNS::Config.default_config_hash || {}))\n dns.getresources(host, Resolv::DNS::Resource::IN::A).any?\n # :nocov:\n end", "def full_host_record(ip:)\n load_cnames\n \n @forward_host_record ||= {} # Global, as we want to do name lookups.\n return_record = []\n unless( (host_records = @infoblox.get_host_by_ip(ip_address: ip)).nil? )\n host_records.each do |hosts|\n hosts.each do |hn|\n # Assign an empty record, if we haven't seen this host before\n @forward_host_record[hn] ||= { hostname: hn, ip: '', aliases: [], cnames: [] }\n \n # Record the IP. There may be multiple IPs with one hostname.\n @forward_host_record[hn][:ip] = ip\n \n # The hostname might have CNAMES point to it\n unless @reverse_cnames[hn].nil?\n @reverse_cnames[hn].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n \n # The hostname may have alternate hostname A records, stored in IPAM as ALIASES\n @infoblox.get_alias(hostname: hn) do |a| \n short_alias = a.split('.',2)[0]\n @forward_host_record[hn][:aliases] << short_alias\n \n # The ALIASes might have CNAME records pointing to it\n unless @reverse_cnames[a].nil?\n # Record the ALIAS CNAMES against the parent hostname.\n @reverse_cnames[a].each do |cn| \n @forward_host_record[hn][:cnames] << cn \n end\n end\n end\n return_record << @forward_host_record[hn]\n \n # Add forward lookup entries for each ALIAS\n host_domain = hn.split('.',2)[1]\n @forward_host_record[hn][:aliases].each do |a|\n @forward_host_record[\"#{a}.#{host_domain}\"] = @forward_host_record[hn]\n end\n \n # Add forward lookup entries for each CNAME\n @forward_host_record[hn][:cnames].each do |cn|\n @forward_host_record[cn] = @forward_host_record[hn]\n end\n \n end\n end\n end\n return return_record\nend", "def dns_get_srv(name)\n addr, port = '.', 0\n\n DNSRuby::DNS.open do |dns|\n srv = dns.getresource(name, DNSRuby::Types.SRV)\n addr, port = srv.target.to_s, srv.port\n end\n\n (addr == '.' || port == 0) ? [nil, nil] : [addr, port]\nend", "def owncloud_trusted_domains\n [\n node['owncloud']['server_name'], node['owncloud']['server_aliases']\n ].flatten\n end", "def check_domain_matches(drop)\n unless custom_domain_matches? drop\n puts [ '*' * 5,\n drop.data[:url].inspect,\n env['HTTP_HOST'].inspect,\n '*' * 5\n ].join(' ')\n\n not_found\n end\n end", "def get_dns_values (components)\n values = Array.new\n components.each do |component|\n\n attrs = component['ciAttributes']\n\n dns_record = attrs['dns_record'] || ''\n\n # backwards compliance: until all computes,lbs,clusters have dns_record populated need to get via case stmt\n if dns_record.empty?\n case component['ciClassName']\n when /Compute/\n if attrs.has_key?('public_dns') && !attrs['public_dns'].empty?\n dns_record = attrs['public_dns']+'.'\n else\n dns_record = attrs['public_ip']\n end\n\n if location == '.int' || dns_entry == nil || dns_entry.empty?\n dns_record = attrs['private_ip']\n end\n\n when /Lb/\n dns_record = attrs['dns_record']\n when /Cluster/\n dns_record = attrs['shared_ip']\n end\n else\n # unless ends w/ . or is an ip address\n dns_record += '.' unless dns_record =~ /,|\\.$|^\\d+\\.\\d+\\.\\d+\\.\\d+$/\n end\n\n if dns_record.empty?\n Chef::Log.error('azuredns:build_entries_list.rb - cannot get dns_record value for: '+component.inspect)\n exit 1\n end\n\n if dns_record =~ /,/\n values.concat dns_record.split(',')\n else\n values.push(dns_record)\n end\n end\n return values\nend", "def index\n @dns_entries = DnsEntry.all\n end", "def check_hostname_dns_reverse_lookup\n my_fqdn = %x{hostname -f}.chomp\n if !$?.success?\n opoo \"You can't run 'hostname -f'!? I can't check your hostname dns reverse lookup.\"\n elsif %x{traceroute -m 2 \"#{my_fqdn}\" 2>/dev/null}.chomp.lines.to_a.size != 1 || !$?.success?\n # Actually, passing this check only proves that the name is bound to someone in your subnet.\n opoo \"Your effective FQDN (#{my_fqdn}) doesn't seem to traceroute to yourself.\"\n end\n end", "def domains\n @_domains ||= mxers.map { |m| Host.new(m.first).domain_name }.sort.uniq\n end", "def check_gdom_exists(options)\n message = \"Information:\\tChecking guest domain \"+options['name']+\" exist\"\n command = \"ldm list |grep #{options['name']}\"\n output = execute_command(options,message,command)\n if not output.match(/#{options['name']}/)\n handle_output(options,\"Warning:\\tGuest domain #{options['name']} doesn't exist\")\n quit(options)\n end\n return\nend", "def dns\n if @dns.nil?\n begin\n @dns = Timeout::timeout(TIMEOUT) do\n without_warnings do\n Net::DNS::Resolver.start(absolute_domain).answer if domain\n end\n end\n @dns ||= false\n rescue Exception\n @dns = false\n end\n end\n @dns || nil\n end", "def dns; settings.components.dns.config end", "def domains\n domains = []\n nextToken = nil\n base_options = {:Action => 'ListDomains'}\n continue = true\n \n while continue\n options = base_options.dup\n options[:NextToken] = nextToken unless nextToken.nil?\n \n sdb_query(options) do |h|\n h.search('//DomainName').each {|e| domains << Domain.new(self, e.innerText)}\n mt = h.at('//NextToken')\n if mt\n nextToken = mt.innerText\n else\n continue = false\n end\n end\n end\n \n domains\n end", "def get_domain_computers()\n\t\tcomputer_list = []\n\t\tdevisor = \"-------------------------------------------------------------------------------\\r\\n\"\n\t\traw_list = client.shell_command_token(\"net view\").split(devisor)[1]\n\t\tif raw_list =~ /The command completed successfully/\n\t\t\traw_list.sub!(/The command completed successfully\\./,'')\n\t\t\traw_list.gsub!(/\\\\\\\\/,'')\n\t\t\traw_list.split(\" \").each do |m|\n\t\t\t\tcomputer_list << m\n\t\t\tend\n\t\tend\n\n\t\treturn computer_list\n\tend", "def canonical\n dns_host_name\n end", "def fqdn?\n tld ? true : false\n end", "def load_used_dns_plugins\n dns_plugins = Vmpooler::Dns.get_dns_plugin_config_classes(config)\n Vmpooler::Dns.load_by_name(dns_plugins)\n end", "def default_dns\n @networks.each do |network|\n return network.dns if network.has_default_dns?\n end\n @networks[0].dns\n end", "def kvm_exists?(kvm_name)\n begin\n virt.lookup_domain_by_name(kvm_name)\n true\n rescue Libvirt::RetrieveError\n false\n end\nend", "def index\n @dns_zones = DnsZone.all\n end", "def list_known_servers\n connect.servers.all\n end", "def private_dns_name\n data[:private_dns_name]\n end", "def search_domains_for(domain)\n domain.downcase!\n serach_domains = []\n \n if domain =~ CookieStore::Cookie::IPADDR\n serach_domains << domain\n else\n domain = domain + '.local' if !(domain =~ /.\\../)\n serach_domains << domain\n serach_domains << \".#{domain}\"\n \n # H is the host domain name of a host; and,\n # H has the form A.B; and\n if domain =~ /[^\\.]+(\\..+)/\n reach = $1\n # B has at least one embedded dot\n if reach =~ /.[\\.:]./\n # B has at least one embedded dot, or B is the string \"local\".\n # then the reach of H is .B.\n serach_domains << reach\n end\n end\n end\n \n serach_domains\n end", "def zones_by_name(name, max_items = nil)\n client.list_hosted_zones_by_name(\n dns_name: name,\n max_items: max_items,\n )&.hosted_zones\n end", "def records\n dns.getresources domain, Resolv::DNS::Resource::IN::MX\n end", "def host_aliases (host)\n\t\tputs \"Search aliases in the local hosts data repository for host: #{host}\" if @verbose\n\t\thost.strip!\n\t\traise \"Unknown method input: #{host} We expect a FQDN host-name string from you. \" unless is_fqdn?(host)\n\t\taliases=Array.new\n\t\tif @known_hosts.key?(host)\n\t\t\tip=local_host_2_ip(host)\n\t\t\t@known_hosts.keys.map do |key|\n\t\t\t\tmy_ip=local_host_2_ip(key)\n\t\t\t\tif ip == my_ip\n\t\t\t\t\taliases.push(key)\n\t\t\t\tend\n\t\t\tend\n\t\telse\n\t\t\traise \"Unknown host-name in the local hosts data repository: #{host}\"\n\t\tend\n\t\treturn aliases-[host]\n\trescue Exception => ee\n\t\tputs \"Exception on method #{__method__}: #{ee}\"\n\t\treturn nil\n\tend", "def index\n @tmp_domain_names = TmpDomainName.all\n end", "def bds_resolvable?\n begin\n Rex::Socket.resolv_to_dotted(datastore['DOMAIN'])\n rescue RuntimeError, SocketError\n return false\n end\n\n true\n end", "def list_records(host)\n domain = find_domain!(host)\n raise IncorrectDomainType, \"Domain #{host} is a #{domain.type} domain\" unless domain.can_have_records?\n \n return @domain_records[domain.host] unless @domain_records.nil? or @domain_records[domain.host].nil?\n \n res = get('/dns.php', domain.list_records_options)\n if response_status_message(res) == (RESPONSE_MESSAGES[:DOMAIN_LIST_RECORDS] % domain.host)\n record_list = RecordList.parse_list(domain, get(URI.join(\"http://#{EVERYDNS_HOSTNAME}/dns.php\", res['location']).to_s).body)\n cache_domain_records(domain.host, record_list)\n return record_list\n else\n return false\n end\n end", "def exist?(domain)\n Domain.all(:name => domain).any?\n end", "def get_host_info(s)\n\n # Prepare response array of aliases (IP and addresses)\n aliases = []\n\n # Get information from the given IP or name\n begin\n resp = Socket.getaddrinfo(s, nil)\n rescue\n aliases << s\n else\n\n fqdn = resp.first[2]\n ip = resp.first[3]\n aliases << fqdn\n\n if fqdn != ip\n host_dom = fqdn.split('.', 2)\n if $local_domain && host_dom.length == 2 && host_dom.last == $local_domain\n aliases << host_dom.first\n end\n aliases << ip\n end\n\n end\n\n return aliases\n\nend" ]
[ "0.6982348", "0.6486663", "0.6458568", "0.6433711", "0.6415802", "0.6387529", "0.6387529", "0.6371843", "0.6368246", "0.6352938", "0.63450956", "0.6302255", "0.62767863", "0.62422323", "0.6147947", "0.6139751", "0.6135192", "0.60991794", "0.6093843", "0.60455513", "0.60195744", "0.6011954", "0.59856594", "0.59669673", "0.59626853", "0.5957874", "0.59577686", "0.59577686", "0.59545606", "0.5945577", "0.5917255", "0.59086055", "0.5853635", "0.5843583", "0.58387923", "0.5820837", "0.5815934", "0.5760128", "0.5758348", "0.57412577", "0.5736642", "0.5728533", "0.57237345", "0.57237345", "0.5716585", "0.5710554", "0.5710554", "0.5684647", "0.5674728", "0.5656591", "0.5654733", "0.56519175", "0.5647181", "0.5642808", "0.5639813", "0.5632386", "0.56228507", "0.5607022", "0.55990064", "0.55961376", "0.559448", "0.5589607", "0.55856615", "0.55705863", "0.556851", "0.55648863", "0.5560736", "0.55568683", "0.55493546", "0.5543752", "0.55325377", "0.55309236", "0.55238295", "0.5518037", "0.55151093", "0.5513576", "0.55094856", "0.5497654", "0.5491594", "0.54849535", "0.5483192", "0.5482753", "0.54823476", "0.54698646", "0.5467553", "0.54672754", "0.5461743", "0.5455369", "0.54545486", "0.545306", "0.54514456", "0.54402936", "0.5426546", "0.5422158", "0.5416661", "0.5414163", "0.541217", "0.5409784", "0.5408469", "0.5406828" ]
0.57708126
37
determine if record exists
def record_exist?(fqdn, type) matches = find_match(@dnss.records, fqdn, true) if matches != nil record = nil matches.each do |record| Puppet.debug "inspecting #{record.hash_type} == #{type}" if record.hash_type.to_s == type.to_s Puppet.notice "found dns record : #{fqdn}, #{type}" return true end end else Puppet.debug "match found no record : #{fqdn}, #{type}" end Puppet.debug "record not found : #{fqdn}, #{type}" return false end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def exists?\n load!\n true\n rescue RecordNotFound\n false\n end", "def has_record?(record)\n table.has_key?(lookup_key_for(record))\n end", "def exists?\n rec = run_sql(\"SELECT * FROM #{table} WHERE id = #{@id};\")\n if rec.empty?\n @errors << \"That id does not exist in the table.\"\n false\n else\n true\n end\n end", "def exist?\n\t\t!self.class.first(:conditions => {:identification_document => identification_document}).nil?\n\tend", "def exists?\n uid && ABAddressBook.sharedAddressBook.recordForUniqueId(uid)\n end", "def contains?(record)\n begin\n val = relation.exists?(record.id)\n @valid = true # set valid to true, if relation.exists?(model) does not throw any exception\n val\n rescue\n @valid = false\n end\n end", "def row_exists?(unique_identifier)\n wait_for_results\n exists? result_row(unique_identifier)\n end", "def row_exists?(unique_identifier)\n wait_for_results\n exists? result_row(unique_identifier)\n end", "def exist?\n !find_exists.nil?\n end", "def check_if_record_exists\n\tif MenuItem.exists?(:name =>self.name,:vendor_id=>self.vendor_id)\n\t\tputs\"This record already exists\"\n\t\tthrow:abort\n\telse\n\t\treturn true\n\tend\n end", "def exist? \n !DB.execute(\"SELECT name FROM students WHERE Id = ? \", @id).empty?\n end", "def exists?\n !@not_found\n end", "def exists?\n\t\treturn false\n\tend", "def exists?\n @exists == true\n end", "def exists?\n @exists\n end", "def exists?\n model.exists?(@id)\n end", "def exists?()\n #This is a stub, used for indexing\n end", "def record_already_exists?\n return @record_already_exists if defined?(@record_already_exists)\n\n @record_already_exists = SecurityEvent.exists?(\n issuer: service_provider.issuer,\n jti: jti,\n user_id: user.id,\n )\n end", "def exists?\n retrieve\n true\n rescue Error::NoSuchKey\n false\n end", "def exist?\n @exists\n end", "def exist?\n true\n end", "def exists?\n !count.zero?\n end", "def exist?\n nil\n end", "def _record_exists?(get_url)\n existing = @rest_client.get(get_url)\n\n return nil if (existing.is_a? Integer) \\\n && (existing == Sunra::Utils::RestClient::NOT_FOUND)\n\n existing\n end", "def exists?(id)\n rec = CONNECTION.execute(\"SELECT * FROM #{table_name} WHERE id = #{id};\").first\n if rec.nil?\n false\n else\n self.new(rec)\n end\n end", "def add_if_not_exists()\n\tif record_exists()\n\t\tprintf(\"EXISTS %s\\n\",self.digest)\n\t\treturn 0\n\tend\n\tsave()\n\treturn 1\nend", "def exists?\n !@exists.nil? && @exists\n end", "def exists?\n !@exists.nil? && @exists\n end", "def exists?\n !@exists.nil? && @exists\n end", "def exists?\n !@exists.nil? && @exists\n end", "def exists?\n !@exists.nil? && @exists\n end", "def exist?\n !count.zero?\n end", "def exist\n\treturn true\n end", "def exists?; end", "def exists?\n new? ? false : !this.get(SQL::AliasedExpression.new(1, :one)).nil?\n end", "def exists?\n new? ? false : !this.get(SQL::AliasedExpression.new(1, :one)).nil?\n end", "def exists!\n @exists = true\n end", "def exists?\n false\n end", "def exists?\n false\n end", "def exists\n @record = Record.new\n comment = Comment.find_by_app_id_and_authorId(params[:app_id], params[:authorId], :select => :id)\n\n if comment.nil?\n @record.exists = false\n else\n @record.id = comment.id\n @record.exists = true\n end\n\n respond_to do |format|\n format.xml {render :xml => @record}\n format.json {render :json => @record} \n end\n end", "def exist? (name)\n @by_id[name.to_s]\n end", "def exists?\n true\n end", "def exists?\n !data.empty?\n end", "def exists\n @record = Record.new\n app = App.find_by_packageName(params[:packageName], :select => :id)\n \n if app.nil?\n @record.exists = false\n else\n @record.id = app.id\n @record.exists = true\n end\n \n respond_to do |format|\n format.xml {render :xml => @record}\n format.json {render :json => @record} \n end\n end", "def exists?\n\t\treturn self.entry ? true : false\n\tend", "def found?\n return false if no_search\n\n id.present? || records.present?\n end", "def exists?\n criteria.exists?\n end", "def exists?\n this.count > 0\n end", "def exists?()\n end", "def exists?()\n\t\t\treturn @metadata.exists?\n\t\tend", "def exists?\n !!@exists\n end", "def create?\n @record.present?\n end", "def exist?\n @resource.exist?\n end", "def exist?\n pk = partition_key\n sk = conditional_sort_key\n self.class.find(pk, sk).present?\n rescue Mara::Model::NotFoundError\n false\n end", "def exists?\n !new? && self.class.exists?(id)\n end", "def exists?\n !service.get_table(instance_id, name, view: :NAME_ONLY).nil?\n rescue Google::Cloud::NotFoundError\n false\n end", "def exists?\n Puppet.debug \"using provider action_record\"\n Puppet.debug \"starting exists? #{self.class.to_s}\"\n Puppet.debug \"check name => #{get_fqdn}\"\n Puppet.debug \"check type => #{get_type}\"\n dns_service = get_dns_service(get_fqdn)\n return false if dns_service == nil\n return dns_service.record_exist?(get_fqdn, get_type)\n end", "def exists\n @deleted = false\n @exists = true\n end", "def exist?\n !!@exist\n end", "def exist?\n !!@exist\n end", "def exists?(object); end", "def exists?(object); end", "def exists\n @record = Record.new\n visual = Visual.find_by_app_id_and_image_file_name(params[:app_id], params[:filename], :select => :id)\n \n if visual.nil?\n @record.exists = false\n else\n @record.id = visual.id\n @record.exists = true\n end\n\n respond_to do |format|\n format.xml {render :xml => @record}\n format.json {render :json => @record} \n end\n end", "def existing?\n @existing\n end", "def exists?\n error_code.success?\n end", "def exist?(id)\n path = record_path(id)\n File.exist?(path) ? path : nil\n end", "def exists?\r\n !new? && self.class.exists?(id, prefix_options)\r\n end", "def new_record?(object)\n object[\"UID\"].nil? || object[\"UID\"] == \"\"\n end", "def single_record?\n id.present?\n end", "def exist?\n @lock.synchronize { valid? }\n end", "def exists?\n !new? && self.class.exists?(id, prefix_options)\n end", "def exists?(id, options = {})\r\n id && !find_single(id, options).nil?\r\n rescue ActiveResource::ResourceNotFound\r\n false\r\n end", "def does_user_exist(username)\n # note :db_column_name syntax like \"params[:id]\"\n user = Account.find_by(:user_name => username)\n if user\n return true\n else\n return false\n end\nend", "def exist?(*args)\n find(*args) && true\n rescue NotFoundError\n false\n end", "def exists?(id, options = {})\n id && !find_single(id, options).nil?\n rescue ActiveResource::ResourceNotFound\n false\n end", "def exists?\n begin \n CouchDB.get uri\n true\n rescue\n false\n end \n end", "def exist?\n not self.name.nil?\n end", "def exists?\n storage.exists?(id)\n end", "def exist?\n @created\n end", "def show?\n scope.where(:id => record.id).exists?\n end", "def exists?(id)\n id && !find_single(id).nil?\n rescue ActiveWmi::ResourceNotFound\n false\n end", "def include?(record)\n # The existing implementation relies on receiving an Active Record instance as the input parameter named record.\n # Any non-Active Record object passed to this implementation is guaranteed to return `false`.\n return false unless record.is_a?(klass)\n\n if loaded? || offset_value || limit_value || having_clause.any?\n records.include?(record)\n else\n id = if record.class.composite_primary_key?\n record.class.primary_key.zip(record.id).to_h\n else\n record.id\n end\n\n exists?(id)\n end\n end", "def exists?\n stats.key? @resource[:name]\n end", "def unique?\n existing_record = CONNECTION.execute(\"SELECT * FROM logs WHERE user_id = #{self.user_id} AND train_id = #{self.train_id}\")\n return existing_record == []\n end", "def exist?(key)\n store.key?(key)\n end", "def exists?(id)\n profile(id) ? true : false\n end", "def exist?\n !entries.empty?\n end", "def exist?(key)\n instrument :exist, key: key do |payload|\n id = map_key_to_id(key)\n answer = id.present?\n\n payload[:exist] = answer\n answer\n end\n end", "def exist?(cccc)\n not find_data_by_cccc(cccc).nil?\n end", "def exist?(key)\n\n end", "def exists?\n data != {}\n end", "def exists? jid\n\t\tuser = @users.read ['id'], ['jid', jid]\n\t\tuser.count > 0 ? true : false\n\tend", "def isExistingMember( member )\n #Validate if member already exists\n\n @validatemember = Member.find(:all, :conditions => [\"firstname = ? AND lastname = ? AND emailid = ?\", member.firstname, member.lastname, member.emailid\n ])\n if @validatemember.length == 0\n return false\n else\n member.id = @validatemember[0].id\n return true\n end\n\n end", "def exists?\n schema.exists?(self)\n end", "def exists?\n name, type = resource[:name].split('/')\n # Create the resolver, pointing to the nameserver\n r = Resolv::DNS.new(:nameserver => server)\n # Do the look-up\n begin\n @dnsres = r.getresources(name, typeclass(type))\n rescue Resolv::ResolvError\n return false\n end\n # MX and SRV lookups will return empty arrays\n if @dnsres.is_a? Array\n return false if @dnsres.empty?\n end\n # The record exists!\n return true\n end", "def does_user_exist?(username)\n user = UsersModel.find_by(:name => username.to_s)\n if user\n return true\n else\n return false\n end\nend", "def exist?(key)\n !find(key).nil?\n end", "def title_exist(title)\n \n if Title.find_by(name: title) == nil\n Title.create(name: title)\n end\n (Title.find_by name: title).id\nend", "def exists?\n fail NotImplementedError\n end", "def success?\n data_rows.exists? && !data_rows.failed.exists?\n end" ]
[ "0.81976396", "0.80839896", "0.7752192", "0.76036686", "0.75926435", "0.7587839", "0.746919", "0.746919", "0.7455745", "0.7446991", "0.7357543", "0.7344456", "0.73401487", "0.7338183", "0.7330477", "0.7326184", "0.73158324", "0.73088336", "0.7301359", "0.7296956", "0.7291184", "0.7270652", "0.7265896", "0.72561014", "0.7253303", "0.7239625", "0.72395426", "0.72395426", "0.72286004", "0.72286004", "0.72286004", "0.72277755", "0.7220464", "0.7207312", "0.71941763", "0.71941763", "0.71167135", "0.7114955", "0.7114955", "0.71042216", "0.7098786", "0.7091546", "0.7083104", "0.7068877", "0.7063298", "0.7039584", "0.69915926", "0.69899935", "0.69709164", "0.6937651", "0.69006586", "0.68947846", "0.6894555", "0.68873656", "0.68866086", "0.68774784", "0.6841657", "0.68349624", "0.6834288", "0.6834288", "0.68182594", "0.68182594", "0.680705", "0.6797163", "0.6776132", "0.6773774", "0.6763021", "0.675512", "0.67544484", "0.6726327", "0.6720456", "0.67199636", "0.6698494", "0.66956806", "0.66853744", "0.6668277", "0.666594", "0.6655421", "0.6627652", "0.6619596", "0.6602482", "0.6601935", "0.659675", "0.6593958", "0.65902656", "0.6587642", "0.65813047", "0.657767", "0.6571979", "0.6552891", "0.65451986", "0.65318877", "0.6528102", "0.6526192", "0.6523138", "0.6521672", "0.6517382", "0.65140086", "0.65125257", "0.65116453" ]
0.69222325
50
get a dns record object
def get_record(fqdn, type) matches = find_match(@dnss.records, fqdn, true) if matches != nil record = nil matches.each do |record| Puppet.debug "inspecting #{record.hash_type} == #{type}" if record.hash_type.to_s == type.to_s Puppet.notice "found dns record : #{fqdn}, #{type}" return record end end else Puppet.debug "match found no record : #{fqdn}, #{type}" end Puppet.debug "record not found : #{fqdn}, #{type}" return nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_record(fqdn)\n\n url = \"https://dnsapi.cn/Record.List\"\n\n h = HTTPClient.new()\n\n default_params = {\n :login_email => \"\"\n }\n params = {\n\n }.merge(default_params)\n\n res = h.post(url, params)\n records = JSON.parse(res.body)['records']\n\n\n # Request a single record \"starting with\" the desired record.\n #reply = r53.list_resource_record_sets(\n # :hosted_zone_id => @aws_hosted_zone_id,\n # :start_record_name => fqdn,\n # :max_items => 1\n # )\n\n\n # If the returned record name matches exactly, return it.\n # record fqdn are returned with the trailing anchor (.)\n return nil if not reply\n\n # Check if we found it exactly\n res = reply[:resource_record_sets][0]\n return nil if not res\n\n return res if res[:name] == fqdn + \".\"\n\n # If not, then you got nothing or a record which didn't match.\n nil\n end", "def makeARecord(machine, ttl: Config::TTL_A_RECORD)\n return DnsRecord.new(name: machine.dns_record(),\n type: \"A\",\n content: machine.static_ip(),\n ttl: ttl)\nend", "def dns_a_record\n @_dns_a_record = \"0.0.0.0\" if @config[:dns_lookup] == :off\n @_dns_a_record ||= Socket.gethostbyname(dns_name)\n rescue SocketError # not found, but could also mean network not work\n @_dns_a_record ||= []\n end", "def get_record(hosted_zone, record_name, record_type='A')\n\n #record_type = options.fetch(\"record_type\", 'A')\n records = AwsPocketknife::Route53.get_record(hosted_zone_name: hosted_zone,\n record_name:record_name,\n record_type: record_type)\n headers = [\"Name\", \"Type\", \"DNS Name\"]\n data = []\n if records.length > 0\n records.each do |record|\n if record.type == 'CNAME'\n data << [record.name, record.type, record.resource_records[0].value]\n else\n data << [record.name, record.type, record.alias_target.dns_name]\n end\n end\n AwsPocketknife::Route53.pretty_table(headers: headers, data: data)\n else\n puts \"Record #{record_name} not found in hosted zone #{hosted_zone}\"\n end\n end", "def get_record(fqdn)\n # Request a single record \"starting with\" the desired record.\n reply = r53.list_resource_record_sets(\n :hosted_zone_id => @aws_hosted_zone_id,\n :start_record_name => fqdn,\n :max_items => 1\n )\n\n # If the returned record name matches exactly, return it.\n # record fqdn are returned with the trailing anchor (.)\n return nil if not reply\n\n # Check if we found it exactly\n res = reply[:resource_record_sets][0]\n return nil if not res\n\n return res if res[:name] == fqdn + \".\"\n\n # If not, then you got nothing or a record which didn't match.\n nil\n end", "def find_record(name, type = 'A')\n # Find the record\n response = @route53.client.list_resource_record_sets({\n :hosted_zone_id => @hosted_zone_id,\n :start_record_name => name,\n :start_record_type => type,\n :max_items => 1\n })\n\n record = nil\n if response && response.data\n if response.data[:resource_record_sets] && response.data[:resource_record_sets].size > 0\n response_record = response.data[:resource_record_sets][0]\n if (response_record[:name] == name || response_record[:name] == \"#{name}.\") && response_record[:type] == type\n record = Route53Record.new(response_record[:name], response_record[:type], response_record[:ttl], response_record[:resource_records][0][:value])\n end\n end\n end\n\n record\n end", "def makeSoaRecord(cluster, ttl: Config::TTL_SOA)\n return DnsRecord.new(name: cluster.nameservers()[0].dns_record(),\n type: \"SOA\",\n content: cluster.hostmasters()[0].dns_record(),\n ttl: ttl)\nend", "def dns\n doc = request(\"dns-list_records\")\n api_error?(doc)\n (doc/:data).inject([]) { |records, dns| records << Dns.new_from_xml(dns); records }\n end", "def get_authority_resource_record(dns_query, parsed_dns)\n nscount = parsed_dns[:dns_header_field][:nscount]\n return nil if nscount == 0\n get_resource_record(dns_query, nscount, parsed_dns)\n end", "def create_single_dns_record(app_name,\n stack_name,\n zone_name,\n record_name,\n ttl: 300,\n type: 'A',\n healthcheck: nil,\n zone_id: nil,\n alias_target: {},\n resource_records: [])\n if type && !RECORD_TYPE.include?(type)\n fail(\"Route53 record type can only be one of the following: #{RECORD_TYPE.join(',')}\")\n end\n if healthcheck && (!healthcheck.is_a?(Hash) || !healthcheck.include?(:Ref))\n fail('healthcheck must be a valid cloudformation Ref function')\n end\n if alias_target && (!alias_target.is_a?(Hash))\n fail('AliasTarget must be a Hash')\n end\n\n name = app_name || stack_name.titleize.remove(/\\s/)\n properties = {\n Name: record_name,\n Comment: \"#{type} record for #{[app_name, 'in '].join(' ') if app_name}#{stack_name} stack\",\n Type: type\n }\n\n # HostedZoneId and HostedZoneName options are mutually exclusive\n if zone_id && !zone_id.nil?\n properties[:HostedZoneId] = zone_id\n else\n properties[:HostedZoneName] = zone_name\n end\n\n if !alias_target.blank?\n fail('AliasTarget can be created only for A or AAAA type records') unless %w(A AAAA).include?(type)\n unless alias_target.key?(:HostedZoneId) && alias_target.key?(:DNSName)\n fail('AliasTarget must have HostedZoneId and DNSName properties')\n end\n properties[:AliasTarget] = alias_target\n else\n properties[:TTL] = ttl\n properties[:HealthCheckId] = healthcheck if healthcheck\n properties[:ResourceRecords] = resource_records.empty? ? ref(\"#{app_name}PublicIpAddress\") : resource_records\n end\n\n resource \"#{name}Hostname\",\n Type: 'AWS::Route53::RecordSet',\n Properties: properties\n end", "def find_record\n @record = reply_address.record\n end", "def rr(type, name, rdata)\n ttl = 3600\n klass = 'IN'\n string = [name, ttl, klass, type, rdata].join(' ')\n Dnsruby::RR.new_from_string(string)\n end", "def get_record(bibnumber)\n if record_exists?(bibnumber)\n marc_url = URI_FOR_MARC % ([@scope] + Array.new(3, bibnumber))\n record_url = URI_FOR_RECORD % [bibnumber, @scope]\n \n # Retrieve MARC data and convert to UTF-8 prior to decoding ...\n record_page = get_page(marc_url)\n record_data = MARC_REGEX.match(record_page)\n \n if record_data.nil?\n raise ParserError, \"Could not decode data: MARC data not found.\"\n else\n record_data = record_data[1].strip()\n record_data = Iconv.conv('UTF-8', 'LATIN1', record_data)\n end\n\n record = decode_pseudo_marc(record_data)\n unless record.nil?\n record.bibnum = bibnumber\n record.raw = record_data\n record.record_url = \"#{self.class.base_uri}#{record_url}\"\n record.marc_url = \"#{self.class.base_uri}#{marc_url}\"\n end\n return record\n else\n raise NonExistentRecordError, \"Record not found.\"\n end\n rescue NonExistentRecordError => error\n warn error.message\n return nil\n rescue ParserError => error \n warn error.message\n return nil\n end", "def get_a_record(host, hosted_zone = nil)\n\t\thosted_zone ||= get_hosted_zone()\n\n\t\tstart_name = \"#{host}.#{hosted_zone[:name]}\"\n\n\t\tresp = @r53.list_resource_record_sets(:hosted_zone_id => @zone, :start_record_name => start_name, :start_record_type => 'A')\n\t\trecord = nil\n\t\tif resp[:resource_record_sets].length > 0\n\t\t\trecord = resp[:resource_record_sets][0] if resp[:resource_record_sets][0][:type] == 'A'\n\t\tend\n\t\trecord\n\tend", "def set_dns_record\n @dns_record = DnsRecord.find(params[:id])\n end", "def dns\n @dns ||= Resolv::DNS.open\n end", "def get_additional_resource_record(dns_query, parsed_dns)\n arcount = parsed_dns[:dns_header_field][:arcount]\n return nil if arcount == 0\n get_resource_record(dns_query, arcount, parsed_dns)\n end", "def get_answer_resource_record(dns_query, parsed_dns)\n ancount = parsed_dns[:dns_header_field][:ancount]\n return nil if ancount == 0\n get_resource_record(dns_query, ancount, parsed_dns)\n end", "def parse_dns(dns_raw)\n dns_records = {}\n dns_raw.each do |line|\n arr = line.split(\", \")\n if(arr[0] == \"A\" || arr[0] == \"CNAME\")\n dns_records[arr[1]] = {:type => arr[0], :target => arr[2].strip}\n end\n end\n \n return dns_records\n end", "def findRecord(domain)\n return CouchPotato.database.load_document domain\n end", "def get_parsed_dns( dns_query )\n begin\n parsed_dns = {\n :index => 0,\n :domain_name_dictionary => [],\n :dns_header_field => Hash.new(),\n :question_section => Hash.new(),\n :answer_section => Hash.new(),\n :authority_section => Hash.new(),\n :additional_section => Hash.new()\n }\n\n parsed_dns[:dns_header_field] = get_header_section(dns_query)\n parsed_dns[:index] = QUESTION_FIELD_START_INDEX\n parsed_dns[:question_section] = get_question_section(dns_query, parsed_dns)\n parsed_dns[:answer_section] = get_answer_resource_record(dns_query, parsed_dns)\n parsed_dns[:authority_section] = get_authority_resource_record(dns_query, parsed_dns)\n parsed_dns[:additional_section] = get_additional_resource_record(dns_query, parsed_dns)\n rescue\n end\n parsed_dns\n end", "def get_record(identifier, opts = {})\n opts[:identifier] = identifier\n opts = opts.merge(@opts)\n @record_class.build(mint_id(identifier),\n record_xml(client.get_record(opts).record))\n end", "def pull\n zt=Dnsruby::ZoneTransfer.new\n zt.transfer_type=Dnsruby::Types.AXFR\n zt.server=self.server\n zone=zt.transfer(self.zone.domain)\n zone.tsig=self.zone.domain+\".\", self.key\n soa=zone[0]\n recl=zone[1]\n for record in zone\n src,type,target=record.to_s.match(/([A-z\\.0-9]*)[0-9\\t ]*(IN\\t[A-z]*)\\t([A-z0-9\\. ]*)/).captures\n if type=='IN\\tMX' or type=='IN\\tA' or type=='IN\\tCNAME'\n\tcreateRecord(record)\n elsif type=='IN\\tSOA'\n updateSerial(record)\n end\n end\nend", "def get_record(identifier)\n doc = client.get!(CGI.escape(identifier)).body.to_json\n @record_class.build(mint_id(identifier), doc, 'application/json')\n end", "def fetch_zone\n \n # zone name pass from url\n zone_name = params[:src]\n # Record type, A or PTR\n record_type = params[:type]\n # zone name pass from url\n network_type = params[:net]\n \n # Output Buffer\n @o = ''\n \n if network_type == 'int'\n dns_zone = DnsZone.find_by_name(zone_name + \"-int\")\n else\n dns_zone = DnsZone.find_by_name(zone_name)\n end\n \n # If can't find the specified zone, we'll return with some useful text\n if dns_zone.nil?\n @o += \"; ##ERROR## Invalid zone name specified.\\n\"\n @o += \"; Valid names can be one of the following:\\n\"\n \n @o += DnsZone.find(:all, :order => :name, :select => :name).collect{|a| \"; \" + a.name}.join(\"\\n\")\n else\n # Our rules for dns record generation. \n # 1. Only generate a record once\n # 2. Generate record in closest zone defined.\n # 3. If nothing match, generate nothing.\n # 4. Record will be specified in absolute name, include the \".\" at the end\n # For ex: ads1.vip.sc9.yahoo.com should match zone, \"vip.sc9.yahoo.com\" first, if not found,\n # try sc9.yahoo.com, then yahoo.com, then .com. If no zone match, then this record is ignored.\n # @o += \"; Generated zone for #{zone_name} on #{Time.new.to_s}\\n\"\n # Dont think we need ORIGIN, will find out when deploy internal DNS\n #@o += \"$ORIGIN #{dns_zone.name}.\\n\"\n @o += \"$TTL #{dns_zone.my_ttl}\\n\"\n \n # In order to make sure we only generate one record, we actually have get all asset and zone\n # then put them in appropriate places. It kinda suck, but one http call can't get us multiple file\n # Unless we get everything into one file, then have the local script to parse it into multiple\n # files, but that sounds a bit too hacky. So instead, we let AST do the expensive work.\n\n # Alright, let's build the SOA first.\n @o += \"@ \\t IN \\t SOA #{dns_zone.my_soa} (\\n\"\n @o += \"\\t\\t\\t #{Time.new.to_i} \\t;serial\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_refresh} \\t;refresh\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_retry} \\t;retry\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_expire} \\t;expire\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_minimum} \\t;minimum\\n\"\n @o += \");\\n\"\n # NS\n for ns in dns_zone.my_dns_ns_records\n @o += \"\\t\\tNS\\t\\t#{ns.name}.\\n\" \n end\n # MX\n for mx in dns_zone.my_dns_mx_records\n @o += \"\\t\\tMX\\t\\t#{mx.priority} #{mx.name}.\\n\"\n end\n \n @o += \"\\n\"\n \n # use appropriate function for each type of record\n if record_type == 'a'\n \t# If master A record is not null, put it in here\n \tif ! dns_zone.mastera.nil?\n @o += \"\\t\\t\\t\\t#{dns_zone.mastera}\\n\\n\"\n end\n @o += fetch_dns_a(zone_name) \n elsif record_type == 'ptr'\n @o += fetch_dns_ptr(zone_name)\n end\n #@o += assets.collect{|a| a.primary_interface.ip_to_string rescue nil}.join(\"<br/>\")\n end\n \n render(:partial => \"output\",:object => @o) \n\n end", "def get_record_type(dns_name, dns_values)\n # default to CNAME\n record_type = 'cname'\n # if the value is an IP then it is an 'A' record\n ips = dns_values.grep(/\\d+\\.\\d+\\.\\d+\\.\\d+/)\n record_type = 'a' unless ips.empty?\n record_type = 'ptr' if dns_name =~ /^\\d+\\.\\d+\\.\\d+\\.\\d+$/\n record_type\n end", "def dns\n @dns ||= @node.search('DNS/listEntry').map do |entry|\n DomainName.new(entry.inner_text)\n end\n end", "def add_domain_record_a(params)\n post('dns/recorda', params)\n end", "def parse_dns(dns_raw)\n hash= {}\n dns_raw.each do |record|\n record = record.split(\",\")\n if record.length() > 1 && record[0] != \"# RECORD TYPE\"\n hash[record[1].strip()] = record[2].strip()\n end\n end\n return hash\n end", "def find(id)\n response = get(\"/domains/#{@@parent_id}/records/#{id}\")[\"record\"]\n response or return nil\n Record.new response\n end", "def get_record(key)\n fields = get(key)[:record]\n MemoryRecord.new.init(key,fields) if fields\n end", "def record(record_id, params = {})\n Record.new(record_id, params).get\n end", "def record(record_id, params = {})\n Record.new(record_id, params).get\n end", "def create_record(fqdn, type, ipdata)\n unless @dnss.is_valid?\n Puppet.crit dns.cstatus\n end\n priority = {} # TODO: research how to implement priority for puppet\n# priority = priority[0]\n# if priority.nil?\n# priority = {}\n# else\n# priority = { :priority => priority.to_i }\n# end\n record = @dnss.create_record(fqdn, type, ipdata, priority)\n if record.nil?\n Puppet.err dns.cstatus\n end\n Puppet.notice \"Created dns record '#{fqdn}' with id '#{record[:id]}'.\"\n end", "def load_record(rid, mid)\n url = Configuration::PROPERTIES.get_property :url\n url_get_records = Configuration::PROPERTIES.get_property :url_get_record_info\n\n url_get_records = url_get_records.gsub '{csk}', URI::encode(@credential[:csk])\n url_get_records = url_get_records.gsub '{aci}', URI::encode(@credential[:aci])\n url_get_records = url_get_records.gsub '{mid}', mid.to_s\n url_get_records = url_get_records.gsub '{rid}', rid.to_s\n\n response = DynamicService::ServiceCaller.call_service url + url_get_records, {}, 'get'\n\n json = JSON.parse(response)\n record = json['record']\n\n unless record\n raise 'Record key doesn\\'t present in response from Dynamicloud server.'\n end\n\n Dynamicloud::API::DynamicloudHelper.normalize_record record\n end", "def dmarc\n dns_name ? txt_hash(\"_dmarc.\" + dns_name) : {}\n end", "def add_domain_record_ns(params)\n post('dns/recordns', params)\n end", "def parse_dns(dns_raw)\n\tdns_records = {}\n\n\n\tdns_raw.\n\tmap{|line| line.strip }.\n\treject {|line| line.empty?}.\n\treject {|line| line[0] == \"#\" }.\n\n\teach{|line|\n\t\tinfo = line.split \",\"\n\t\tdns_records[info[1].strip] = { :type => info[0].strip, :val => info[2].strip }\n\t}\n\treturn dns_records\nend", "def dns\n @dns ||= select { |type,value| type == :dns }.map do |(type,value)|\n value\n end\n end", "def record_to_object(record)\n record\n end", "def a_record?\n dns.first.class == Net::DNS::RR::A if dns?\n end", "def add_domain_record_aaaa(params)\n post('dns/recordaaaa', params)\n end", "def dnspod()\n AWS::Route53.new(:access_key_id => @aws_access_key_id,\n :secret_access_key => @aws_access_key).client\n end", "def new_record(template, domain, record)\n r = Record.new\n\n r.domain_id = domain.id\n r.name = subst(domain, template.name)\n\n if template.type == \"A\" || template.type == \"CNAME\" || template.type == \"AAAA\"\n r.name += \".\" unless template.name.empty?\n r.name += domain.name\n end\n\n r.type = template.type\n\n if template.type == \"A\" || template.type == \"AAAA\"\n unless record[1].empty?\n r.content = record[1]\n else\n r.content = template.content\n record[1] = template.content\n end\n else\n r.content = subst(domain, template.content)\n end\n\n r.ttl = template.ttl\n r.prio = template.prio\n r.change_date = Time.now.to_i\n\n r.save\n return r\n end", "def create_dns_record(domain, hostname, type, content, ttl, priority = nil)\n body = {\n 'hostname' => hostname,\n 'type' => type,\n 'content' => content,\n 'ttl' => ttl\n }\n body.update!(:priority => priority) if priority\n connection.post \"/dns/create/#{domain}\", body\n end", "def find_record\n if @zone.nil?\n if @resource[:zoneid] != 'absent' then\n @zone = @resource[:zoneid]\n else\n @zone = zone_by_name @resource[:zone]\n if @zone.nil? then\n self.fail \"No such zone: #{@resource[:zone]}\"\n end\n end\n end\n connection.list_resource_record_sets(hosted_zone_id: @zone, start_record_name: @resource[:record], start_record_type: @resource[:type]).resource_record_sets.each do |record|\n if record.name == @resource[:record] && record.type == @resource[:type]\n return record\n end\n end\n return nil\n end", "def parse_dns(dns_raw)\n dns = []\n dns_records = {}\n record_type_A = []\n record_type_A_IP = []\n record_type_CNAME = []\n record_type_CNAME_alias = []\n\n #adds each line to dns array and splipt them with \",\"\n dns_raw.each do |lines_in_files|\n dns.push([lines_in_files.split(\",\")])\n end\n\n #Checks for recordA,IP or recordCNAME and adds them to the respected array\n dns.each do |words_in_files|\n if words_in_files[0][0] == \"A\"\n record_type_A.push(words_in_files[0][1].strip)\n record_type_A_IP.push(words_in_files[0][2].strip)\n elsif words_in_files[0][0] == \"CNAME\"\n record_type_CNAME.push(words_in_files[0][1].strip)\n record_type_CNAME_alias.push(words_in_files[0][2].strip)\n end\n end\n\n #record_A hash stores values of recordA\n record_A = {\n :source => record_type_A,\n :ip => record_type_A_IP,\n }\n\n #recordCNAME hash stores values of recordCNAME\n record_CNAME = {\n :source => record_type_CNAME,\n :alias => record_type_CNAME_alias,\n }\n\n #dns_records gets both Hashes\n dns_records = {\n :A => record_A,\n :CNAME => record_CNAME,\n }\n\n #returns record dns_record with two hashes.\n return dns_records\nend", "def find_single_record zone, name, content, type = 'A'\n get_records(zone, name).values.each do |rec|\n if rec['zone_name'] == zone \\\n && rec['display_name'] == name \\\n && rec['content'] == content \\\n && rec['type'] == type\n return rec\n end\n end\n nil\n end", "def convert_record(line)\n record = line.split(' ')\n if record[1] == 'A' || record[1] == 'AAAA'\n ip = IPAddr.new record[2]\n name = ip.reverse\n puts name + \". PTR \" + record[0]\n end\nend", "def add_domain_record_srv(params)\n post('dns/recordsrv', params)\n end", "def find_record\n if @zone.nil?\n if @resource[:zoneid] != 'absent' then\n @zone = zone_by_id @resource[:zoneid]\n if @zone.nil? then\n self.fail \"No zone with id: #{@resource[:zoneid]}\"\n end\n else\n @zone = zone_by_name @resource[:zone]\n if @zone.nil? then\n self.fail \"No such zone: #{@resource[:zone]}\"\n end\n end\n end\n @records = @zone.records\n @records.each do |record|\n if record.name == @resource[:record]\n return record\n end\n end\n return nil\n end", "def get_record zone, name\n get_all_records_for_zone(zone).each do |rec|\n return rec if rec['display_name'] == name && rec['zone_name'] == zone\n end rescue NoMethodError\n nil\n end", "def domain_dns_records()\n return MicrosoftGraph::DomainDnsRecords::DomainDnsRecordsRequestBuilder.new(@path_parameters, @request_adapter)\n end", "def dns_find(key)\n \n end", "def get_dns_ipaddr(host)\n dns = Dnsruby::DNS.new({\n :nameserver => [ IWMNns ],\n :search => [ 'canishe.com' ],\n :ndots => 1\n })\n\n answer = dns.getaddress(host)\n\n return answer.to_s\nend", "def parse_dns(dns_raw)\n dns_records = {}\n dns_raw.each do |rec|\n rec=rec.chomp\n unless rec[0] == \"#\" || rec.empty?\n records = rec.split(/,/)\n records = records.map {|recd| recd.strip()}\n unless dns_records.has_key?(records[0])\n dns_records.store(records[0],[[records[1],records[2]]])\n else\n dns_records[records[0]].push([records[1],records[2]])\n end\n end\n end\n return dns_records\nend", "def get_instance(payload)\n return RecordInstance.new(\n @version,\n payload,\n account_sid: @solution['account_sid'],\n )\n end", "def fetch_dns_ptr(zone_name)\n \n @o = ''\n # find out the range we are parsing in this zone.\n ranges = []\n zone_name.split(\".\").map{|a| \n # Make sure it's request for arpa zone which should be all number\n if ! (a =~ /^\\d+$/).nil?\n if ranges.empty?\n ranges << a\n else\n ranges.insert(0, a)\n end\n end\n }\n \n # After look through zone name, if it's not a arpa zone, we'll return nil\n if ranges.empty?\n return @o\n end\n \n # Use later to determine how many number from ip we need\n zone_class = ranges.length\n \n # Now we have the range from zone name, let's use Networking class to help us find all interfaces\n # Find out wether it's class a, b, c or d\n netmask = 32 # start with D class netmask\n for i in (ranges.length..4-1)\n # Get the netmask correctly\n netmask = netmask - 8\n # Set the empty ip slot to 0\n ranges[i] = 0;\n end\n \n # Build the address\n range_address = ranges.join(\".\") + \"/#{netmask}\"\n \n # Call in cidr, find all interface under this range.\n interfaces = Networking.get_interfaces_in_range(range_address).sort{|a,b| a.ip <=> b.ip}\n\n # Find asset for each interface\n # If asset is Server, we need to look up two things\n # 1. If ip is drac, we will add \"-d\" to the hostname\n # 2. Maybe for vip, we need to ptr to it, but on the second thought, that shouldn't be. \n for interface in interfaces\n\n # Build the ip correct for this zone\n ips = []\n ip_parts = interface.ip_to_string.split(\".\")\n for i in (zone_class..4-1)\n # Insert reversely\n ips.insert(0, ip_parts[i])\n end\n ip = ips.join(\".\")\n \n # If it's a drac and type = server, we transform the hostname\n if ( interface.drac_ip? && interface.asset.resource_type == 'Server')\n name = convert_to_drac_name(interface.asset.name)\n else\n # Check to see if there is multiple vips poing to this ip, if so raise exception.\n # If only one ip, then we'll point PTR record to that vip.\n if interface.vips.length > 1\n #raise \"#{interface.ip_to_string} has more than one vip \" + interface.vips.collect{|a| a.name}.inspect + \" pointing to it\"\n @o += \";#{interface.ip_to_string} has more than one vip \" + interface.vips.collect{|a| a.name}.inspect + \" pointing to it.\\n\"\n @o += \";Picking the first one.\\n\"\n name = interface.vips[0].name \n elsif interface.vips.length == 1\n name = interface.vips[0].name\n # Network asset with named interface\n elsif interface.asset.resource_type == 'Network' and interface.name and interface != interface.asset.primary_interface and ! interface.name.empty?\n name = interface.name + '.' + interface.asset.name\n else\n name = interface.asset.name \n end\n \n end\n \n @o += \"#{ip}\\t\\tPTR\\t\\t#{name}.\\n\"\n\n end\n\n return @o\n\n rescue Exception => exc\n flash[:interface] = \"##ERROR## Fetch failed following reason: #{exc.message}\\n\"\n\n \n end", "def do_lookup(args)\n if args[\"qname\"] == \"example.com\" and args[\"qtype\"].downcase == \"soa\"\n @result = [\n record(\"example.com\", \"SOA\", \"sns.dns.icann.org noc.dns.icann.org 2013012485 7200 3600 1209600 3600\"),\n ]\n elsif args[\"qname\"] == \"example.com\" and args[\"qtype\"].downcase == \"any\"\n @result = [ \n record(\"example.com\", \"SOA\", \"sns.dns.icann.org noc.dns.icann.org 2013012485 7200 3600 1209600 3600\"),\n record(\"example.com\", \"NS\", \"sns.dns.icann.org\"),\n record_prio(\"example.com\", \"MX\", \"test.example.com\",10)\n ]\n elsif args[\"qname\"] == \"test.example.com\" and args[\"qtype\"].downcase == \"any\"\n @result = [\n record(\"test.example.com\", \"A\", \"127.0.0.1\")\n ]\n elsif args[\"qname\"] =~ /(.*)\\.example\\.com$/ and args[\"qtype\"].downcase == \"any\"\n ip = 0\n $1.downcase.each_byte do |b| ip = ip + b end\n ip_2 = ip/256\n ip = ip%256\n @result = [\n record(args[\"qname\"], \"A\", \"127.0.#{ip_2}.#{ip}\")\n ]\n end\n end", "def load_general_and_get_rdata(string, options = {})\n # strip comments, unless its escaped.\n # skip semicolons within \"quote segments\" (TXT records)\n string.gsub!(/((?<!\\\\);)(?=(?:[^\"]|\"[^\"]*\")*$).*/o, \"\")\n\n captures = string.match(DNS::Zone::RR::REGEX_RR)\n return nil unless captures\n\n if [' ', nil].include?(captures[:label])\n @label = options[:last_label]\n else\n @label = captures[:label]\n end\n\n # unroll records nested under other origins\n unrolled_origin = options[:last_origin].sub(options[:origin] || options[:default_origin], '').chomp('.') if options[:last_origin]\n if unrolled_origin && !unrolled_origin.empty?\n @label = @label == '@' ? unrolled_origin : \"#{@label}.#{unrolled_origin}\"\n end\n\n @ttl = captures[:ttl]\n captures[:rdata]\n end", "def new_mx_record(domain, content, ttl, prio)\n r = Record.new\n\n r.domain_id = domain.id\n r.name = domain.name\n r.type = \"MX\"\n r.content = content\n r.ttl = ttl\n r.prio = prio\n r.change_date = Time.now.to_i\n\n r.save\n return r\n end", "def resolve(dns_records, lookup_chain, domain)\n value = dns_records[domain]\n if(value == nil)\n puts \"Error: record not found for #{domain}\"\n exit\n\n elsif(value[:type] == \"A\")\n lookup_chain.push(value[:target])\n return lookup_chain\n\n elsif(value[:type] == \"CNAME\")\n lookup_chain.push(value[:target])\n return resolve(dns_records, lookup_chain, value[:target])\n \n end\n end", "def makeARecordGroup(name, machines, ttl: Config::TTL_A_RECORD)\n return DnsRecord.new(name: name,\n type: \"A\",\n content: machines.map(&:static_ip).join(\",\"),\n ttl: ttl)\nend", "def build( domain = nil )\n record_class = self.record_type.constantize\n\n # make a clean copy of ourself\n attrs = self.attributes.dup\n attrs.delete_if { |k,_| !record_class.columns.map(&:name).include?( k ) }\n attrs.delete('id')\n\n # parse each attribute for %ZONE%\n unless domain.nil?\n attrs.keys.each do |k|\n attrs[k] = attrs[k].gsub( '%ZONE%', domain.name ) if attrs[k].is_a?( String )\n end\n end\n\n record_class.new( attrs )\n end", "def create\n @dns_record = @zone.dns_records.build(dns_record_params)\n @dns_record.ttl = (30 * 60) if @dns_record.ttl.nil?\n respond_to do |format|\n if @dns_record.save\n format.html { redirect_to zone_path(@zone), notice: 'DNS Record was successfully created.' }\n format.json { render :show, status: :created, location: @zone }\n else\n puts \"failed to save DNS record: #{@dns_record.errors.to_json}\"\n format.html { render 'zones/show' }\n format.json { render json: @dns_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def parse_dns(raw)\n # Filtering Lines with Comments and Empty Lines\n dns_filter = raw.select { |x| x[0] != \"#\" && x != \"\\n\" }\n\n # Creating a List with 3 Columns\n dns_filter_list = []\n dns_filter.each { |x| dns_filter_list.push(x.split(\", \")) }\n\n # Creating the List each DNS for Hash\n record_type_list = []\n source_list = []\n destination_list = []\n\n dns_filter_list.each do |x|\n record_type_list.push(x[0])\n source_list.push(x[1])\n destination_list.push(x[2])\n end\n\n # Building the Hash\n dns_hash = {\n \"RECORDTYPE\".to_sym => record_type_list,\n \"SOURCE\".to_sym => source_list,\n \"DESTINATION\".to_sym => destination_list,\n }\n return dns_hash\nend", "def get_instance_by_dns_name(dns_name)\n @groups.each_value { |instances|\n instances.each do |instance|\n if instance.dns_name == dns_name\n return instance\n end\n end\n }\n raise \"unknown dns name: #{dns_name}\"\n end", "def add_domain_record_cname(params)\n post('dns/recordcname', params)\n end", "def parse_dns(raw)\n # Filtering Lines with Comments and Empty Lines\n dns_filter = raw.select {|x| x[0]!= \"#\" && x != \"\\n\" }\n\n # Creating a List with 3 Columns\n dns_filter_list = []\n dns_filter.each {|x| dns_filter_list.push(x.split(\", \"))}\n\n # Creating the List each DNS for Hash\n record_type_list = []\n source_list = []\n destination_list = []\n\n dns_filter_list.each do |x|\n record_type_list.push(x[0])\n source_list.push(x[1])\n destination_list.push(x[2])\n end\n\n # Building the Hash\n dns_hash = {\n \"RECORDTYPE\".to_sym => record_type_list,\n \"SOURCE\".to_sym => source_list,\n \"DESTINATION\".to_sym => destination_list,\n }\n return dns_hash\nend", "def parse_dns(dns_raw)\n raw_data=dns_raw.reject { |line| line.empty? or line[0] == \"#\" }#removing hash and empty lines,string\n split_data=raw_data.map { |line| line.strip.split(\", \") }#split the entry into columns using ','\n clean_data=split_data.reject { |record| record.length < 3 }# discarding false entries in zone file\n clean_data.each_with_object({}) do |record, records|# preparing hash for dns entries\n records[record[1]] = {\n type: record[0],\n target: record[2],\n }\n end\n end", "def dns(target, page: 1)\n params = { page: page }\n _get(\"/query/domains/dns/#{target}\", params) { |json| json }\n end", "def get_rdata_value(dns_query, parsed_dns, length)\n template = length == LONG_LENGTH ? \"N\" : \"n\"\n value = dns_query[parsed_dns[:index], length].unpack(template)[0]\n parsed_dns[:index] += length\n return value\n end", "def db_ddns_access(data={})\n return nil if data.empty? || (!data.has_key?(:id) && !data.has_key?(:device_id) && !data.has_key?(:ip_address) && !data.has_key?(:full_domain))\n \n where_data = data.clone\n\n if data.has_key?(:full_domain) then\n full_domain = where_data[:full_domain]\n host_name = find_hostname(full_domain)\n domain_name = find_domainname(full_domain)\n domain = Domain.find_by_domain_name(domain_name)\n domain_id = domain.id\n where_data[:hostname] = host_name\n where_data[:domain_id] = domain_id\n where_data.delete(:full_domain)\n end\n\n if where_data.has_key?(:ip_address) then\n where_data[:ip_address] = IPAddr.new(where_data[:ip_address]).to_i.to_s(16).rjust(8, \"0\")\n end\n\n rows = DDNS.where(where_data).first\n \n if !rows.nil? then\n return rows\n else\n return nil\n end\n end", "def getrec\n unless @records.empty?\n return @records.shift\n end\n getline unless @line\n return nil if @line.nil?\n lines = [ @line ]\n if rectype = @line.rectype\n loop do\n getline\n break if @line.nil? || rectype.nil?\n break if rectype != @line.rectype\n break if lines.last.snr >= @line.snr\n\n lines << @line\n end\n end\n return Record.new(rectype, lines, @lineno - lines.size)\n end", "def stdlookup(session,domain,dest)\n\tdest = dest + \"-general-record-lookup.txt\"\n\tprint_status(\"Getting MX and NS Records for Domain #{domain}\")\n\tfilewrt(dest,\"SOA, NS and MX Records for Domain #{domain}\")\n\ttypes = [\"SOA\",\"NS\",\"MX\"]\n\tmxout = []\n\tresults = []\n\tgarbage = []\n\ttypes.each do |t|\n\tbegin\n\t\tr = session.sys.process.execute(\"nslookup -type=#{t} #{domain}\", nil, {'Hidden' => true, 'Channelized' => true})\n\t\twhile(d = r.channel.read)\n\t\t\tmxout << d\n\t\tend\n\t\tr.channel.close\n\t\tr.close\n\t\tresults = mxout.join.split(/\\n/)\n\t\tresults.each do |rec|\n\t\t\t\tif rec.match(/\\s*internet\\saddress\\s\\=\\s/)\n\t\t\t\t\tgarbage << rec.split(/\\s*internet\\saddress\\s\\=/)\n\t\t\t\t\tprint_status(\"#{garbage[0].join.sub(\" \",\" \")} #{t} \")\n\t\t\t\t\tfilewrt(dest,garbage[0].join.sub(\" \",\" \")+\" #{t} \")\n\t\t\t\t\tgarbage.clear\n\t\t\t\tend\n\t\t\t\tgarbage.clear\n\t\tend\n\n\trescue ::Exception => e\n \t\tprint_status(\"The following Error was encountered: #{e.class} #{e}\")\n\tend\n\tend\nend", "def create_domain_record(domainName = nil, hostName = nil, recordType = nil, data = nil, ttl = 0, priority = 0)\n valid_ttls = [0, 1, 60, 300, 600, 900, 1800, 2700, 3600, 7200, 14400, 28800, 43200, 64800, 86400, 172800]\n raise \"Ttl must be one of #{valid_ttls.join(',')}\" if ttl && ! valid_ttls.include?(ttl)\n\n mx_prio = [5, 10, 20, 30, 40, 50, 60, 70, 80, 90]\n f_prio = [1, 2, 3]\n raise \"MX priority must be one of #{mx_prio.join(',')}\" if recordType == \"MX\" and ! mx_prio.include?(priority)\n raise \"F priority must be one of #{f_prio.join(',')}\" if recordType == \"F\" and ! f_prio.include?(priority)\n\n valid_types = [\"A\", \"CNAME\", \"MX\", \"F\", \"TXT\", \"SRV\"]\n raise \"Record type must be one of #{valid_types.join(',')}\" if recordType && ! valid_types.include?(recordType)\n\n DomainRecord.new(domainName, hostName, recordType, data, ttl, priority)\n end", "def domain(domain)\n get(\"/dns/domain/#{domain}\")\n end", "def get_class(dns_query, parsed_dns)\n RECORD_CLASS[get_rdata_value(dns_query, parsed_dns, SHORT_LENGTH).to_i]\n end", "def query_request\n\t\t\tdb = PhoneDNS::DB.new\n\t\t\treturn db.find(@domain, @locale)\n\t\tend", "def dns; settings.components.dns.config end", "def get_record(identifier)\n find_by(**id_term(identifier))\n end", "def set_dns_entry\n @dns_entry = DnsEntry.find(params[:id])\n end", "def create\n Puppet.debug \"starting create #{self.class.to_s}\"\n dns_service = get_dns_service(get_fqdn)\n dns_service.create_record(get_fqdn, get_type, get_ip) if dns_service != nil\n Puppet.debug \"done with create #{self.class.to_s}\"\n end", "def records\n dns.getresources domain, Resolv::DNS::Resource::IN::MX\n end", "def parse_record( parser, identifier )\n\t\t\texpires = parser.expires_on if parser.property_any_supported?( :expires_on )\n\n\t\t\tif !parser.registered?\n\t\t\t\treturn { error: 'Not registered.' }\n\t\t\telsif expires && expires <= Time.now\n\t\t\t\treturn { error: \"Expired on #{expires}\" }\n\t\t\tend\n\n\t\t\treturn Whois::Parser::PROPERTIES.each_with_object({}) do |prop, data|\n\t\t\t\tnext unless parser.property_any_supported?( prop )\n\n\t\t\t\tval = parser.public_send( prop )\n\n\t\t\t\tcase prop\n\t\t\t\twhen :nameservers\n\t\t\t\t\tdata[ 'nameservers' ] = val.map( &:name )\n\t\t\t\twhen :available?, :registered?\n\t\t\t\t\tdata[ prop.to_s[0..-2] ] = val\n\t\t\t\twhen :registrant_contacts, :admin_contacts, :technical_contacts\n\t\t\t\t\tdata[ prop ] = val.map do |contact|\n\t\t\t\t\t\t\"%s <%s>\" % [ contact.name, contact.email ]\n\t\t\t\t\tend\n\t\t\t\twhen :status\n\t\t\t\t\tdata[ prop ] = val.map( &:to_s )\n\t\t\t\telse\n\t\t\t\t\tdata[ prop ] = val.to_s\n\t\t\t\tend\n\t\t\tend\n\t\trescue Whois::ParserError, NoMethodError => err\n\t\t\tmsg = \"%p while parsing record for %s: %s\" %\n\t\t\t\t[ err.class, identifier, err.message ]\n\t\t\tself.log.error( msg )\n\t\t\tself.log.debug { err.backtrace.join(\"\\n \") }\n\n\t\t\treturn { warning: \"Record fetched, but the record could not be parsed.\" }\n\t\tend", "def marc_record\n @marc_record ||= Folio::MarcRecordMapper.build(stripped_marc_json, holdings, instance)\n end", "def r53()\n AWS::Route53.new(:access_key_id => @aws_access_key_id,\n :secret_access_key => @aws_access_key).client\n end", "def dns\n if @dns.nil?\n begin\n @dns = Timeout::timeout(TIMEOUT) do\n without_warnings do\n Net::DNS::Resolver.start(absolute_domain).answer if domain\n end\n end\n @dns ||= false\n rescue Exception\n @dns = false\n end\n end\n @dns || nil\n end", "def dns\n @gapi.dns_name\n end", "def dns_entry(name, value, type = 'A')\n # FIXME: don't hardcode aws or tiptap.com\n\n conflict_types = {'A' => 'CNAME', 'CNAME' => 'A'}\n\n name = canonicalize(name)\n value = canonicalize(value) if type == 'CNAME'\n zone = Fog::DNS[:aws].zones.all(:domain => 'tiptap.com.').first\n records = Fog::DNS[:aws].records(:zone => zone).all\n record = records.find{|r| r.name == name and r.type == type}\n\n if record and record.value != [value]\n puts \"Deleting old #{type} record (#{name} -> #{record.value})\"\n record.destroy\n record = nil\n @changed = true\n end\n\n # Automatically delete CNAME when creating an A record or vice versa - any other types, you're on your own\n if conflict_types[type]\n conflict_record = records.find{|r| r.name == name and r.type == conflict_types[type]}\n if conflict_record\n puts \"Deleting old, conflicting #{conflict_record.type} record (#{name} -> # conflict_record.value})\"\n conflict_record.destroy\n conflict_record = nil\n @changed = true\n end\n end\n\n unless record\n puts \"Creating #{type} record (#{name} -> #{value})\"\n Fog::DNS[:aws].records(:zone => zone).create(:name => name, :value => value, :type => type, :ttl => 300)\n @changed = true\n end\n\n @changed\n end", "def parse_dns(dns_raw)\r\n\r\n dns_raw1 = []\r\n len = dns_raw.length-1\r\n i = 0\r\n for r in 0..len do\r\n str1 = dns_raw[r]\r\n if dns_raw[r][0] != '#'\r\n dns_raw1[i] = dns_raw[r]\r\n i = i + 1\r\n end\r\n end\r\n dns_raw = dns_raw1\r\n\r\n b=[]\r\n dns_raw.each do |item|\r\n str = item == \"\\n\"\r\n if !str\r\n b.push(item.split(','))\r\n end\r\n end\r\n\r\n len = b.length-1\r\n dns_records ={}\r\n\r\n for r in 0 .. len do\r\n dkey = {}\r\n dkey[:type] = b[r][0].strip\r\n dkey[:target] = b[r][2].strip.chomp\r\n dns_records[b[r][1].strip] = dkey\r\n end\r\n\r\n return dns_records\r\n end", "def add_domain_record_mx(params)\n post('dns/recordmx', params)\n end", "def get_record_type (dns_name, dns_values)\n record_type = \"cname\"\n ips = dns_values.grep(/\\d+\\.\\d+\\.\\d+\\.\\d+/)\n dns_values.each do |dns_value|\n if dns_value =~ Resolv::IPv6::Regex\n record_type = \"aaaa\"\n end\n end\n\n\n if ips.size > 0\n record_type = \"a\"\n end\n if dns_name =~ /^\\d+\\.\\d+\\.\\d+\\.\\d+$/ || dns_name =~ Resolv::IPv6::Regex\n record_type = \"ptr\"\n end\n if dns_name =~ /^txt-/\n record_type = \"txt\"\n end\n return record_type\n end", "def create\n \n dns_entry_response = RestClient.post('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n\n if JSON.parse(dns_entry_response)[\"success\"]\n @dns_entry = DnsEntry.new(dns_entry_params)\n\n respond_to do |format|\n if @dns_entry.save\n format.html { redirect_to @dns_entry, notice: \"Dns entry was successfully created.\" }\n format.json { render :show, status: :created, location: @dns_entry }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @dns_entry.errors, status: :unprocessable_entity }\n end\n end \n\n end\n\n\n end", "def build_record\n record = MARC::Record.new\n data_field = nil\n control_field = nil\n subfield = nil\n text = \"\"\n attrs = nil\n if Module.constants.index(\"Nokogiri\") && @parser.is_a?(Nokogiri::XML::Reader)\n datafield = nil\n cursor = nil\n open_elements = []\n @parser.each do |node|\n if node.value? && cursor\n if cursor.is_a?(Symbol) && (cursor == :leader)\n record.leader = node.value\n else\n cursor.value = node.value\n end\n cursor = nil\n end\n next unless node.namespace_uri == @ns\n if open_elements.index(node.local_name.downcase)\n open_elements.delete(node.local_name.downcase)\n next\n else\n open_elements << node.local_name.downcase\n end\n case node.local_name.downcase\n when \"leader\"\n cursor = :leader\n when \"controlfield\"\n record << datafield if datafield\n datafield = nil\n control_field = MARC::ControlField.new(node.attribute(\"tag\"))\n record << control_field\n cursor = control_field\n when \"datafield\"\n record << datafield if datafield\n datafield = nil\n data_field = MARC::DataField.new(node.attribute(\"tag\"), node.attribute(IND1), node.attribute(IND2))\n datafield = data_field\n when \"subfield\"\n raise \"No datafield to add to\" unless datafield\n subfield = MARC::Subfield.new(node.attribute(CODE))\n datafield.append(subfield)\n cursor = subfield\n when \"record\"\n record << datafield if datafield\n return record\n end\n end\n\n else\n while @parser.has_next?\n event = @parser.pull\n\n if event.text?\n text += REXML::Text.unnormalize(event[0])\n next\n end\n\n if event.start_element?\n text = \"\"\n attrs = event[1]\n case strip_ns(event[0])\n when \"controlfield\"\n text = \"\"\n control_field = MARC::ControlField.new(attrs[TAG])\n when \"datafield\"\n text = \"\"\n data_field = MARC::DataField.new(attrs[TAG], attrs[IND1],\n attrs[IND2])\n when \"subfield\"\n text = \"\"\n subfield = MARC::Subfield.new(attrs[CODE])\n end\n end\n\n if event.end_element?\n case strip_ns(event[0])\n when \"leader\"\n record.leader = text\n when \"record\"\n return record\n when \"controlfield\"\n control_field.value = text\n record.append(control_field)\n when \"datafield\"\n record.append(data_field)\n when \"subfield\"\n subfield.value = text\n data_field.append(subfield)\n end\n end\n end\n end\n end", "def record(path, parameters={})\n result = request(path, parameters)\n (result && !result.empty?) ? Record.new(result.keys.first, result.values.first) : nil\n end", "def record(path, parameters={})\n result = request(path, parameters)\n (result && !result.empty?) ? Record.new(result.keys.first, result.values.first) : nil\n end", "def marc_record_from_marcxml\n id = fetch(_marc_source_field)\n\n response = Faraday.get(\"#{Requests.config['bibdata_base']}/bibliographic/#{id}\")\n @can_retry = response.status == 429\n response_stream = StringIO.new(response.body)\n marc_reader = ::MARC::XMLReader.new(response_stream)\n marc_records = marc_reader.to_a\n marc_records.first\n end", "def ingest_dns_record(to_save, uploader, skip_validations, obj, parent = nil)\n \n dns_record = DnsRecord.ingest(uploader, obj)\n return nil if dns_record.blank?\n if !parent.nil?\n dns_record.is_ciscp = true if parent.is_ciscp\n dns_record.is_mifr = true if parent.is_mifr\n end\n embedded_obj = obj.ip_address\n if embedded_obj.present?\n parsed_obj = self.parse_sub_obj(to_save, uploader, skip_validations, embedded_obj, dns_record)\n if parsed_obj.present?\n dns_record.dns_address = parsed_obj\n end\n end\n embedded_obj = obj.domain_name\n if embedded_obj.present? && embedded_obj.class.to_s == 'Stix::Native::CyboxDomain'\n parsed_obj = self.parse_sub_obj(to_save, uploader, skip_validations, embedded_obj, dns_record)\n if parsed_obj.present?\n dns_record.dns_domain = parsed_obj\n end\n else\n # its a URI but we need to support it as a domain...\n parsed_obj = Domain.new\n HumanReview.adjust(embedded_obj, uploader)\n parsed_obj.name_condition = embedded_obj.uri_condition\n parsed_obj.name_raw = embedded_obj.name_raw\n parsed_obj.read_only = uploader.read_only\n parsed_obj = IngestUtilities.swap_if_needed(uploader, parsed_obj, to_save)\n parsed_obj.is_upload = true\n parsed_obj.is_ciscp = true if dns_record.is_ciscp\n parsed_obj.is_mifr = true if dns_record.is_mifr\n if parsed_obj.id.present? && parsed_obj.stix_markings.present?\n parsed_obj.stix_markings.destroy_all\n end\n self.ingest_object_markings(uploader, embedded_obj, parsed_obj, to_save)\n skip_validations << parsed_obj\n to_save << parsed_obj\n dns_record.dns_domain = parsed_obj\n end\n dns_record\n end", "def marc_record_from_marc21\n return if marc_source.blank?\n MARC::Record.new_from_marc marc_source\n end" ]
[ "0.71340287", "0.68997043", "0.6855213", "0.67315835", "0.6587001", "0.6580899", "0.6540604", "0.64740884", "0.64225733", "0.6381819", "0.6371659", "0.6353926", "0.63450676", "0.6343346", "0.63272756", "0.6322495", "0.6267944", "0.62651867", "0.6238346", "0.6217513", "0.62006986", "0.6089828", "0.6081332", "0.60811055", "0.6050051", "0.6033249", "0.60169685", "0.5994942", "0.59477377", "0.5915323", "0.59000164", "0.5891039", "0.5891039", "0.58590376", "0.5833527", "0.5833209", "0.5825195", "0.5810224", "0.5805463", "0.5800719", "0.579815", "0.57817733", "0.5767897", "0.57395935", "0.57246774", "0.57235444", "0.57109576", "0.56936884", "0.56522936", "0.5637917", "0.56283724", "0.56154287", "0.5610809", "0.5608895", "0.560083", "0.5570001", "0.5561436", "0.55591", "0.5556523", "0.5548496", "0.55440485", "0.55410033", "0.5537983", "0.55350935", "0.5529938", "0.5525025", "0.55241877", "0.55203366", "0.5515777", "0.5511816", "0.55106735", "0.549587", "0.5495262", "0.54942334", "0.5488266", "0.5466532", "0.5457963", "0.5447456", "0.54367906", "0.54306245", "0.5417986", "0.541495", "0.5383057", "0.5382267", "0.53780526", "0.5375683", "0.53709525", "0.53667283", "0.5365827", "0.5363754", "0.53617525", "0.53578854", "0.5353501", "0.53483915", "0.53456664", "0.534002", "0.534002", "0.53395706", "0.5333967", "0.5307508" ]
0.70954484
1
create a dns zone
def create_zone(zone, email, ttl) @dnsh.name = zone @dnsh.email = email @dnsh.ttl = ttl if @dnsh.save == true Puppet.notice "Created dns zone #{zone} with id #{@dnsh.id}" else Puppet.err @dnsh.cstatus raise @dnsh.cstatus end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n Puppet.debug \"starting create #{self.class.to_s}\"\n dns_service = get_dns_service(get_zone)\n dns_service.create_zone(get_zone, get_email, get_ttl) if dns_service != nil\n Puppet.debug \"done with create #{self.class.to_s}\"\n end", "def zone_create(zone)\n obj_create zone, Zone\n end", "def create_zone attrs\n ZerigoDNS::Zone.create({follow_template: 'follow', zone_template_id: id}.merge(attrs))\n end", "def create\n @domain = Domain.friendly.find(params[:domain_id])\n @dns_zone = @domain.dns_zones.create(dns_zone_params.merge({:version => 1}))\n if @dns_zone.save\n redirect_to @domain, notice: 'Dns zone was successfully created.'\n else\n render action: 'edit', @errors => @dns_zone.errors, alert: \"Dns zone validation failed.\"\n end\n end", "def create\n @dns_record = @zone.dns_records.build(dns_record_params)\n @dns_record.ttl = (30 * 60) if @dns_record.ttl.nil?\n respond_to do |format|\n if @dns_record.save\n format.html { redirect_to zone_path(@zone), notice: 'DNS Record was successfully created.' }\n format.json { render :show, status: :created, location: @zone }\n else\n puts \"failed to save DNS record: #{@dns_record.errors.to_json}\"\n format.html { render 'zones/show' }\n format.json { render json: @dns_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def new_zone(domain_id)\n z = Zone.new\n z.domain_id = domain_id\n z.owner = User.all(:username => \"admin\").first.id\n\n z.save\n return z\n end", "def zone() end", "def create\n @dns_zone = DnsZone.new(params[:dns_zone])\n\n respond_to do |format|\n if @dns_zone.save\n flash[:notice] = 'DnsZone was successfully created.'\n format.html { render :action => \"edit\" }\n #format.html { redirect_to(@dns_zone) }\n format.xml { render :xml => @dns_zone, :status => :created, :location => @dns_zone }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @dns_zone.errors, :status => :unprocessable_entity }\n end\n end\n end", "def fetch_zone\n \n # zone name pass from url\n zone_name = params[:src]\n # Record type, A or PTR\n record_type = params[:type]\n # zone name pass from url\n network_type = params[:net]\n \n # Output Buffer\n @o = ''\n \n if network_type == 'int'\n dns_zone = DnsZone.find_by_name(zone_name + \"-int\")\n else\n dns_zone = DnsZone.find_by_name(zone_name)\n end\n \n # If can't find the specified zone, we'll return with some useful text\n if dns_zone.nil?\n @o += \"; ##ERROR## Invalid zone name specified.\\n\"\n @o += \"; Valid names can be one of the following:\\n\"\n \n @o += DnsZone.find(:all, :order => :name, :select => :name).collect{|a| \"; \" + a.name}.join(\"\\n\")\n else\n # Our rules for dns record generation. \n # 1. Only generate a record once\n # 2. Generate record in closest zone defined.\n # 3. If nothing match, generate nothing.\n # 4. Record will be specified in absolute name, include the \".\" at the end\n # For ex: ads1.vip.sc9.yahoo.com should match zone, \"vip.sc9.yahoo.com\" first, if not found,\n # try sc9.yahoo.com, then yahoo.com, then .com. If no zone match, then this record is ignored.\n # @o += \"; Generated zone for #{zone_name} on #{Time.new.to_s}\\n\"\n # Dont think we need ORIGIN, will find out when deploy internal DNS\n #@o += \"$ORIGIN #{dns_zone.name}.\\n\"\n @o += \"$TTL #{dns_zone.my_ttl}\\n\"\n \n # In order to make sure we only generate one record, we actually have get all asset and zone\n # then put them in appropriate places. It kinda suck, but one http call can't get us multiple file\n # Unless we get everything into one file, then have the local script to parse it into multiple\n # files, but that sounds a bit too hacky. So instead, we let AST do the expensive work.\n\n # Alright, let's build the SOA first.\n @o += \"@ \\t IN \\t SOA #{dns_zone.my_soa} (\\n\"\n @o += \"\\t\\t\\t #{Time.new.to_i} \\t;serial\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_refresh} \\t;refresh\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_retry} \\t;retry\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_expire} \\t;expire\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_minimum} \\t;minimum\\n\"\n @o += \");\\n\"\n # NS\n for ns in dns_zone.my_dns_ns_records\n @o += \"\\t\\tNS\\t\\t#{ns.name}.\\n\" \n end\n # MX\n for mx in dns_zone.my_dns_mx_records\n @o += \"\\t\\tMX\\t\\t#{mx.priority} #{mx.name}.\\n\"\n end\n \n @o += \"\\n\"\n \n # use appropriate function for each type of record\n if record_type == 'a'\n \t# If master A record is not null, put it in here\n \tif ! dns_zone.mastera.nil?\n @o += \"\\t\\t\\t\\t#{dns_zone.mastera}\\n\\n\"\n end\n @o += fetch_dns_a(zone_name) \n elsif record_type == 'ptr'\n @o += fetch_dns_ptr(zone_name)\n end\n #@o += assets.collect{|a| a.primary_interface.ip_to_string rescue nil}.join(\"<br/>\")\n end\n \n render(:partial => \"output\",:object => @o) \n\n end", "def add_zone!(name)\n zone = add_zone(name)\n zone.save!\n zone\n end", "def zonecreate_standard(fabrickey, zonename, *aliases)\n result = @zones.zonecreate_standard(fabrickey, zonename, *aliases)\n result[1]\n end", "def create(options = {})\n response = request(:post, \"/network_zones.json\", :query => {:pack => options})\n end", "def create_public_hosted_zone(app_name, stack_name, name, comment, tags: [])\n properties = {\n Name: name\n }\n\n properties[:HostedZoneConfig] = {\n Comment: comment\n } unless comment.blank?\n\n properties[:HostedZoneTags] = [\n {\n Key: 'Application',\n Value: app_name\n },\n {\n Key: 'Stack',\n Value: stack_name\n }\n ]\n properties[:HostedZoneTags].concat(tags) unless tags.blank?\n\n resource_name = \"#{app_name}HostedZone\"\n resource resource_name,\n Type: 'AWS::Route53::HostedZone',\n Properties: properties\n resource_name\n end", "def create\n Puppet.debug \"starting create #{self.class.to_s}\"\n dns_service = get_dns_service(get_fqdn)\n dns_service.create_record(get_fqdn, get_type, get_ip) if dns_service != nil\n Puppet.debug \"done with create #{self.class.to_s}\"\n end", "def create_private_hosted_zone\n fail('method \"create_private_hosted_zone\" is not implemented')\n end", "def create_cnames(domain, cname_records)\n account_id = ENV['DNSIMPLE_ACCOUNT']\n cname_records.each do |record|\n cname_name = record.name.chomp(\".#{domain}.\")\n cname_value = record.value.chomp('.')\n\n puts \"#{record.name} => #{record.value}\"\n $dns_client.zones.create_zone_record(account_id, domain, name: cname_name, type: \"cname\", content: cname_value)\n end\nend", "def zone; end", "def load_zone(zone_file_path, site_uid, site, zone_type, add_header)\n if File.exist?(zone_file_path)\n zone = DNS::Zone.load(File.read(zone_file_path))\n else\n zone = DNS::Zone.new\n end\n zone.site_uid = site_uid\n zone.file_path = zone_file_path\n #If the target file will have a header or not (manage included files without records duplication)\n zone.header = add_header\n zone.soa = zone.records[0] if zone.records.any? && zone.records[0].type == 'SOA'\n\n #We only want the zone to manage these records, we will manage SOA, MX, NS, @s manually\n zone.records.reject! { |rec|\n !( rec.is_a?(DNS::Zone::RR::A) || rec.is_a?(DNS::Zone::RR::CNAME) || rec.is_a?(DNS::Zone::RR::PTR)) || rec.label == \"@\"\n }\n if add_header && zone_type == :internal\n set_internal_zone_header_records(zone, site)\n elsif add_header && zone_type == :external\n set_external_zone_header_records(zone, site)\n end\n zone.include = include_manual_file(zone, zone_type)\n return zone\nend", "def create\n \n dns_entry_response = RestClient.post('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n\n if JSON.parse(dns_entry_response)[\"success\"]\n @dns_entry = DnsEntry.new(dns_entry_params)\n\n respond_to do |format|\n if @dns_entry.save\n format.html { redirect_to @dns_entry, notice: \"Dns entry was successfully created.\" }\n format.json { render :show, status: :created, location: @dns_entry }\n else\n format.html { render :new, status: :unprocessable_entity }\n format.json { render json: @dns_entry.errors, status: :unprocessable_entity }\n end\n end \n\n end\n\n\n end", "def makeARecord(machine, ttl: Config::TTL_A_RECORD)\n return DnsRecord.new(name: machine.dns_record(),\n type: \"A\",\n content: machine.static_ip(),\n ttl: ttl)\nend", "def create_record(fqdn, type, ipdata)\n unless @dnss.is_valid?\n Puppet.crit dns.cstatus\n end\n priority = {} # TODO: research how to implement priority for puppet\n# priority = priority[0]\n# if priority.nil?\n# priority = {}\n# else\n# priority = { :priority => priority.to_i }\n# end\n record = @dnss.create_record(fqdn, type, ipdata, priority)\n if record.nil?\n Puppet.err dns.cstatus\n end\n Puppet.notice \"Created dns record '#{fqdn}' with id '#{record[:id]}'.\"\n end", "def fetch_dns_ptr(zone_name)\n \n @o = ''\n # find out the range we are parsing in this zone.\n ranges = []\n zone_name.split(\".\").map{|a| \n # Make sure it's request for arpa zone which should be all number\n if ! (a =~ /^\\d+$/).nil?\n if ranges.empty?\n ranges << a\n else\n ranges.insert(0, a)\n end\n end\n }\n \n # After look through zone name, if it's not a arpa zone, we'll return nil\n if ranges.empty?\n return @o\n end\n \n # Use later to determine how many number from ip we need\n zone_class = ranges.length\n \n # Now we have the range from zone name, let's use Networking class to help us find all interfaces\n # Find out wether it's class a, b, c or d\n netmask = 32 # start with D class netmask\n for i in (ranges.length..4-1)\n # Get the netmask correctly\n netmask = netmask - 8\n # Set the empty ip slot to 0\n ranges[i] = 0;\n end\n \n # Build the address\n range_address = ranges.join(\".\") + \"/#{netmask}\"\n \n # Call in cidr, find all interface under this range.\n interfaces = Networking.get_interfaces_in_range(range_address).sort{|a,b| a.ip <=> b.ip}\n\n # Find asset for each interface\n # If asset is Server, we need to look up two things\n # 1. If ip is drac, we will add \"-d\" to the hostname\n # 2. Maybe for vip, we need to ptr to it, but on the second thought, that shouldn't be. \n for interface in interfaces\n\n # Build the ip correct for this zone\n ips = []\n ip_parts = interface.ip_to_string.split(\".\")\n for i in (zone_class..4-1)\n # Insert reversely\n ips.insert(0, ip_parts[i])\n end\n ip = ips.join(\".\")\n \n # If it's a drac and type = server, we transform the hostname\n if ( interface.drac_ip? && interface.asset.resource_type == 'Server')\n name = convert_to_drac_name(interface.asset.name)\n else\n # Check to see if there is multiple vips poing to this ip, if so raise exception.\n # If only one ip, then we'll point PTR record to that vip.\n if interface.vips.length > 1\n #raise \"#{interface.ip_to_string} has more than one vip \" + interface.vips.collect{|a| a.name}.inspect + \" pointing to it\"\n @o += \";#{interface.ip_to_string} has more than one vip \" + interface.vips.collect{|a| a.name}.inspect + \" pointing to it.\\n\"\n @o += \";Picking the first one.\\n\"\n name = interface.vips[0].name \n elsif interface.vips.length == 1\n name = interface.vips[0].name\n # Network asset with named interface\n elsif interface.asset.resource_type == 'Network' and interface.name and interface != interface.asset.primary_interface and ! interface.name.empty?\n name = interface.name + '.' + interface.asset.name\n else\n name = interface.asset.name \n end\n \n end\n \n @o += \"#{ip}\\t\\tPTR\\t\\t#{name}.\\n\"\n\n end\n\n return @o\n\n rescue Exception => exc\n flash[:interface] = \"##ERROR## Fetch failed following reason: #{exc.message}\\n\"\n\n \n end", "def set_dns_zone\n unless @dns_zone = current_user.dns_zones.where(id: params[:id]).first\n flash[:alert] = 'DnsZone not found.'\n redirect_to domains_url\n end\n end", "def cfg_create(cfg)\n obj_create cfg, ZoneConfiguration\n end", "def zone_identifier; end", "def zone_identifier; end", "def add_zone(name)\n zone = ImageZone.create_with_name(name)\n self[N::TALIA.hasSubZone] << zone\n zone\n end", "def create_dns_record(domain, hostname, type, content, ttl, priority = nil)\n body = {\n 'hostname' => hostname,\n 'type' => type,\n 'content' => content,\n 'ttl' => ttl\n }\n body.update!(:priority => priority) if priority\n connection.post \"/dns/create/#{domain}\", body\n end", "def zone_add(zone,member)\n obj_add(zone,Zone,member)\n end", "def makeSoaRecord(cluster, ttl: Config::TTL_SOA)\n return DnsRecord.new(name: cluster.nameservers()[0].dns_record(),\n type: \"SOA\",\n content: cluster.hostmasters()[0].dns_record(),\n ttl: ttl)\nend", "def alicreate(fabrickey, aliname, *wwn)\n result = @zones.alicreate(fabrickey, aliname, *wwn)\n result[1]\n end", "def zoneadd_standard(fabrickey, zonename, *aliases)\n result = @zones.alterzoning_standard(fabrickey, 'ADD', zonename, *aliases)\n result[1]\n end", "def create_host_template attrs={}\n ZerigoDNS::HostTemplate.create(attrs.merge(zone_template_id: id))\n end", "def zoneadd_peerzone(fabrickey, zonename, **wwns)\n result = @zones.alterzoning_peerzone(fabrickey, 'ADD', zonename, **wwns)\n result[1]\n end", "def create_record(record_type, zone_id, name, data, options = {})\n optional_tags= ''\n options.each { |option, value|\n case option\n when :ttl\n optional_tags+= \"<ttl type='integer'>#{value}</ttl>\"\n when :active\n optional_tags+= \"<active>#{value}</active>\"\n when :aux\n optional_tags+= \"<aux>#{value}</aux>\"\n end\n }\n\n request(\n :body => %Q{<?xml version=\"1.0\" encoding=\"UTF-8\"?><record><record_type>#{record_type}</record_type><zone_id type=\"integer\">#{zone_id}</zone_id><name>#{name}</name><data>#{data}</data>#{optional_tags}</record>},\n :expects => 201,\n :method => 'POST',\n :parser => Fog::Parsers::DNS::Slicehost::CreateRecord.new,\n :path => 'records.xml'\n )\n end", "def add_zone(user_key, zone, resolve_to, subdomains)\n send_req({\n act: :zone_set,\n user_key: user_key,\n zone_name: zone,\n resolve_to: resolve_to,\n subdomains: subdomains.kind_of?(Array) ? zones.join(',') : subdomains\n })\n end", "def forward_zone(s)\ntextTest = File.open( s+\".zone\",'w')\n\t\ttextTest.puts \";\n; BIND data file for \" + s+ \" zone\n;\n$TTL\t604800\n@\tIN\tS\t\"+s+\" webmaster@\"+s+\". (\n\t\t\t \"+datum+\"1\t\t; Serial\n\t\t\t 604800\t\t; Refresh\n\t\t\t 86400\t\t; Retry\n\t\t\t2419200\t\t; Expire\n\t\t\t 604800 )\t; Negative Cache TTL\n;\n@\tIN\tNS\tns1.\"+s+\"\n@\tIN\tA\t\"+get_own_ip+\"\n\" \n\ntextTest.close\nend", "def create_record(zone_id, type, name, content, options={})\n body = %Q{<?xml version=\"1.0\" encoding=\"UTF-8\"?><record><type>#{type}</type><name>#{name}</name><content>#{content}</content>}\n options.each do |k,v|\n body += %Q{<#{k}>#{v}</#{k}>}\n end\n body += %Q{</record>}\n request(\n :body => body,\n :expects => 202,\n :method => 'POST',\n :parser => Fog::Parsers::DNS::Bluebox::CreateRecord.new,\n :path => \"/api/domains/#{zone_id}/records.xml\"\n )\n end", "def create(name:,\n origin_ips:,\n minimum_cache_ttl: nil,\n maximum_cache_ttl: nil,\n deprecate_any_request: nil,\n ratelimit: nil)\n id_check(:name, name)\n max_length_check(:name, name, 160)\n non_empty_array_check(:origin_ips, origin_ips)\n\n data = {name: name, origin_ips: origin_ips}\n\n unless minimum_cache_ttl.nil?\n range_check(:minimum_cache_ttl, minimum_cache_ttl, 30, 36000)\n data[:minimum_cache_ttl] = minimum_cache_ttl\n end\n\n unless maximum_cache_ttl.nil?\n range_check(:maximum_cache_ttl, maximum_cache_ttl, 30, 36000)\n data[:maximum_cache_ttl] = maximum_cache_ttl\n end\n\n unless deprecate_any_request.nil?\n valid_value_check(:deprecate_any_request, deprecate_any_request, [true, false])\n data[:deprecate_any_request] = deprecate_any_request\n end\n\n unless ratelimit.nil?\n range_check(:ratelimit, ratelimit, 0, 100000000)\n data[:ratelimit] = ratelimit\n end\n\n cf_post(path: \"#{uri_prefix}/virtual_dns\", data: data)\n end", "def add_zone(zone)\n if @hash.key? 'zone'\n @hash['zone'].append(zone)\n else\n @hash['zone'] = [zone]\n end\n end", "def roll\n zone = Zone.new\n zone.short_name = short_name\n zone.description = description\n zone\n end", "def zone_exist?(name)\n match = find_match(@dns.domains, name)\n if match != nil\n Puppet.notice \"found dns zone #{match.name}\"\n return true\n else\n Puppet.debug \"zone not found : #{name}\"\n return false\n end\n end", "def create(options = {})\n response = request(:post, \"/settings/hypervisor_zones.json\", :query => {:pack => options})\n end", "def zone_identifiers; end", "def zone_identifiers; end", "def destroy\n Puppet.debug \"starting with destroy #{self.class.to_s}\"\n dns_service = get_dns_service(get_zone)\n if dns_service != nil\n dnszone = dns_service.get_zone(get_zone)\n \n dns_service.remove_zone(dnszone.id)\n end\n Puppet.debug \"done with destroy #{self.class.to_s}\"\n end", "def create_timezone\n raise_not_implemented('create_timezone')\n end", "def zonecreate_peerzone(fabrickey, zonename, **members)\n raise BrocadeAPIClient::UnsupportedVersion unless @peer_zone_support\n\n result = @zones.zonecreate_peerzone(fabrickey, zonename, **members)\n result[1]\n end", "def generate_dns_file(conf_file=nil)\n project_info = self.details\n domain = project_info[:domain]\n case conf_file\n## named.conf\n when nil, \"named\"\n forwarders = Lab.find(self.lab_id).nameservers.join(\";\")\n base_file = File.open(Rails.root + \"lib/configurations/named.conf_base\", 'rb')\n conf = base_file.read\n base_file.close\n conf+=<<EOF\ninclude \"apps.#{domain}.key\";\n\nacl \"openstack\" { 192.168.1.0/24; };\n\nview \"internal\" {\n match-clients { \"openstack\"; };\n include \"/etc/named.rfc1912.zones\";\n recursion yes;\n forwarders { #{forwarders}; };\n\n zone \"#{domain}\" IN {\n type master;\n file \"static/#{domain}-internal.db\";\n };\n\n zone \"apps.#{domain}\" IN {\n type slave;\n masters { 127.0.0.1; };\n file \"dynamic/apps.#{domain}-slave.db\";\n allow-notify { #{project_info[:named_ip]}; };\n allow-update-forwarding { \"openstack\"; };\n };\n\n zone \"1.168.192.in-addr.arpa\" IN {\n type master;\n file \"static/192.168.1.db\";\n };\n};\n\nview \"global\" {\n match-clients { any; };\n include \"/etc/named.rfc1912.zones\";\n recursion no;\n\n zone \"apps.#{domain}\" IN {\n type master;\n file \"dynamic/apps.#{domain}.db\";\n allow-update { key \"apps.#{domain}\" ; };\n allow-transfer { 127.0.0.1; #{project_info[:named_ip]}; };\n also-notify { #{project_info[:named_ip]}; };\n };\n\n zone \"#{domain}\" IN {\n type master;\n file \"static/#{domain}-global.db\";\n };\n};\nEOF\n\n## STATIC GLOBAL\n when \"static-global\"\n conf=<<EOF\n$ORIGIN .\n$TTL 60 ; 1 minute\n#{domain} IN SOA #{project_info[:named_hostname]}. hostmaster.#{domain}. (\n 2011112941 ; serial\n 60 ; refresh (1 minute)\n 15 ; retry (15 seconds)\n 1800 ; expire (30 minutes)\n 10 ; minimum (10 seconds)\n )\n NS #{project_info[:named_hostname]}.\n$ORIGIN #{domain}.\napps IN NS #{project_info[:named_hostname]}.\n\nEOF\n project_info[:named_entries].each do |entry|\n host = entry.split(\":\")[0]\n ip = entry.split(\":\")[1]\n conf += \"#{host} A #{ip}\\n\"\n end\n\n## STATIC INTERNAL\n when \"static-internal\"\n conf=<<EOF\n$ORIGIN .\n$TTL 60 ; 1 minute\n#{domain} IN SOA #{project_info[:named_hostname]}. hostmaster.#{domain}. (\n 2011112941 ; serial\n 60 ; refresh (1 minute)\n 15 ; retry (15 seconds)\n 1800 ; expire (30 minutes)\n 10 ; minimum (10 seconds)\n )\n NS #{project_info[:named_hostname]}.\n$ORIGIN #{domain}.\napps IN NS #{project_info[:named_hostname]}.\n\nEOF\n project_info[:internal_named_entries].each do |entry|\n host = entry.split(\":\")[0]\n ip = entry.split(\":\")[1]\n conf += \"#{host} A #{ip}\\n\"\n end\n\n## DYNAMIC\n when \"dynamic-master\", \"dynamic-slave\", \"dynamic\"\n conf=<<EOF\n$ORIGIN .\n$TTL 10 ; 10 seconds\napps.#{domain} IN SOA #{project_info[:named_hostname]}. hostmaster.#{domain}. (\n 2012113117 ; serial\n 60 ; refresh (1 minute)\n 15 ; retry (15 seconds)\n 1800 ; expire (30 minutes)\n 10 ; minimum (10 seconds)\n )\n NS #{project_info[:named_hostname]}.\n$ORIGIN apps.#{domain}.\n$TTL 60 ; 1 minute\nEOF\n project_info[:named_entries].each do |entry|\n host = entry.split(\":\")[0]\n conf += \"#{host} CNAME #{host}.#{domain}\\n\"\n end\n\n## STATIC IPS\n when \"static-ips\"\n conf=<<EOF\n$TTL 60 ; 1 minute\n; 192.168.1.0/24\n; 1.168.192.in-addr.arpa.\n@ IN SOA #{project_info[:named_hostname]}. hostmaster.#{domain}. (\n 2011112942 ; serial\n 60 ; refresh (1 minute)\n 15 ; retry (15 seconds)\n 1800 ; expire (30 minutes)\n 10 ; minimum (10 seconds)\n )\n NS #{project_info[:named_hostname]}.\n\nEOF\n project_info[:internal_named_entries].each do |entry|\n host = entry.split(\":\")[0]\n ip_end = entry.split(\":\")[1].split(\".\").last\n conf += \"#{ip_end} IN PTR #{host}.#{domain}.\\n\"\n end\n else\n raise \"Unrecognized dns configuration file requested.\"\n end\n conf\n end", "def compile_zone_file\n hosts_seen = {}\n f = $stdout\n f.puts ZONE_HEADER % {:domain => provider.domain, :ns => provider.domain, :contact => provider.contacts.default.first.sub('@','.')}\n max_width = manager.nodes.values.inject(0) {|max, node| [max, relative_hostname(node.domain.full).length].max }\n put_line = lambda do |host, line|\n host = '@' if host == ''\n f.puts(\"%-#{max_width}s %s\" % [host, line])\n end\n\n f.puts ORIGIN_HEADER\n # 'A' records for primary domain\n manager.nodes[:environment => '!local'].each_node do |node|\n if node.dns['aliases'] && node.dns.aliases.include?(provider.domain)\n put_line.call \"\", \"IN A #{node.ip_address}\"\n end\n end\n\n # NS records\n if provider['dns'] && provider.dns['nameservers']\n provider.dns.nameservers.each do |ns|\n put_line.call \"\", \"IN NS #{ns}.\"\n end\n end\n\n # all other records\n manager.environment_names.each do |env|\n next if env == 'local'\n nodes = manager.nodes[:environment => env]\n next unless nodes.any?\n f.puts ENV_HEADER % (env.nil? ? 'default' : env)\n nodes.each_node do |node|\n if node.dns.public\n hostname = relative_hostname(node.domain.full)\n put_line.call relative_hostname(node.domain.full), \"IN A #{node.ip_address}\"\n end\n if node.dns['aliases']\n node.dns.aliases.each do |host_alias|\n if host_alias != node.domain.full && host_alias != provider.domain\n put_line.call relative_hostname(host_alias), \"IN A #{node.ip_address}\"\n end\n end\n end\n if node.services.include? 'mx'\n put_line.call relative_hostname(node.domain.full_suffix), \"IN MX 10 #{relative_hostname(node.domain.full)}\"\n end\n end\n end\n end", "def create_single_dns_record(app_name,\n stack_name,\n zone_name,\n record_name,\n ttl: 300,\n type: 'A',\n healthcheck: nil,\n zone_id: nil,\n alias_target: {},\n resource_records: [])\n if type && !RECORD_TYPE.include?(type)\n fail(\"Route53 record type can only be one of the following: #{RECORD_TYPE.join(',')}\")\n end\n if healthcheck && (!healthcheck.is_a?(Hash) || !healthcheck.include?(:Ref))\n fail('healthcheck must be a valid cloudformation Ref function')\n end\n if alias_target && (!alias_target.is_a?(Hash))\n fail('AliasTarget must be a Hash')\n end\n\n name = app_name || stack_name.titleize.remove(/\\s/)\n properties = {\n Name: record_name,\n Comment: \"#{type} record for #{[app_name, 'in '].join(' ') if app_name}#{stack_name} stack\",\n Type: type\n }\n\n # HostedZoneId and HostedZoneName options are mutually exclusive\n if zone_id && !zone_id.nil?\n properties[:HostedZoneId] = zone_id\n else\n properties[:HostedZoneName] = zone_name\n end\n\n if !alias_target.blank?\n fail('AliasTarget can be created only for A or AAAA type records') unless %w(A AAAA).include?(type)\n unless alias_target.key?(:HostedZoneId) && alias_target.key?(:DNSName)\n fail('AliasTarget must have HostedZoneId and DNSName properties')\n end\n properties[:AliasTarget] = alias_target\n else\n properties[:TTL] = ttl\n properties[:HealthCheckId] = healthcheck if healthcheck\n properties[:ResourceRecords] = resource_records.empty? ? ref(\"#{app_name}PublicIpAddress\") : resource_records\n end\n\n resource \"#{name}Hostname\",\n Type: 'AWS::Route53::RecordSet',\n Properties: properties\n end", "def add_domain_record_aaaa(params)\n post('dns/recordaaaa', params)\n end", "def pull\n zt=Dnsruby::ZoneTransfer.new\n zt.transfer_type=Dnsruby::Types.AXFR\n zt.server=self.server\n zone=zt.transfer(self.zone.domain)\n zone.tsig=self.zone.domain+\".\", self.key\n soa=zone[0]\n recl=zone[1]\n for record in zone\n src,type,target=record.to_s.match(/([A-z\\.0-9]*)[0-9\\t ]*(IN\\t[A-z]*)\\t([A-z0-9\\. ]*)/).captures\n if type=='IN\\tMX' or type=='IN\\tA' or type=='IN\\tCNAME'\n\tcreateRecord(record)\n elsif type=='IN\\tSOA'\n updateSerial(record)\n end\n end\nend", "def makeARecordGroup(name, machines, ttl: Config::TTL_A_RECORD)\n return DnsRecord.new(name: name,\n type: \"A\",\n content: machines.map(&:static_ip).join(\",\"),\n ttl: ttl)\nend", "def zone_names; end", "def zone_names; end", "def zone(start_or_range=nil, stop=nil)\n @conn.zone = if start_or_range.kind_of? Range\n start_or_range\n elsif start_or_range == nil && stop == nil\n nil\n else\n ((start_or_range || 0) .. (stop || 127))\n end\n end", "def zone(start_or_range=nil, stop=nil)\n @conn.zone = if start_or_range.kind_of? Range\n start_or_range\n elsif start_or_range == nil && stop == nil\n nil\n else\n ((start_or_range || 0) .. (stop || 127))\n end\n end", "def add_domain_record_ns(params)\n post('dns/recordns', params)\n end", "def new\n #Ajax after delete\n zone_id = params[:zone_id]\n zone_id = zone_id.to_i unless zone_id.match(/[^[:digit:]]+/)\n if zone_id.is_a?(Integer)\n @zone = Zone.find(params[:zone_id])\n else\n @zone = Zone.find_by_zone_name(url2domain(params[:zone_id]))\n end\n\n @name_server = ZoneNameServer.new\n #@name_server.ns_ttl = Dnscell::Utils.default_ttl\n @name_server.ns_ttl = ZoneNameServer.where(:zone_id => @zone.id, :primary => true).first.ns_ttl\n end", "def dns_entry(name, value, type = 'A')\n # FIXME: don't hardcode aws or tiptap.com\n\n conflict_types = {'A' => 'CNAME', 'CNAME' => 'A'}\n\n name = canonicalize(name)\n value = canonicalize(value) if type == 'CNAME'\n zone = Fog::DNS[:aws].zones.all(:domain => 'tiptap.com.').first\n records = Fog::DNS[:aws].records(:zone => zone).all\n record = records.find{|r| r.name == name and r.type == type}\n\n if record and record.value != [value]\n puts \"Deleting old #{type} record (#{name} -> #{record.value})\"\n record.destroy\n record = nil\n @changed = true\n end\n\n # Automatically delete CNAME when creating an A record or vice versa - any other types, you're on your own\n if conflict_types[type]\n conflict_record = records.find{|r| r.name == name and r.type == conflict_types[type]}\n if conflict_record\n puts \"Deleting old, conflicting #{conflict_record.type} record (#{name} -> # conflict_record.value})\"\n conflict_record.destroy\n conflict_record = nil\n @changed = true\n end\n end\n\n unless record\n puts \"Creating #{type} record (#{name} -> #{value})\"\n Fog::DNS[:aws].records(:zone => zone).create(:name => name, :value => value, :type => type, :ttl => 300)\n @changed = true\n end\n\n @changed\n end", "def create\n @zone = Zone.new(zone_params)\n\n if @zone.save\n render json: @zone, status: :created, location: @zone\n else\n render json: @zone.errors, status: :unprocessable_entity\n end\n end", "def create\n @zone = Zone.new(params[:zone])\n\n respond_to do |format|\n if @zone.save\n format.html { redirect_to zones_url, notice: 'Zone was successfully created.' }\n format.json { render json: @zone, status: :created, location: @zone }\n else\n format.html { render action: \"new\" }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @zone = Zone.new(zone_params)\n\n respond_to do |format|\n if @zone.save\n format.html { redirect_to zones_path, notice: \"Zone was successfully created.\" }\n format.json { render :show, status: :created, location: @zone }\n else\n format.html { render :new }\n format.json { render json: @zone.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @zone_name_server = ZoneNameServer.new(params[:zone_name_server])\n @zone_name_server.primary = false\n @zone_name_server.zone_id = params[:zone_name_server][:zone_id]\n @zone_name_server.user_id = current_user.id\n \n if @zone_name_server.save\n @primary = ZoneNameServer.where(:zone_id => @zone_name_server.zone_id, :primary => true)\n @slaves = ZoneNameServer.where(:zone_id => @zone_name_server.zone_id, :primary => false)\n @zone = Zone.find @zone_name_server.zone_id\n flash[:notice] = 'Name server was successfully created.'\n #redirect_to ns_zone_path, :notice => \"Yeay NS was created!\"\n else\n #@zone_ns_glue = ZoneNs.new\n #@zone_ns_glue.ns_ttl = @zone_ns.ns_ttl\n #@zone_ns_glue.ns = @zone_ns.ns\n if @zone_name_server.errors.include?(:glue)\n zone_id = params[:zone_id]\n zone_id = zone_id.to_i unless zone_id.match(/[^[:digit:]]+/)\n if zone_id.is_a?(Integer)\n @zone = Zone.find(params[:zone_id])\n else\n @zone = Zone.find_by_zone_name(url2domain(params[:zone_id]))\n end\n @zone_name_server.ipv4_ttl = Dnscell::Utils.default_ttl\n @zone_name_server.ipv6_ttl = Dnscell::Utils.default_ttl\n render 'glue_ns'\n else\n render \"error.js\"\n #render 'new_ns' \n end\n end\n end", "def create\n name, type = resource[:name].split('/')\n rdata = resource[:rdata]\n ttl = resource[:ttl]\n case type\n when 'MX'\n Array(rdata).each_with_index do |exchange, index|\n preference = Array(resource[:preference])[index]\n nsupdate(\"server #{server}\n update add #{name} #{ttl} MX #{preference} #{exchange}\n send\")\n end\n when 'SRV'\n Array(rdata).each_with_index do |target, index|\n port = Array(resource[:port])[index]\n weight = Array(resource[:weight])[index]\n priority = Array(resource[:priority])[index]\n nsupdate(\"server #{server}\n update add #{name} #{ttl} SRV #{priority} #{weight} #{port} #{target}\n send\")\n end\n else\n nsupdate(\"server #{server}\n update add #{name} #{ttl} #{type} #{Array(rdata).first}\n send\")\n end\n end", "def create_server(zone: \"fi-hel1\", title:, hostname:, core_number: 1,\n memory_amount: 1024, storage_devices:, ip_addresses: :all)\n data = {\n \"server\" => {\n \"zone\" => zone,\n \"title\" => title,\n \"hostname\" => hostname,\n \"core_number\" => core_number,\n \"memory_amount\" => memory_amount,\n \"storage_devices\" => { \"storage_device\" => storage_devices }\n }\n }\n\n if ip_addresses != :all\n ips = []\n ips << { \"access\" => \"public\", \"family\" => \"IPv4\" } if ip_addresses.include? :public\n ips << { \"access\" => \"private\", \"family\" => \"IPv4\" } if ip_addresses.include? :private\n ips << { \"access\" => \"public\", \"family\" => \"IPv6\" } if ip_addresses.include? :ipv6\n\n data[\"server\"][\"ip_addresses\"] = {}\n data[\"server\"][\"ip_addresses\"][\"ip_address\"] = ips\n end\n\n json = JSON.generate data\n response = post \"server\", json\n response\n end", "def rec_new(zone, type, name, content, ttl, prio = nil, service = nil, srvname = nil, protocol = nil, weight = nil, port = nil, target = nil, service_mode = '1')\n send_req({\n a: :rec_new,\n z: zone,\n type: type,\n name: name,\n content: content,\n ttl: ttl,\n prio: prio,\n service: service,\n srvname: srvname,\n protocol: protocol,\n weight: weight,\n port: port,\n target: target,\n service_mode: service_mode\n })\n end", "def dns_update(zone, records)\n update = Dnsruby::Update.new(zone)\n records.each do |r|\n if r.type.upcase == 'ADD'\n s = \"#{Domain} 3600 #{Type} #{RDATA}\"\n rr = Dnsruby::RR.create(s)\n update.add(rr)\n else\n update.delete(r['Domain'], r['Type'], r['RDATA'])\n end\n end\n update\n end", "def create_record(name, value, type = \"A\", ttl = 300)\n # Delete existing record because you can't update records\n delete_record_by_name(name, type, false)\n\n # Create new record\n begin\n @route53.client.change_resource_record_sets({\n :hosted_zone_id => @hosted_zone_id, \n :change_batch => {\n :changes => [ \n {\n :action => \"CREATE\", \n :resource_record_set => { \n :name => name, \n :type => type,\n :ttl => ttl, \n :resource_records => [ { :value => value } ]\n }\n }\n ]\n }\n })\n rescue StandardError => bang\n @log.error \"Error creating A record from Route53: #{bang}\"\n end\n end", "def dns_zone_params\n params.require(:dns_zone).permit(:admin_email, :version, :origin, :ttl, :description, :user_id).tap do |dns_zone_params|\n dns_zone_params.merge!({:user_id => current_user.id})\n end\n end", "def create_timezone\n DataTimezone.new(self)\n end", "def setup_dns(domain)\n# TODO should we just use the ID instead of the full href?\n owner=@deployment.href\n @dns = SharedDns.new(domain)\n raise \"Unable to reserve DNS\" unless @dns.reserve_dns(owner)\n @dns.set_dns_inputs(@deployment)\n end", "def reverse_zone(s,a)\ntextTest = File.open(a+\".arpa\",'w')\ntextTest.puts \"; \n;BIND data file for \" + s+ \" reverse lookup\n$TTL\t604800\n@\tIN\tSOA\t\"+s+\" webmaster@\"+s+\". (\n\t\t\t \"+datum+\"\t\t; Serial\n\t\t\t 604800\t\t; Refresh\n\t\t\t 86400\t\t; Retry\n\t\t\t2419200\t\t; Expire\n\t\t\t 604800 )\t; Negative Cache TTL\n;\n@\tIN\tNS\tns1.\"+s+\"\n\"+a+\"\tIN\tPTR\t ns1.\"+s+\".\"\n\n\ntextTest.close\nend", "def create_transport_zone(transport_zone, opts = {})\n data, _status_code, _headers = create_transport_zone_with_http_info(transport_zone, opts)\n data\n end", "def add_domain_record_a(params)\n post('dns/recorda', params)\n end", "def create\n if @country\n @zone = @country.zones.build(params[:zone])\n else\n @zone = Zone.new(params[:zone])\n end\n\n respond_to do |format|\n if @zone.save\n flash[:notice] = 'Zone was successfully created.'\n format.html { redirect_to(context_url) }\n else\n format.html { render :action => \"new\" }\n end\n end\n end", "def get_hosting_zone(domain)\n route53.list_hosted_zones.hosted_zones.select do |x|\n x.name == \"#{domain}.\"\n end.first\n end", "def rec_new zone, *args\n flush_cache_for_zone zone\n super zone, *args\n end", "def new\n @dns_zone = DnsZone.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @dns_zone }\n end\n end", "def zone_letter\n end", "def set_zone\n @zone = @stadium.zones.friendly.find(params[:id])\n end", "def setup_dns(domain)\n # TODO should we just use the ID instead of the full href?\n owner=@deployment.href\n @dns = SharedDns.new(domain)\n raise \"Unable to reserve DNS\" unless @dns.reserve_dns(owner)\n @dns.set_dns_inputs(@deployment)\n end", "def setup_dns(domain)\n # TODO should we just use the ID instead of the full href?\n owner=@deployment.href\n @dns = SharedDns.new(domain)\n raise \"Unable to reserve DNS\" unless @dns.reserve_dns(owner)\n @dns.set_dns_inputs(@deployment)\n end", "def create_transport_zone_with_http_info(transport_zone, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ManagementPlaneApiNetworkTransportTransportZonesApi.create_transport_zone ...'\n end\n # verify the required parameter 'transport_zone' is set\n if @api_client.config.client_side_validation && transport_zone.nil?\n fail ArgumentError, \"Missing the required parameter 'transport_zone' when calling ManagementPlaneApiNetworkTransportTransportZonesApi.create_transport_zone\"\n end\n # resource path\n local_var_path = '/transport-zones'\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(transport_zone)\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 => 'TransportZone')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ManagementPlaneApiNetworkTransportTransportZonesApi#create_transport_zone\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_domain\n debug(\"Creating domain #{domain_name}\")\n debug(\"Using options: #{domain_options}\")\n domain = client.servers.create(domain_options)\n prepare_domain(domain)\n domain\n end", "def build( zone_name = nil )\n # get the class of the record_type\n record_class = self.record_type.constantize\n\n # duplicate our own attributes, strip out the ones the destination doesn't\n # have (and the id/zone_name as well)\n attrs = self.attributes.dup\n attrs.delete_if { |k,_| !record_class.columns.map( &:name ).include?( k ) }\n attrs.delete( :id )\n attrs.delete( :zone_name )\n \n # parse each attribute, looking for %ZONE%\n unless zone_name.nil?\n attrs.keys.each do |k|\n attrs[k] = attrs[k].gsub( '%ZONE%', zone_name ) if attrs[k].is_a?( String )\n end\n end\n\n # instantiate a new destination with our duplicated attributes & validate\n record_class.new( attrs )\n end", "def load_zones\n return nil unless load_zones?\n\n @zones = []\n node['dns']['zones'].each do |zone|\n bag_name = node['dns']['bag_name'] || 'dns_zones'\n zones << data_bag_item(bag_name, Dhcp::Helpers.escape(zone)).to_hash\n end\n @zones\n end", "def zone_number\n end", "def zone(zone_id)\n Milight::V6::Zone.new(@command, zone_id)\n end", "def SafeZoneH \n \"SafeZoneH\" \n end", "def exists?\n Puppet.debug \"Check if zone exist #{get_zone}\"\n Puppet.debug \"check email => #{get_email}\"\n Puppet.debug \"check ttl => #{get_ttl}\"\n dns_service = get_dns_service(get_zone)\n return ((dns_service == nil ) ? false : dns_service.zone_exist?(get_zone))\n end", "def cleanup_zone(zone, domain, namespace, ingress_name)\n if is_zone_empty?(zone.hosted_zone.id)\n delete_zone(zone.hosted_zone.id)\n else\n delete_a_record(zone.hosted_zone.id, zone.hosted_zone.name, domain, namespace, ingress_name)\n delete_txt_record(zone.hosted_zone.id, zone.hosted_zone.name, domain, namespace)\n delete_zone(zone.hosted_zone.id)\n end\nend", "def get_hosted_zone()\n\t\tresp = @r53.get_hosted_zone(:id => @zone)\n\t\tresp[:hosted_zone]\n\tend", "def zone\n fetch('games.final_fantasy_xiv.zones')\n end", "def create\n\t\t@domain = Domain.new(:hostname => params[:hostname])\n\n\t\t# Attempt to save the domain, and return the appropriate JSON or Error\n\t\trespond_to do |format|\n\t\t\tif @domain.save\n\t\t\t\tformat.json { render json: @domain, status: :created }\n\t\t\telse\n\t\t\t\tformat.json { render json: @domain.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\t\t\n\t\t# Fetch the hostname IP address and update the record in a new thread\n\t\tt1=Thread.new{fetch_origin_ip()}\n\t\tt1.join\n\tend", "def zone(resource)\n 'us-east-1'\n end", "def push\n res = Dnsruby::Resolver.new(self.server)\n res.dnssec=false\n tsig=Dnsruby::RR.create({:name=>zone.domain,:type=\"TSIG\",key=>self.key})\n update=Dnsruby::Update.new(zone.domain)\n #addtotheupdate\n tsig.apply(update) \n response=res.send_message(update)\n end", "def create!\n Subnet.reserve(@subnet)\n super\n Address.mkdir(@id)\n PoolNode.mkdir(@id)\n create_address(gateway)\n end", "def zone_exists?(name)\n route53_client.list_hosted_zones_by_name(dns_name: name).hosted_zones.select { |r| r.name == name }.any?\n end" ]
[ "0.7931895", "0.739134", "0.7235577", "0.7179706", "0.698375", "0.6760779", "0.6733734", "0.6639063", "0.6634835", "0.6634155", "0.6612857", "0.6490288", "0.64193064", "0.6364734", "0.6350982", "0.63324004", "0.63143957", "0.6301615", "0.62735534", "0.62387955", "0.62060624", "0.6197365", "0.61845756", "0.6175709", "0.61233497", "0.61233497", "0.61031175", "0.60924214", "0.6076584", "0.60575515", "0.6043883", "0.6000955", "0.5997041", "0.59895736", "0.5965082", "0.5948466", "0.59466296", "0.5929761", "0.5913984", "0.5903639", "0.59022015", "0.5872585", "0.5853773", "0.5853312", "0.5853312", "0.58485967", "0.5830051", "0.5823772", "0.58059907", "0.57893443", "0.5787721", "0.57829636", "0.57784456", "0.574721", "0.56622535", "0.56622535", "0.5641696", "0.5641696", "0.56011933", "0.55910504", "0.5587428", "0.55669737", "0.55623764", "0.55605847", "0.5555387", "0.5549971", "0.5533569", "0.552465", "0.55216897", "0.5512111", "0.55036443", "0.54747075", "0.54695666", "0.5468242", "0.5454676", "0.5438232", "0.543476", "0.5419695", "0.5417224", "0.54115283", "0.5399608", "0.53921694", "0.5387728", "0.5387728", "0.5384761", "0.5362497", "0.5359121", "0.53510803", "0.5346767", "0.5331066", "0.53245884", "0.5313361", "0.5312004", "0.5311632", "0.5311069", "0.5307316", "0.530669", "0.53031874", "0.52916366", "0.5290725" ]
0.81226397
0
remove a dns zone
def remove_zone(zone_or_id) zone = get_zone(zone_or_id) # destroy the zones Puppet.notice "removing zone #{zone.name}" Puppet.debug "zone.name => #{zone.name}" Puppet.debug "zone.id => #{zone.id}" zone.destroy if zone_exist?(zone_or_id) Puppet.err "Failed to remove zone => #{zone_or_id}" raise "Failed to remove zone => #{zone_or_id}" end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n Puppet.debug \"starting with destroy #{self.class.to_s}\"\n dns_service = get_dns_service(get_zone)\n if dns_service != nil\n dnszone = dns_service.get_zone(get_zone)\n \n dns_service.remove_zone(dnszone.id)\n end\n Puppet.debug \"done with destroy #{self.class.to_s}\"\n end", "def cleanup_zone(zone, domain, namespace, ingress_name)\n if is_zone_empty?(zone.hosted_zone.id)\n delete_zone(zone.hosted_zone.id)\n else\n delete_a_record(zone.hosted_zone.id, zone.hosted_zone.name, domain, namespace, ingress_name)\n delete_txt_record(zone.hosted_zone.id, zone.hosted_zone.name, domain, namespace)\n delete_zone(zone.hosted_zone.id)\n end\nend", "def zone_delete(zone)\n obj_delete zone, Zone\n end", "def zone_remove(zone,member)\n obj_remove(zone,Zone,member)\n end", "def destroy\n @dns_zone = DnsZone.find(params[:id])\n @dns_zone.destroy\n\n respond_to do |format|\n format.html { redirect_to(dns_zones_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @dns_record = @zone.dns_records.find_by(id: params[:id])\n @dns_record.destroy\n respond_to do |format|\n format.html { redirect_to zone_path(@zone), notice: 'DNS Record was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def del_zone(user_key, zone)\n send_req({act: :zone_delete, user_key: user_key, zone_name: zone})\n end", "def delete(id)\n request(:delete, \"/network_zones/#{id}.json\")\n end", "def destroy\n dns_entry_response = RestClient.delete('https://api.cloudflare.com/client/v4/zones/:zone_identifier/dns_records/:identifier',:content_type => :json, :accept => :json, :'x-auth-key' => session[:key] :'x-auth-email' => session[:email])\n @dns_entry.destroy\n respond_to do |format|\n format.html { redirect_to dns_entries_url, notice: \"Dns entry was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def zone_purge(zone)\n obj_purge(zone,Zone)\n end", "def delete_hosted_zone(zone_id)\n # AWS methods return zone_ids that looks like '/hostedzone/id'. Let the caller either use\n # that form or just the actual id (which is what this request needs)\n zone_id = zone_id.sub('/hostedzone/', '')\n\n request({\n :expects => 200,\n :parser => Fog::Parsers::AWS::DNS::DeleteHostedZone.new,\n :method => 'DELETE',\n :path => \"hostedzone/#{zone_id}\"\n })\n end", "def destroy\n @zone.destroy\n\n head :no_content\n end", "def zonedelete(fabrickey, *zonenames)\n result = @zones.zonedelete(fabrickey, *zonenames)\n result[1]\n end", "def destroy\n respond_to do |format|\n # if @dns_zone.domain.dns_zone != @dns_zone && @dns_zone.destroy\n if @dns_zone.destroy\n format.html { redirect_to @dns_zone.domain, notice: 'Dns zone was successfully deleted.' }\n format.json { head :no_content }\n else\n format.html { redirect_to @dns_zone.domain, alert: 'Dns_zone in use!' }\n format.json { render json: @tag, status: :has_nodes }\n end\n end\n end", "def delete_zone(zone_id:)\n raise('zone_id required') if zone_id.nil?\n cf_delete(path: \"/zones/#{zone_id}\")\n end", "def rec_delete(zone, zoneid)\n send_req({a: :rec_delete, z: zone, id: zoneid})\n end", "def delete(id:)\n id_check(:id, id)\n\n cf_delete(path: \"#{uri_prefix}/virtual_dns/#{id}\")\n end", "def delete_dns_record(domain, record_id)\n connection.post \"/dns/delete/#{domain}\", { :record_id => record_id }\n end", "def remove_zone\n zone = ImageZone.find(params[:id])\n if(zone.remove)\n flash[:notice] = \"Removed zone #{zone.name}\"\n else\n flash[:notice] = \"Error in removing zone #{zone.name}\"\n end\n redirect_to :controller => :images, :action => :index\n end", "def destroy\n @zone = Zone.find(params[:id])\n @zone.destroy\n\n respond_to do |format|\n format.html {\n redirect_to(admin_country_zone_url(@zone.country, @zone)) }\n end\n end", "def delete(id)\n request(:delete, \"/settings/hypervisor_zones/#{id}.json\")\n end", "def zoneremove_peerzone(fabrickey, zonename, **wwns)\n result = @zones.alterzoning_peerzone(fabrickey, 'REMOVE', zonename, **wwns)\n result[1]\n end", "def remove_domain(domain_id)\n delete(\"dns/#{domain_id}\")\n end", "def update_dns(ad_dns_server, zone, record_type, value1, value2)\n begin\n # log what we are doing\n log(:info, \"Removing DNS entry on server: <#{ad_dns_server}>\")\n log(:info, \"DNS Remove Values: Zone <#{zone}>, Record Type <#{record_type}>, Value1 <#{value1}> Value2 <#{value2}>\")\n \n # NOTE: this is generic for both forward and reverse record updates\n # A record: value1 = fqdn, value2 = ipaddress\n # PTR record: value1 = reverse ip, value2 = fqdn\n IO.popen(\"nsupdate\", 'r+') do |f|\n f << <<-EOF\n server #{ad_dns_server}\n zone #{zone}\n update delete #{value1} #{record_type} #{value2}\n send\nEOF\n f.close_write\n end\n \n # log a successful completion message\n log(:info, \"Successfully removed #{record_type} record for #{value1}\")\n return true\n rescue => err\n # log a failure message\n log(:error, \"#{err.inspect}\")\n log(:error, \"Unable to successfully remove #{record_type} record for #{value1}\")\n return false\n end\n end", "def remove_domain_record(domain_id, record_id)\n delete(\"dns/#{domain_id}/#{record_id}\")\n end", "def destroy\n Puppet.debug \"starting with destroy #{self.class.to_s}\"\n dns_service = get_dns_service(get_fqdn)\n if dns_service != nil\n dnsrecord = dns_service.get_record(get_fqdn, get_type)\n dns_service.remove_record(dnsrecord.hash_id)\n end\n Puppet.debug \"done with destroy #{self.class.to_s}\"\n end", "def delete_a_record(zone_id, zone_name, domain_name, namespace, ingress_name)\n sleep 1\n client = Aws::Route53::Client.new\n\n a_record = {\n action: \"DELETE\",\n resource_record_set: {\n name: domain_name,\n alias_target: {\n # ZD4D7Y8KGAS4G this zone is the default AWS zone for ELB records, in eu-west-2\n \"hosted_zone_id\": \"ZD4D7Y8KGAS4G\",\n \"dns_name\": get_ingress_endpoint(namespace, ingress_name) + \".\",\n \"evaluate_target_health\": true,\n },\n type: \"A\",\n },\n }\n\n client.change_resource_record_sets({\n hosted_zone_id: zone_id,\n change_batch: {\n changes: [a_record],\n },\n })\nend", "def cfg_delete(cfg)\n obj_delete cfg, ZoneConfiguration\n end", "def destroy\n @time_zone = TimeZone.find(params[:id])\n @time_zone.destroy\n\n respond_to do |format|\n format.html { redirect_to time_zones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ozone.destroy\n\n end", "def zone_file_purge(zone, url)\n send_req({a: :zone_file_purge, z: zone, url: url})\n end", "def destroy\n @soa_section.destroy\n respond_to do |format|\n format.html { redirect_to domain_dns_zone_path(@soa_section.dns_zone.domain, @soa_section.dns_zone) }\n format.json { head :no_content }\n end\n end", "def destroy\n @display_zone = DisplayZone.find(params[:id])\n @display_zone.destroy\n\n respond_to do |format|\n format.html { redirect_to(display_zones_url) }\n format.xml { head :ok }\n end\n end", "def delete(zone_id, version_id, filters = {})\n call('domain.zone.record.delete', zone_id, version_id, filters)\n end", "def delete_txt_record(zone_id, zone_name, domain_name, namespace)\n sleep 1\n client = Aws::Route53::Client.new\n txt_record = {\n action: \"DELETE\",\n resource_record_set: {\n name: \"_external_dns.#{domain_name}\",\n ttl: 300,\n resource_records: [\n {\n value: %(\"heritage=external-dns,external-dns/owner=default,external-dns/resource=ingress/#{namespace}/#{domain_name}\"),\n },\n ],\n type: \"TXT\",\n },\n }\n\n client.change_resource_record_sets({\n hosted_zone_id: zone_id,\n change_batch: {\n changes: [txt_record],\n },\n })\nend", "def destroy\n @zone = Zone.find(params[:id])\n @zone.destroy\n\n respond_to do |format|\n format.html { redirect_to zones_url }\n format.json { head :ok }\n end\n end", "def zoneremove_standard(fabrickey, zonename, *aliases)\n result = @zones.alterzoning_standard(fabrickey, 'REMOVE', zonename, *aliases)\n result[1]\n end", "def destroy\n @zona = Zona.find(params[:id])\n @zona.destroy\n\n respond_to do |format|\n format.html { redirect_to zone_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @timezone = Timezone.find(params[:id])\n @timezone.destroy\n\n respond_to do |format|\n format.html { redirect_to timezones_url }\n format.json { head :no_content }\n end\n end", "def cfg_remove(cfg,member)\n obj_remove(cfg,ZoneConfiguration,member)\n end", "def destroy\n name, type = resource[:name].split('/')\n case type\n when 'MX'\n @dnsres.each do |res|\n preference = res.preference\n target = res.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} MX #{preference} #{target}.\n send\")\n end\n when 'SRV'\n @dnsres.each do |res|\n priority = res.priority\n weight = res.weight\n port = res.port\n target = res.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} SRV #{priority} #{weight} #{port} #{target}\n send\")\n end\n else\n rdata = @dnsres.to_rdata\n nsupdate(\"server #{server}\n update delete #{name} #{type} #{rdata}\n send\")\n end\n end", "def destroy\n requires :name, :type, :ttl, :rrdatas\n\n service.create_change(self.zone.id, [], [resource_record_set_format])\n true\n end", "def rmhost(host_name)\n call_rpc_for_target(ZONE_METHODS[:rmhost], host_name)\n end", "def delete force: false\n clear! if force\n\n ensure_service!\n service.delete_zone id\n true\n end", "def delete\n super(ZONE_METHODS[:delete])\n end", "def del_ip(vid, ip_address)\n perform_request(:action => 'vserver-delip', :vserverid => vid, :ipaddr => ip_address)\n end", "def set_dns_zone\n unless @dns_zone = current_user.dns_zones.where(id: params[:id]).first\n flash[:alert] = 'DnsZone not found.'\n redirect_to domains_url\n end\n end", "def cleanup_records\n Fog::DNS[:dreamhost].records.each do |r|\n # Do not delete the 'do-not-delete' record, we need it for the tests\n r.destroy if r.name =~ /#{test_domain}/ and r.name != do_not_delete_record\n end\nend", "def destroy\n @zone.destroy\n respond_to do |format|\n format.html { redirect_to zones_url, notice: \"Zone was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @erogenous_zone = ErogenousZone.find(params[:id])\n @erogenous_zone.destroy\n\n respond_to do |format|\n format.html { redirect_to erogenous_zones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @name_server = ZoneNameServer.find(params[:id])\n #@zone = Zone.find(@name_server.zone_id)\n @name_server.user_id = current_user.id\n @name_server.destroy\n\n @primary = ZoneNameServer.where(:zone_id => @name_server.zone_id, :primary => true)\n @slaves = ZoneNameServer.where(:zone_id => @name_server.zone_id, :primary => false)\n @zone = Zone.find @name_server.zone_id\n #@zone = Zone.find_by_zone_name(url2domain(params[:zone_id]))\n #@name_servers = @zone.name_servers\n flash[:notice] = 'Name server was successfully deleted.' \n end", "def destroy\n @auth_ip_address_group.destroy\n head :no_content\n end", "def rec_delete_by_name zone, name\n get_all_records_for_zone(zone).each do |rec|\n if rec['display_name'] == name && rec['zone_name'] == zone\n rec_delete(zone, rec['rec_id'])\n end\n end\n end", "def destroy\n if @zone.destroy()\n render json: { :message => \"Success!\" }\n else\n render json: { :message => \"La zona no pudo ser eliminada\" }\n end\n end", "def destroy\n @ad_zone_type = AdZoneType.find(params[:id])\n @ad_zone_type.destroy\n\n respond_to do |format|\n format.html { redirect_to(ad_zone_types_url) }\n format.xml { head :ok }\n end\n end", "def del_host(wspace, address, comm='')\n\t\thost = wspace.hosts.find_by_address_and_comm(address, comm)\n\t\thost.destroy if host\n\tend", "def destroy\n @dn.destroy\n respond_to do |format|\n format.html { redirect_to dns_url, notice: 'Dn was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def remove(record, zone)\n record_fqdn = record.fqdn.sub(/\\.$/, '')\n\n existing_record = client.record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type\n )\n return if existing_record.nil?\n\n pruned_answers = existing_record['answers']\n .map { |answer| symbolize_keys(answer) }\n .reject { |answer| answer[:answer] == build_api_answer_from_record(record) }\n\n if pruned_answers.empty?\n client.delete_record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type\n )\n return\n end\n\n client.modify_record(\n zone: zone,\n fqdn: record_fqdn,\n type: record.type,\n params: { answers: pruned_answers }\n )\n end", "def release_dns\n @dns.release_dns\n end", "def delete_dns_cname_records(zone_name, domain_names)\n domain_names.map do |domain_name|\n request_delete_dns_cname_record(zone_name, domain_name)\n end.each do |request_id|\n wait_until_updates_propagate(request_id)\n end\n end", "def dns_entry(name, value, type = 'A')\n # FIXME: don't hardcode aws or tiptap.com\n\n conflict_types = {'A' => 'CNAME', 'CNAME' => 'A'}\n\n name = canonicalize(name)\n value = canonicalize(value) if type == 'CNAME'\n zone = Fog::DNS[:aws].zones.all(:domain => 'tiptap.com.').first\n records = Fog::DNS[:aws].records(:zone => zone).all\n record = records.find{|r| r.name == name and r.type == type}\n\n if record and record.value != [value]\n puts \"Deleting old #{type} record (#{name} -> #{record.value})\"\n record.destroy\n record = nil\n @changed = true\n end\n\n # Automatically delete CNAME when creating an A record or vice versa - any other types, you're on your own\n if conflict_types[type]\n conflict_record = records.find{|r| r.name == name and r.type == conflict_types[type]}\n if conflict_record\n puts \"Deleting old, conflicting #{conflict_record.type} record (#{name} -> # conflict_record.value})\"\n conflict_record.destroy\n conflict_record = nil\n @changed = true\n end\n end\n\n unless record\n puts \"Creating #{type} record (#{name} -> #{value})\"\n Fog::DNS[:aws].records(:zone => zone).create(:name => name, :value => value, :type => type, :ttl => 300)\n @changed = true\n end\n\n @changed\n end", "def delete_floating_ip\n raw_delete_floating_ip\n end", "def reset_zone\n @last_map_id = -1\n @zone = -1\n end", "def rec_delete_by_name zone, name\n get_records(zone, name).keys.each { |rec_id| rec_delete(zone, rec_id) }\n end", "def remove_dns_entries(entries=[])\n if not entries.empty?\n entries.each do |domain|\n yes = dns_service.namespace_available?(domain)\n if !yes\n #puts \"deregistering #{domain}\"\n dns_service.deregister_namespace(domain)\n end\n end\n\n dns_service.publish\n dns_service.close\n end\n end", "def add_zone!(name)\n zone = add_zone(name)\n zone.save!\n zone\n end", "def release_dns\n @dns.release_dns\n end", "def release_dns\n @dns.release_dns\n end", "def remove_domain(host)\n domain = find_domain!(host)\n res = post '/dns.php', domain.delete_options\n if response_status_message(res) == (RESPONSE_MESSAGES[:DOMAIN_DELETED] % host)\n clear_domain_cache!\n return true\n else\n return false\n end\n end", "def reset!\n self.zone = nil\n end", "def delete(opt)\n ipaddr_modify(RTM_DELADDR, 0, opt)\n end", "def del_ip(vid, ip_address)\n perform_request(action: 'vserver-delip', vserverid: vid, ipaddr: ip_address)\n end", "def remove(host, plataform)\n @plataforms[plataform].rem(host)\n end", "def delete(id:)\n id_check('id', id)\n cf_delete(path: \"/zones/#{zone_id}/custom_certificates/#{id}\")\n end", "def delete(name)\n connect { |connection| connection.delete dn(name) }\n end", "def deletesecuritygroup\n if not checkRequirements([\"thezone\",\"thefirewall\"])\n return false\n end\n checkToken(@thezone)\n submit = queryGCE(:path => '/compute/v1beta15/projects/#{@thezone.name}/global/firewalls/#{@thefirewall.serial}', :method => 'delete', :options => '', :acces_token => @thezone.token )\n checkQuery(:type => 'global', :token => @thezone.token, :projectname => @thezone.name, :operationname => submit[\"name\"])\n end", "def destroy\n @ozone.destroy\n respond_to do |format|\n format.html { redirect_to ozones_url, notice: 'Ozone was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n requires :ip\n remove(:release => true)\n end", "def aliremove(fabrickey, aliname, *wwn)\n result = @zones.alteralias(fabrickey, 'REMOVE', aliname, *wwn)\n result[1]\n end", "def delete\n self.update_column(:deleted_at, object_zone_time)\n end", "def delete(dst)\n _check_open!\n re = Entry.new\n if( re.dst.set_string(dst) and ::Dnet.route_get(@handle, re) == 0 )\n return re \n end\n end", "def delete_domain!(name)\n sdb_query({:Action => 'DeleteDomain', 'DomainName' => name})\n end", "def rm(hostname)\n hosts.delete hostname\n end", "def remove_host(host)\r\n @hosts.delete(host)\r\n end", "def delete_record(name, type, ttl, value, log_errors = true)\n delete_result = true\n begin\n @route53.client.change_resource_record_sets({\n :hosted_zone_id => @hosted_zone_id, \n :change_batch => {\n :changes => [ \n {\n :action => \"DELETE\", \n :resource_record_set => { \n :name => name, \n :type => type,\n :ttl => ttl, \n :resource_records => [ { :value => value } ]\n }\n }\n ]\n }\n })\n rescue StandardError => bang\n @log.error \"Error deleting A record from Route53: #{bang}\" if log_errors\n delete_result = false\n end\n delete_result\n end", "def zone() end", "def destroy_and_undefine\n @display.stop if @display&.active?\n begin\n old_domain = @virt.lookup_domain_by_name(@domain_name)\n old_domain.destroy if old_domain.active?\n old_domain.undefine\n rescue StandardError\n # Nothing to clean up\n end\n end", "def destroy\n @zone_updater = ZoneUpdater.find(params[:id])\n @zone_updater.destroy\n\n respond_to do |format|\n format.html { redirect_to zone_updaters_url }\n format.json { head :no_content }\n end\n end", "def unpublish\n if (@sa.ipv4)\n DNSUpdate.unpublish(@sa.target, Dnsruby::Types.A, @sa.ipv4)\n signal(:removed, Dnsruby::Types.A, @sa.ipv4)\n end\n if (@sa.ipv6)\n DNSUpdate.unpublish(@sa.target, Dnsruby::Types.AAAA, @sa.ipv6)\n signal(:removed, Dnsruby::Types.A, @sa.ipv6)\n end\n end", "def destroy\n @toy_zone = ToyZone.find(params[:id])\n @toy_zone.destroy\n\n respond_to do |format|\n format.html { redirect_to toy_zones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @zone_status = ZoneStatus.find(params[:id])\n @zone_status.destroy\n\n respond_to do |format|\n format.html { redirect_to zone_statuses_url }\n format.json { head :no_content }\n end\n end", "def remove(ip_address)\n if entry = find_entry_by_ip_address(ip_address)\n @entries.delete(entry)\n end\n end", "def create_zone(zone, email, ttl)\n @dnsh.name = zone\n @dnsh.email = email\n @dnsh.ttl = ttl\n if @dnsh.save == true\n Puppet.notice \"Created dns zone #{zone} with id #{@dnsh.id}\"\n else\n Puppet.err @dnsh.cstatus\n raise @dnsh.cstatus\n end\n end", "def dns_update(zone, records)\n update = Dnsruby::Update.new(zone)\n records.each do |r|\n if r.type.upcase == 'ADD'\n s = \"#{Domain} 3600 #{Type} #{RDATA}\"\n rr = Dnsruby::RR.create(s)\n update.add(rr)\n else\n update.delete(r['Domain'], r['Type'], r['RDATA'])\n end\n end\n update\n end", "def destroy\n @customer_tax_zone.destroy\n respond_to do |format|\n format.html { redirect_to customer_tax_zones_url, notice: 'Customer tax zone was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def pull\n zt=Dnsruby::ZoneTransfer.new\n zt.transfer_type=Dnsruby::Types.AXFR\n zt.server=self.server\n zone=zt.transfer(self.zone.domain)\n zone.tsig=self.zone.domain+\".\", self.key\n soa=zone[0]\n recl=zone[1]\n for record in zone\n src,type,target=record.to_s.match(/([A-z\\.0-9]*)[0-9\\t ]*(IN\\t[A-z]*)\\t([A-z0-9\\. ]*)/).captures\n if type=='IN\\tMX' or type=='IN\\tA' or type=='IN\\tCNAME'\n\tcreateRecord(record)\n elsif type=='IN\\tSOA'\n updateSerial(record)\n end\n end\nend", "def remove_record(domain, *args)\n domain = find_domain!(domain)\n raise IncorrectDomainType, \"Domain #{host} is a #{domain.type} domain\" unless domain.can_have_records?\n record = args.first.is_a?(Record) ? record : list_records(domain)[*args]\n raise MissingRecordError, \"Record does not exist\" if record.nil? || record.new?\n \n response = get('/dns.php', record.delete_options)\n if response_status_message(response) == RESPONSE_MESSAGES[:RECORD_DELETED]\n clear_domain_records_cache!(domain)\n true\n else\n puts response_status_message(response)\n false\n end\n \n end", "def delete(dn)\n @conn.delete :dn => dn\n end", "def destroy\n @cityzone.destroy\n respond_to do |format|\n format.html { redirect_to cityzones_url, notice: 'Cityzone was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def create\n @domain = Domain.friendly.find(params[:domain_id])\n @dns_zone = @domain.dns_zones.create(dns_zone_params.merge({:version => 1}))\n if @dns_zone.save\n redirect_to @domain, notice: 'Dns zone was successfully created.'\n else\n render action: 'edit', @errors => @dns_zone.errors, alert: \"Dns zone validation failed.\"\n end\n end" ]
[ "0.79036623", "0.7475566", "0.7417273", "0.7274328", "0.72708243", "0.7064017", "0.7005779", "0.69378227", "0.6888122", "0.6855303", "0.68493116", "0.68198544", "0.6663066", "0.66160464", "0.6500788", "0.64389473", "0.64343834", "0.6367987", "0.63340586", "0.63256085", "0.6264397", "0.6253894", "0.6246143", "0.62372434", "0.62105215", "0.61806244", "0.616727", "0.61584777", "0.61520296", "0.61212224", "0.6086311", "0.6076233", "0.606353", "0.6057983", "0.6044881", "0.6040106", "0.6012313", "0.6008417", "0.5998897", "0.5995417", "0.5982095", "0.5978237", "0.5970816", "0.5957444", "0.5919046", "0.5889771", "0.587685", "0.58761257", "0.58730114", "0.5872516", "0.580907", "0.5795205", "0.5787995", "0.57700485", "0.575991", "0.5750081", "0.573756", "0.57322663", "0.5731361", "0.5727733", "0.5714979", "0.5712802", "0.5696722", "0.5693395", "0.5687274", "0.5686526", "0.5673419", "0.5673419", "0.5649679", "0.5649008", "0.56454265", "0.56254303", "0.56253487", "0.5624892", "0.5594891", "0.55947363", "0.55909085", "0.557313", "0.55726385", "0.55568016", "0.55529785", "0.5546002", "0.55442667", "0.5535807", "0.5529198", "0.5526396", "0.5510724", "0.5475307", "0.5474523", "0.5456369", "0.54500425", "0.54487383", "0.5424629", "0.54149956", "0.5413188", "0.54128915", "0.5393606", "0.53798676", "0.53793263", "0.5365908" ]
0.6823242
11
get a dns zone
def get_zone(zone) return find_match(@dns.domains, zone) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_hosted_zone()\n\t\tresp = @r53.get_hosted_zone(:id => @zone)\n\t\tresp[:hosted_zone]\n\tend", "def get_zone(zone)\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::Zerigo::DNS::GetZone.new,\n :path => \"/api/1.1/zones/#{zone}.xml\"\n )\n end", "def get_hosting_zone(domain)\n route53.list_hosted_zones.hosted_zones.select do |x|\n x.name == \"#{domain}.\"\n end.first\n end", "def zone_by_name name\n connection if @connection.nil?\n @connection.zones.all.each do |zone|\n if zone.domain == name\n return zone\n end\n end\n return nil\n end", "def fetch_dns_ptr(zone_name)\n \n @o = ''\n # find out the range we are parsing in this zone.\n ranges = []\n zone_name.split(\".\").map{|a| \n # Make sure it's request for arpa zone which should be all number\n if ! (a =~ /^\\d+$/).nil?\n if ranges.empty?\n ranges << a\n else\n ranges.insert(0, a)\n end\n end\n }\n \n # After look through zone name, if it's not a arpa zone, we'll return nil\n if ranges.empty?\n return @o\n end\n \n # Use later to determine how many number from ip we need\n zone_class = ranges.length\n \n # Now we have the range from zone name, let's use Networking class to help us find all interfaces\n # Find out wether it's class a, b, c or d\n netmask = 32 # start with D class netmask\n for i in (ranges.length..4-1)\n # Get the netmask correctly\n netmask = netmask - 8\n # Set the empty ip slot to 0\n ranges[i] = 0;\n end\n \n # Build the address\n range_address = ranges.join(\".\") + \"/#{netmask}\"\n \n # Call in cidr, find all interface under this range.\n interfaces = Networking.get_interfaces_in_range(range_address).sort{|a,b| a.ip <=> b.ip}\n\n # Find asset for each interface\n # If asset is Server, we need to look up two things\n # 1. If ip is drac, we will add \"-d\" to the hostname\n # 2. Maybe for vip, we need to ptr to it, but on the second thought, that shouldn't be. \n for interface in interfaces\n\n # Build the ip correct for this zone\n ips = []\n ip_parts = interface.ip_to_string.split(\".\")\n for i in (zone_class..4-1)\n # Insert reversely\n ips.insert(0, ip_parts[i])\n end\n ip = ips.join(\".\")\n \n # If it's a drac and type = server, we transform the hostname\n if ( interface.drac_ip? && interface.asset.resource_type == 'Server')\n name = convert_to_drac_name(interface.asset.name)\n else\n # Check to see if there is multiple vips poing to this ip, if so raise exception.\n # If only one ip, then we'll point PTR record to that vip.\n if interface.vips.length > 1\n #raise \"#{interface.ip_to_string} has more than one vip \" + interface.vips.collect{|a| a.name}.inspect + \" pointing to it\"\n @o += \";#{interface.ip_to_string} has more than one vip \" + interface.vips.collect{|a| a.name}.inspect + \" pointing to it.\\n\"\n @o += \";Picking the first one.\\n\"\n name = interface.vips[0].name \n elsif interface.vips.length == 1\n name = interface.vips[0].name\n # Network asset with named interface\n elsif interface.asset.resource_type == 'Network' and interface.name and interface != interface.asset.primary_interface and ! interface.name.empty?\n name = interface.name + '.' + interface.asset.name\n else\n name = interface.asset.name \n end\n \n end\n \n @o += \"#{ip}\\t\\tPTR\\t\\t#{name}.\\n\"\n\n end\n\n return @o\n\n rescue Exception => exc\n flash[:interface] = \"##ERROR## Fetch failed following reason: #{exc.message}\\n\"\n\n \n end", "def fetch_zone\n \n # zone name pass from url\n zone_name = params[:src]\n # Record type, A or PTR\n record_type = params[:type]\n # zone name pass from url\n network_type = params[:net]\n \n # Output Buffer\n @o = ''\n \n if network_type == 'int'\n dns_zone = DnsZone.find_by_name(zone_name + \"-int\")\n else\n dns_zone = DnsZone.find_by_name(zone_name)\n end\n \n # If can't find the specified zone, we'll return with some useful text\n if dns_zone.nil?\n @o += \"; ##ERROR## Invalid zone name specified.\\n\"\n @o += \"; Valid names can be one of the following:\\n\"\n \n @o += DnsZone.find(:all, :order => :name, :select => :name).collect{|a| \"; \" + a.name}.join(\"\\n\")\n else\n # Our rules for dns record generation. \n # 1. Only generate a record once\n # 2. Generate record in closest zone defined.\n # 3. If nothing match, generate nothing.\n # 4. Record will be specified in absolute name, include the \".\" at the end\n # For ex: ads1.vip.sc9.yahoo.com should match zone, \"vip.sc9.yahoo.com\" first, if not found,\n # try sc9.yahoo.com, then yahoo.com, then .com. If no zone match, then this record is ignored.\n # @o += \"; Generated zone for #{zone_name} on #{Time.new.to_s}\\n\"\n # Dont think we need ORIGIN, will find out when deploy internal DNS\n #@o += \"$ORIGIN #{dns_zone.name}.\\n\"\n @o += \"$TTL #{dns_zone.my_ttl}\\n\"\n \n # In order to make sure we only generate one record, we actually have get all asset and zone\n # then put them in appropriate places. It kinda suck, but one http call can't get us multiple file\n # Unless we get everything into one file, then have the local script to parse it into multiple\n # files, but that sounds a bit too hacky. So instead, we let AST do the expensive work.\n\n # Alright, let's build the SOA first.\n @o += \"@ \\t IN \\t SOA #{dns_zone.my_soa} (\\n\"\n @o += \"\\t\\t\\t #{Time.new.to_i} \\t;serial\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_refresh} \\t;refresh\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_retry} \\t;retry\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_expire} \\t;expire\\n\"\n @o += \"\\t\\t\\t #{dns_zone.my_minimum} \\t;minimum\\n\"\n @o += \");\\n\"\n # NS\n for ns in dns_zone.my_dns_ns_records\n @o += \"\\t\\tNS\\t\\t#{ns.name}.\\n\" \n end\n # MX\n for mx in dns_zone.my_dns_mx_records\n @o += \"\\t\\tMX\\t\\t#{mx.priority} #{mx.name}.\\n\"\n end\n \n @o += \"\\n\"\n \n # use appropriate function for each type of record\n if record_type == 'a'\n \t# If master A record is not null, put it in here\n \tif ! dns_zone.mastera.nil?\n @o += \"\\t\\t\\t\\t#{dns_zone.mastera}\\n\\n\"\n end\n @o += fetch_dns_a(zone_name) \n elsif record_type == 'ptr'\n @o += fetch_dns_ptr(zone_name)\n end\n #@o += assets.collect{|a| a.primary_interface.ip_to_string rescue nil}.join(\"<br/>\")\n end\n \n render(:partial => \"output\",:object => @o) \n\n end", "def zone\n fetch('games.final_fantasy_xiv.zones')\n end", "def zone_by_name name\n connection.list_hosted_zones_by_name(dns_name: name, max_items: 1).hosted_zones.each do |zone|\n if zone.name == name\n return zone.id\n end\n end\n return nil\n end", "def zone_identifier; end", "def zone_identifier; end", "def zone(zone_id:)\n raise('zone_id required') if zone_id.nil?\n cf_get(path: \"/zones/#{zone_id}\")\n end", "def zone\n Zone.find(self.zone_id)\n end", "def zone\n zn = zone_name\n zn ? @engine.item_by_name(zn) : nil\n end", "def get_zone\n return @resource[:name]\n end", "def zone\n @zone\n end", "def zone_info(zone_name)\n parameters = \"zone=#{zone_name}\"\n request(:get, \"/api/zone?#{parameters}\")\n end", "def get_hosted_zone(zone_id)\n # AWS methods return zone_ids that looks like '/hostedzone/id'. Let the caller either use\n # that form or just the actual id (which is what this request needs)\n zone_id = zone_id.sub('/hostedzone/', '')\n\n request({\n :expects => 200,\n :idempotent => true,\n :method => 'GET',\n :parser => Fog::Parsers::AWS::DNS::GetHostedZone.new,\n :path => \"hostedzone/#{zone_id}\"\n })\n end", "def get_zone(x, y, worldmap_id = @worldmap)\n zone_id = GameData::WorldMap.get(worldmap_id).data[x, y]\n return zone_id && zone_id >= 0 ? GameData::Zone.get(zone_id) : nil\n end", "def zone_for( host, port )\n config.each_pair do |zone, info|\n return zone if info['host'] == host and info['port'] == port.to_i\n end\n nil\n end", "def zone_for( host, port )\n config.each_pair do |zone, info|\n return zone if info['host'] == host and info['port'] == port.to_i\n end\n nil\n end", "def set_dns_zone\n unless @dns_zone = current_user.dns_zones.where(id: params[:id]).first\n flash[:alert] = 'DnsZone not found.'\n redirect_to domains_url\n end\n end", "def get_hosted_zone(zone_id)\n\n # AWS methods return zone_ids that looks like '/hostedzone/id'. Let the caller either use \n # that form or just the actual id (which is what this request needs)\n zone_id = zone_id.sub('/hostedzone/', '')\n\n request({\n :expects => 200,\n :parser => Fog::Parsers::DNS::AWS::GetHostedZone.new,\n :method => 'GET',\n :path => \"hostedzone/#{zone_id}\"\n })\n\n end", "def zone_info\n @info.zones\n end", "def zone_by_name(name)\n zones_by_name(name, 1).find do |zone|\n zone.name == name\n end\n end", "def zone_id_from_name(name)\n route53_client.list_hosted_zones_by_name(dns_name: name).hosted_zones.collect { |x| x.id if x.name == name }.first\n end", "def zone_id_from_name(name)\n route53_client.list_hosted_zones_by_name(dns_name: name).hosted_zones.collect { |x| x.id if x.name == name }.first\n end", "def zone() end", "def zone; end", "def get_zones\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::DNS::Slicehost::GetZones.new,\n :path => 'zones.xml'\n )\n end", "def zone_names; end", "def zone_names; end", "def zone_lookup(user_key, zone)\n send_req({act: :zone_lookup, user_key: user_key, zone_name: zone})\n end", "def get_record zone, name\n get_all_records_for_zone(zone).each do |rec|\n return rec if rec['display_name'] == name && rec['zone_name'] == zone\n end rescue NoMethodError\n nil\n end", "def zone\n strftime('%Z')\n end", "def zone_exist?(name)\n match = find_match(@dns.domains, name)\n if match != nil\n Puppet.notice \"found dns zone #{match.name}\"\n return true\n else\n Puppet.debug \"zone not found : #{name}\"\n return false\n end\n end", "def reverse_name_lookup(ip, type = :A)\n # look for all the zones\n type = type.to_sym if type.class != Symbol\n dns_name = String.new\n @dns.domains.each do |zone|\n @dns.domains.get(zone.id).records.each do | record |\n if record.data == ip and record.type.to_sym == type\n dns_name = record.name\n break\n end\n end\n end\n return dns_name\n end", "def zone_name\n l = location\n l ? l.zone_name : state[\"zone\"]\n end", "def zone(resource)\n 'us-east-1'\n end", "def zone_name\n compliance_data[:name]\n end", "def warp_zone\n return @warp_zone\n end", "def zone_identifiers; end", "def zone_identifiers; end", "def zone_number\n end", "def zone\n period.abbreviation\n end", "def zone\n if @_utc then\n return \"UTC\"\n else\n return self.to_a[IDX_ZONE]\n end\n end", "def create_zone(zone, email, ttl)\n @dnsh.name = zone\n @dnsh.email = email\n @dnsh.ttl = ttl\n if @dnsh.save == true\n Puppet.notice \"Created dns zone #{zone} with id #{@dnsh.id}\"\n else\n Puppet.err @dnsh.cstatus\n raise @dnsh.cstatus\n end\n end", "def index\n @dns_zones = DnsZone.all\n end", "def current_zone\n return @zone\n end", "def zone_name(zone_id)\n @zone_name.fetch(zone_id, :undefined)\n end", "def load_zone(zone_file_path, site_uid, site, zone_type, add_header)\n if File.exist?(zone_file_path)\n zone = DNS::Zone.load(File.read(zone_file_path))\n else\n zone = DNS::Zone.new\n end\n zone.site_uid = site_uid\n zone.file_path = zone_file_path\n #If the target file will have a header or not (manage included files without records duplication)\n zone.header = add_header\n zone.soa = zone.records[0] if zone.records.any? && zone.records[0].type == 'SOA'\n\n #We only want the zone to manage these records, we will manage SOA, MX, NS, @s manually\n zone.records.reject! { |rec|\n !( rec.is_a?(DNS::Zone::RR::A) || rec.is_a?(DNS::Zone::RR::CNAME) || rec.is_a?(DNS::Zone::RR::PTR)) || rec.label == \"@\"\n }\n if add_header && zone_type == :internal\n set_internal_zone_header_records(zone, site)\n elsif add_header && zone_type == :external\n set_external_zone_header_records(zone, site)\n end\n zone.include = include_manual_file(zone, zone_type)\n return zone\nend", "def canonical_zone\n @linked_timezone.canonical_zone\n end", "def get_zone_info(compute)\n zone = JSON.parse(compute['ciAttributes']['zone'])\n return \"#{zone['fault_domain']}_#{zone['update_domain']}\"\n end", "def new_zone(domain_id)\n z = Zone.new\n z.domain_id = domain_id\n z.owner = User.all(:username => \"admin\").first.id\n\n z.save\n return z\n end", "def get_dns_ipaddr(host)\n dns = Dnsruby::DNS.new({\n :nameserver => [ IWMNns ],\n :search => [ 'canishe.com' ],\n :ndots => 1\n })\n\n answer = dns.getaddress(host)\n\n return answer.to_s\nend", "def pull\n zt=Dnsruby::ZoneTransfer.new\n zt.transfer_type=Dnsruby::Types.AXFR\n zt.server=self.server\n zone=zt.transfer(self.zone.domain)\n zone.tsig=self.zone.domain+\".\", self.key\n soa=zone[0]\n recl=zone[1]\n for record in zone\n src,type,target=record.to_s.match(/([A-z\\.0-9]*)[0-9\\t ]*(IN\\t[A-z]*)\\t([A-z0-9\\. ]*)/).captures\n if type=='IN\\tMX' or type=='IN\\tA' or type=='IN\\tCNAME'\n\tcreateRecord(record)\n elsif type=='IN\\tSOA'\n updateSerial(record)\n end\n end\nend", "def zone(start_or_range=nil, stop=nil)\n @conn.zone = if start_or_range.kind_of? Range\n start_or_range\n elsif start_or_range == nil && stop == nil\n nil\n else\n ((start_or_range || 0) .. (stop || 127))\n end\n end", "def zone(start_or_range=nil, stop=nil)\n @conn.zone = if start_or_range.kind_of? Range\n start_or_range\n elsif start_or_range == nil && stop == nil\n nil\n else\n ((start_or_range || 0) .. (stop || 127))\n end\n end", "def timezone\n Timezone.get_proxy(@identifier)\n end", "def set_zone\n @zone = @stadium.zones.friendly.find(params[:id])\n end", "def show\n @dns_zone = DnsZone.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @dns_zone }\n end\n end", "def dns\n @dns ||= Resolv::DNS.open\n end", "def zone_letter\n end", "def create\n @domain = Domain.friendly.find(params[:domain_id])\n @dns_zone = @domain.dns_zones.create(dns_zone_params.merge({:version => 1}))\n if @dns_zone.save\n redirect_to @domain, notice: 'Dns zone was successfully created.'\n else\n render action: 'edit', @errors => @dns_zone.errors, alert: \"Dns zone validation failed.\"\n end\n end", "def availability_zone\n @subnet.availability_zone\n end", "def zones(id:)\n id_check(:id, id)\n\n cf_get(path: \"/organizations/#{org_id}/railguns/#{id}/zones\")\n end", "def dnspod()\n AWS::Route53.new(:access_key_id => @aws_access_key_id,\n :secret_access_key => @aws_access_key).client\n end", "def dns\n @gapi.dns_name\n end", "def dns_a_record\n @_dns_a_record = \"0.0.0.0\" if @config[:dns_lookup] == :off\n @_dns_a_record ||= Socket.gethostbyname(dns_name)\n rescue SocketError # not found, but could also mean network not work\n @_dns_a_record ||= []\n end", "def create\n Puppet.debug \"starting create #{self.class.to_s}\"\n dns_service = get_dns_service(get_zone)\n dns_service.create_zone(get_zone, get_email, get_ttl) if dns_service != nil\n Puppet.debug \"done with create #{self.class.to_s}\"\n end", "def destroy\n Puppet.debug \"starting with destroy #{self.class.to_s}\"\n dns_service = get_dns_service(get_zone)\n if dns_service != nil\n dnszone = dns_service.get_zone(get_zone)\n \n dns_service.remove_zone(dnszone.id)\n end\n Puppet.debug \"done with destroy #{self.class.to_s}\"\n end", "def availability_zone\n data[:availability_zone]\n end", "def availability_zone\n @dbi.availability_zone\n end", "def availability_zone\n @dbi.availability_zone\n end", "def zones\n zone_identifiers.collect {|id|\n Timezone.get_proxy(id) \n }\n end", "def hosted_zone_id\n if is_elb?\n ELB::get_aws(name).canonical_hosted_zone_name_id\n elsif is_record_set?\n local_zone_id\n elsif is_s3?\n S3::zone_ids[S3::get_aws(name).location]\n elsif is_cloudfront?\n \"Z2FDTNDATAQYW2\" # AWS hard codes this\n end\n end", "def load_zones\n return nil unless load_zones?\n\n @zones = []\n node['dns']['zones'].each do |zone|\n bag_name = node['dns']['bag_name'] || 'dns_zones'\n zones << data_bag_item(bag_name, Dhcp::Helpers.escape(zone)).to_hash\n end\n @zones\n end", "def dns scope: nil, retries: nil, timeout: nil\n require \"gcloud/dns\"\n Gcloud.dns @project, @keyfile, scope: scope,\n retries: (retries || @retries),\n timeout: (timeout || @timeout)\n end", "def zones\n retry_on_connection_errors do\n session.zones.all_zones(account_id).data.map(&:name)\n end\n end", "def time_zone\n addresses.primary.blank? || addresses.primary.time_zone.blank? ? nil : addresses.primary.time_zone\n end", "def hosted_zone_id\n data[:hosted_zone_id]\n end", "def show(id)\n response = request(:get, \"/network_zones/#{id}.json\")\n response['network_group']\n end", "def canonical_zone\n real_timezone.canonical_zone\n end", "def request_time_zone\n facility_id = @request.dig(:facility, :parent_site_code)\n facility = Mobile::VA_FACILITIES_BY_ID[\"dfn-#{facility_id}\"]\n facility ? facility[:time_zone] : nil\n end", "def find_record\n if @zone.nil?\n if @resource[:zoneid] != 'absent' then\n @zone = @resource[:zoneid]\n else\n @zone = zone_by_name @resource[:zone]\n if @zone.nil? then\n self.fail \"No such zone: #{@resource[:zone]}\"\n end\n end\n end\n connection.list_resource_record_sets(hosted_zone_id: @zone, start_record_name: @resource[:record], start_record_type: @resource[:type]).resource_record_sets.each do |record|\n if record.name == @resource[:record] && record.type == @resource[:type]\n return record\n end\n end\n return nil\n end", "def zones_by_name(name, max_items = nil)\n client.list_hosted_zones_by_name(\n dns_name: name,\n max_items: max_items,\n )&.hosted_zones\n end", "def dns; settings.components.dns.config end", "def list_zones\n request(\n :expects => 200,\n :method => 'GET',\n :parser => Fog::Parsers::DNS::Zerigo::ListZones.new,\n :path => '/api/1.1/zones.xml'\n )\n end", "def dns\n @dns ||= select { |type,value| type == :dns }.map do |(type,value)|\n value\n end\n end", "def zone_name\n @name ||= new_resource.name[-1] == '.' ? new_resource.name : \"#{new_resource.name}.\"\n end", "def availability_zone\n data.availability_zone\n end", "def location_preference_zone\n settings.fetch(:location_preference, {})[:zone]\n end", "def exists?\n Puppet.debug \"Check if zone exist #{get_zone}\"\n Puppet.debug \"check email => #{get_email}\"\n Puppet.debug \"check ttl => #{get_ttl}\"\n dns_service = get_dns_service(get_zone)\n return ((dns_service == nil ) ? false : dns_service.zone_exist?(get_zone))\n end", "def zone_identifiers\n @info.zone_identifiers\n end", "def zone_for(px, pz, sz_bot, sz_top)\n # puts \"calculating zone: #{px}, #{pz}, #{sz_bot}, #{sz_top}\"\n zone = [-0.70833, -0.23611, 0.23611, 0.70833, 100].index{|lower_bound| lower_bound > px} + 1\n zone += 5 * [sz_top, (2*sz_top/3 + sz_bot/3), (2*sz_bot/3 + sz_top/3), sz_bot, -100].index{|bound| bound < pz}\n # puts zone\n return zone\n end", "def find_record\n if @zone.nil?\n if @resource[:zoneid] != 'absent' then\n @zone = zone_by_id @resource[:zoneid]\n if @zone.nil? then\n self.fail \"No zone with id: #{@resource[:zoneid]}\"\n end\n else\n @zone = zone_by_name @resource[:zone]\n if @zone.nil? then\n self.fail \"No such zone: #{@resource[:zone]}\"\n end\n end\n end\n @records = @zone.records\n @records.each do |record|\n if record.name == @resource[:record]\n return record\n end\n end\n return nil\n end", "def zones\n retry_on_connection_errors do\n client.zones.map { |zone| zone['zone'] }\n end\n end", "def zone(zone_id)\n Milight::V6::Zone.new(@command, zone_id)\n end", "def get_zone_data(name)\n File.read(File.join(ZONE_FILE_PATH, name))\n end", "def time_zone\n \"Mountain Time (US & Canada)\"\n #{}\"Eastern Time (US & Canada)\"\n end", "def zones\n raise NotImplementedError\n end" ]
[ "0.7621107", "0.7456592", "0.7333731", "0.730833", "0.7251321", "0.6871877", "0.6811838", "0.67660356", "0.6747667", "0.6747667", "0.66899514", "0.6667358", "0.66535854", "0.66006154", "0.65746117", "0.6572665", "0.6535256", "0.6501411", "0.6485206", "0.6485206", "0.64761746", "0.64750606", "0.64128447", "0.64038086", "0.6396492", "0.6396492", "0.63936317", "0.63865536", "0.6341389", "0.62820876", "0.62820876", "0.6206486", "0.6195866", "0.61523795", "0.61514986", "0.61419654", "0.6133527", "0.6096095", "0.608123", "0.60809684", "0.6080865", "0.6080865", "0.6080488", "0.6045584", "0.6038893", "0.6011609", "0.5992324", "0.59878343", "0.59671915", "0.59625983", "0.5957723", "0.59491944", "0.59471977", "0.59344757", "0.59218067", "0.5912609", "0.5912609", "0.58794945", "0.58642113", "0.58458835", "0.5832416", "0.5831451", "0.5829627", "0.58251834", "0.58242404", "0.58208597", "0.5808222", "0.5795531", "0.5791279", "0.5785296", "0.5769841", "0.57691073", "0.57691073", "0.5756645", "0.57552", "0.57536733", "0.57522005", "0.57516", "0.5749109", "0.57410294", "0.5737087", "0.57294893", "0.5714185", "0.57022125", "0.56977886", "0.56969815", "0.56721747", "0.56677806", "0.5665734", "0.5652996", "0.56489456", "0.5648096", "0.5645214", "0.5643964", "0.56345636", "0.5632986", "0.56329274", "0.5627062", "0.5608569", "0.5602269" ]
0.7733444
0
items IS a method. attr_accessor creates two instance methods.reader and getter method. if we want to read specific properties from an instance, we need to initialize that method with a variable to hold the method
def initialize(discount = 0) @total = 0 @discount = discount @items = [] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def items(**items)\n const_set(:ITEMS, items)\n item_names = items.keys\n attr_accessor *item_names\n end", "def get_items\n @items\n end", "def initialize(item)\n dm = GcpResourceDynamicMethods.new\n dm.create_methods(self, item)\n\n # Set the item as a property on the class\n # This is so that it is possible to interrogate what has been added to the class and isolate them from\n # the standard methods that a Ruby class has.\n # This used for checking Tags on a resource for example\n # It also allows direct access if so required\n @item = item\n\n # Set how many items have been set\n @count = item.length if item.respond_to? :length\n end", "def attr_reader(*)\n end", "def accessor(*args)\n attr_accessor(*args)\n args\n end", "def items\n @items ||= Items.new\n end", "def initialize(item)\n dm = AzureResourceDynamicMethods.new\n dm.create_methods(self, item)\n\n # Set the item as a property on the class\n # This is so that it is possible to interrogate what has been added to the class and isolate them from\n # the standard methods that a Ruby class has.\n # This used for checking Tags on a resource for example\n # It also allows direct access if so required\n @item = item\n\n # Set how many items have been set\n @count = item.length\n end", "def item\n self.properties\n end", "def item; @item; end", "def item; @item; end", "def create_getters\n self.class::ATTRS.each do |method_name|\n self.class.class_eval do\n define_method(method_name) do\n get_webpage\n eval(\"scrape_#{method_name}\")\n eval(\"@#{method_name}\")\n end\n end\n end\n end", "def key_attr_reader(key)\n define_method key do\n self[key]\n end\n end", "def my_attr_reader(*args)\n\targs.each do |a|\n\t\tself.class_eval do\n\t\t\tinstance_variable_set \"@#{a}\", nil\n\t\t\tdefine_method a do\n\t\t\t\tinstance_variable_get \"@#{a}\"\n\t\t\tend\n\t\tend\n\tend\nend", "def item;\n @item;\n end", "def read\n super\n\n self.fetch\n\n self.items\n end", "def items(&block) \n if block_given?\n instance_eval(&block) \n else\n @items\n end \n end", "def items\n @items\n end", "def items\n @items\n end", "def items\n @items\n end", "def items\n @items\n end", "def item; end", "def item; end", "def item; end", "def item; end", "def item; end", "def initialize(list, item, client)\n return unless item\n KNOWN_ATTRIBUTES.each do |attr|\n send \"#{attr}=\", item[attr.to_s]\n end\n @list = list\n @client = client\n end", "def getters; end", "def items\n self.class.items\n end", "def initialize\n @items = []\n end", "def metaattr_reader(*meths)\n metaclass.instance_eval{attr_reader(*meths)}\n end", "def attr_reader(sym, *more) end", "def initialize\n @items_list = []\n end", "def attr_accessor_sybling(method)\n attr_reader?(method) ? to_attr_writer(method) : to_attr_reader(method)\n end", "def attr_accessor(*args)\n attr_reader(*args)\n attr_writer(*args)\n end", "def items\n return @items\n end", "def initialize\n @items = []\n end", "def items(); @items || CrateAPI::Items.new(); end", "def instance_read(attr)\n getter = :\"#{@name_string}_#{attr}\"\n instance.send(getter) if instance.respond_to?(getter)\n end", "def initialize(*args)\n super\n self.items ||= []\n end", "def items\n @items ||= []\n end", "def items(**items)\n const_set(:ITEMS, items)\n end", "def initialize\n @items = []\n end", "def attributes(*args)\n attr_accessor(*args)\n end", "def item=(item)\n @item = item\n end", "def private_attr_reader(*method_names)\n attr_reader(*method_names)\n private(*method_names)\n end", "def items\n @items ||= items_from_response\n end", "def method_missing(method, *args, &block)\n attributes.public_send(method, *args, &block)\n end", "def initialize(items=[])\n @items = items\n end", "def initialize(items=[])\n \traise IllegalArgument if items.nil?\n \t@items = []\n items.each do |item|\n @items.push Item.new(item)\n end\n end", "def instance_read(attr)\n getter = :\"#{name}_#{attr}\"\n responds = instance.respond_to?(getter)\n cached = self.instance_variable_get(\"@_#{getter}\")\n return cached if cached\n instance.send(getter) \n end", "def initialize\r\n self.items = []\r\n end", "def attr_reader(*attrs)\n attrs.each do |attr|\n define_attribute_method(attr)\n define_predicate_method(attr)\n end\n end", "def get_items\n\t\t@arr\n\tend", "def accessors\n self.class.accessors\n end", "def add_attributes(item)\n [:class, :instance].each do |attr_loc|\n # Grab attributes for the current location (class or instance)\n attrs = item.attributes[attr_loc]\n attrs.each do |name, attribute|\n reader = attribute[:read]\n writer = attribute[:write]\n\n unless reader || writer\n Logging.warn(\"attribute is not readable or writable somehow, skipping\", attribute)\n next\n end\n\n # Get all given types\n yard_types = []\n if reader\n next if @hide_private && reader.visibility == :private\n yard_types += reader.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n reader.tags('param').flat_map(&:types)\n end\n if writer\n next if @hide_private && writer.visibility == :private\n yard_types += writer.tags('return').flat_map(&:types).compact.reject { |x| x.downcase == 'void' } +\n writer.tags('param').flat_map(&:types)\n end\n\n # Use untyped if not types specified anywhere, otherwise try to\n # compute Parlour type given all these types\n if yard_types.empty?\n Logging.omit(\"no YARD type given for #{name.inspect}, using untyped\", reader || writer)\n parlour_type = Parlour::Types::Untyped.new\n elsif yard_types.all? { |x| x == 'nil' }\n # Nil attributes are extremely unusual, so just use untyped\n parlour_type = Parlour::Types::Untyped.new\n else\n parlour_type = TypeConverter.yard_to_parlour(\n yard_types, reader || writer, @type_converter_config)\n end\n\n # Generate attribute\n if reader && writer\n kind = :accessor\n elsif reader\n kind = :reader\n elsif writer\n kind = :writer\n end\n\n if @exclude_untyped && parlour_type.is_a?(Parlour::Types::Untyped)\n Logging.omit(\"excluding untyped attribute\", reader || writer, immediate: true)\n next\n end\n\n case @mode\n when :rbi\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n class_attribute: (attr_loc == :class)\n ) do |m|\n add_comments(reader || writer, m)\n end\n when :rbs\n if attr_loc == :class\n # RBS doesn't support class attr_accessors so create individual methods\n\n if reader\n @current_object.create_method(\n name.to_s,\n [Parlour::RbsGenerator::MethodSignature.new([], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(reader, m)\n end\n end\n\n if writer\n @current_object.create_method(\n \"#{name}=\",\n [Parlour::RbsGenerator::MethodSignature.new([Parlour::RbsGenerator::Parameter.new(\n \"value\",\n type: parlour_type,\n required: true\n )], parlour_type)],\n class_method: true\n ) do |m|\n add_comments(writer, m)\n end\n end\n else\n @current_object.create_attribute(\n name.to_s,\n kind: kind,\n type: parlour_type,\n ) do |m|\n add_comments(reader || writer, m)\n end\n end\n end\n end\n end\n end", "def initialize data\n @listOfItem = data\n end", "def attr_reader(*fields)\n check_fields(fields)\n added_fields = jiak.data.readable(*fields)\n added_fields.each do |field|\n class_eval <<-EOM\n def #{field}\n @jiak.object.data.#{field}\n end\n EOM\n end\n nil\n end", "def initialize(discount = 0) #Says what attributes each instance is born with\n @total = 0\n @discount = discount \n @item = []\n end", "def initialize(items = [])\n @items = items\n end", "def initialize array_of_items\n\tend", "def on_get_item_attr(i)\n nil\n end", "def create_accessors!\n instance.each do |key,val|\n create_accessor_for(key)\n end\n end", "def add_setting_accessor(item)\n add_setting_reader(item)\n add_setting_writer(item)\n end", "def get_list\n \t@items\n end", "def get_items\n\t\treturn @list\n\tend", "def items=(value)\n @items = value\n end", "def items=(value)\n @items = value\n end", "def metaattr_accessor(*meths)\n metaclass.instance_eval{attr_accessor(*meths)}\n end", "def method_missing method_name,*method_args, &method_block\n if method_name.end_with?('_name') || method_name.end_with?('_names')\n attribute = method_name.to_s.gsub(/_name(s)?$/,'')\n args.fetch(attribute)\n elsif method_name.end_with?('_value')\n attribute = method_name.to_s.gsub('_value','')\n attribute_name = send(\"#{attribute}_name\")\n item.send attribute_name\n elsif method_name.end_with?('_values')\n attribute = method_name.to_s.gsub('_values','')\n attribute_names = send(\"#{attribute}_names\")\n attribute_names.map{|attribute_name| item.send(attribute_name) }\n else\n super\n end\n end", "def delegated_instance_methods\n FlickrMocks::Models::Helpers.array_accessor_methods\n end", "def items\n @items ||= line_items.to_a\n end", "def attr_accessor(*fields)\n attr_reader *fields\n attr_writer *fields\n end", "def internal_attr_accessor(*syms)\n internal_attr_reader(*syms)\n internal_attr_writer(*syms)\n end", "def readonly(*syms)\nreturn if syms.size == 0 # If no arguments, do nothing\ncode = \"\"\n# Start with an empty string of code\n# Generate a string of Ruby code to define attribute reader methods.\n# Notice how the symbol is interpolated into the string of code.\nsyms.each do |s|\n# For each symbol\ncode << \"def #{s}; @#{s}; end\\n\"\n# The method definition\nend\n# Finally, class_eval the generated code to create instance method\nclass_eval code\nend", "def initialize(item_list)\n\t\t@item_list = item_list\n\tend", "def create_accessors!\n self.each do |key,val|\n create_accessor_for(key)\n end\n end", "def items\n reload unless attributes[\"items\"]\n\n @_items ||= Array(attributes[\"items\"]).map do |item|\n item[\"list_id\"] = @id\n\n Todoable::Item.new(item)\n end\n\n @_items\n end", "def mattr_accessor(*syms)\n mattr_reader(*syms) + mattr_writer(*syms)\n end", "def delegate_object_reader_method; end", "def initialize\n @listOfItem = Array.new\n end", "def load_items\n items.map { |serialized_item| item_from_attributes(serialized_item) }.compact\n end", "def initialize(object)\n @item = object[\"item\"]\n end", "def show\n @item_decorator = ItemDecorator.new(@item)\n end", "def attr_internal_accessor(*attrs)\n attr_internal_reader(*attrs)\n attr_internal_writer(*attrs)\n end", "def attr_internal_accessor(*attrs)\n attr_internal_reader(*attrs)\n attr_internal_writer(*attrs)\n end", "def attr_internal_accessor(*attrs)\n attr_internal_reader(*attrs)\n attr_internal_writer(*attrs)\n end", "def get_items\r\n @list\r\n end", "def define_attr_reader(name)\n define_method(name) do\n instance_variable_get(\"@#{name}\")\n end\n end", "def initialize(items=[])\n if items.nil?\n raise IllegalArgument.new\n else\n @items = []\n \n items.each do |item|\n @items << Item.new(item)\n end\n \n end\n end", "def initialize(atts)\n atts.each do |key, val|\n accessor = \"#{key}=\"\n\n if respond_to?(accessor)\n send(accessor, val)\n end\n end\n end", "def key_reader *keys\n keys.each do |method|\n key = method.to_s\n define_method method do\n self[key]\n end\n end\n end", "def define_reader_method(mod)\n reader_method_name = name\n attribute = self\n\n mod.send(:define_method, reader_method_name) { attribute.get(self) }\n mod.send(reader_visibility, reader_method_name)\n\n self\n end", "def items(params = {})\n if instance_variable_defined?(:@items)\n # TODO raise error if params are passed here, since they're meaningless\n @items\n else\n @items = load_page(params)\n end\n end", "def initialize()\n @items = nil\n end", "def get_name # AK as mentioned in `item.rb`, getters and setters are generated by `attr_accessor`. Kind of like in C# with properties.\r\n \"#{self.name}\"\r\n end", "def items\n if @items.nil?\n raise NoData.new(\"No data has been retrieved yet.\", self)\n else\n @items.collect do |hsh|\n item = self.class.item_class.new\n item.store_result(:attrs => hsh)\n item\n end\n end\n end", "def setup(items)\n\tend", "def initialize(items = {})\n # Get accessors out of hash\n @instance_klass = items[:klass]\n @instance_id = items[:id]\n @attacment_name = items[:name]\n end", "def reader\n @proxy ||= CollectionProxy.new(klass, self)\n end", "def define_readers(attr_names)\n attr_names.each do |attr_name|\n if respond_to?(attr_name)\n if self.class.is_an_association?(attr_name)\n # lazy instantiate associated records\n association_writer = method(\"#{attr_name}=\")\n association_reader = method(attr_name)\n define_singleton_method(attr_name) do\n association_writer.(attributes[attr_name])\n association_reader.()\n end\n else\n raise \"Cannot define accessor: #{attr_name}\"\n end\n else\n define_singleton_method(attr_name) do\n attributes[attr_name]\n end\n end\n end\n end", "def accessor\n @@accessor ||= nil\n @@accessor\n end" ]
[ "0.7242194", "0.6242292", "0.61954933", "0.61513776", "0.61238015", "0.61218935", "0.61102283", "0.610126", "0.6066452", "0.6066452", "0.5995553", "0.5991889", "0.5952791", "0.59464437", "0.59328246", "0.59289247", "0.5913085", "0.5913085", "0.5913085", "0.5913085", "0.5912199", "0.5912199", "0.59121495", "0.59121495", "0.59121495", "0.5865524", "0.58639127", "0.58528805", "0.58523357", "0.58518517", "0.58077997", "0.5805334", "0.5798943", "0.57765245", "0.5763395", "0.5757734", "0.57314545", "0.5709573", "0.56990135", "0.5695621", "0.56919104", "0.5684706", "0.56769085", "0.56759083", "0.56716144", "0.5660638", "0.56568277", "0.5653305", "0.56429446", "0.5640095", "0.5638772", "0.56327665", "0.5630591", "0.5618229", "0.5611385", "0.5606759", "0.5600726", "0.5600553", "0.55873936", "0.5564117", "0.556327", "0.55609655", "0.55463916", "0.5526398", "0.55210733", "0.5520753", "0.5520753", "0.5510935", "0.55042464", "0.5497147", "0.548889", "0.54830927", "0.5472062", "0.5467425", "0.5455037", "0.54476464", "0.54441583", "0.54377204", "0.54213476", "0.5419632", "0.5411966", "0.54105234", "0.5410443", "0.5405769", "0.5405769", "0.5405769", "0.5403817", "0.54023266", "0.5385959", "0.5384415", "0.53759456", "0.5371", "0.5365103", "0.5363565", "0.5362514", "0.5360154", "0.5355557", "0.5352012", "0.5350861", "0.5341617", "0.5326462" ]
0.0
-1
GET /users GET /users.json
def index @users = User.order(:name).page(params[:page]).per_page(20) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def users(args = {})\n get(\"/users.json\",args)\n end", "def show\n begin\n user = User.find(params[:user_id])\n render json: { users: user }, status: :ok\n rescue => e\n render json: { errors: e.message}, status: 404\n end\n end", "def GetUsers params = {}\n\n params = params.merge(path: 'users.json')\n APICall(params)\n\n end", "def index\n if params[:single]\n\t url = \"#{API_BASE_URL}/users/#{params[:id]}.json\"\n\t response = RestClient.get(url)\n\t @user = JSON.parse(response.body)\n\telse\n\t url = \"#{API_BASE_URL}/users.json\"\t \n response = RestClient.get(url)\n @users = JSON.parse(response.body)\t\t \n\tend\n end", "def list_users\n self.class.get('/users')\n end", "def users\n get('get_users')\n end", "def index\n users = User.all\n json_response(users)\n end", "def show\n @users = User.all\n json_response(@users)\n end", "def list\r\n users = User.all\r\n render json: users\r\n end", "def show\n @users = User.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @users }\n end\n end", "def get \n render :json => User.find(params[:id])\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n users = User.all\n render json: { users: users }, status: :ok\n end", "def index\r\n users = User.all\r\n render json: users\r\n end", "def users(params = {})\n params.merge!(key: 'users')\n objects_from_response(Code42::User, :get, 'user', params)\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def index\n users = User.all\n render json: users\n end", "def users(params = {})\n make_get_request('/account/users', params)\n end", "def index\n users = User.all\n render json: users \n end", "def index\n users = User.all\n\n render json: users, each_serializer: Api::V1::UsersSerializer\n end", "def index\n user= User.all\n render json: {users:user}\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n @users = User.all\n render json: @users\n end", "def index\n json_response(User.all) \n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def index\n @users = User.all\n\n render json: @users\n end", "def user_info\n @user = @github.users.get user: params[:username]\n render json: Hash[@user]\n end", "def index\n users = User.all \n render json: users \n end", "def index\n\t\t# specifying json format in the URl\n\t uri = \"#{API_BASE_URL}/users.json\"\n\t # It will create new rest-client resource so that we can call different methods of it\n\t rest_resource = RestClient::Resource.new(uri, USERNAME, PASSWORD)\n\n\t # this next line will give you back all the details in json format, \n\t #but it will be wrapped as a string, so we will parse it in the next step.\n\t users = rest_resource.get \n\n\t # we will convert the return data into an array of hash. see json data parsing here\n\t @users = JSON.parse(users, :symbolize_names => true)\n\tend", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t\tformat.html\n\t\t\tformat.json { render json: @users.map(&:as_json) }\n\t\tend\n\tend", "def list\n render json: User.all\n end", "def index\n @users = User.all\n render json: @users, status: :ok\n end", "def user\n render :json=> User.find(params[:id])\n end", "def index\n\n users = User.all \n render json: users\n\n end", "def show\n render json: Users.find(params[\"id\"])\n end", "def GetUser id\n\n APICall(path: \"users/#{id}.json\")\n\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html\n format.json { render json: @users }\n end\n end", "def show\n @users = User.find(params[:id])\n if @users\n respond_to do |format|\n format.json { render :json => @users }\n format.xml { render :xml => @users }\n end\n else\n head :not_found\n end\n end", "def index\n \t@users = User.all\n\n respond_to do |format| \n format.json { render json: @users }\n end\n end", "def list\n get('users')['users']\n end", "def index\n render ActiveModelSerializers::SerializableResource.new(@users,\n each_serializer: UserSerializer\n ).to_json, status: 200\n end", "def index\n @users = User.all \n render json: @users, status: :ok \n end", "def index\n @users = User.all\n logger.debug(\"user index\")\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n render json: User.all\n end", "def index\n @users = User.order_by(last_name: :desc)\n if @users\n render json: Oj.dump(json_for(@users, include: ['phones', 'cards'], meta: meta), mode: :compat)\n else\n return head :unauthorized\n end\n end", "def users(params = {})\n response = get('users/lookup.json', params)\n response.map {|user| Croudia::Object::User.new(user) }\n end", "def index\n render json: User.all\n end", "def index\n render json: User.all\n end", "def show\n user = User.find(params[:id])\n render json: @user\nend", "def list_users(user_id)\n self.class.get(\"/users/#{user_id}\")\n end", "def show\n user = User.find(params[:id])\n render json: user\n end", "def index\n\t\t@users = User.all\n\n\t\trespond_to do |format|\n\t\t format.html # index.html.erb\n\t\t format.json { render json: @users }\n\t\tend\n\tend", "def index\n @users = User.all(limit: 100)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users.as_json(user: current_user) }\n end\n end", "def get_users\r\n # Prepare query url.\r\n _path_url = '/users'\r\n _query_builder = Configuration.get_base_uri\r\n _query_builder << _path_url\r\n _query_url = APIHelper.clean_url _query_builder\r\n # Prepare headers.\r\n _headers = {\r\n 'accept' => 'application/json'\r\n }\r\n # Prepare and execute HttpRequest.\r\n _request = @http_client.get(\r\n _query_url,\r\n headers: _headers\r\n )\r\n CustomHeaderAuth.apply(_request)\r\n _context = execute_request(_request)\r\n validate_response(_context)\r\n # Return appropriate response type.\r\n decoded = APIHelper.json_deserialize(_context.response.raw_body)\r\n decoded.map { |element| User.from_hash(element) }\r\n end", "def show\n # When a http GET request to '/users/1' is received, have it show,\n # in json format, user 1's information.\n @id = params[:id]\n @user = User.find(@id)\n render json: @user\n end", "def show\n user = User.find(params[:id])\n\n render json: user\n end", "def index \n render json: User.all\n end", "def index\n @myusers = Myuser.all\n\n render json: @myusers\n end", "def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def query_users(options={}) path = \"/api/v2/users\"\n get(path, options, AvaTax::VERSION) end", "def list\n response = @client.get(\"/users\")\n response[\"users\"].map {|u| User.new(@client, u) }\n end", "def users\n\t\trespond_with User.all\n\tend", "def index\n @users = User.all\n\n respond_with do |format|\n format.json do\n render json: @users,\n each_serializer: Api::UserSerializer,\n root: 'users'\n end\n end\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def show\n @user = User.find(params[:id])\n render json: @user\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end", "def index\n @users = User.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @users }\n end\n end" ]
[ "0.82109934", "0.7873764", "0.7860689", "0.78108346", "0.78067017", "0.7678852", "0.76586664", "0.76318866", "0.7582366", "0.75291824", "0.7487637", "0.74485743", "0.7439024", "0.7437192", "0.7427442", "0.73978853", "0.73978853", "0.73978853", "0.73978853", "0.7377353", "0.7372414", "0.736885", "0.7368531", "0.7367068", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7358582", "0.7351495", "0.7350187", "0.7350187", "0.7350187", "0.7350187", "0.7350187", "0.7350187", "0.73463756", "0.73426867", "0.7331111", "0.73231107", "0.73227614", "0.73126787", "0.7295692", "0.7274169", "0.7265484", "0.72624177", "0.72607577", "0.722517", "0.72189873", "0.71941674", "0.71883225", "0.7187108", "0.71815044", "0.717089", "0.71695215", "0.7156781", "0.71546155", "0.71546155", "0.7140691", "0.7135879", "0.7134857", "0.71316093", "0.71315825", "0.712011", "0.7114429", "0.7112858", "0.7107888", "0.7098051", "0.70957917", "0.70957917", "0.7093039", "0.70904744", "0.70890427", "0.70889443", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7085115", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685", "0.7081685" ]
0.0
-1
POST /users POST /users.json
def create @user = User.new(user_params) if @user.application_admin? && !current_user.application_admin? flash[:error] = "Error: since you are not logged in as an application admin user, you can't create a new application admin user." render :edit else #set a random password, but don't tell the user. They'll need to use the token to reset the password. random_pw = SecureRandom.hex(8) @user.password = random_pw @user.password_confirmation = random_pw if @user.save @user.generate_password_token! NotificationMailer.new_user_email(@user,current_user).deliver up = UserPermission.new(rulemaking: current_rulemaking, user: @user) up.save flash[:notice] = "An account for #{@user.name} was successfully created. They have been given permissions to this rulemaking, and a link to log in and set up their password has been emailed to them." redirect_to users_path else render :edit end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def post_users(users)\n self.class.post('https://api.yesgraph.com/v0/users', {\n :body => users.to_json,\n :headers => @options,\n })\n end", "def CreateUser params = {}\n \n APICall(path: 'users.json',method: 'POST',payload: params.to_json)\n \n end", "def post body=nil, headers={}\n @connection.post \"users.json\", body, headers\n end", "def create\n # render json: params\n render json: Users.create(params[\"user\"])\n end", "def create_user(params:)\n parse(JSON.parse(connection.post(\"users\", params.to_json).body))\n end", "def create\n user = User.create(user_params) \n render json: user, status: :created\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(form_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: { users: @user }, status: :created }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(\n username: user_params[:username],\n password: user_params[:password])\n if user.save\n create_example_collection(user)\n render json: user, except: [:password_digest, :created_at, :updated_at]\n else\n render json: {errors: user.errors.full_messages}\n end\n end", "def create\n user= User.create(user_params)\n render json: user\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n\t\t@user = User.new(users_params)\n\t\tif @user.save\n\t\t\tjson_response(@user, \"User is created Successfully.\")\n\t\telse\n\t\t\trender json: {message: @user.errors.full_messages.join(\" \")}, status: 400\n\t\tend\t\t\n\tend", "def create\n user = User.new(@user_info)\n if user.save && user.errors.empty?\n render json: { status: 200, data: UserSerializer.new(user).as_json }\n else\n render json: { status: 400, error: user.errors.full_messages }\n end\n end", "def create\n user = User.create(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end", "def create(options = {})\n request(:post, '/users.json', default_params(options))\n end", "def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new user_params(params[:user])\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.create user_params\n \n if @user.save\n respond_with(@user) do |format|\n format.json {render}\n end\n end\n end", "def create\n @user = User.new(user_params(params))\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params(params))\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create_user\n @user = User.new(user_params)\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = @application.users.create(user_params)\n\n if @user.valid?\n render json: @user, status: :created, location: api_application_user_path(@application,@user)\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = User.create(user_params)\n if user.save\n render json: user\n else\n render json: user.errors, status: :bad\n end\n end", "def create\n r = @api.create_user(user_params)\n respond_to do |format|\n if r.code == 201\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n else\n response = JSON.parse(r.body)\n format.html { redirect_to users_url, alert: response['message']}\n end\n end\n end", "def create\n\n puts '-----------------------create in user controller'\n\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: UserSerializer.new(@user).serialized_json\n else\n render json: { error: I18n.t('user_create_error') }, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n render json: { user: @user, success: 'User registration successful' }\n else\n render json: { error: 'User registration unsuccessful' }\n end\n end", "def create\n @user = User.new(user_params)\n \n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n\t\tputs user_params\n\t\tuser = User.new(user_params)\n\t\tif user.save\n\t\t\trender json: { user: user, status: :success }\n\t\telse\n\t\t\trender json: { status: :failure, errors: user.errors.full_messages.join('') }\n\t\tend\n\tend", "def create\n\t\t@user = User.new(user_params)\n\t\tif @user.save\n\t\t\trender json: @user, status: :created, location: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def add_user(name, value)\n self.class.post(\"/users/#{name}\",\n body: value,\n headers: {\n 'Content-Type' => 'application/json; charset=UTF-8',\n Connection: 'keep-alive',\n Accept: 'application/json, text/plain, */*'\n })\n end", "def create\n user = User.new(user_params)\n\n respond_to do |format|\n if user.save\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = current_user.users.build(user_params)\n\n if @user.save\n render json: @user\n else\n @user_items = []\n end\n end", "def create\n user = User.new(user_params)\n render json: { status: 200, msg: 'User was created.', data: \"User Id #{user.id}\" } if user.save\n end", "def create\n @users = User.new(params[:user])\n\n respond_to do |format|\n if @users.save\n format.html { redirect_to @users, notice: 'Regist was successfully created.' }\n format.json { render json: @users, status: :created, location: @users }\n else\n format.html { render action: \"new\" }\n format.json { render json: @users.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render :json => user, :status => :created\n else\n render :json => {:ok => false, :message => user.errors}, :status => :unprocessable_entity\n end\n end", "def create\n logger.debug user_params\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :not_acceptable\n end\n end", "def create\n user = User.create(user_params)\n render json: user, message: 'user succefully create', status: 200\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n\n up = user_params\n\n if up[:name].present?\n up[:first_name] = up[:name].split(' ')[0]\n up[:last_name] = up[:name].split(' ')[1]\n up.delete :name\n end\n @user = User.new(up)\n\n respond_to do |format|\n if @user.save\n # render json: {user: user, token: token}\n\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: api_user_url(@user)}\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: {status: \"Se creo el usuario\"}, status: :ok\n else\n render json: {status: \"Error al crear el usuario\", errors: user.errors }, status: :unprocessable_entity\n end\n end", "def create\n user = User.new(params[:user].permit(:username))\n if user.save\n render json: user\n else\n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end", "def create\n puts '>>> params:'\n puts params.inspect\n @user = User.new(params[:user])\n puts '>>> User:'\n puts @user.inspect\n\n if @user.save\n render json: @user, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n \tdata = { data: @user, status: :created, message: \"User was successfully created.\" }\n render :json => data\n else\n \tdata = { data: @user.errors, status: :unprocessable_entity }\n render :json => data\n end\n end", "def create\n user_details = params.permit(:first_name, :last_name, :email)\n success = User.create(user_details)\n\n render json: { success: success }\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: @user.as_json(only: [:email, :authentication_token]), status: :created\n else\n head(:unprocessable_entity)\n end\n end", "def create_user\n params = {\n :client_id => Swiftype.platform_client_id,\n :client_secret => Swiftype.platform_client_secret\n }\n post(\"users.json\", params)\n end", "def create\n @user = User.new(params[:user])\n\n if @user.save\n respond_to do |format|\n format.json { render :json => @user.to_json, :status => 200 }\n format.xml { head :ok }\n format.html { redirect_to :action => :index }\n end\n else\n respond_to do |format|\n format.json { render :text => \"Could not create user\", :status => :unprocessable_entity } # placeholder\n format.xml { head :ok }\n format.html { render :action => :new, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n render :ok, json: @user.to_json\n else\n @errors = @user.errors.full_messages\n render json: { message: @errors }, status: :unauthorized\n end\n end", "def create\n puts params\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user.as_json(user: current_user), status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: {status: 200, msg: 'User was created.'}\n else\n render json: {errors: user.errors.messages}\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, :notice => 'User was successfully created.' }\n format.json { render :json => @user, :status => :created, :location => @user }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new({name: params[:name], email: params[:email], password: params[:password], photo: params[:photo]})\n @user.save\n render json:@user\n end", "def create\n user = User.create(user_params)\n\n if user.valid?\n render json: {user: UserSerializer.new(user), token: encode_token(user.id)}\n else\n render json: user.errors.full_messages\n end\n end", "def create\n\t\tnew_user = User.new(user_params)\n\t\tif new_user.save\n\t\t render status: 200, json: {\n\t\t \tstatus: 200,\n\t\t message:\"New User Created\",\n\t\t response: {\n\t\t name: new_user.name,\n\t\t email: new_user.email,\n\t\t id: new_user.id,\n\t\t facebook_id: new_user.facebook_id,\n\t\t device_id: new_user.device_id,\n\t\t authentication_token: new_user.authentication_token\n\t\t }\n\t\t \n\t\t }.to_json\n\t\telse\n\t\t render status: 404, json: {\n\t\t \tstatus: 404,\n\t\t errors: new_user.errors\n\t\t }.to_json\n\t\tend\n\tend", "def create\n\t\tresp = {} \n user = User.create(user_params)\n \tif user.valid?\n if user.save\n return render :json => user.as_json\n end\n end\n render json: user.errors.full_messages \n\tend", "def post_users_with_http_info(users, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: UsersApi.post_users ...'\n end\n # verify the required parameter 'users' is set\n if @api_client.config.client_side_validation && users.nil?\n fail ArgumentError, \"Missing the required parameter 'users' when calling UsersApi.post_users\"\n end\n # resource path\n local_var_path = '/users'\n\n # query parameters\n query_params = opts[:query_params] || {}\n\n # header parameters\n header_params = opts[:header_params] || {}\n # HTTP header 'Accept' (if needed)\n header_params['Accept'] = @api_client.select_header_accept(['application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json'])\n\n # form parameters\n form_params = opts[:form_params] || {}\n\n # http body (model)\n post_body = opts[:body] || @api_client.object_to_http_body(users) \n\n # return_type\n return_type = opts[:return_type] || 'User' \n\n # auth_names\n auth_names = opts[:auth_names] || ['Bearer']\n\n new_options = opts.merge(\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names,\n :return_type => return_type\n )\n\n data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: UsersApi#post_users\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def create_user(options = {})\n post \"/users\", options\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_url, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n \n user = User.new(user_params)\n\n if user.save\n\n render json: {status: 200, msg: 'User was created.'}\n\n else \n render json: {\n errors: user.errors.full_messages\n }, status: :unprocessable_entity\n\n end\n\n end", "def create\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save \n format.html { redirect_to users_url, notice: \"User #{@user.name} was successfully created.\" }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user(body)\n post 'create_user', body\n end", "def create\n @user = User.new(user_params)\n @user.email = params[:email].downcase\n if @user.save\n render json: @user, status: 200\n else\n render json: { errors: @user.errors.full_messages }, status: 400\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json:@user\n elsif @user.errors\n render json: {error: {code: 400, server_message: @user.errors}}, status: :bad_request\n else\n render json: {error: {code: 500, message: \"Could not save user\", server_message: @user.errors}}, status: :internal_server_error\n end\n\n end", "def create\n user = User.new(user_params)\n\n if user.valid?\n user.save\n render json: {user: user, token: encode_token({user_id: user.id})}\n else\n render json: {error: \"Failed to create the user\"}\n end\n end", "def create\n @user = User.new(user_params)\n @user.save\n respond_with @user\n end", "def create\n @user = User.new(user_params)\n render json: @user && return if @user.save\n\n render json: { error: \"Unable to save user: #{@user.errors.messages}\" }, status: 400\n end", "def create\n params[:user][\"_id\"] = params[:user][:name]\n @user = User.new(params[:user])\n\n respond_to do |format|\n if @user.save()\n format.html { redirect_to @user, notice: 'User was successfully created.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_user(attributes)\n post(\"/v1/users\", attributes)\n end", "def create\n user = User.new(user_params)\n\n # if user is saved sucessfully it will return user and ith status 201 for created\n if user.save\n render json:user,status: :created\n #if request is properly served but data is wrong it ll give ubprocessable_entity with code 422\n else\n render json: user.errors, status: :unprocessable_entity\n end \n end", "def create\r\n @user = User.new(params[:user])\r\n\r\n respond_to do |format|\r\n if @user.save\r\n format.html { redirect_to users_path, notice: 'Os dados do usuário foram salvos com sucesso!' }\r\n format.json { render json: @user, status: :created, location: @user }\r\n else\r\n format.html { render action: \"new\" }\r\n format.json { render json: @user.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def create\n @user = User.new(\n first_name: params[:first_name],\n last_name: params[:last_name],\n birth_date: params[:birth_date],\n height: params[:height],\n weight: params[:weight],\n user_name: params[:user_name],\n password: params[:password],\n password_confirmation: params[:password_confirmation],\n facebook_url: params[:facebook_url],\n twitter_url: params[:twitter_url],\n instagram_url: params[:instagram_url],\n address: params[:address],\n email: params[:email]\n ) \n if @user.save!\n render 'successful.json.jb', status: :created\n else\n render 'unsuccessful.json.jb', status: :bad_request\n end\n end", "def post(hash)\n HttpClient::Preconditions.assert_class('hash', hash, Hash)\n @client.request(\"/users\").with_json(hash.to_json).post { |hash| Apidoc::Models::User.new(hash) }\n end", "def create\n user = User.create!(user_params)\n session[:user_id] = user.id\n render json: user, status: :created\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render json: {message: \"user create successfuly\"}\n else\n render json: {message: \"Error\"}\n end \n end", "def create\n # Insert new user in database\n user = User.new(user_params)\n\n if user.save\n # On success, send token information to authenticate user\n token = create_token(user.id, user.username)\n render json: {status: 200, token: token, user: user}\n # render json: @user, status: :created, location: @user\n else\n render json: user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(params[:user])\n @user.status = 'active'\n\n respond_to do |format|\n if @user.save\n format.json { render :json => @user, :status => :created }\n format.html { redirect_to(users_path) }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n respond_with(@user, location: users_url, notice: 'User was successfully created.')\n else\n respond_with(@user)\n end\n end", "def create\n user = User.new(user_params)\n \n if user.save\n token = JsonWebToken.encode(user_id: user.id)\n render json: { auth_token: token, user: AuthUserSerializer.new(user).serializable_hash }, status: 201\n else \n render json: { errors: user.errors.full_messages }, status: 400\n end\n end", "def create\n @user = User.new(params[:user])\n puts params[:user]\n respond_to do |format|\n if @user.save\n format.html { redirect_to :users, notice: 'Registration successful.' }\n format.json { render json: @user, status: :created, location: @user }\n else\n format.html { render action: \"new\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render :show, status: :created, location: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n user = User.create(user_params)\n if user.valid?\n user.username.downcase\n @token = issue_token(user)\n list = List.create(name: user.username)\n list.user_id = user.id\n user.save\n list.save\n render json: { user: UserSerializer.new(user), jwt: @token }, status: :created \n else \n render json: { error: user.errors.full_messages }, status: :not_acceptable\n end \n end", "def create\n @user = User.new(user_params)\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @user = User.new(user_params)\n\n respond_to do |format|\n if @user.save\n format.html { redirect_to users_path, notice: 'User was successfully created.' }\n format.json { render :show, status: :created, location: @user }\n else\n format.html { render :new }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n user_response = API::V1::Users.authenticate params.as_json\n if user_response.success?\n json = HashWithIndifferentAccess.new(user_response.parsed_response)\n auth_response = API::V1::Auth.issue json[:data]\n respond_with auth_response.body, auth_response.code\n else\n respond_with nil, :unauthorized\n end\n end", "def create\n @user = User.new(user_params)\n\n if @user.save\n render :json => { :status => 0 }\n else\n render :json => { :status => 1, :msg => @user.errors}\n end\n end", "def create\n @user = User.new(user_params)\n if @user.save\n auth_token = Knock::AuthToken.new payload: { sub: @user.id }\n render json: { username: @user.username, jwt: auth_token.token }, status: :created\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def create\n authorize :user, :create?\n @user = User.new(user_params)\n @user.save\n\n respond_to do |format|\n format.html\n format.json { render :json => @user, status: 200 }\n end\n end", "def post_accounts(json_hash)\n @options = {:path => '/users.json',\n :body => json_hash[:json]}.merge(@options)\n\n request(\n :expects => 201,\n :method => :post,\n :body => @options[:body]\n )\n end", "def create\n user = User.new(username: params[:username])\n if user.save\n payload = {'user_id': user.id}\n token = JWT.encode(payload, 'chatapp')\n render json: {\n user: user,\n token: token\n }\n else \n render json: { message: 'There was an error creating your account' }\n end\n end", "def create\n user = User.create!(user_params)\n if user\n session[:user_id] = user.id\n render json: user, status: :created\n else\n render json: { errors: user.errors.full_messages }, status: :unprocessable_entity\n end\n end", "def create\r\n @user = User.new user_params\r\n\r\n if @user.save\r\n render json: @user, serializer: SessionSerializer, root: nil\r\n else\r\n render json: { errors: @user.errors }, status: :unprocessable_entity\r\n end\r\n end", "def create\n user = User.new(user_params)\n if user.save\n render json: { status: 'OK', msg: 'User was created.', error: 'nil' },\n status: :created\n else\n not_good(422)\n end\n end" ]
[ "0.77179813", "0.75206673", "0.73831296", "0.72405374", "0.719841", "0.7140812", "0.71038526", "0.7058827", "0.7041636", "0.70236504", "0.7003128", "0.70021695", "0.70021695", "0.70021695", "0.69936967", "0.6990463", "0.6980393", "0.6979075", "0.69788617", "0.69788617", "0.69762856", "0.6962628", "0.6952247", "0.69454783", "0.69454783", "0.6920555", "0.69181055", "0.691467", "0.6901315", "0.6898759", "0.689459", "0.6889815", "0.6880676", "0.6880467", "0.6880196", "0.68797004", "0.6877297", "0.686924", "0.6855058", "0.6851115", "0.6844058", "0.6814104", "0.6803589", "0.6777842", "0.6776859", "0.67678535", "0.6757897", "0.67471397", "0.6738628", "0.6734963", "0.6733872", "0.6720612", "0.6711659", "0.6670256", "0.66581875", "0.66573423", "0.6654514", "0.6638977", "0.66325235", "0.66199607", "0.6615226", "0.66148156", "0.65989614", "0.65910506", "0.65792614", "0.6578957", "0.6573529", "0.6573351", "0.6557221", "0.6553408", "0.6551572", "0.65466446", "0.6540912", "0.65399504", "0.6538697", "0.6535891", "0.6533581", "0.6526114", "0.65116656", "0.65072525", "0.6507116", "0.6503024", "0.6490388", "0.6488653", "0.64881754", "0.6473845", "0.64722794", "0.64702916", "0.64702916", "0.6469406", "0.64682525", "0.6462379", "0.64619774", "0.646129", "0.6455196", "0.645272", "0.6448271", "0.6447503", "0.64468706", "0.64460355", "0.6441883" ]
0.0
-1
PATCH/PUT /users/1 PATCH/PUT /users/1.json
def update respond_to do |format| if @user.application_admin? && user_params[:application_admin] != '1' && User.where(application_admin: true).count == 1 flash[:error] = "There must be at least one application admin user." format.html { redirect_to users_path } format.json { render json: @user.errors, status: "Error: there must be at least one application admin user." } elsif !@user.application_admin? && user_params[:application_admin] == '1' && !current_user.application_admin? flash[:error] = "Error: since you are not logged in as an application admin user, you can't edit a user to make them an application admin." format.html { render :edit } format.json { render json: @user.errors, status: :unprocessable_entity } elsif @user.update(user_params) if @user == current_user format.html { redirect_to profile_edit_path, notice: 'Your profile was successfully updated.' } format.json { render :show, status: :ok, location: @user } else format.html { redirect_to users_path, notice: 'User successfully updated.' } format.json { render :show, status: :ok, location: @user } end else format.html { render :edit } format.json { render json: @user.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n render json: User.update(params[\"id\"], params[\"user\"])\n end", "def update\n render json: Users.update(params[\"id\"], params[\"user\"])\n end", "def UpdateUser params = {}\n \n APICall(path: 'users.json',method: 'PUT',payload: params.to_json)\n \n end", "def update \n user = User.find(params[:id])\n # byebug\n user.update(user_params)\n\n render json: user\n end", "def update\n user = User.find(params[:id])\n\n # Use update with user_params to do a mass-assignment update and save. \n if user.update_attributes(user_params)\n render json: user\n else \n render json: user.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n user = User.find_by(id: params[:id])\n user.update(user_params)\n render json: user\n end", "def update\n \trespond_to do |format|\n if @user.update(user_params)\n format.json { render json: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n\t \t\n end", "def update\n user = find_user\n user.update!(user_params)\n render json: user\n end", "def update\n if user.update(user_params)\n render json: user\n else\n render json: {errors: \"Cannot create user\"}, :status => 420\n end\n end", "def update\n if @api_v1_user.update(api_v1_user_params)\n head :no_content\n else\n render json: @api_v1_user.errors, status: :unprocessable_entity\n end\n end", "def update_current_logged_in_user(args = {}) \n put(\"/users.json/current\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update_users_password(args = {}) \n put(\"/users.json/backoffice/#{args[:userId]}/password/#{args[:password]}\", args)\nend", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update_attributes(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update_user(options)\n patch(\"/user\", options, 3)\n end", "def modify_user(user)\n query_api_object Model::User, '/rest/user', user.to_hash, 'PUT'\n end", "def update\n user = User.find(params[:id])\n user.update(user_params)\n if user.valid?\n render json: user\n else\n render json: user.errors\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { render action: \"edit\"}\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n \n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.role = params[:type]\n @user.save\n render json:@user\n end", "def update\n if @user.id == current_api_user.id\n if @user.update(user_params)\n render json: @user.as_json(except: [:updated_at]), status: :ok\n else\n render json: @user.errors, status: :bad_request\n end\n else\n render json: '', status: :forbidden\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: {error: \"Could not update user\"}\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n render json:@user\n else\n render json: { error: {code: 404, message: 'Invalid user' }}, status: :not_found\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(params_user)\n render json: user, status: 200\n else\n render json: user.errors, status: 422\n end\n\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update user_params(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n @user.name = params[:name]\n @user.email = params[:email]\n @user.password = params[:password]\n @user.photo = params[:photo]\n @user.save\n render json:@user\n end", "def updateUser\n options = {\n :body => params.to_json,\n :headers => {\n 'Content-Type' => 'application/json',\n 'Authorization' => request.headers['Authorization']\n }\n }\n results = HTTParty.put(\"http://192.168.99.101:4051/users/\"+@current_user[\"id\"].to_s, options)\n render json: results.parsed_response, status: results.code\n end", "def update\n user = @user_service.update_user(params[:id])\n render json: user, status: :ok\n end", "def update\n @user = User.find(params[:id]) \n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User #{@user.name} was successfully created.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: 200\n else\n render json: @user.errors, status: 422\n end\n end", "def update\n begin\n user = User.find(params[:user_id])\n if user.update(user_params)\n render json: { users: user }, status: :ok\n else\n render json: { errors: user.errors.messages }, status: 422\n end\n rescue => e\n render json: { errors: e.message }, status: 404\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(params[:user])\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if user.update(user_params)\n render json: user, status: :ok\n else\n format.json { render json: user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params[:user]))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def update\n @user = User.find(params[:id])\n @user.update_attributes(params[:user])\n respond_with @user\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes_from_api(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { render_for_api :user, :json => @user }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = current_org.users.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_url, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def patch_user(user_id, body)\n raise Auth0::MissingUserId, 'Must supply a valid user_id' if user_id.to_s.empty?\n raise Auth0::InvalidParameter, 'Must supply a valid body' if body.to_s.empty? || body.empty?\n path = \"#{users_path}/#{user_id}\"\n patch(path, body)\n end", "def update\n @user = User.find(params[:id])\n @user.update(user_params)\n render json: @current_user\n end", "def update_current_logged_in_users_password(args = {}) \n put(\"/users.json/current/password\", args)\nend", "def update\n user = User.find(params[:id])\n render json: { status: 200, msg: 'User details have been updated.' } if user.update(user_params)\n end", "def modify_user(user)\n query_api_object User, \"/rest/user\", user.dump(), \"PUT\"\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to users_path, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: user\n else\n render json: user.errors.full_messages\n end\n end", "def update\n respond_to do |format|\n if @user.update(form_params)\n format.json { render json: { users: @user }, status: :ok, location: @user }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user.update(user_params)\n respond_with @user\n end", "def update\n @user = user.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'user was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_user\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update(user_params(params))\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = get_user(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to root_url, notice: \"User #{@user.login_name} was successfully updated.\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n if @user.update(user_params)\n head :no_content\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @v1_user.update(v1_user_params)\n format.html { redirect_to @v1_user, notice: 'User was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_user }\n else\n format.html { render :edit }\n format.json { render json: @v1_user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @user.update(user_params)\n render json: @user, status: :ok\n else\n render json: @user.errors, status: :unprocessable_entity\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => t('user.update_success') }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status=> :unprocessable_entity }\n end\n end\n end", "def update\n @user.update(user_params_update)\n json_response(@user)\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to users_path }\n format.json { render :json => @user }\n else\n format.html { render :edit }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user.as_json(user: current_user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = selected_user\n if @user.update(users_params)\n render 'api/users/show'\n else\n render json: @user.errors.full_messages, status: 422\n end\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.json { head :ok }\n else\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update(user_params)\n format.html { redirect_to root_path}\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = V1::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n flash[:notice] = 'V1::User was successfully updated.'\n format.html { redirect_to(@user) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update \n user = User.where(:id => current_user.user)\n if user.update(user_params)\n render :json => {:user => user }\n else\n render :json => {:error => user.errors.full_messages.first}\n end\nend", "def update\n @user = User.find(params[:id])\n \n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n\t\tif @user.update(user_params)\n\t\t\trender json: @user\n\t\telse\n\t\t\trender json: @user.errors, status: :unprocessable_entity\n\t\tend\n\tend", "def update(id, params = {})\n request(:put, \"/users/#{id}\", body: params)\n end", "def update\n @user = current_api_user\n unless @user.update(user_params)\n render json: { error: @user.errors.full_messages.to_sentence }, status: :not_found\n end\n end", "def update\n # not_found unless @user\n # @user = User.get(params[:id]) || not_found\n\n respond_to do |format|\n if @user.update(params[:user])\n format.html { redirect_to @user, :notice => 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @user.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, :notice => \"This user was successfully updated!\" }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: I18n.t(:users_update) }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n user = User.find(params[:id])\n if user.update(user_params)\n render json: {\n status: 'OK',\n msg: 'User details have been updated.',\n error: 'nil'\n }, status: :accepted\n else\n not_good(406)\n end\n end", "def update\n @user = ::User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @todo = Todo.find(params[:todo][:id])\n if @todo.update_attributes(user_params)\n render json: @todo\n else\n render nothing: true, status: :bad_request\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to user_path(@user), notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n @current_user.update(user_params)\n render json: @current_user\n end", "def update\n @user = User.find(params[:id])\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @user = User.find(params[:id])\n\n respond_to do |format|\n if @user.update_attributes(params[:user])\n format.html { redirect_to @user, notice: 'User was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @user.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7224859", "0.7128554", "0.7003616", "0.690352", "0.6821481", "0.68151546", "0.6708411", "0.6692893", "0.6680146", "0.66730475", "0.66725844", "0.66651213", "0.66651213", "0.66596603", "0.66596603", "0.6655346", "0.6648638", "0.66431737", "0.66419953", "0.6634677", "0.66177285", "0.6614973", "0.66095996", "0.66069126", "0.65836185", "0.65822726", "0.65817076", "0.65790063", "0.6561894", "0.65584266", "0.65584266", "0.6543112", "0.6536016", "0.65159816", "0.6514337", "0.65063924", "0.6505753", "0.6505753", "0.65021855", "0.64682513", "0.6466914", "0.64648896", "0.6453747", "0.64493877", "0.6444422", "0.6441551", "0.64377135", "0.6428541", "0.64284664", "0.64284664", "0.6426769", "0.6426579", "0.642457", "0.642457", "0.6424321", "0.6419177", "0.64153576", "0.64113843", "0.6405941", "0.64049417", "0.6398396", "0.63941747", "0.6391455", "0.63903034", "0.638802", "0.63839704", "0.63837045", "0.63833344", "0.6382557", "0.63781774", "0.6375734", "0.6373974", "0.6373901", "0.63729876", "0.6370544", "0.6362869", "0.6361579", "0.63613963", "0.6356976", "0.6356609", "0.6351076", "0.634276", "0.6335019", "0.6333511", "0.632938", "0.63279295", "0.63279295", "0.63279295", "0.63279295", "0.63279295", "0.63279295", "0.63279295", "0.63279295", "0.63279295", "0.63279295", "0.63279295", "0.63279295", "0.63279295", "0.63279295", "0.63279295", "0.63279295" ]
0.0
-1
DELETE /users/1 DELETE /users/1.json
def destroy #any suggested changes assigned to this user will be set to assigned_to_id = null automatically by the foreign key constraint. respond_to do |format| if @user.application_admin? && User.where(application_admin?: true).count == 1 flash[:error] = "The last application admin user cannot be deleted." format.html { redirect_to users_path } format.json { render json: @user.errors, status: :unprocessable_entity } elsif ChangeLogEntry.where(user: @user).count > 0 flash[:error] = "This user can't be deleted, because there are one or more change log entries for actions they took. If this user no longer uses the application, try setting them to inactive instead." format.html { redirect_to users_path } format.json { render json: @user.errors, status: :unprocessable_entity } else @user.destroy format.html { redirect_to users_url, notice: 'User was successfully deleted. Any suggested changes assigned to this user are now assigned to no one.' } format.json { head :no_content } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def DeleteUser id\n \n APICall(path: \"users/#{id}.json\",method: 'DELETE')\n \n end", "def delete\n render json: User.delete(params[\"id\"])\n end", "def delete(id)\n request(:delete, \"/users/#{id}.json\")\n end", "def delete\n render json: Users.delete(params[\"id\"])\n end", "def delete\n @user.destroy\n respond_to do |format|\n format.html { redirect_to v1_resources_users_all_path, notice: 'User was deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n render json:@user\n end", "def destroy\n @user = V1::User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to(v1_users_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n \"\"\"\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n \"\"\"\n end", "def destroy\n debugger\n @user.destroy\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user.destroy\n format.json { head :no_content }\n end", "def destroy\n user = User.find(params[:id]) # from url, nothing to do with table\n user.destroy\n render json: user\n end", "def destroy\n @user.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find_by_id_or_username params[:id]\n @user.destroy\n render api_delete @user\n end", "def destroy\n @user = user.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def delete_user\n @user = User.find(params[:id])\n if @user.destroy\n render :json => @user\n else\n render :json => @user.errors.full_messages\n end\n end", "def destroy\n @v1_user.destroy\n respond_to do |format|\n format.html { redirect_to v1_users_url, notice: 'User was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n \n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :ok }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @user = User.find(params[:id])\n @user.destroy\n\n respond_to do |format|\n format.html { redirect_to users_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.78750724", "0.77518034", "0.7713981", "0.7610077", "0.747295", "0.74073994", "0.74073994", "0.7369968", "0.7346072", "0.7340465", "0.7328618", "0.7309635", "0.73095363", "0.7306841", "0.7297868", "0.72917855", "0.7291585", "0.7289111", "0.7284347", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7250935", "0.7245172", "0.7242216", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177", "0.7232177" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_self_as_user @user = self.current_user 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 user_params params.require(:user).permit(:name, :email, :application_admin, :active) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
Use callbacks to share common setup or constraints between actions.
def set_house_purchase @house_purchase = HousePurchase.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_handler\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 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 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 action; end", "def action; end", "def action; end", "def action; end", "def action; end", "def workflow\n end", "def setup\n @action = SampleActionAndroid.new(os_name: 'android',\n app_name: APP_PATH)\n end", "def before(action)\n invoke_callbacks *self.class.send(action).before\n end", "def before_dispatch(env); end", "def process_action(...)\n send_action(...)\n end", "def setup\n # override and do something appropriate\n end", "def after_actions(*logic)\n self.after_actions = logic\n end", "def setup(client)\n return unless @setup\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n actions.each do |action|\n action.execute(client)\n end\n self\n end", "def setup(_context)\n end", "def setup(resources) ; end", "def validate_actions\n errors.add(:base, :should_give_at_least_one_action) if !manage? && !forecasting? && !read? && !api?\n end", "def setup\n @resource_config = {\n :callbacks => {\n :before_create => nil,\n :after_create => nil,\n :before_update => nil,\n :after_update => nil,\n :before_destroy => nil,\n :after_destroy => nil,\n },\n :child_assoc => nil,\n :model => nil,\n :parent => nil,\n :path => nil,\n :permission => {},\n :properties => {},\n :relation => {\n :create => nil,\n :delete => nil,\n },\n :roles => nil,\n }\n end", "def determine_valid_action\n\n end", "def 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 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 action\n end", "def setup\n @setup_proc.call(self) if @setup_proc\n end", "def config(action, *args); end", "def setup_callbacks\n defined_callbacks.each do |meth|\n unless respond_to?(\"call_#{meth}_callbacks\".to_sym)\n self.class.module_eval <<-EOE\n def call_#{meth}_callbacks(*args)\n plugin_store.each {|a| a.call_#{meth}_callbacks(*args) } if respond_to?(:plugin_store) && plugin_store\n self.send :#{meth}, *args if respond_to?(:#{meth})\n end\n EOE\n end\n end\n end", "def before_action \n end", "def action\n end", "def setup\n # override this if needed\n end", "def matt_custom_action_begin(label); 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 setup_signals; 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 after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def after_created\r\n return unless compile_time\r\n Array(action).each do |action|\r\n run_action(action)\r\n end\r\nend", "def set_target_and_action target, action\n self.target = target\n self.action = 'sugarcube_handle_action:'\n @sugarcube_action = action.respond_to?('weak!') ? action.weak! : action\n end", "def after_set_callback; end", "def setup\n #implement in subclass;\n end", "def initialize(*args)\n super\n @action = :set\nend", "def setup &block\n if block_given?\n @setup = block\n else\n @setup.call\n end\n end", "def lookup_action; end", "def around_hooks; 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 setup(easy)\n super\n easy.customrequest = @verb\n end", "def save_action; end", "def setup\n callback(:setup) do\n notify(:setup)\n migration_check.last_deployed_commit\n end\n end", "def action_target()\n \n end", "def setup\n return unless @setup\n\n actions = @setup['setup'].select { |action| action['do'] }.map { |action| Action.new(action['do']) }\n run_actions_and_retry(actions)\n self\n end", "def before_setup\n # do nothing by default\n end", "def setup(&blk)\n @setup_block = blk\n end", "def my_actions(options)\n @setup = false\n get_template_part(\"custom_used\",\"action_users\",true)\n end", "def default_action; end", "def callback_phase\n super\n end", "def advice\n end", "def call\n setup_context\n super\n end", "def _handle_action_missing(*args); end", "def shared_action(name, &block)\n @controller.shared_actions[name] = 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", "def duas1(action)\n action.call\n action.call\nend" ]
[ "0.6162554", "0.60452986", "0.5945278", "0.59169763", "0.58877826", "0.5834763", "0.5775349", "0.5704972", "0.5704972", "0.56543803", "0.5621491", "0.5427202", "0.54093206", "0.54093206", "0.54093206", "0.53975695", "0.53776276", "0.53562194", "0.5340594", "0.5337824", "0.5328757", "0.5310255", "0.5300339", "0.5298796", "0.5295774", "0.5256034", "0.5243039", "0.5236007", "0.5235239", "0.5235239", "0.5235239", "0.5235239", "0.5235239", "0.52321917", "0.5227032", "0.52216744", "0.5216349", "0.52161187", "0.5210265", "0.5207244", "0.5177388", "0.5177142", "0.51747334", "0.516293", "0.51629275", "0.5155534", "0.51540613", "0.515197", "0.5151636", "0.5145279", "0.51380795", "0.5135777", "0.5117378", "0.5115066", "0.5115066", "0.5110235", "0.5106418", "0.50917816", "0.50909185", "0.50855017", "0.5082105", "0.506359", "0.5055345", "0.50546116", "0.50523037", "0.50523037", "0.50327307", "0.5024364", "0.5021113", "0.50174654", "0.50163317", "0.5000553", "0.50002855", "0.49991882", "0.49905527", "0.49905527", "0.49849054", "0.4982546", "0.4980941", "0.4979153", "0.49693102", "0.4967172", "0.49594432", "0.49564302", "0.49552485", "0.49533385", "0.49506924", "0.49452737", "0.49442786", "0.49347955", "0.49341312", "0.49295264", "0.49261844", "0.4925649", "0.49251428", "0.4920729", "0.49177617", "0.4916373", "0.49158472", "0.4915794", "0.49156648" ]
0.0
-1
Only allow a trusted parameter "white list" through.
def house_purchase_params params.require(:house_purchase).permit(:trade_day, :trade_type, :house_type, :house_address, :house_amount) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def allowed_params\n ALLOWED_PARAMS\n end", "def expected_permitted_parameter_names; end", "def param_whitelist\n [:role, :title]\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def permitted_params\n []\n end", "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def filtered_parameters; end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def parameters_list_params\n params.require(:parameters_list).permit(:name, :description, :is_user_specific)\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n [:rating, :review]\n end", "def valid_params?; end", "def permitted_params\n declared(params, include_missing: false)\n end", "def permitted_params\n declared(params, include_missing: false)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def filter_parameters; end", "def filter_parameters; end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def check_params; true; end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def list_params\n params.permit(:name)\n end", "def check_params\n true\n end", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def additional_permitted_params\n []\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def resource_params\n params[resource_singular_name].try(:permit, self.class.param_whitelist)\n end", "def allow_params_authentication!; end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def param_params\n params.require(:param).permit(:param_category_id, :param_table_id, :name, :english_name, :weighting, :description)\n end", "def quote_params\n params.permit!\n end", "def list_params\n params.permit(:list_name)\n end", "def allowed_params(parameters)\n parameters.select do |name, values|\n values.location != \"path\"\n end\n end", "def all_params; end", "def permitted_resource_params\n params[resource.object_name].present? ? params.require(resource.object_name).permit! : ActionController::Parameters.new\n end", "def source_params\n params.require(:source).permit(all_allowed_params)\n end", "def user_params\n end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def params; end", "def get_allowed_parameters\n return _get_specific_action_config(:allowed_action_parameters, :allowed_parameters)&.map(&:to_s)\n end", "def permitted_params\n @wfd_edit_parameters\n end", "def user_params\r\n end", "def param_whitelist\n whitelist = [\n :comment,\n :old_progress, :new_progress,\n :metric_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:metric_id)\n end\n \n whitelist\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def get_params\n\t\t\n\t\treturn ActionController::Parameters.new(self.attributes).permit(:first_name, :last_name, :email, :provider)\n\n\tend", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def valid_parameters\n sort_symbols(@interface.allowed_parameters)\n end", "def params_permit\n params.permit(:id)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def filter_params\n params.permit(*resource_filter_permitted_params)\n end", "def community_params\n params.permit(:profile_image, :name, :description, :privacy_type, :viewed_by, {tags: []}, {features: []}, {admins: []}, :members, :location, :beacon, :creator, :ambassadors, :current_events, :past_events, :feed, :category, :address, :allow_member_post_to_feed, :allow_member_post_to_events)\n end", "def specialty_params\n\t\tparams.require(:specialty).permit(*Specialty::DEFAULT_ACCESSIBLE_ATTRIBUTES)\n\tend", "def authorize_params\n super.tap do |params|\n %w[display scope auth_type].each do |v|\n if request.params[v]\n params[v.to_sym] = request.params[v]\n end\n end\n end\n end", "def feature_params_filter\n params.require(:feature).permit(:name, :cat, :lower, :upper, :opts, :category, :description, :company, :active, :unit, :icon)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def argument_params\n params.require(:argument).permit(:name)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def property_params\n params.permit(:name, :is_available, :is_approved, :owner_id)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def sponsor_params\n params.require(:sponsor).permit(WHITE_LIST)\n end", "def whitelist_person_params\n params.require(:person).permit(:family, :pre_title, :given_name, :dates, :post_title, :epithet, :dates_of_office, same_as: [], related_authority: [], altlabel: [], note: []) # Note - arrays need to go at the end or an error occurs!\n end", "def parameters\n nil\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def sequence_param_whitelist\n default_param_whitelist << \"show_index\"\n end", "def resource_filter_permitted_params\n raise(NotImplementedError, 'resource_filter_permitted_params method not implemented')\n end", "def normal_params\n reject{|param, val| param_definitions[param][:internal] }\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def special_device_list_params\n params.require(:special_device_list).permit(:name)\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end" ]
[ "0.7121987", "0.70541996", "0.69483954", "0.6902367", "0.6733912", "0.6717838", "0.6687021", "0.6676254", "0.66612333", "0.6555296", "0.6527056", "0.6456324", "0.6450841", "0.6450127", "0.6447226", "0.6434961", "0.64121825", "0.64121825", "0.63913447", "0.63804525", "0.63804525", "0.6373396", "0.6360051", "0.6355191", "0.62856233", "0.627813", "0.62451434", "0.6228103", "0.6224965", "0.6222941", "0.6210244", "0.62077755", "0.61762565", "0.61711127", "0.6168448", "0.6160164", "0.61446255", "0.6134175", "0.6120522", "0.6106709", "0.60981655", "0.6076113", "0.60534036", "0.60410434", "0.6034582", "0.6029977", "0.6019861", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.6019158", "0.60184896", "0.60157263", "0.6005857", "0.6003803", "0.60012573", "0.59955895", "0.5994598", "0.5993604", "0.5983824", "0.5983166", "0.5977431", "0.597591", "0.5968824", "0.5965953", "0.59647584", "0.59647584", "0.59566855", "0.59506303", "0.5950375", "0.59485626", "0.59440875", "0.5930872", "0.5930206", "0.5925668", "0.59235454", "0.5917905", "0.59164816", "0.5913821", "0.59128743", "0.5906617", "0.59053683", "0.59052664", "0.5901591", "0.58987755", "0.5897456", "0.58970183", "0.58942604" ]
0.0
-1
checks that file exists TODO: use active support's delegate method ?
def check_for_file @ff.check_for_file end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_exists\n end", "def exist; File.exist?(@fname); end", "def file_exists?(file)\n false\n end", "def file_exists?(path)\n end", "def file_exists?\r\n File.file?(full_path)\r\n end", "def file_exists?(file)\n File.exists?(file)\n end", "def file_exist?\n return FileTest.exist?(@fileurl)\n end", "def file_exists?\n !!file_path\n end", "def file_exists?\n !!file_path\n end", "def file_exists?\n File.exists?(@filename)\n end", "def exist?\n ::File.exist?(file_path)\n end", "def file_exist?(file_path)\n File.exist?(file_path)\n end", "def file_exists(file)\n File.exists?(file)\n end", "def file_exists?(file)\n File.file? file\n end", "def cry_exist?(filename)\n return File.exist?(filename)\n end", "def file_exist?(path)\n exist?(path) && is_file?(path)\n end", "def filecheck\n return file.nil? ? false : File.exist?(file)\n end", "def exists?\n FileTest.exists?(@file)\n end", "def user_file_exist?(file)\n File.exist? user_file_path(file)\n end", "def file_exists?(file_path)\n File.exist? @site.in_source_dir(file_path)\n end", "def exists?\n File.exist? file_path\n end", "def has_file\n if id == nil \n false\n else\n FileTest.exists?( local_file_path )\n end\n end", "def filecheck\n file.nil? ? false : File.exist?(file)\n end", "def local_file_exists?(full_path)\n File.exists?(full_path)\nend", "def exist?\n File.exist?(@path)\n end", "def check_file_exist(path)\n raise \"Cannot find: #{path}\" unless File.exist?(path)\n end", "def check_for fn\n File.readable?( fn ) && fn\n end", "def exists?\n file.exists?\n end", "def exist?\n FileTest.exist?(to_s)\n end", "def exists?\n File.exists? path\n end", "def safeExists?(f)\r\n ret=false\r\n File.open(f,\"rb\") { ret=true } rescue nil\r\n return ret\r\nend", "def ensure_exists(file)\n File.exist?(file) ? file : nil\n end", "def exist?\n File.exist? fullpath\n end", "def exists?\n File.exists?(filename)\n end", "def exist?\n filepath.file? and filepath.readable?\n end", "def exists?\n File.exists?(path)\n end", "def file_exists?(file_name)\n test(\"[ -f #{file_name} ]\")\n end", "def exists?\n File.exist?(@path)\n end", "def checkfile()\n if not File.file?(@file)\n abort(\"File #{@file} does not exist. Aborting...\")\n end\n end", "def mmkv_file_exists(file)\n is_exist = false\n if File.methods.include?(:exists?)\n is_exist = File.exists? file\n else\n is_exist = File.exist? file\n end\n return is_exist\nend", "def file_exists?(filename)\n shell_exec(\"test -f #{filename}\")\n rescue\n false\n else\n true\n end", "def file_exists?(name)\n File.file?(File.join(path, name))\n end", "def check_file!(filename)\n unless ::File.exists?(filename)\n raise FileNotFound\n end\n end", "def file_exists?(path)\n run(\"test -f #{path}\").success?\n end", "def exists?\n File.exist? @src_path\n end", "def opx_file_exist?(file)\n File.exist?(file)\n rescue => e\n opx_err(\"Fatal failure of File.exist? for file: #{file}\", e)\n end", "def check_exists\n raise GlusterFS::Error, \"File does not exist: #{@path}\" unless exists?\n end", "def file_exists?(filename)\n\tif !File.exists?(filename) \n\t\tabort \"Unable to read file #{filename}\"\n\tend\nend", "def file_exists?(path)\n parse_boolean(transport.execute(\"Test-Path #{escape(path)}\", :read_only => true).stdout)\n end", "def check_file(file)\n begin\n file_read = File.open(file, 'r')\n rescue SystemCallError\n puts \"#{file} does not exist\"\n return false\n end\n file_read\n end", "def has_file? name\n File.file? path / name\n end", "def is_up?\n\t\tFile.exists?(@file)\n\tend", "def exists?\n File.exists?(path)\n end", "def remote_file_exists?(full_path)\n remote_filetest_passes?('-e', full_path)\n end", "def file_exist?(_file_name_=false)\n File.exists?(_file_name_ || current_file_path)\n end", "def file_exists?(path)\n response = self.class.head(File.join('/', path), request_options)\n response.code >= 200 && response.code < 300\n end", "def contain?(filename); end", "def check_file?(path)\n Actions.check_file path\n rescue FileError\n false\n else true\n end", "def test_file_exists?(host, file_rel_path)\n file_exists?(host, get_test_file_path(host, file_rel_path))\nend", "def fileExists?(filename)\n shell_exec(\"test -f #{filename}\") rescue return false\n true\n end", "def strict_file_exists?(path)\n directory = `dirname #{path}`.chomp\n name = `basename #{path}`.chomp\n !`find \"#{directory}\" -name \"#{name}\"`.empty?\n end", "def exists?\n File.exists?(path)\n end", "def exists_or_false(file)\n File.exist?(file) ? file : false\n end", "def test_file_existence(filename, path, file_data = nil)\n return true if file_data&.exists?(filename.downcase)\n return true if File.exist?(format(Common_filename_format, path, filename).downcase)\n false\n end", "def exists?\n File.exist?(path)\n end", "def exists?(file)\n out = File.exist?(file) &&\n !File.zero?(file)\n raise \"File #{file} does not exist or is empty!\" unless out\n out\nend", "def exist?( path )\r\n File.exist?(path)\r\n end", "def ensure_exists(filename)\n puts(\"Couldn't find: #{filename}\") and exit unless FileTest.exist?(filename)\n end", "def file_verified?(filename)\n if !File.exists?(filename)\n notifier.test_file_missing(filename)\n puts \"=> ERROR: could not find test file: #{filename}\"\n return false\n end\n return true\n end", "def valid?\n File.exist?(fullpath)\n end", "def exists?\n File.exists?(@resource[:name])\n end", "def checkForFileExistence(fileName)\n raise \"#{fileName} file already exists\" if File.exist?(fileName);\nend", "def check_file_existence (file_path)\n \"[ -f '#{file_path}' ]\"\n end", "def start file_path\n\t\tfileExist? file_path\n\tend", "def ensure_exists(filename)\n return if FileTest.exist?(filename)\n\n puts(\"Couldn't find: #{filename}\") and exit\n end", "def resource_exists?\n path_exists? install_dir\nend", "def user_path?(file); end", "def file_exists?(path)\n result = transport.execute(\"ls -d #{path}\")\n result.exitstatus == 0 && result.stdout != ''\n end", "def exists? path\n end", "def exist?(name)\n File.exist?(path(name))\n end", "def safeExists?(f)\n ret=false\n if f[/\\A[\\x20-\\x7E]*\\z/]\n return FileTest.exist?(f)\n end\n begin\n File.open(f,\"rb\") { ret=true }\n rescue Errno::ENOENT, Errno::EINVAL, Errno::EACCES\n ret=false\n end\n return ret\nend", "def check_file_exists(file_name)\n \tif File.exist?(file_name)\n logger.fatal \"#{file_name} already exists.\"\n \t\tabort\n \tend\n end", "def knows?(name)\n !find_file(name).nil?\n end", "def path_exists?(path)\n File.exists?(path)\n end", "def file_exists?(path)\n begin\n ret = self.quietly { ls(path) }\n rescue Rye::Err => ex\n ret = ex.rap\n end\n # \"ls\" returns a 0 exit code regardless of success in Linux\n # But on OSX exit code is 1. This is why we look at STDERR. \n !(ret.exit_status > 0) || ret.stderr.empty?\n end", "def file?\n File.exist?(path) && File.directory?(path)\n end", "def file_exists?(path)\n result = transport.execute(\"ls -d #{path}\", :read_only => true)\n result.exitstatus == 0 && result.stdout != ''\n end", "def exist?\n File.directory? @full_path\n end", "def check_file\n super\n end", "def file_exists_on(host, file_path)\n if host[:platform].include?('windows')\n command = %(Test-Path #{file_path})\n\n if file_path.include?(':')\n split_path = win_ads_path(file_path)\n\n command = %(Test-Path #{split_path[:path]})\n command += %( -AND Get-Item -path #{split_path[:path]} -stream #{split_path[:ads]}) if split_path[:ads]\n end\n\n command = powershell(command)\n else\n command = %(test -f \"#{file_path}\")\n end\n\n return on(host, command, { :accept_all_exit_codes => true }).exit_code.zero?\n end", "def test_file_missing(filename)\n end", "def dir_exists?(name)\n # Does it exist?\n end", "def file_exists(file_path)\n s = read_file(file_path)\n if s and s.length\n return true\n end\n return false\n end", "def suspend_file_exists?\n File.file? File.join(path, \"#{@name}.vmem\")\n end", "def suspend_file_exists?\n File.file? File.join(path, \"#{@name}.vmem\")\n end", "def ensure_exists(file)\n if not File.file?(file)\n throw Exception.new(\"No #{ File.extname(file) } file found at #{ file }. Please ensure it exists, or that you have transpiled the necessary files.\")\n else\n file\n end\n end", "def check_for_file(format)\n File.exists?(\"#{@work.download_basename}.#{format}\")\n end", "def exists?\n ::File.directory? self.path\n end", "def check_file(path)\n raise Error, \"The path '#{path}' does not exist or is not a file\" unless path.file? || attrs[:exists] == false\n end", "def storage_exists?\n File.exists?(file_path)\n end" ]
[ "0.85186595", "0.8347249", "0.8271966", "0.8260194", "0.7983861", "0.7979421", "0.79466254", "0.79173124", "0.79169804", "0.7881887", "0.7808925", "0.7808304", "0.78068596", "0.7799756", "0.7764423", "0.7722265", "0.7684597", "0.7680001", "0.76455075", "0.7637633", "0.7637431", "0.7624607", "0.7622463", "0.76046675", "0.7601575", "0.759359", "0.75884694", "0.7573995", "0.7573136", "0.75583667", "0.75485355", "0.75189745", "0.7505765", "0.7504274", "0.7499008", "0.7491744", "0.7482874", "0.7466368", "0.74654865", "0.7428961", "0.7411877", "0.7393771", "0.7361375", "0.73522824", "0.7331957", "0.7331209", "0.7323397", "0.7319988", "0.73151547", "0.73017424", "0.73007524", "0.72983044", "0.72886664", "0.72786057", "0.7264549", "0.72492963", "0.72423166", "0.7232275", "0.7221683", "0.72211987", "0.72173333", "0.7207878", "0.71883816", "0.7174398", "0.717297", "0.71701944", "0.7165099", "0.71604717", "0.7155053", "0.7152504", "0.7152394", "0.7151253", "0.7149211", "0.7146185", "0.7109808", "0.71039903", "0.70965266", "0.7092233", "0.70919853", "0.7091122", "0.708807", "0.70822936", "0.70815957", "0.70798314", "0.70722055", "0.70657486", "0.7053841", "0.70370346", "0.70335084", "0.7033362", "0.70251507", "0.702344", "0.702105", "0.70075107", "0.70075107", "0.7005096", "0.70044947", "0.7004462", "0.6996152", "0.6993507" ]
0.74490917
39
pulls info about the file
def file_stats @stats = @ff.get_stats end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def file_info(path)\n info File.read(path)\n end", "def get_info(filename)\n @octokit_client = @octokit_client_factory.call if @octokit_client.nil?\n @octokit_client.contents @fullname, path: filename\n end", "def info(command)\n if !command[1] || command[1].empty?\n puts \"please specify item to get\"\n else\n path = '/' + clean_up(command[1])\n pp @client.files.info(path)\n end\n end", "def file_info(path)\n file = scope.get(path)\n InvalidPath.raise! {!file}\n file.info\n end", "def info\n @encoding = find_enoding\n puts \"INFO:\"\n print 'File name '; print \"#{@file_name}\\n\".colorize(:green)\n print 'File headers '; print \"#{@file_headers}\\n\".colorize(:green)\n print 'File rows number '; print \"#{@data.size}\\n\".colorize(:green)\n print 'File encoding '; print \"#{@encoding}\\n\".colorize(:green)\n\n ## temp decision\n if @output_file_name\n print 'Output File '; print \"#{@output_file_name || 'nil'}\\n\".colorize(:green)\n end\n end", "def info_file\n @info_file ||= File.join(image_dir, '_info.txt')\n end", "def files_info(params = {})\n fail ArgumentError, \"Required arguments 'file' missing\" if params['file'].nil?\n response = @session.do_post \"#{SCOPE}.info\", params\n Slack.parse_response(response)\n end", "def Fileinfo(path)\n Vidibus::Fileinfo::Base.new(path).data\nend", "def info(filename, nohash = nil)\n\tf = filename\n\tif test_file(f)\n\t\th = nohash ? (nil) : (Digest::SHA1.hexdigest(File.read(f)))\n\t\treturn [File.mtime(f), File.stat(f).mode.to_s(8).to_i, h]\n\tend\n\treturn []\nend", "def readFile(filename)\n info = \"\"\n file = File.open(filename)\n file.each do |line|\n info = info + line\n end\n file.close\n $myinfo = info\n end", "def txt\n @info_file\n end", "def info_file\n @info_file ||= File.join(image_dir, '_info.json')\n end", "def file_details\n return @file_details\n end", "def get_file_details(file_id)\n begin\n api_result = @client.metadata(file_id, 1, true)\n rescue\n return nil\n end\n \n if api_result.present?\n self.item_into_standard_format(api_result, true)\n else\n nil\n end\n end", "def fileinfo(info)\n return info if info.respond_to?(:filetype)\n\n Aur::FileInfo.new(info)\n end", "def read_info(uid)\n grid_info = files_collection.find(filename: uid).first or raise Tus::NotFound\n grid_info[:metadata]\n end", "def load_info\n info = File.readlines @dir+\"info\"\n @last_quantity = info[0].chop\n @last_category = info[1].chop.to_i\n @exercises = info[2].chop.split(\",\")\n @last_repq = info[3].chop\n @rep_ex = info[4].chop\n end", "def describe\n f = file!\n puts \"Current target: #{f.basename}\"\n puts '*' * 70\n File.open(f).each do |line|\n puts \" #{line}\"\n end\n puts '*' * 70\n end", "def info(path, **_opts)\n full = full_path(path)\n path = norm_path(path)\n out = sh! %(stat -c '%F;%s;%Z;%a' #{Shellwords.escape full})\n\n type, size, epoch, mode = out.strip.split(';', 4)\n raise BFS::FileNotFound, path unless type.include?('file')\n\n BFS::FileInfo.new(path: path, size: size.to_i, mtime: Time.at(epoch.to_i), mode: BFS.norm_mode(mode))\n rescue CommandError => e\n e.status == 1 ? raise(BFS::FileNotFound, path) : raise\n end", "def get_file(filename, branch_or_tag='master') \n\t\tlog = repo.log(branch_or_tag, filename) \n\t\treturn log.first.tree.contents.first.data\n\tend", "def get_file\n\t\t{\n\t\t\tfile_name: File.basename(file.path.to_s),\n\t\t\turl: file.url\n\t\t}\n\tend", "def build_info_file\n File.join build_info_dir, \"#{full_name}.info\"\n end", "def get_file(file_id)\n\tputs \"Getting file: \" + file_id\n\tresponse = request_get('/api/partner/file/' + file_id)\n\tputs response.body\nend", "def get_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 get_file_details(id)\n uri = ENDPOINT + \"file/details/#{key}/#{id}\"\n data = JSON.parse(self.class.get(uri).body, :symbolize_names => true)\n Reach::Helper::convert_keys(data)\n end", "def get_file_details(file_id)\n begin\n drive = @client.discovered_api('drive', 'v2')\n result = @client.execute(:api_method => drive.files.get, :parameters => { 'fileId' => file_id })\n rescue\n return nil\n end\n \n if result.status == 200\n self.item_into_standard_format(result.data) if result.data.present?\n else\n nil\n end\n end", "def info\n info = Hash.new\n output = @filer.invoke(\"system-get-info\")\n if(output.results_errno() != 0)\n r = output.results_reason()\n raise \"Failed : \\n\" + r\n else \n output.children_get[0].children_get.each do |naelem|\n info[naelem.name] = naelem.content\n end\n end\n info\n end", "def info(path, _opts={})\n path = norm_path(path)\n BFS::FileInfo.new(path, @client.size(path), @client.mtime(path))\n rescue Net::FTPPermError\n raise BFS::FileNotFound, path\n end", "def info_file(path = nil)\n File.join(info_dir(path), 'info.yaml')\n end", "def info(path, _opts={})\n path = norm_path(path)\n raise BFS::FileNotFound, path unless @files.key?(path)\n\n entry = @files[path]\n BFS::FileInfo.new(path, entry.io.size, entry.mtime, entry.content_type, entry.metadata)\n end", "def file\n @file\n end", "def read\n\t\t@file_content = File.open(\"/home/calin/football/football.dat\",\"r\")\n\tend", "def get\n file\n end", "def file(name)\n begin\n @name=name\n @content=get_rest(\"extra/#{@name}\")\n rescue Stingray::NotFoundError \n nil\n end\n end", "def inspect\n \"File: #{@name} #{@ext}\"\n end", "def file_node(path)\n file_info(path).first[0..19]\n end", "def info(path, **_opts)\n path = norm_path(path)\n BFS::FileInfo.new(path: path, size: @client.size(path), mtime: @client.mtime(path))\n rescue Net::FTPPermError\n raise BFS::FileNotFound, path\n end", "def set_file_info\n @file_info = FileInfo.includes(:component).find(params[:id])\n end", "def load_info\n info = File.readlines @dir+\"info\"\n @last_learnq = info[0].to_i\n @last_repq = info[1].to_i\n @last_exerq = info[2].to_i\n @last_category = info[3].to_i\n @exercises = info[4].split(\",\").collect! {|v| v.to_i}\n @rep_ex = info[4].to_i\n end", "def files_remote_info(options = {})\n post('files.remote.info', options)\n end", "def file\n @file\n end", "def file\n @file\n end", "def file\n @file\n end", "def file\n @file\n end", "def read(path)\n @path = path\n unless File.exist?(info_file)\n debug(\"file #{info_file} missing\")\n write(path, {})\n return\n end\n # data = @info_cacher[info_file]\n info_hash[base_name]\n end", "def read\n file\n end", "def read_generic_file(file)\n TagLib::FileRef.open(file) do |fileref|\n tag = fileref.tag\n \n # Read basic attributes\n puts 'title: ' + tag.title.to_s #=> \"Wake Up\"\n puts 'artist: ' + tag.artist.to_s #=> \"Arcade Fire\"\n puts 'albulm: ' + tag.album.to_s #=> \"Funeral\"\n puts 'year: ' + tag.year.to_s #=> 2004\n puts 'track ' + tag.track.to_s #=> 7\n puts 'genre ' + tag.genre.to_s #=> \"Indie Rock\"\n puts 'comment ' +tag.comment.to_s #=> nil\n \n properties = fileref.audio_properties\n puts 'prop.length ' + properties.length.to_s #=> 335 (song length in seconds)\n end\n end", "def config_file\n send_command(:getinfo, 'config-file')\n reply = read_reply.split('=').last\n read_reply # skip \"250 OK\"\n Pathname(reply)\n end", "def file_info(path)\n if manifest_entry # have we loaded our manifest yet? if so, use that sucker\n result = [manifest_entry[path], manifest_entry.flags[path]]\n if result[0].nil?\n return [NULL_ID, '']\n else\n return result\n end\n end\n if manifest_delta || files[path] # check if it's in the delta... i dunno\n if manifest_delta[path]\n return [manifest_delta[path], manifest_delta.flags[path]]\n end\n end\n # Give us, just look it up the long way in the manifest. not fun. slow.\n node, flag = @repo.manifest.find(raw_changeset[0], path)\n if node.nil?\n return [NULL_ID, '']\n end\n return [node, flag]\n end", "def file_description\n @descriptive_detail.file_description\n end", "def version_info\n # thanks to Roger Pack on ruby-forum for how to get to the version\n # file\n filename = File.open(File.dirname(__FILE__) + \"/../../VERSION\")\n v = nil\n if File.exists?(filename)\n v = File.open(filename).read.chomp if File.exists?(filename)\n #else\n #$stderr.puts \"could not locate file #{filename}. \" \n #puts `pwd`\n end\n v\n end", "def get_file_name \n send_cmd(\"get_file_name\")\n end", "def retrieve_file(target)\n # only local dir in tutorial!\n full_path = File.join(File.dirname(__FILE__), target)\n @client.puts \"Looking for #{full_path} ...\"\n\n content = []\n\n # Check if file exists, return appropriate response\n if File.exists?(full_path)\n @http_status = \"HTTP/1.1 200 OK\"\n\n # Open the file, read content.\n begin\n File.open(full_path, \"r\") do |f|\n \n f.each_line do |l|\n content << l\n end\n end\n rescue \n @client.puts \"Error when opening file.\"\n @http_status = \"HTTP/1.0 404 Not Found\"\n end\n\n else\n @http_status = \"HTTP/1.0 404 Not Found\"\n end\n\n return content.join(\"\")\n end", "def file_get_more_information(directory) \n @files = []\n @file_information = {} # {\"/directory\"=>[\"file\"], \"/directory/directory\"=>[\"file\", \"file\"]\n directory = \"#{@current_directory}/#{directory}\" unless @current_directory == \"\"\n @current_directory = directory \n Dir.chdir(\"#{directory}\") \n Dir.foreach(\"#{directory}\") { |d| @files.push(d) unless d == \".\" || d == \"..\" }\n @file_information.store(directory, @files)\n @files = []\n return @file_information\n end", "def filestat\n\t\tbrand(Rex::Post::Meterpreter::Extensions::Stdapi::Fs::FileStat)\n\tend", "def fetch(filename, filesize)\n end", "def show\n @file_info = FileInfo.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @file_info }\n end\n end", "def file\n files.first\n end", "def file\n files.first\n end", "def version_info\n # thanks to Roger Pack on ruby-forum for how to get to the version\n # file\n filename = File.open(File.dirname(__FILE__) + \"/../../../VERSION\")\n v = nil\n if File.exists?(filename)\n v = File.open(filename).read.chomp if File.exists?(filename)\n #else\n #$stderr.puts \"could not locate file #{filename}. \" \n #puts `pwd`\n end\n v\n end", "def file\n @file\n end", "def access_file_name\n end", "def read_metadata; end", "def file\n @file ||= find_file\n end", "def find_file(path_info, accept_encoding:); end", "def get_info\n end", "def get_info\n end", "def get_info\n end", "def read_file(file)\n travs = \"\"\n travs << \"../\" * datastore['DEPTH']\n travs << file\n\n print_status(\"#{@peer} - Retrieving file contents...\")\n\n connect\n req = \"GET #{normalize_uri(target_uri.path, \"gefebt.exe\")}?substitute.bcl+FILE=#{travs} HTTP/1.0\\r\\n\\r\\n\"\n sock.put(req)\n res = sock.get_once\n disconnect\n\n if res and res =~ /HTTP\\/1\\.0 200 OK/\n return res\n else\n return nil\n end\n\n end", "def get_file_contents(fname)\n f_h = File.open(fname,'r')\n readbuf = f_h.read()\n# puts \"Read #{readbuf.length()} bytes from #{fname}.\"\n f_h.close()\n return readbuf\nend", "def get_file(url)\n get(url).body\n end", "def file_data\n @client.get_file @file_url\n end", "def show\n @file_name = @quickchecker.file\n end", "def send_file_info(last, path)\n if not last == nil\n user = current_user\n path = path.force_encoding(\"UTF-8\")\n @file_names = \"#{path.split('/').last}\" + \"\\n\"\n @access_url = \"#{HOSTING_URL}\" + \"/user_files/\"+ \"#{user.userid}\" + path.force_encoding(\"UTF-8\") \n \n else\n @file_names = \"error\"\n @access_url = \"\"\n end\n puts_message \"send_file_info end\" \n end", "def getFileAt(position)\n require 'rubygems/package'\n require 'zlib'\n\n @files = []\n f = File.new(@filename)\n tar_extract = Gem::Package::TarReader.new(f)\n tar_extract.rewind # The extract has to be rewinded after every iteration\n \n i = 0\n tar_extract.each do |entry|\n COURSE_LOGGER.log(entry)\n COURSE_LOGGER.log(i)\n\n if i == position then\n return nil, nil unless entry\n return entry.read, entry.full_name\n end\n\n i += 1\n end\n\n return nil, nil unless header\n\n rescue\n return nil, nil\n end", "def get_current_files\n get_files(OcflTools::Utils.version_string_to_int(@head))\n end", "def show\n # begin monkey\n ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n ::Deepblue::LoggingHelper.called_from,\n \"params=#{params}\",\n \"params[:format]=#{params[:format]}\",\n \"\" ] if DOWNLOADS_CONTROLLER_DEBUG_VERBOSE\n # begin monkey\n case file\n when ActiveFedora::File\n # begin monkey\n #\n # check if file is too big to download, this will happen when it is a json request\n # ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n # ::Deepblue::LoggingHelper.called_from,\n # \"file.class.name=#{file.class.name}\",\n # \"file.metadata=#{file.metadata}\",\n # \"file.metadata.size=#{file.metadata.size}\",\n # \"::RDF::Vocab::EBUCore.fileSize.to_s=#{::RDF::Vocab::EBUCore.fileSize.to_s}\",\n # \"file.metadata.attributes[fileSize]=#{file.metadata.attributes[\"http://www.ebu.ch/metadata/ontologies/ebucore/ebucore#fileSize\"]}\",\n # \"file.metadata.attributes[::RDF::Vocab::EBUCore.fileSize]=#{file.metadata.attributes[::RDF::Vocab::EBUCore.fileSize]}\",\n # \"file.metadata.attributes[::RDF::Vocab::EBUCore.fileSize.to_s]=#{file.metadata.attributes[::RDF::Vocab::EBUCore.fileSize.to_s]}\",\n # #\"file.metadata.methods.sort=#{file.metadata.methods.sort}\",\n # \"\" ] if DOWNLOADS_CONTROLLER_DEBUG_VERBOSE\n\n relation = file.metadata.attributes[::RDF::Vocab::EBUCore.fileSize.to_s]\n # ::Deepblue::LoggingHelper.bold_debug [ ::Deepblue::LoggingHelper.here,\n # ::Deepblue::LoggingHelper.called_from,\n # \"relation.methods.sort=#{relation.methods.sort}\",\n # \"relation.first=#{relation.first}\",\n # \"relation.first.to_i=#{relation.first.to_i}\",\n # \"\" ] if DOWNLOADS_CONTROLLER_DEBUG_VERBOSE\n\n file_size = 0\n file_size = relation.first.to_i if relation.present?\n respond_to do |wants|\n wants.html do\n if file_size > DeepBlueDocs::Application.config.max_file_size_to_download\n raise ActiveFedora::IllegalOperation # TODO need better error than this\n end\n # For original files that are stored in fedora\n super\n end\n wants.json do\n unless ::DeepBlueDocs::Application.config.rest_api_allow_read\n return render_json_response( response_type: :bad_request, message: \"Method not allowed.\" )\n end\n if file_size > DeepBlueDocs::Application.config.max_file_size_to_download\n return render_json_response( response_type: :unprocessable_entity, message: \"file too large to download\" )\n end\n # For original files that are stored in fedora\n super\n end\n end\n # end monkey\n when String\n # For derivatives stored on the local file system\n send_local_content\n else\n raise ActiveFedora::ObjectNotFoundError\n end\n end", "def info_message\n info = File.read(File.join(spec.path, 'INFO')) rescue ''\n template = ERB.new(info, nil, '<>')\n puts \"\\n#{template.result(binding)}\"\n end", "def info_message\n info = File.read(File.join(spec.path, 'INFO')) rescue ''\n template = ERB.new(info, nil, '<>')\n puts \"\\n#{template.result(binding)}\"\n end", "def extract_attributes(file_name)\n extract_publish_date(file_name)\n extract_tags(file_name)\n extract_filter(file_name)\n extract_title_and_content(file_name)\n @path = Pathname.new(file_name)\n @file = @path.to_s\n @title = @file.gsub('_', ' ').capitalize if @title.to_s.empty?\n @summary = @content.match(%r{<p>.*</p>}).to_s\n self\n end", "def retrieve_files\r\n if RUBY_PLATFORM =~ /win32|win64/i then\r\n $help_file = File.read('C:\\files\\BJHelp.txt')\r\n $welcome_file = File.read('C:\\files\\BJWelcome.txt')\r\n $credits_file = File.read('C:\\files\\BJCredits.txt')\r\n else\r\n $help_file = File.read('files/BJHelp.txt')\r\n $welcome_file = File.read('files/BJWelcome.txt')\r\n $credits_file = File.read('files/BJCredits.txt')\r\n end\r\n end", "def to_s\n \"File #{file_identity.inspect} (version #{version}) \" \\\n \"at #{extracted_at.strftime('%Y-%m-%d %H:%M')}. \" \\\n \"#{full? ? 'A full' : 'An update'} extract \" \\\n \"for #{start_date} to #{end_date}.\"\n end", "def read_meta_info\n if meta_info_file_pathname.exist?\n inode, bytes_read = meta_info_file_pathname.read.strip.split(':').map(&:to_i)\n {\n inode: inode,\n bytes_read: bytes_read\n }\n else\n {\n inode: nil,\n bytes_read: 0\n }\n end\n end", "def file( name )\n\t\t\t\tKesh::ArgTest::type( \"name\", name, String )\n\t\t\t\tKesh::ArgTest::stringLength( \"name\", name, 1 )\t\t\t\n\t\t\t\treturn Kesh::Loader::FileInfo.new( self, name )\n\t\t\tend", "def files\n info[\"Files\"].to_a\n end", "def info\n return @info unless @info.nil?\n\n fname = path('info.yml')\n return nil if fname.nil?\n\n @info ||= OpenStruct.new(YAML::load_file(fname).merge({:path => @path}))\n end", "def generate_header_info\n magic = FileMagic.new\n @header_info = magic.file(@file_name)\n magic.close\n\n @header_info\n end", "def command_get filename\n # construct absolute path\n filename = Server.absolute_path(@directory.path, filename)\n puts filename\n\n # Respond with \"OK #{filesize}\"\n # Start sending file over data connection\n if File.exists? filename and not File.directory? filename\n f = File.new(filename)\n\t\tf.seek 0, IO::SEEK_END\n\t\tf_size = f.tell\n\t\tf.seek 0, IO::SEEK_SET\n @client.puts \"OK #{f_size}\"\n @data_connection.transfer f\n else\n @client.puts \"FAILURE: File Not Found\"\n end\n end", "def read file\n File.open file\n end", "def infos_path\n\t@infos_path ||= File.join(main_folder, 'infos.yaml')\nend", "def show_file(env, res, tag, path)\n body = \"(empty)\"\n git(\"show\", \"#{tag}:#{path}\") do |io|\n body = io.read\n end\n mime_type = Rack::Mime.mime_type(File.extname(path), \"text/plain\")\n if mime_type != \"text/plain\"\n res.write body\n res['Content-Type'] = mime_type\n return\n end\n E_show_file.result(binding)\n end", "def get_file_info(object_id:)\n {\n method: \"DOM.getFileInfo\",\n params: { objectId: object_id }.compact\n }\n end", "def metadata_file; end", "def metadata_file; end", "def get_file(file_id, file_type)\n\t\tresponse = self.auth_get(\"/weboncampus/getFile.do?tipo=#{file_type}&id=#{file_id}\")\n\t\tfilename = response[\"content-disposition\"].match(/filename=\"(.*)\"/)[1]\n\t\tlength = response[\"Content-Length\"]\n\t\treturn filename, length, response.body\n\tend", "def read_file(filename); end", "def information\n @information || grab_information_without_download\n end", "def fetch(type, fileinfo)\n if fileinfo.type == type\n current = {\n :format => fileinfo.format,\n :version => fileinfo.version,\n :checksum => fileinfo.checksum }\n end\n\n api.node_data(type, FORMATS[type], current)\n end", "def files; end", "def files; end" ]
[ "0.7792083", "0.71775687", "0.7158657", "0.7034281", "0.6905487", "0.68901384", "0.6790478", "0.67184913", "0.66902345", "0.667823", "0.6673454", "0.6647459", "0.65786797", "0.6565178", "0.64748925", "0.64623564", "0.6428776", "0.6388954", "0.63585883", "0.6357946", "0.6336698", "0.6327721", "0.63171995", "0.63121146", "0.6299177", "0.6281972", "0.6249537", "0.62450635", "0.62364376", "0.6222829", "0.6192654", "0.6183669", "0.6159154", "0.61525977", "0.6131659", "0.6128616", "0.61053425", "0.60981756", "0.6095765", "0.6093298", "0.6091836", "0.6091836", "0.6091836", "0.6091836", "0.6086357", "0.6071787", "0.6067633", "0.6062346", "0.6047279", "0.60305315", "0.6018747", "0.6017597", "0.60075146", "0.600508", "0.60039747", "0.59955245", "0.5986185", "0.5984782", "0.5984782", "0.5984658", "0.5983722", "0.5974897", "0.59598255", "0.59567684", "0.59304905", "0.59131956", "0.59131956", "0.59131956", "0.5908297", "0.59062266", "0.58963567", "0.5859258", "0.58471155", "0.5846112", "0.5844235", "0.5839977", "0.58385223", "0.5838294", "0.5838294", "0.5834264", "0.5828142", "0.58252114", "0.58227086", "0.58196867", "0.5816409", "0.5809498", "0.58035946", "0.58024484", "0.57976407", "0.57969135", "0.5795978", "0.57874143", "0.5785312", "0.5785312", "0.57829523", "0.57798254", "0.57781297", "0.5775617", "0.57687646", "0.57687646" ]
0.649796
14
the key attribute of a query
def initialize(lipid, mods=[]) @lipid = lipid @modifications = mods @mz = nil end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def key\n attributes[:key]\n end", "def key\n @attributes[:key]\n end", "def key\n @attributes[:key]\n end", "def key_field\n 'key'\n end", "def key\n @key\n end", "def key\n @key\n end", "def key\n @key\n end", "def key\n @key\n end", "def key\n @key.id2name\n end", "def key\n return @key\n end", "def key\n return @key\n end", "def get_key record\n record\n end", "def key\n attributes['key'] or raise NoKeySpecified\n end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key; end", "def key_id; end", "def key\n params.k\n end", "def key_id\n return @key_id\n end", "def key_id\n return @key_id\n end", "def key_id\n return @key_id\n end", "def key\n (key_name || name).to_sym\n end", "def key\n @entity.key\n end", "def key_name\n data[:key_name]\n end", "def key\n raise MissingID if not defined?(@id)\n model.key[id]\n end", "def key\n id\n end", "def key\n self.keys.first\n end", "def key\n self.id\n end", "def key\n self.id\n end", "def key\n self.id\n end", "def key\n @key ||= name.to_s\n end", "def _key\n @_key || self.class.key.(self)\n end", "def getKey; argSetTextual.to_sym end", "def key\n self.class._key\n end", "def key1\n self.key('key1')\n end", "def get_key(record)\n get(self.by, record)\n end", "def key_value\n @attrs[self.class.key_attribute.to_s]\n end", "def dynamo_attribute_key\n @attr.dynamo_name\n end", "def predicate_key\n cached_fetch(:predicate_key){qualify_assoc(self[:key])}\n end", "def id\n key\n end", "def _key(*args); args.hash; end", "def key_value\n @attrs[self.class.key_attribute.to_s]\nend", "def key\n get_primary_key_value_map[self.class.table_name]\n end", "def dump_key(object)\n object.key_attribute\n end", "def keys\n @key\n end", "def key_for(entry)\n entry\n end", "def to_param\n key\n end", "def key\n\t\t\tself.class.key(user)\n\t\tend", "def hash_key\n read_attribute(table_hash_key)\n end", "def keyname(key)\n\t\t@keynames[key]\n\tend", "def name_as_search_key\n QueryField.mapping(@name)\n end", "def key\n `return #{self}.__key__ || #{nil};`\n end", "def to_key; end", "def key\n @key or raise MissingKey\n end", "def extract_key(ctx); end", "def primary_key\n fields.select { |f| f.key }.map(&:name)\n end", "def key\n model.extract_key(path)\n end", "def flexible_key; end", "def opt\n @key\n end", "def association_key(assoc)\n model.association_reflection(assoc)[:key]\n end", "def getKey; @args.map { |a| a.to_s }.join(':').to_sym end", "def key_symbol\n @key\n end", "def key\n @key ||= [model_name, operation, scope]\n end", "def key_columns\n @key_columns ||= [\"#{self.table_name}__id\".to_sym]\n end", "def to_param\n @key\n end", "def key\n self.class.item_name\n end", "def key\n to_a[0..(num_key_fields-1)].join(\"-\")\n end", "def name_var\n key_attributes = self.class.key_attributes\n (key_attributes.length == 1) && key_attributes.first\n end", "def primary_key\n @attributes[self.primary_key_attribute]\n end", "def key_index\n options[:key_index]\n end", "def get_min_key()\n \n end", "def answer_keys\n [key]\n end", "def predicate_key\n cached_fetch(:predicate_key){qualified_primary_key}\n end", "def read_key; end", "def key=(_arg0); end", "def key=(_arg0); end", "def key=(_arg0); end", "def keys\n @keys ||= [column_for_order_by(relation), primary_key].compact.uniq\n end", "def cache_key\r\n attributes.to_s\r\n end", "def key_data; end", "def key_data; end", "def get_key(data)\n\t\t keys = data.keys\n\t\t if keys.length != 1 || INDICES.none? { |key| key.to_sym == keys.first.to_sym }\n\t\t raise ArgumentError.new(\"`find_by` accepts only one of #{INDICES.join(\" or \")} as argument. none provided\")\n\t\t end\n\t\t keys.first\n\t\t end", "def map_key(key)\n key\n end", "def [](key_)\n @attributes[key_.to_s]\n end" ]
[ "0.787833", "0.77189225", "0.77189225", "0.7650753", "0.7471585", "0.7471585", "0.7457709", "0.7457709", "0.74514955", "0.7331824", "0.7331824", "0.73312074", "0.7317567", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.72196174", "0.7106283", "0.70685065", "0.70347553", "0.70347553", "0.70347553", "0.70326906", "0.7026893", "0.69677156", "0.6960966", "0.6932295", "0.6903119", "0.6882589", "0.6882589", "0.6882589", "0.6857105", "0.685679", "0.68472034", "0.68264735", "0.6822445", "0.6812647", "0.6794412", "0.6728865", "0.67141515", "0.6708642", "0.6678925", "0.66760224", "0.6664594", "0.66473925", "0.66385555", "0.66337407", "0.66283906", "0.66257894", "0.66247004", "0.6614429", "0.6609283", "0.6605724", "0.66035545", "0.6602425", "0.65967345", "0.6592462", "0.65766084", "0.65716267", "0.65646386", "0.656345", "0.6552838", "0.65513426", "0.6550912", "0.65424305", "0.65422535", "0.65335727", "0.6502741", "0.6494238", "0.6494183", "0.649229", "0.6480134", "0.64781666", "0.6472942", "0.64529747", "0.64378476", "0.64378476", "0.64378476", "0.6435256", "0.6425665", "0.64244235", "0.64244235", "0.64235055", "0.6410118", "0.6392458" ]
0.0
-1
the unsigned m/z value
def mz _mz_signed = mz_signed _mz_signed >= 0 ? _mz_signed : -_mz_signed end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def z\n return @z\n end", "def z_value\n @z_value ||= self.class.z_value\n end", "def unit \n\t\t\tunitq = self.dup\n\t\t\tmagnitude = self.abs\n\t\t\tunitq[0] /= magnitude\n\t\t\tunitq[1] /= magnitude\n\t\t\tunitq[2] /= magnitude\n\t\t\tunitq[3] /= magnitude\n\t\t\treturn unitq\n\t\tend", "def magnitude\n Math.sqrt(@x ** 2 + @y ** 2 + @z ** 2)\n end", "def get_juz_number_for(mushaf_type:)\n mushaf_juzs_mapping[mushaf_type.to_s] || mushaf_pages_mapping['madani']\n end", "def z\n @z\n end", "def magnitude; Math.sqrt x*x + y*y + z*z; end", "def binary_value\n\t\treturn self.value.unpack( 'm' ).first\n\tend", "def z=(new_z)\n @z = new_z.to_f if new_z\n end", "def z=(value)\n @z = value\n end", "def z_value=(value)\n @z_value = value\n end", "def collatz(num)\n collatz_int(num,0)\nend", "def z\n return nil unless @grpc.position\n @grpc.position.z\n end", "def signed; end", "def z=(value); self[Z] = Float(value); end", "def z=(value); self[Z] = Float(value); end", "def to_uint\n elements = ((\"%02d\" * 4) % [hours,minutes,seconds,frames]).split(//).map{|e| e.to_i }\n uint = 0\n elements.reverse.each_with_index do | p, i |\n uint |= p << 4 * i \n end\n uint\n end", "def to_uint\n elements = ((\"%02d\" * 4) % [hours,minutes,seconds,frames]).split(//).map{|e| e.to_i }\n uint = 0\n elements.reverse.each_with_index do | p, i |\n uint |= p << 4 * i \n end\n uint\n end", "def screen_z\n [screen_z_formula,3].max\n end", "def uimm val\n val = val.to_i\n\n if val < 0\n raise ArgumentError, \"#{val} is negative\"\n elsif val <= 0xFF\n imm8 val\n elsif val <= 0xFFFF\n imm16 val\n elsif val <= 0xFFFFFFFF\n imm32 val\n elsif val <= 0xFFFFFFFFFFFFFFFF\n imm64 val\n else\n raise ArgumentError, \"#{val} is too large for a 64 bit int\"\n end\n end", "def get_u_value()\n total_conductivity = 0.0\n case self.get_keyword_value(\"TYPE\")\n when \"LAYERS\"\n self.get_materials().each do |material_command|\n case material_command.get_keyword_value(\"TYPE\")\n when \"RESISTANCE\"\n conductivity = 1 / material_command.get_keyword_value(\"RESISTANCE\").to_f\n when \"PROPERTIES\"\n conductivity = material_command.get_keyword_value(\"CONDUCTIVITY\").to_f\n else\n raise \"Error in material properties\"\n end\n total_conductivity = total_conductivity + conductivity\n end\n return total_conductivity\n when \"U-VALUE\"\n return self.get_keyword_value(\"U-VALUE\").to_f\n end\n end", "def matz; end", "def magnification\n 1300\n end", "def ordinal_azimuth; end", "def magnitude()\n _nrm2()\n end", "def uint64()\n _uint64(\"uint64\")\n end", "def u64\n next_bytes(8).unpack(\"Q>\").first\n end", "def magnitude\n return 1000 if (4..6).include?(digits)\n 10 ** (digits - 1)\n end", "def m(v)\n v % 0x100000000\n end", "def unit_vector\n len = self.r\n raise Vector::ZeroOperationError if (len == 0.0)\n self * (1.0/len)\n # Mageo::Vector3D.new(@x*(1.0/len), @y*(1.0/len), @z*(1.0/len))\n end", "def m(v)\n v % 0x100000000\n end", "def hz_to_ghz i\n (i / 10000.0).round / 100.0\nend", "def r(value)\n (value & 0xff000000) >> 24\n end", "def r(value)\n (value & 0xff000000) >> 24\n end", "def lngamm(z)\n x = 0\n x += 0.0000001659470187408462 / (z+7)\n x += 0.000009934937113930748 / (z+6)\n x -= 0.1385710331296526 / (z+5)\n x += 12.50734324009056 / (z+4)\n x -= 176.6150291498386 / (z+3)\n x += 771.3234287757674 / (z+2)\n x -= 1259.139216722289 / (z+1)\n x += 676.5203681218835 / (z)\n x += 0.9999999999995183\n\n return(Math.log(x)-5.58106146679532777-z+(z-0.5) * Math.log(z+6.5))\n end", "def lngamm(z) \n x = 0\n x += 0.0000001659470187408462 / (z+7)\n x += 0.000009934937113930748 / (z+6)\n x -= 0.1385710331296526 / (z+5)\n x += 12.50734324009056 / (z+4)\n x -= 176.6150291498386 / (z+3)\n x += 771.3234287757674 / (z+2)\n x -= 1259.139216722289 / (z+1)\n x += 676.5203681218835 / (z)\n x += 0.9999999999995183\n\n return(Math.log(x)-5.58106146679532777-z+(z-0.5) * Math.log(z+6.5))\n end", "def azucaresIR\n\t\t((valorEnergeticoKJ.to_f*90)/8400).round(2)\n\tend", "def read_u3\n (read_u1 << 16) | read_u2\n end", "def juz(juz_number)\n return @juz[juz_number]\n end", "def vu(value=1)\n @music.vu(value.to_i)\n end", "def z\n return @background.z\n end", "def zero_u_b\n UkAccountValidator::ModulusWeight.new(\n modulus_weight.sort_code_start,\n modulus_weight.sort_code_end,\n modulus_weight.modulus,\n 0, 0, 0, 0, 0, 0, 0, 0,\n modulus_weight.c, modulus_weight.d, modulus_weight.e,\n modulus_weight.f, modulus_weight.g, modulus_weight.h,\n modulus_weight.exception\n )\n end", "def seuil()\n\t\treturn 0\n\tend", "def value\n\t\tself.baz_dot = 0 if !self.baz_dot\n\t\tself.rev_dot = 0 if !self.rev_dot\n\t\tresult = (self.baz_dot.to_f - self.rev_dot.to_f).round\n\tend", "def test_set_z_as_fixnum\n obj = Geom::Point3d.new\n obj.z = 1000\n result = obj.z\n expected = 1000\n assert_equal(expected, result, 'expected does not match result.')\n end", "def in_celsius\n if @type == :c\n @temp\n else\n (@temp.to_f - 32.0) * (5.0/9.0)\n end\n end", "def vpiZ!\n put_value(VpiZ, VpiScalarVal)\n end", "def zodiacValue(sign)\n return (sign)%12\nend", "def Float(p0) end", "def asa(m, u, tc)\n erlang_c(m.to_f, u.to_f) * tc.to_f / (m.to_f - u.to_f)\n end", "def cardinal_azimuth; end", "def float128()\n # Maybe some day\n raise NotImplementedError\n end", "def height\n a = self.orientation\n return 0.inch if not a\n a[0].z\nend", "def i64u\n r = little? ? BinUtils.get_int64_le(@data, @pos) : BinUtils.get_int64_be(@data, @pos)\n @pos += 8\n r\n end", "def metal_values value, metal, credits\n\tmetal = (credits.to_f/value.to_f).to_f\n\treturn metal\nend", "def zrotation\n end", "def luma(value)\n if value < 0\n 0\n elsif value > 255\n 255\n else\n value\n end\n end", "def unit!(x=1,y=1,z=1)\n scale!(1/modulus)\n end", "def pixel2mm(pixel_value)\n return pixel_value * pixel_unit;\n end", "def native_mag\n H87AttrSettings::DEFAULT_MAX_CHARGE\n end", "def unit_vector\n\t\tlen = self.r\n\t\traise Vector::ZeroOperation if (len == 0)\n\t\tself * (1/len)\n\t\t# Vector3D.new(@x*(1.0/len), @y*(1.0/len), @z*(1.0/len))\n\tend", "def zero(z = nil)\nif z == nil then return 0 end\nif z[0] == \"+\" then return z[1] end\nif z[0] == \"-\" then return 0 - z[1] end\nif z[0] == \"*\" then return 0 end\nif z[0] == \"/\" then return 0.00 end\nend", "def mag_from_db(decible)\r\n 10 ** (decible / 20.0)\r\n end", "def magnitude\n\t\tt = 0.0\n\t\tsize.times do |k|\n\t\t\tt += __get(k).abs2\n\t\tend\n\t\treturn Math.sqrt(t)\n\tend", "def cveclen(u)\n\tMath.sqrt(u[0,0]**2+u[1,0]**2+u[2,0]**2)\nend", "def screen_z_formula\n @shadow_point.screen_y + additional_z\n # Real Y position (without jumping) + Additional Z value\n end", "def indicator_luminance\n usb_get_indicator_luminance(dataIn: 1).unpack('C').first.to_f / 255.0\n end", "def float\n r = little? ? @data.byteslice(@pos, 4).unpack('e')[0] : @data.byteslice(@pos, 4).unpack('g')[0]\n @pos += 4\n r\n end", "def magnitude\r\n data.map do |f|\r\n f.abs\r\n end\r\n end", "def decode_uinteger_value(value)\n build_integer(value, 0, value.length)\n end", "def read_u4\n (read_u1 << 24) | read_u3\n end", "def povuci_mrezu\n return @mreza\n end", "def g(value)\n (value & 0x00ff0000) >> 16\n end", "def g(value)\n (value & 0x00ff0000) >> 16\n end", "def ∅?; self.real.zero?; end", "def asum; Blas::asum(@storage); end", "def screen_z\n # Return after calculating z-coordinate by order of members in party\n if self.index != nil\n return 4 - self.index\n else\n return 0\n end\n end", "def m3; 3 end", "def in_celsius\n \t@c ? @c : (@f - 32) * 5.0 / 9.0\n end", "def unpack_unsigned_long(value)\n value.unpack('V')[0]\n end", "def uint32()\n _uint32(\"uint32\")\n end", "def get_f64\n res, @data = @data.unpack(\"Ga*\")\n self.underrun! unless res\n res\n end", "def vat_number; end", "def convert_to_uv(abs_value, absolute_side)\n uv_value = (((abs_value.to_f - 0.5) / (absolute_side.to_f - 1)) - 0.5) * 2.0\n end", "def normalized_size\n\t\t\ttile_size(max_level) * @unit_size\n\t\tend", "def zettabytes\n self * ZETTABYTE\n end", "def r\n return (x**2.0 + y**2.0 + z**2.0)**0.5\n end", "def max_altitude; end", "def z=(value)\n end", "def test_set_z_as_float\n obj = Geom::Point3d.new\n obj.z = 1000.0\n result = obj.z\n expected = 1000.0\n assert_equal(expected, result, 'expected does not match result.')\n end", "def i64u\n little? ? BinUtils.get_int64_le(read(8)) : BinUtils.get_int64_be(read(8))\n end", "def zero?(z)\n raise Rus3::NumberRequiredError, z unless number?(z)\n z.zero?\n end", "def to_f(data)\n return ((data[1].ord + (256 * data[0].ord)) / 1.2)\n end", "def get_metals_value(space_units_array, metal, credits)\n\tnumeral = get_numeral_from_space_unit(space_units_array)\n\t@metals_values[metal] = credits.to_i / numeral.to_f\nend", "def read_imc_uint64\n name(\"imc_uint64\") do\n high = 0\n flag = peek { name(\"uint8_or_flag\") { read_uint8 } }\n\n if flag == 0xff\n # The high 32-bits are stored first as an ic_uint32.\n adjust(+1) # Skip the flag byte.\n high = name(\"high\") { read_ic_uint32 }\n flag = nil\n end\n\n # The low 32-bits are stored as an ic_uint32; pass the flag we already\n # read, so we don't have to read it again.\n low = name(\"low\") { read_ic_uint32(flag) }\n\n (high << 32) | low\n end\n end", "def y\n @hex.y\n end", "def vpm\n bpm / value\n end", "def asum()\n _asum()\n end", "def convert_to_fl_oz(amount, unit)\n\t\tcase unit\n\t\t\twhen 'gallon' then amount * 128\n\t\t\twhen 'quart' then amount * 32\n\t\t\twhen 'pint' then amount * 16\n\t\t\twhen 'cup' then amount * 8\n\t\t\twhen 'fl_oz' then amount\n\t\t\twhen 'Tbsp' then amount * 0.5\n\t\t\twhen 'tsp' then amount * 0.1666666666667\n\t\tend\n\tend", "def km_in_mi\n 0.621371192\n end" ]
[ "0.6043465", "0.6006474", "0.5899675", "0.5866685", "0.57574797", "0.57383895", "0.5709954", "0.57004696", "0.5652513", "0.55898327", "0.55563855", "0.55516213", "0.5547633", "0.5527039", "0.5519486", "0.5519486", "0.55054855", "0.55054855", "0.55045134", "0.54850674", "0.5417714", "0.5417106", "0.54098845", "0.54010946", "0.5383548", "0.5376114", "0.53698516", "0.5354207", "0.53206754", "0.5296689", "0.5286418", "0.5276178", "0.5251429", "0.5251429", "0.52448565", "0.52432984", "0.5235801", "0.5233247", "0.52126014", "0.52102876", "0.5204326", "0.52023345", "0.5188391", "0.51757", "0.51754075", "0.5175296", "0.5160331", "0.51555294", "0.51528966", "0.5150396", "0.51280206", "0.51271224", "0.5126748", "0.5124424", "0.5096283", "0.50915146", "0.509111", "0.5079815", "0.5076758", "0.50745213", "0.50692976", "0.50664103", "0.5066089", "0.50647885", "0.5061934", "0.5061908", "0.50493896", "0.50443965", "0.5043001", "0.5040648", "0.5039529", "0.5038349", "0.5031133", "0.5031133", "0.5027924", "0.5016681", "0.5012982", "0.50125194", "0.5003943", "0.50036454", "0.50023013", "0.49979824", "0.4997406", "0.49917358", "0.4989851", "0.49796575", "0.49706036", "0.4960557", "0.49600855", "0.4958235", "0.49555323", "0.49548987", "0.49543428", "0.49507755", "0.49438354", "0.49389932", "0.49386707", "0.49274462", "0.491198", "0.49115926" ]
0.6661136
0
GET /supplies_providers_loans/1 GET /supplies_providers_loans/1.json
def show @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id]) respond_to do |format| format.html # show.html.erb format.json { render json: @supplies_providers_loan } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n @supplies_loan = SuppliesLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_loan }\n end\n end", "def new\n @supplies_providers_loan = SuppliesProvidersLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end", "def new\n @supplies_loan = SuppliesLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_loan }\n end\n end", "def show\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end", "def show\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end", "def show\n @provider = current_company.providers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end", "def index\n @providers = current_company.providers.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @providers }\n end\n end", "def show\n @title = t('view.providers.show_title')\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end", "def show\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html { redirect_to provider_readme_url(@provider) } \n format.json { render json: @provider }\n end\n end", "def loans\n url = \"#{LOANS_PATH}/pre-approved\"\n data = perform_get(url)\n data || {}\n end", "def new\n @provider = current_company.providers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def show\n @loan = Loan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @loan }\n end\n end", "def index\n @shop_platinum_offers = Shop::PlatinumOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @shop_platinum_offers }\n end\n end", "def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def show\n @providers = @profile.providers_data\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @profile }\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 @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def show\n @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_platinum_offer }\n end\n end", "def index\n render json: Loan.all\n end", "def show\n @payment_provider = PaymentProvider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @payment_provider }\n end\n end", "def index\n @providers = Provider.all\n \n respond_to do |format|\n format.json {render json: @providers}\n format.xml {render xml: @providers}\n end\n end", "def index\n @plans = Plan.all\n\n render json: @plans\n end", "def show\n @cloud_provider = current_user.cloud_providers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @cloud_provider }\n end\n end", "def destroy\n @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id])\n @supplies_providers_loan.destroy\n\n respond_to do |format|\n format.html { redirect_to supplies_providers_loans_url }\n format.json { head :no_content }\n end\n end", "def index\n @supplysites = Supplysite.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplysites }\n end\n end", "def show\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @shop_bonus_offer }\n end\n end", "def get_brandings\n request :get, \"/v3/brandings.json\"\n end", "def show\n @supplysite = Supplysite.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplysite }\n end\n end", "def show\n @app = @client.app(params[:id])\n @paas_providers = cached_providers\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @app }\n end\n end", "def new\n @offering = Offering.new\n @resources = Resource.find_all_by_user_id current_user.id\n @select = []\n @resources.each do |resource|\n addresses = Address.find_all_by_id resource.address_id\n addresses.each do |address|\n @select << [address.street + \", \" + address.number.to_s + \" - \" + resource.place, resource.id]\n end\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offering }\n end\n end", "def index\n @providers = Provider.all\n end", "def index\n @offers = Offer.all\n\n render json: @offers\n end", "def index\n @provider_contacts = ProviderContact.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @provider_contacts }\n format.json {\n if params[:provider_id] != nil\n #The first int in the array for the provider id is the id of the selected provider and the second is the id for the unspecified provider so unspecified shous up in the list\n @provider_contacts = ProviderContact.select(\"id, name\").where(:provider_id => [params[:provider_id], Provider.find_by_name('unspecified').id])\n end\n render :json => @provider_contacts \n }\n end\n end", "def show\r\n @applied_loan_detail = AppliedLoanDetail.find(params[:id])\r\n\r\n respond_to do |format|\r\n format.html # show.html.erb\r\n format.json { render json: @applied_loan_detail }\r\n end\r\n end", "def show\n @inter_library_loan = InterLibraryLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @inter_library_loan }\n end\n end", "def index\n @care_plans = CarePlan.all\n render json: @care_plans\n end", "def index_loans_for_bundle\n @bundles = Bundle.find(params[:id])\n\n respond_to do |format|\n format.html { render 'loans/index'}\n format.xml { render :xml => @bundles }\n end\n end", "def new\n @shop_platinum_offer = Shop::PlatinumOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_platinum_offer }\n end\n end", "def new\n @cloud_provider = current_user.cloud_providers.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cloud_provider }\n end\n end", "def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan }\n end\n end", "def show\n @data_provider = DataProvider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @data_provider }\n end\n end", "def show\n @lab_supplier = LabSupplier.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @lab_supplier }\n end\n end", "def index\n @pledges = Pledge.where('user_id = ?', current_user.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @pledges }\n end\n end", "def index\n @tenants = keystone.tenants\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render :json => @tenants }\n end\n end", "def index\n @site_plans = @product.site_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @site_plans }\n end\n end", "def index\n @floor_plans = @product.floor_plans\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @floor_plans }\n end\n end", "def index\n @plans = Plan.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @plans }\n end\n end", "def index\n @livingsupplies = Livingsupply.all\n end", "def new\n @supplysite = Supplysite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplysite }\n end\n end", "def show\n @player_loan = PlayerLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @player_loan }\n end\n end", "def index\n @power_supplies = PowerSupply.all.to_a\n render(json: @power_supplies.map do |power_supply|\n setup_power_supply_properties power_supply\n power_supply.properties\n end)\n end", "def new\n redirect_unless_admin\n hide_left_menu\n \n @gift_card = GiftCard.new\n @type = SupplierAccountType.find_by_name(\"Vestidos Boutique\")\n @supplier_accounts = SupplierAccount.where(\"supplier_account_type_id = ?\", @type.id).approved\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gift_card }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.xml # show.xml.builder\n format.json { render :json => @service_provider.to_json }\n end\n end", "def index\n @providerservices = Providerservice.all\n end", "def show\n @admin_whitelist = Admin::Whitelist.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @admin_whitelist }\n end\n end", "def loan\n Reggora::Resources::Loan.new(config)\n end", "def new\n @offer = Offer.new\n if can? :manage, @offer\n @venue_names = current_user.venues.pluck(:venue_name)\n #@venue_names = current_user.venues.select('venues.id, venue_name')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n else\n redirect_to offers_path\n end\n end", "def index\n @supplier_providers = Supplier::Provider.all\n end", "def index\n @public_offers = @club.public_offers\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "def specific\n @state = State.find(params[:id])\n @loans = @state.loans.where(:purpose_id == params[:purpose_id])\n render json: { state: @state, loans: @loans }\n end", "def show\n @pokeparty = Pokeparty.find(params[:id])\n \n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @pokeparty }\n end\n end", "def 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 show\n render \"api/v1/bounties/show\"\n end", "def index\n @title = t('view.providers.index_title')\n @searchable = true\n @providers = Provider.filtered_list(params[:q]).order(:name).page(params[:page])\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @providers }\n end\n end", "def show\n @borrower = Borrower.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @borrower }\n end\n end", "def show\n @clientsOffers = ClientsOffers.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @clientsOffers }\n end\n end", "def index\n @power_supplies = PowerSupply.all\n end", "def index\n @power_supplies = PowerSupply.all\n end", "def new\n @admin_whitelist = Admin::Whitelist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_whitelist }\n end\n end", "def show\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @provider }\n end\n end", "def index\n @plants = Plant.all\n\n respond_to do |format|\n format.html\n format.json { render :json => @plants }\n end\n end", "def current\n batles = BatlePool.instance.all\n render json: batles,\n except: :location_id,\n include: [:heroes, :threat],\n status: :ok\n end", "def offers\n ApiGift.where('user_id_giver = ? and provider = ?', user_id, provider).includes(:gift)\n end", "def index\n @data_providers = DataProvider.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @data_providers }\n end\n end", "def index\n @applicants = Applicant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @applicants }\n end\n end", "def show\n @kennel_litter = KennelLitter.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @kennel_litter }\n end\n end", "def index\n @offers = Offer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @offers }\n end\n end", "def new\n @shop_bonus_offer = Shop::BonusOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_bonus_offer }\n end\n end", "def new\n @pin = current_user.pins.new\n @items_types = ITEM_TYPE_LIST\n @brands = Brand.find(:all, :order => \"name\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end", "def show\n @release_loan = ReleaseLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @release_loan }\n end\n end", "def new\n @administration_offering = Administration::Offering.new\n load_merchants\n @merchant_offerings = Administration::MerchantOffering.find(:all)\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @administration_offering }\n end\n end", "def show\n @providerable, @name = find_polymorphic\n @provider = ProviderInsurance.find(params[:id])\n @title = @name.titleize + \" Provider Insurance\"\n @show = true\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @provider }\n end\n end", "def list_tenants_for_circles(args = {}) \n get(\"/tenants.json/circles\", args)\nend", "def new\n @flavours = @provider.get_flavors\n puts \"getting the flavors #{@flavours.inspect}\"\n @images = @provider.get_images\n puts \"getting the flavors #{@images.inspect}\"\n @instance = @provider.instances.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instance }\n end\n end", "def index\n @supplemental_details = SupplementalDetail.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @supplemental_details }\n end\n end", "def new\n @preference = Preference.new\n @customer_names = Customer.all(:order => 'last_name ASC')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preference }\n end\n end", "def index\n @merchants = Merchant.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @merchants }\n end\n end", "def show\n @boat = Boat.find(params[:id])\n\n render json: @boat\n end", "def client_choose(offset = 10, limit = 20)\n response = Net::HTTP.get(\n URI(\"https://pokeapi.co/api/v2/pokemon/?offset=#{offset}&limit=#{limit}\")\n )\n \n JSON.parse(response)\nend", "def new\n @payment_provider = PaymentProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment_provider }\n end\n end", "def index\n @loans = @tool.loans.all\n end", "def index\n @chargers = Charger.all\n render json: @chargers\n end", "def index\n respond_with(@plans = Plan.all)\n end", "def new\n @stationeryrequest = Stationeryrequest.new\n # получить список предметов на складе\n @hotelsupplies = Hotelsupply.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stationeryrequest }\n end\n end", "def show\n render json: Seances::UseCases::AvailableSeats.new.call(id: params[:id])\n end", "def index\n @cryptostables = Cryptostable.all\n\n require 'uri'\n require 'net/http'\n require 'openssl'\n\n @url = \"https://pro-api.coinmarketcap.com/v1/cryptocurrency/listings/latest?CMC_PRO_API_KEY=#{ENV.fetch('CRYPTO')}&start=1&limit=500\"\n @uri = URI(@url)\n @response = Net::HTTP.get(@uri)\n @lookup_cryptos = JSON.parse(@response)\n @profit_loss = 0\n end", "def index\n @accepted_offers = AcceptedOffer.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @accepted_offers }\n end\n end", "def show\n p 'show?'\n @acceptances = []\n if(current_user)\n if(params[:id])\n @acceptance = Acceptance.find(params[:id])\n else\n @acceptances = Acceptance.where(\"user_id=? and (status=? or status = ?) and end_time> ?\", current_user.id, \"successfully paid\", \"payment pending\", Time.now())\n end\n end\n p \"acceptances are \"\n \n presenter = Api::V3::AcceptancesPresenter.new\n acceptances_json = @acceptances.map{|x| presenter.as_json(x)}\n p acceptances_json\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: acceptances_json }\n end\n end", "def show\n @promotersbind = Promotersbind.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @promotersbind }\n end\n end" ]
[ "0.7412478", "0.71966857", "0.69355094", "0.6468367", "0.6468367", "0.6420029", "0.62445724", "0.62176585", "0.61988497", "0.6192699", "0.61271405", "0.6050038", "0.6038974", "0.6025539", "0.6025539", "0.6006675", "0.5911915", "0.59048086", "0.59004813", "0.58405393", "0.58342934", "0.5817723", "0.5816665", "0.57949644", "0.5779677", "0.57770646", "0.5749038", "0.5745029", "0.5736422", "0.57335484", "0.5728102", "0.57280636", "0.5707334", "0.5705009", "0.5649519", "0.5643356", "0.5625442", "0.5621783", "0.5620036", "0.56158173", "0.5609393", "0.5606124", "0.56032276", "0.56025684", "0.5600115", "0.55998594", "0.559961", "0.5595404", "0.5590486", "0.55889654", "0.5584172", "0.55818766", "0.5576033", "0.5575228", "0.5573548", "0.5565777", "0.55643106", "0.5561386", "0.5559343", "0.55526793", "0.55444014", "0.55341524", "0.55264276", "0.55234885", "0.5521231", "0.5519064", "0.55104953", "0.5510023", "0.5510023", "0.5499231", "0.5496956", "0.5495303", "0.5480069", "0.54712653", "0.54693514", "0.54614526", "0.5459376", "0.5451677", "0.5447555", "0.54376435", "0.5431397", "0.543135", "0.54174435", "0.5408489", "0.5400225", "0.5398551", "0.5398195", "0.53968644", "0.5396313", "0.53827846", "0.5377972", "0.53779674", "0.53777707", "0.5376713", "0.5374199", "0.5361978", "0.5360514", "0.5359783", "0.5359336", "0.5356992" ]
0.7729894
0
GET /supplies_providers_loans/new GET /supplies_providers_loans/new.json
def new @supplies_providers_loan = SuppliesProvidersLoan.new respond_to do |format| format.html # new.html.erb format.json { render json: @supplies_providers_loan } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @supplies_loan = SuppliesLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_loan }\n end\n end", "def new\n @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 @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n @provider = current_company.providers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan }\n end\n end", "def create\n @title = t('view.providers.new_title')\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: t('view.providers.correctly_created') }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\r\n @provider = Provider.new\r\n render_new\r\n end", "def new\n @supplysite = Supplysite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplysite }\n end\n end", "def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end", "def new\n @cloud_provider = current_user.cloud_providers.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cloud_provider }\n end\n end", "def new\n @person = Person.new\n set_person_attribute_defaults(@person)\n @provider = Provider.find(params[:provider_id]) unless params[:provider_id].blank?\n if @provider\n @person.person_provider_links.build(:psu_code => @psu_code,\n :provider => @provider,\n :person => @person,\n :is_active_code => 1)\n @person.sampled_persons_ineligibilities.build(:psu_code => @psu_code,\n :person => @person,\n :provider => @provider)\n end\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render :json => @person }\n end\n end", "def new\n @payment_provider = PaymentProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment_provider }\n end\n end", "def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @borrow = Borrow.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow }\n end\n end", "def new\n @provider = Provider.new\n @provider.locations.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end", "def new\n @borrow_request = BorrowRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrow_request }\n end\n end", "def new\n @supplier = Supplier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplier }\n end\n end", "def new\n @pickup = Pickup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pickup }\n end\n end", "def new\n @borrower = Borrower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrower }\n end\n end", "def new\n @borrower = Borrower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @borrower }\n end\n end", "def create\n @provider = current_company.providers.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render action: 'show', status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @breadcrumb = 'create'\n @bank = Bank.new\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank }\n end\n end", "def new\n @pokeparty = Pokeparty.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pokeparty }\n end\n end", "def new\n @data_provider = DataProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @data_provider }\n end\n end", "def new\n @party = Party.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @party }\n end\n end", "def new\n @lost = Lost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lost }\n end\n end", "def new\n @new_policy = NewPolicy.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @new_policy }\n end\n end", "def new\n @provider_type = ProviderType.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider_type }\n end\n end", "def new\n @boat = Boat.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json {render json: @boat}\n end\n end", "def new\n @pin = current_user.pins.new\n @items_types = ITEM_TYPE_LIST\n @brands = Brand.find(:all, :order => \"name\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end", "def new\n @potluck = Potluck.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @potluck }\n end\n end", "def new\n @lift = Lift.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lift }\n end\n end", "def new\n @title = t('view.banks.new_title')\n @bank = Bank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank }\n end\n end", "def new\n @providerable, @name = find_polymorphic\n @provider = ProviderInsurance.new\n @title = @name.titleize + \" New Provider Insurance\"\n @all_insurance_company = InsuranceCompany.find(:all, :order => :name)\n @edit = true\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 @lookup = Lookup.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lookup }\n end\n end", "def new\n @patent = Patent.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @patent }\n end\n end", "def new\n @applicant = Applicant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @applicant }\n end\n end", "def new\n @applicant = Applicant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @applicant }\n end\n end", "def new\n @applicant = Applicant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @applicant }\n end\n end", "def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @stalking = Stalking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stalking }\n end\n end", "def new\n @prefer = Prefer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @prefer }\n end\n end", "def new\n @plan = Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plan }\n end\n end", "def new\n @plan = Plan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plan }\n end\n end", "def new\n @grant = Grant.new\n\n respond_to do |format|\n format.html { render :layout => false } # new.html.erb\n format.json { render json: @grant }\n end\n end", "def new\n @baton = Baton.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @baton }\n end\n end", "def new\n @lab_supplier = LabSupplier.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lab_supplier }\n end\n end", "def create\n @provider = Provider.new(provider_params)\n\n if @provider.save\n render json: @provider, status: :created, location: @provider\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end", "def new\n @corporations = Corporation.all(:select => \"id, name\").to_json\n @control_tower = ControlTower.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @control_tower }\n end\n end", "def new\n @lunchplan = Lunchplan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @lunchplan }\n end\n end", "def new\n @preference = Preference.new\n @customer_names = Customer.all(:order => 'last_name ASC')\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @preference }\n end\n end", "def new\n @shop_platinum_offer = Shop::PlatinumOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_platinum_offer }\n end\n end", "def new\n @cupon = Cupon.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cupon }\n end\n end", "def new\n @precinct = Precinct.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @precinct }\n end\n end", "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @offer = Offer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offer }\n end\n end", "def new\n @bill = Bill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bill }\n end\n end", "def new\n @bill = Bill.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bill }\n end\n end", "def new\n @plantype = Plantype.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plantype }\n end\n end", "def new\n @applicant = Applicant.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @applicant }\n end\n end", "def new\r\n @applied_loan_detail = AppliedLoanDetail.new(:applied_loan_id=>params[:applied_loan_id])\r\n\r\n respond_to do |format|\r\n format.html # new.html.erb\r\n format.json { render json: @applied_loan_detail }\r\n end\r\n end", "def new\n @provider = Provider.new\n end", "def new\n @provider_stat = ProviderStat.new\n @provider = Provider.find(params[:id])\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider_stat }\n end\n end", "def new\n\n @pin = Pin.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end", "def new\n @park = Park.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @park }\n end\n end", "def new\n @bank = Bank.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bank }\n end\n end", "def new\n @proveedor = Proveedor.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @proveedor }\n end\n end", "def new\n @pst = Pst.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @pst }\n end\n end", "def new\n @info_polen = InfoPolen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_polen }\n end\n end", "def new\n @info_polen = InfoPolen.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @info_polen }\n end\n end", "def new\n @clonet = Clonet.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @clonet }\n end\n end", "def new\n @pinn = current_user.pinns.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinn }\n end\n end", "def new\n @stationeryrequest = Stationeryrequest.new\n # получить список предметов на складе\n @hotelsupplies = Hotelsupply.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stationeryrequest }\n end\n end", "def new\n unless session[:admin]\n redirect_to lents_url\n return\n end\n\n @lent = Lent.new\n @free_cars = Car.where(condition: Car::Free).map{|x| x[:id]}\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @lent }\n end\n end", "def new\n @player_loan = PlayerLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @player_loan }\n end\n end", "def new\n @pinglun = Pinglun.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pinglun }\n end\n end", "def new\n @pony = Pony.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pony }\n end\n end", "def new\n @plate_cost = PlateCost.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @plate_cost }\n end\n end", "def new\n @breadcrumb = 'create'\n @supplier_payment = SupplierPayment.new\n @suppliers = suppliers_dropdown\n invoices = invoices_dropdown\n @supplier_invoices = invoices\n @approvals = approvals_dropdown_on_model(invoices)\n #@approvals = approvals_dropdown(invoices)\n @users = User.all\n @payment_methods = payment_methods_dropdown\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplier_payment }\n end\n end", "def new\n @pto = Pto.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pto }\n end\n end", "def new\n @withdrawal_request = WithdrawalRequest.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @withdrawal_request }\n end\n end", "def new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @resource }\n end\n end", "def new\n @newapp = Newapp.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @newapp }\n end\n end", "def new\n @breadcrumb = 'create'\n @use = Use.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @use }\n end\n end", "def new\n @partner = Partner.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @partner }\n end\n end", "def new\n @checkout = Checkout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @checkout }\n end\n end", "def new\n @checkout = Checkout.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @checkout }\n end\n end", "def new\n @flavours = @provider.get_flavors\n puts \"getting the flavors #{@flavours.inspect}\"\n @images = @provider.get_images\n puts \"getting the flavors #{@images.inspect}\"\n @instance = @provider.instances.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @instance }\n end\n end", "def new\n @settlement = Settlement.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @settlement }\n end\n end", "def new\n @village = Village.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @village }\n end\n end", "def new\n @where_to_stay = WhereToStay.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @where_to_stay }\n end\n end", "def new\n @release_loan = ReleaseLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @release_loan }\n end\n end", "def new\n @brother = Brother.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brother }\n end\n end", "def new\n @membership = Membership.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @membership }\n end\n end", "def new\n @grant_record = GrantRecord.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render :json => @grant_record }\n end\n end", "def new\n @breadcrumb = 'create'\n @sale_offer = SaleOffer.new\n @projects = projects_dropdown\n @work_orders = work_orders_dropdown\n @charge_accounts = projects_charge_accounts(@projects)\n @stores = stores_dropdown\n @clients = clients_dropdown\n @payment_methods = payment_methods_dropdown\n @status = sale_offer_statuses_dropdown\n # @products = products_dropdown\n @contracting_requests = contracting_requests_dropdown\n @approval = 'false'\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @sale_offer }\n end\n end" ]
[ "0.7858679", "0.7730011", "0.7593227", "0.7593227", "0.7569273", "0.73122126", "0.70767003", "0.7011588", "0.70106", "0.6993267", "0.69070226", "0.6868139", "0.68442243", "0.6826152", "0.680316", "0.6797949", "0.67949706", "0.67820007", "0.6753396", "0.6752861", "0.67484", "0.67484", "0.6721884", "0.6693479", "0.66848135", "0.66824", "0.66615796", "0.6645152", "0.66438216", "0.6640655", "0.6629927", "0.6625319", "0.66246516", "0.6620929", "0.66153437", "0.66139454", "0.66107196", "0.6606694", "0.65964687", "0.6591135", "0.6589303", "0.6589303", "0.65814704", "0.6564811", "0.65606153", "0.6560068", "0.6560068", "0.65579385", "0.65574425", "0.65546495", "0.65403426", "0.65347344", "0.65345734", "0.65327364", "0.6530203", "0.6530179", "0.65260124", "0.6518588", "0.6518588", "0.6518588", "0.6516497", "0.6516497", "0.6512438", "0.6512211", "0.6512114", "0.65047723", "0.6497053", "0.64963984", "0.6496307", "0.6496133", "0.64916456", "0.6488451", "0.64824146", "0.64824146", "0.6470417", "0.64704156", "0.646988", "0.64649594", "0.64556915", "0.6455215", "0.64544976", "0.6453761", "0.6453693", "0.6449844", "0.6448457", "0.64483875", "0.6447263", "0.6446024", "0.6443678", "0.6441166", "0.6441166", "0.64373463", "0.6436273", "0.64311844", "0.643053", "0.6429737", "0.64288354", "0.642877", "0.6423187", "0.64214367" ]
0.7965906
0
POST /supplies_providers_loans POST /supplies_providers_loans.json
def create @supplies_providers_loan = SuppliesProvidersLoan.new(params[:supplies_providers_loan]) @supply = Supply.find(@supplies_providers_loan.supply_id) @supply.stock_ini += @supplies_providers_loan.quantity @supplies_providers_loan.company_id = current_user.company_id respond_to do |format| if @supplies_providers_loan.save @supply.save format.html { redirect_to @supplies_providers_loan, notice: 'Supplies providers loan was successfully created.' } format.json { render json: @supplies_providers_loan, status: :created, location: @supplies_providers_loan } else format.html { render action: "new" } format.json { render json: @supplies_providers_loan.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def new\n @supplies_providers_loan = SuppliesProvidersLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end", "def new\n @supplies_loan = SuppliesLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_loan }\n end\n end", "def show\n @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end", "def provider_params\n params.require(:provider).permit(:name,\n loans_attributes: [:id, :name, :principle, :interest,\n :months_remaining, :payment, :_destroy])\n end", "def create\n @provider = current_company.providers.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def loans\n url = \"#{LOANS_PATH}/pre-approved\"\n data = perform_get(url)\n data || {}\n end", "def create\n @supplies_loan = SuppliesLoan.new(params[:supplies_loan])\n @supply = Supply.find(@supplies_loan.supply_id)\n @supply.stock_ini -= @supplies_loan.quantity\n @supplies_loan.company_id = current_user.company_id\n respond_to do |format|\n if @supplies_loan.save\n @supply.save\n format.html { redirect_to @supplies_loan, notice: 'Supplies loan was successfully created.' }\n format.json { render json: @supplies_loan, status: :created, location: @supplies_loan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @supplies_loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # puts \"provider_params #{provider_params}\"\n @provider = Provider.new(check_params)\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_page_url, notice: 'Поставщик успешно создан.' }\n format.json { render :show, status: :created, location: @provider }\n else\n # puts \"@provider.errors #{@provider.errors.full_messages}\"\n # puts \"@provider #{@provider.to_json}\"\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @supplies_loan = SuppliesLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_loan }\n end\n end", "def create\n @provider = Provider.new(provider_params)\n\n if @provider.save\n render json: @provider, status: :created, location: @provider\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end", "def create\n @loanable = current_user.loanables.new(loanable_params)\n\n respond_to do |format|\n if @loanable.save\n format.html { redirect_to users_loanable_path(@loanable), notice: 'Loanable was successfully created.' }\n format.json { render :show, status: :created, location: @loanable }\n else\n format.html { render :new }\n format.json { render json: @loanable.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render action: 'show', status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @title = t('view.providers.new_title')\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: t('view.providers.correctly_created') }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @provider = current_company.providers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def create\n @provider = Provider.new(params[:provider])\n @provider.active = true\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def create\n @provider = Provider.new(params[:provider])\n @services = Service.all\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_path, notice: 'As informacoes foram salvas com sucesso.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @providers_branch = Providers::Branch.new(providers_branch_params)\n\n respond_to do |format|\n if @providers_branch.save\n format.html { redirect_to providers_branches_path, notice: 'Branch was successfully created.' }\n format.json { redirect_to providers_branches_path, status: :created, location: @providers_branch }\n else\n format.html { render :new }\n format.json { render json: @providers_branch.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def new\n @provider = Provider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def destroy\n @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id])\n @supplies_providers_loan.destroy\n\n respond_to do |format|\n format.html { redirect_to supplies_providers_loans_url }\n format.json { head :no_content }\n end\n end", "def new\n @loan = Loan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @loan }\n end\n end", "def create\n @loan = Loan.new(loan_params)\n\n respond_to do |format|\n if @loan.save\n @item = @loan.item\n format.html { redirect_to @item, notice: I18n.t('views.loan.created') }\n format.json { render :show, status: :created, location: @loan }\n else\n format.html { render :new }\n format.json { render json: @loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @supplier_provider = Supplier::Provider.new(supplier_provider_params)\n\n respond_to do |format|\n if @supplier_provider.save\n format.html { redirect_to @supplier_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @supplier_provider }\n else\n format.html { render :new }\n format.json { render json: @supplier_provider.errors, status: :unprocessable_entity }\n end\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 @pin = current_user.pins.new\n @items_types = ITEM_TYPE_LIST\n @brands = Brand.find(:all, :order => \"name\")\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @pin }\n end\n end", "def create\n logger.debug \"!! create\"\n loan_params\n @loan = Loan.new(loan_params)\n # logger.debug loan_params\n\n respond_to do |format|\n if @loan.save\n format.html { redirect_to @loan, notice: 'Loan was successfully created.' }\n format.json { render action: 'show', status: :created, location: @loan }\n else\n format.html { render action: 'new' }\n format.json { render json: @loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def loan_params\n params.require(:loan).permit(:description, :value, :date, :taker_id, :provider_id)\n end", "def new\n @admin_whitelist = Admin::Whitelist.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @admin_whitelist }\n end\n end", "def create\n @provider = Provider.new(provider_params)\n @provider.user_id = current_user.id\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def provider_bonu_params\n params.require(:provider_bonu).permit(:provider_id, :intent, :bonus)\n end", "def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n flash[:notice] = 'Provider was successfully created.'\n format.html { redirect_to providers_path }\n format.xml { render :xml => @provider, :status => :created, :location => @provider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @loan = Loan.new(loan_params)\n @book = Book.find_by( params[:book_id] )\n\n respond_to do |format|\n if @loan.save\n format.html { redirect_to @loan, notice: 'Book successfully borrowed' }\n format.json { render :show, status: :created, location: @loan }\n else\n format.html { redirect_to books_path, alert: 'Book not available' }\n end\n end\n end", "def create\n @loan = @tool.loans.new(create_loan_params)\n\n @loan.borrower_id = session[:student_id]\n @tool.update(:quantity => @tool.quantity - @loan.tool_quantity)\n @loan.accepted = false\n\n respond_to do |format|\n if @loan.save\n format.html { redirect_to home_path, notice: 'Loan was successfully created.' }\n format.json { render :show, status: :created, location: @loan }\n else\n format.html { render :new }\n format.json { render json: @loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @livingsupply = Livingsupply.new(livingsupply_params)\n\n respond_to do |format|\n if @livingsupply.save\n format.html { redirect_to @livingsupply, notice: 'Livingsupply was successfully created.' }\n format.json { render :show, status: :created, location: @livingsupply }\n else\n format.html { render :new }\n format.json { render json: @livingsupply.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @loan_type = LoanType.new(loan_type_params)\n\n respond_to do |format|\n if @loan_type.save\n format.html { redirect_to @loan_type, notice: 'Loan type was successfully created.' }\n format.json { render :show, status: :created, location: @loan_type }\n else\n format.html { render :new }\n format.json { render json: @loan_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @player_loan = PlayerLoan.new(params[:player_loan])\n\n respond_to do |format|\n if @player_loan.save\n format.html { redirect_to @player_loan, notice: 'Player loan was successfully created.' }\n format.json { render json: @player_loan, status: :created, location: @player_loan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @player_loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @info_provider = Info::Provider.new(info_provider_params)\n\n respond_to do |format|\n if @info_provider.save\n format.html { redirect_to @info_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @info_provider }\n else\n format.html { render :new }\n format.json { render json: @info_provider.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 @payment_provider = PaymentProvider.new(params[:payment_provider])\n\n respond_to do |format|\n if @payment_provider.save\n format.html { redirect_to @payment_provider, notice: 'Payment provider was successfully created.' }\n format.json { render json: @payment_provider, status: :created, location: @payment_provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @payment_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n ProviderAdmin.create(:member_id =>params[:member_id], :provider_id => @provider.id, :active=>true)\n format.html { redirect_to(@provider, :notice => 'Provider was successfully created.') }\n format.xml { render :xml => @provider, :status => :created, :location => @provider }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @stationeryrequest = Stationeryrequest.new\n # получить список предметов на складе\n @hotelsupplies = Hotelsupply.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stationeryrequest }\n end\n end", "def create\n @loan_management = LoanManagement.new(loan_management_params)\n\n respond_to do |format|\n if @loan_management.save\n format.html { redirect_to @loan_management, notice: 'Loan management was successfully created.' }\n format.json { render :show, status: :created, location: @loan_management }\n else\n format.html { render :new }\n format.json { render json: @loan_management.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @home_loan = HomeLoan.new(data: params[:home_loan])\n\n respond_to do |format|\n if @home_loan.save\n format.html { redirect_to @home_loan, notice: 'Home loan was successfully created.' }\n format.json { render :show, status: :created, location: @home_loan }\n else\n format.html { render :new }\n format.json { render json: @home_loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @loan = Loan.new(params[:loan])\n\n respond_to do |format|\n if @loan.save\n flash[:notice] = 'Loan was successfully created.'\n format.html { redirect_to(@loan) }\n format.xml { render :xml => @loan, :status => :created, :location => @loan }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @loan.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @loan_officer = LoanOfficer.new(loan_officer_params)\n\n respond_to do |format|\n if @loan_officer.save\n format.html { redirect_to @loan_officer, notice: 'Loan officer was successfully created.' }\n format.json { render :show, status: :created, location: @loan_officer }\n else\n format.html { render :new }\n format.json { render json: @loan_officer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @release_loan = ReleaseLoan.new(params[:release_loan])\n\n respond_to do |format|\n if @release_loan.save\n format.html { redirect_to @release_loan, notice: 'Release loan was successfully created.' }\n format.json { render json: @release_loan, status: :created, location: @release_loan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @release_loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n redirect_unless_admin\n hide_left_menu\n \n @gift_card = GiftCard.new\n @type = SupplierAccountType.find_by_name(\"Vestidos Boutique\")\n @supplier_accounts = SupplierAccount.where(\"supplier_account_type_id = ?\", @type.id).approved\n \n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @gift_card }\n end\n end", "def new\n @brandslip_suggestion = BrandslipSuggestion.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @brandslip_suggestion }\n end\n end", "def create\n @loan = Loan.new(loan_params)\n respond_to do |format|\n if @loan.save\n Reservation.check_and_delete_reservation(@loan.user_id, @loan.book_id)\n if !params[:loan][:prev_loan_id].blank?\n prev_loan_id = params[:loan][:prev_loan_id]\n Loan.return_book(Loan.get_loan_by_id(prev_loan_id))\n end\n format.html { redirect_to loans_user_all_path(:id => @loan.user_id), notice: 'Výpůjčka byla úspěšně uložena do databáze.' }\n format.json { render :show, status: :created, location: @loan }\n else\n flash.now[:error] = @loan.errors.full_messages\n @users = User.all.order(:surname)\n @book_id = @loan.book_id\n @book = Book.search_by_czu_number(@book_id)\n @loan_length = Setting.get_loan_time\n @all_reservations = Reservation.get_all_book_reservations(@book_id).order(\"created_at ASC\")\n @reservation_count = @all_reservations.count\n format.html { render :new, error: 'Výpůjčka nebyla uložena do databáze.'}\n format.json { render json: @loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @loan = Loan.new(loan_params)\n @loan.amount = loan_params[:amount].gsub(/,/, '').to_f\n @loan.property_value = loan_params[:property_value].gsub(/,/, '').to_f\n\n if @loan.save\n # conduct first test for loan approval\n if @loan.ltv < 40\n @loan.update_attributes(:accepted => true)\n end\n redirect_to \"/loans/#{@loan.id}\"\n else\n flash[:error_hash] = @loan.errors.messages\n flash[:error] = @loan.errors.full_messages\n flash[:error_list] = @loan.errors.messages.keys\n redirect_to :back\n end\n end", "def create\n @loan_servicer = LoanServicer.new(loan_servicer_params)\n\n respond_to do |format|\n if @loan_servicer.save\n format.html { redirect_to @loan_servicer, notice: 'Loan servicer was successfully created.' }\n format.json { render action: 'show', status: :created, location: @loan_servicer }\n else\n format.html { render action: 'new' }\n format.json { render json: @loan_servicer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @loan = Loan.new(loan_params.merge(user: current_user))\n\n respond_to do |format|\n if @loan.save\n format.html { redirect_to books_path, notice: \"Book added to your library\" }\n else\n format.html { render :new, status: :unprocessable_entity }\n end\n end\n end", "def update\n @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id])\n\n respond_to do |format|\n if @supplies_providers_loan.update_attributes(params[:supplies_providers_loan])\n format.html { redirect_to @supplies_providers_loan, notice: 'Supplies providers loan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @supplies_providers_loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_loan_params\n params.require(:loan).permit(:accepted, :returned, :borrower_id, :owner_id, :tool_quantity, :start, :end)\n end", "def create\n @data_provider = DataProvider.new(params[:data_provider])\n\n respond_to do |format|\n if @data_provider.save\n format.html { redirect_to root_path, notice: 'Data provider was successfully created.' }\n format.json { render json: @data_provider, status: :created, location: @data_provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @data_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @shop_platinum_offer = Shop::PlatinumOffer.new(params[:shop_platinum_offer])\n\n respond_to do |format|\n if @shop_platinum_offer.save\n format.html { redirect_to @shop_platinum_offer, notice: 'Platinum offer was successfully created.' }\n format.json { render json: @shop_platinum_offer, status: :created, location: @shop_platinum_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_platinum_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @brandslip_suggestion = BrandslipSuggestion.new(params[:brandslip_suggestion])\n\n respond_to do |format|\n if @brandslip_suggestion.save\n format.html { redirect_to @brandslip_suggestion, notice: 'Brandslip suggestion was successfully created.' }\n format.json { render json: @brandslip_suggestion, status: :created, location: @brandslip_suggestion }\n else\n format.html { render action: \"new\" }\n format.json { render json: @brandslip_suggestion.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @lanparty = Lanparty.new(lanparty_params) \n\n respond_to do |format|\n if @lanparty.save\n format.html { redirect_to @lanparty, notice: 'Lanparty was successfully created.' }\n format.json { render :show, status: :created, location: @lanparty }\n else\n format.html { render :new }\n format.json { render json: @lanparty.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @loan = Loan.new loan_params\n\n if @loan.save\n redirect_to @loan\n else\n render 'new'\n end\n end", "def light_supply_params\n params.require(:light_supply).permit(:provider, :house_id)\n end", "def destroy\n @supplies_loan = SuppliesLoan.find(params[:id])\n @supplies_loan.destroy\n\n respond_to do |format|\n format.html { redirect_to supplies_loans_url }\n format.json { head :no_content }\n end\n end", "def create\n @offer = Offer.find(params[:filter])\n @bill = @offer.bills.create()\n respond_to do |format|\n if @bill\n format.html { render :template => \"bills/edit\", :layout => false}\n end\n end\n end", "def create\n @admin_whitelist = Admin::Whitelist.new(params[:admin_whitelist])\n\n respond_to do |format|\n if @admin_whitelist.save\n format.html { redirect_to @admin_whitelist, notice: 'Whitelist was successfully created.' }\n format.json { render json: @admin_whitelist, status: :created, location: @admin_whitelist }\n else\n format.html { render action: \"new\" }\n format.json { render json: @admin_whitelist.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @provider = Provider.new\n @provider.locations.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.xml { render :xml => @provider }\n end\n end", "def create\n @shop_bonus_offer = Shop::BonusOffer.new(params[:shop_bonus_offer])\n\n respond_to do |format|\n if @shop_bonus_offer.save\n format.html { redirect_to @shop_bonus_offer, notice: 'Bonus offer was successfully created.' }\n format.json { render json: @shop_bonus_offer, status: :created, location: @shop_bonus_offer }\n else\n format.html { render action: \"new\" }\n format.json { render json: @shop_bonus_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @market_offering = MarketOffering.new(market_offering_params)\n authorize @market_offering\n respond_to do |format|\n if @market_offering.save\n format.html { redirect_to @market_offering, notice: 'Market offering was successfully created.' }\n format.json { render :show, status: :created, location: @market_offering }\n else\n format.html { render :new }\n format.json { render json: @market_offering.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_loan\n # helper method to create a loan and return that loan\n options = { holder: test_holder, borrowed: 1000, term: 2, rate: 2 }\n # hash of key value pairs to initialise loan\n Loan.new(options, 5)\n # creates loan and returns it\n end", "def create\n @bill = current_user_or_guest.bills.new(bill_params)\n\n respond_to do |format|\n if @bill.save\n format.html { redirect_to(@bill, notice: t('bill.created')) }\n format.xml { render xml: @bill, status: :created, location: @bill }\n format.xml { render json: @bill, status: :created, location: @bill }\n else\n format.html { render action: \"new\" }\n format.xml { render xml: @bill.errors, status: :unprocessable_entity }\n format.xml { render json: @bill.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @offering = Offering.new\n @resources = Resource.find_all_by_user_id current_user.id\n @select = []\n @resources.each do |resource|\n addresses = Address.find_all_by_id resource.address_id\n addresses.each do |address|\n @select << [address.street + \", \" + address.number.to_s + \" - \" + resource.place, resource.id]\n end\n end\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @offering }\n end\n end", "def new\n @loan = Loan.new(\n :ower_id => params[:ower_id ],\n :creditor_id => params[:creditor_id],\n :tags => params[:tags ],\n :description => params[:description]\n )\n end", "def new\n @supplysite = Supplysite.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplysite }\n end\n end", "def new\n @shop_platinum_offer = Shop::PlatinumOffer.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @shop_platinum_offer }\n end\n end", "def create\n @provider_provider_type = Provider::ProviderType.new(provider_provider_type_params)\n @provider_provider_type.user_created_id = current_user.id\n respond_to do |format|\n if @provider_provider_type.save\n format.html { redirect_to provider_provider_types_path, notice: I18n.t('provider_types.controller.create') }\n format.json { render :show, status: :created, location: @provider_provider_type }\n else\n format.html { render :new }\n format.json { render json: @provider_provider_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @person = Person.new\n set_person_attribute_defaults(@person)\n @provider = Provider.find(params[:provider_id]) unless params[:provider_id].blank?\n if @provider\n @person.person_provider_links.build(:psu_code => @psu_code,\n :provider => @provider,\n :person => @person,\n :is_active_code => 1)\n @person.sampled_persons_ineligibilities.build(:psu_code => @psu_code,\n :person => @person,\n :provider => @provider)\n end\n\n respond_to do |format|\n format.html # new.html.haml\n format.json { render :json => @person }\n end\n end", "def new\n @cloud_provider = current_user.cloud_providers.new\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @cloud_provider }\n end\n end", "def create\n @loan_registration = LoanRegistration.new(loan_registration_params)\n\n respond_to do |format|\n if @loan_registration.save\n format.html { redirect_to @loan_registration, notice: 'Loan registration was successfully created.' }\n format.json { render :show, status: :created, location: @loan_registration }\n else\n format.html { render :new }\n format.json { render json: @loan_registration.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @provider_payment = ProviderPayment.new(provider_payment_params)\n\n respond_to do |format|\n if @provider_payment.save\n @provider_payment.provider.update(status: @provider_payment.provider.set_status)\n\n format.html { redirect_to provider_path(@provider_payment.provider), notice: 'Provider payment was successfully created.' }\n format.json { render :show, status: :created, location: @provider_payment }\n else\n format.html { render :new }\n format.json { render json: @provider_payment.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @smsloan = Smsloan.new(smsloan_params)\n\n respond_to do |format|\n if @smsloan.save\n format.html { redirect_to @smsloan, notice: 'Smsloan was successfully created.' }\n format.json { render :show, status: :created, location: @smsloan }\n else\n format.html { render :new }\n format.json { render json: @smsloan.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n banners = Banner.where(:id => params[:platform].delete(:banners))\n @platform = Platform.new(params[:platform])\n @platform.banners = banners\n\n respond_to do |format|\n if @platform.save\n format.html { redirect_to @platform, notice: 'Platform was successfully created.' }\n format.json { render json: @platform, status: :created, location: @platform }\n else\n format.html { render action: \"new\" }\n format.json { render json: @platform.errors, status: :unprocessable_entity }\n end\n end\n end", "def register_new(provider_data)\n location = Location.find_or_create_by(zip_code: provider_data[:zip_code])\n competencies = provider_data[:competencies].select{|k, v| v == 1}.keys\n provider = location.providers.new(provider_data)\n if provider.save\n competencies.each do |competency|\n assessment = Assessment.find_by(word: competency)\n provider.competencies.create(assessment: assessment)\n end\n end\n end", "def create\n @borrower = @mortgage.borrowers.new(borrower_params)\n\n respond_to do |format|\n if @borrower.save\n flash[:notice] = 'Borrower was successfully created.'\n format.html { redirect_to edit_borrower_path @borrower }\n format.json { render :show, status: :created, location: @borrower }\n else\n format.html { render :new }\n format.json { render json: @borrower.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n # @bonu = Bonus.new(bonus_params)\n #\n # if @bonus.save\n # render :show, status: :created, location: @bonus\n # else\n # render json: @bonus.errors, status: :unprocessable_entity\n # end\n end", "def new\n @stalking = Stalking.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @stalking }\n end\n end", "def new\n @payment_provider = PaymentProvider.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @payment_provider }\n end\n end", "def create\n @borrower = Borrower.new(params[:borrower])\n respond_to do |format|\n if @borrower.save\n format.html { redirect_to @borrower, notice: 'Borrower was successfully created.' }\n format.json { render json: @borrower, status: :created, location: @borrower }\n else\n format.html { render action: \"new\" }\n format.json { render json: @borrower.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n RateServices::UpdateLoanDataFromSelectedRate.call(params[:id], params[:rate][:fees], rate_params, params[:rate][:thirty_fees], params[:rate][:prepaid_fees])\n\n @loan.submitted!\n rental_properties = Property.where(is_primary: false, is_subject: false, loan: @loan)\n @loan.borrower.update(other_properties: JSON.dump(rental_properties.as_json(Property.json_options))) if rental_properties.present?\n\n # create the first loan activity\n activity = ActivityType.find_or_create_by(label: \"Start processing\", order_number: 1) do |f|\n f.activity_names << ActivityName.find_or_create_by(name: \"Submitted loan to MortgageClub\")\n end\n\n user = User.where(email: \"billy@mortgageclub.co\").last\n # add the first activity to loan\n LoanActivityServices::CreateActivity.new.call(user.loan_member, loan_activity_params(activity, @loan)) if user\n\n @loan.reload\n update_rate\n\n redirect_to \"/my/dashboard/#{params[:id]}\"\n\n # bootstrap(\n # loan: LoanDashboardPage::LoanPresenter.new(@loan).show,\n # rate: params[:rate]\n # )\n\n # respond_to do |format|\n # format.html { render template: 'borrower_app' }\n # end\n end", "def new\n @player_loan = PlayerLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @player_loan }\n end\n end", "def create\n @borrower = Borrower.new(params[:borrower])\n\n respond_to do |format|\n if @borrower.save\n format.html { redirect_to @borrower, notice: 'Borrower was successfully created.' }\n format.json { render json: @borrower, status: :created, location: @borrower }\n else\n format.html { render action: \"new\" }\n format.json { render json: @borrower.errors, status: :unprocessable_entity }\n end\n end\n end", "def create_loan\n book = Book.find(params[:book_id])\n book_loan = Log.create!(user: current_user, book: book, classification: Log.classifications[:book_loan],\n date: DateTime.now, due_date: 3.weeks.from_now)\n render json: book_loan, book_loan: true, status: :created\n end", "def create\n form = NewMarketplaceForm.new(params)\n return render status: 400, json: form.errors unless form.valid?\n\n # As there's no community yet, we store the global service name to thread\n # so that mail confirmation email is sent from global service name instead\n # of the just created marketplace's name\n ApplicationHelper.store_community_service_name_to_thread(APP_CONFIG.global_service_name)\n\n marketplace = MarketplaceService::API::Marketplaces.create(\n params.slice(:marketplace_name,\n :marketplace_type,\n :marketplace_country,\n :marketplace_language)\n .merge(payment_process: :preauthorize)\n )\n\n # Create initial trial plan\n plan = {\n expires_at: Time.now.change({ hour: 9, min: 0, sec: 0 }) + 31.days\n }\n PlanService::API::Api.plans.create_initial_trial(community_id: marketplace[:id], plan: plan)\n\n if marketplace\n TransactionService::API::Api.settings.provision(\n community_id: marketplace[:id],\n payment_gateway: :paypal,\n payment_process: :preauthorize,\n active: true)\n end\n\n user = UserService::API::Users.create_user({\n given_name: params[:admin_first_name],\n family_name: params[:admin_last_name],\n email: params[:admin_email],\n password: params[:admin_password],\n locale: params[:marketplace_language]},\n marketplace[:id]).data\n\n auth_token = UserService::API::AuthTokens.create_login_token(user[:id])\n url = URLUtils.append_query_param(marketplace[:url], \"auth\", auth_token[:token])\n\n assign_onboarding_feature_flag(community_id: marketplace[:id])\n\n # TODO handle error cases with proper response\n\n render status: 201, json: {\"marketplace_url\" => url, \"marketplace_id\" => marketplace[:id]}\n end", "def createLoanRequest\n puts 'GOT REQUEST'\n puts params.inspect\n\n # Persist to the database for some reason\n req = LoanRequest.new\n req.ssn = params[:ssn]\n req.creditScore = params[:creditScore]\n req.loanAmount = params[:loanAmount]\n req.loanDuration = params[:loanDuration]\n req.save\n\n reply_to = request.headers['HTTP_REPLY_TO']\n\n #TODO: Get a job in a bank and find out how this are calculated\n randomInterestRate = randomInterest(1, 5).round(2)\n\n result = {\n interestRate: randomInterestRate,\n ssn: req.ssn\n }\n\n conn = Bunny.new\n conn.start\n ch = conn.create_channel\n q = ch.queue(reply_to)\n\n ch.default_exchange.publish(result.to_json, routing_key: q.name)\n\n render :json => result.to_json\n end", "def create\n @loan_application = LoanApplication.new(loan_application_params)\n\n respond_to do |format|\n if @loan_application.save\n format.html { redirect_to @loan_application, notice: 'Loan application was successfully created.' }\n format.json { render :show, status: :created, location: @loan_application }\n else\n format.html { render :new }\n format.json { render json: @loan_application.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @expense_buddy = ExpenseBuddy.new(expense_buddy_params)\n\n respond_to do |format|\n if @expense_buddy.save\n format.html { redirect_to @expense_buddy, notice: 'Expense buddy was successfully created.' }\n format.json { render :show, status: :created, location: @expense_buddy }\n else\n format.html { render :new }\n format.json { render json: @expense_buddy.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @bill = @dwelling.bills.build\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bill }\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 @supply = Supply.new(supply_params)\n\n respond_to do |format|\n if @supply.save\n format.html { redirect_to supplies_path, notice: 'Goods was successfully created.' }\n format.json { render :show, status: :created, location: @supply }\n else\n format.html { render :new }\n format.json { render json: @supply.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @sulabh_loan_confirm = SulabhLoanConfirm.new(sulabh_loan_confirm_params)\n\n respond_to do |format|\n if @sulabh_loan_confirm.save\n format.html { redirect_to @sulabh_loan_confirm, notice: 'Sulabh loan confirm was successfully created.' }\n format.json { render :show, status: :created, location: @sulabh_loan_confirm }\n else\n format.html { render :new }\n format.json { render json: @sulabh_loan_confirm.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.68659556", "0.6658662", "0.5999306", "0.5947909", "0.5892493", "0.5863105", "0.58490545", "0.58364147", "0.5799118", "0.5791754", "0.5778713", "0.57750654", "0.57271034", "0.5725775", "0.5708938", "0.5701417", "0.5678862", "0.5665165", "0.5657129", "0.56388474", "0.5562539", "0.5562539", "0.5546584", "0.5527245", "0.5520371", "0.5520192", "0.55001545", "0.5487328", "0.54784983", "0.5435185", "0.5421461", "0.54179144", "0.5396305", "0.53895813", "0.53866065", "0.5383907", "0.5375887", "0.5366688", "0.53550565", "0.5347806", "0.53474927", "0.5342216", "0.53206456", "0.53182507", "0.52722526", "0.52569693", "0.52282524", "0.52220356", "0.52214825", "0.52149457", "0.52122885", "0.52119154", "0.5210771", "0.5189545", "0.5182459", "0.5182043", "0.51781505", "0.5177637", "0.5175525", "0.5174513", "0.51743466", "0.51709354", "0.516641", "0.5162665", "0.5151004", "0.5148774", "0.5148218", "0.51427895", "0.5129827", "0.5128945", "0.51252425", "0.51167095", "0.5115355", "0.5114733", "0.511361", "0.5112982", "0.5103154", "0.5095041", "0.50933695", "0.5090053", "0.508695", "0.50815785", "0.50812787", "0.50764185", "0.50733674", "0.50695693", "0.5062153", "0.50601065", "0.5058767", "0.50564015", "0.50501734", "0.5046669", "0.50317883", "0.5029323", "0.50264686", "0.502434", "0.50201076", "0.50174487", "0.5017343", "0.50155884" ]
0.5731408
12
PUT /supplies_providers_loans/1 PUT /supplies_providers_loans/1.json
def update @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id]) respond_to do |format| if @supplies_providers_loan.update_attributes(params[:supplies_providers_loan]) format.html { redirect_to @supplies_providers_loan, notice: 'Supplies providers loan was successfully updated.' } format.json { head :no_content } else format.html { render action: "edit" } format.json { render json: @supplies_providers_loan.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n @supplies_loan = SuppliesLoan.find(params[:id])\n\n respond_to do |format|\n if @supplies_loan.update_attributes(params[:supplies_loan])\n format.html { redirect_to @supplies_loan, notice: 'Supplies loan was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @supplies_loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @provider = current_company.providers.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @supplies_providers_loan = SuppliesProvidersLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end", "def update\n @provider = Provider.find(params[:id])\n\n if @provider.update(provider_params)\n head :no_content\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end", "def update\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to provider_readme_url(@provider), notice: 'Provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_providers_loan }\n end\n end", "def create\n @supplies_loan = SuppliesLoan.new(params[:supplies_loan])\n @supply = Supply.find(@supplies_loan.supply_id)\n @supply.stock_ini -= @supplies_loan.quantity\n @supplies_loan.company_id = current_user.company_id\n respond_to do |format|\n if @supplies_loan.save\n @supply.save\n format.html { redirect_to @supplies_loan, notice: 'Supplies loan was successfully created.' }\n format.json { render json: @supplies_loan, status: :created, location: @supplies_loan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @supplies_loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @supplies_loan = SuppliesLoan.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @supplies_loan }\n end\n end", "def update\n respond_to do |format|\n if @provider.update(provider_params)\n format.html { redirect_to @provider, notice: \"Provider was successfully updated.\" }\n format.json { render :show, status: :ok, location: @provider }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to(@provider, :notice => 'Provider was successfully updated.') }\n format.xml { head :ok }\n format.json { render :json => { :resp=> \"ok\" }}\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n format.json { render :json => { :resp=> \"error\" }}\n end\n end\n end", "def update\n respond_to do |format|\n if @provider.update(provider_params)\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { render :show, status: :ok, location: @provider }\n else\n format.html { render :edit }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @provider.update(provider_params)\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { render :show, status: :ok, location: @provider }\n else\n format.html { render :edit }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @supplier_provider.update(supplier_provider_params)\n format.html { redirect_to @supplier_provider, notice: 'Provider was successfully updated.' }\n format.json { render :show, status: :ok, location: @supplier_provider }\n else\n format.html { render :edit }\n format.json { render json: @supplier_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id])\n @supplies_providers_loan.destroy\n\n respond_to do |format|\n format.html { redirect_to supplies_providers_loans_url }\n format.json { head :no_content }\n end\n end", "def update\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to providers_path, notice: 'As informacoes foram atualizadas com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @provider.update(provider_params)\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @provider = Provider.find(params[:id])\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n @providers = Provider.all\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { head :no_content }\n format.js\n else\n logger.debug(@provider)\n format.html { render action: \"edit\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @supplies_loan = SuppliesLoan.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @supplies_loan }\n end\n end", "def update\n respond_to do |format|\n if @provider.update(check_params)\n #@provider = Provider.find(params[:id])\n #if @provider.update_attributes(params[:provider])\n format.html { redirect_to providers_page_url, notice: 'Поставщик успешно обновлен.' }\n format.json { render :show, status: :ok, location: @provider }\n else\n format.html { render :edit }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @supplies_providers_loan = SuppliesProvidersLoan.new(params[:supplies_providers_loan])\n @supply = Supply.find(@supplies_providers_loan.supply_id)\n @supply.stock_ini += @supplies_providers_loan.quantity\n @supplies_providers_loan.company_id = current_user.company_id\n respond_to do |format|\n if @supplies_providers_loan.save\n @supply.save\n format.html { redirect_to @supplies_providers_loan, notice: 'Supplies providers loan was successfully created.' }\n format.json { render json: @supplies_providers_loan, status: :created, location: @supplies_providers_loan }\n else\n format.html { render action: \"new\" }\n format.json { render json: @supplies_providers_loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @info_provider.update(info_provider_params)\n format.html { redirect_to @info_provider, notice: 'Provider was successfully updated.' }\n format.json { render :show, status: :ok, location: @info_provider }\n else\n format.html { render :edit }\n format.json { render json: @info_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @manage_provider.update(manage_provider_params)\n flash[:success] = '添加成功'\n else\n flash[:error] = '修改失败'\n end\n redirect_to '/manage/providers'\n end", "def update\n respond_to do |format|\n if @provider.update(provider_params)\n format.html { redirect_to @provider, notice: 'Fornecedor atualizado com sucesso.' }\n format.json { render :show, status: :ok, location: @provider }\n else\n format.html { render :edit }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n flash[:notice] = 'Provider was successfully updated.'\n format.html { redirect_to(@provider) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @provider.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @cloud_provider = current_user.cloud_providers.find(params[:id])\n\n respond_to do |format|\n if @cloud_provider.update_attributes(params[:cloud_provider])\n format.html { redirect_to @cloud_provider, notice: 'Cloud provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @cloud_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @supplies_loan = SuppliesLoan.find(params[:id])\n @supplies_loan.destroy\n\n respond_to do |format|\n format.html { redirect_to supplies_loans_url }\n format.json { head :no_content }\n end\n end", "def create\n @provider = Provider.new(params[:provider])\n @provider.active = true\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def provider_params\n params.require(:provider).permit(:name,\n loans_attributes: [:id, :name, :principle, :interest,\n :months_remaining, :payment, :_destroy])\n end", "def create\n @provider = current_company.providers.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @provider = Order.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to @provider, notice: 'Provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def offer\n @offer = @host.offers.find(params[:id])\n @offer.update(offer_params) if request.put?\n redirect_to offers_host_path if request.put?\n end", "def update\n respond_to do |format|\n if @market_offering.update(market_offering_params)\n format.html { redirect_to @market_offering, notice: 'Market offering was successfully updated.' }\n format.json { render :show, status: :ok, location: @market_offering }\n else\n format.html { render :edit }\n format.json { render json: @market_offering.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @title = t('view.providers.edit_title')\n @provider = Provider.find(params[:id])\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider])\n format.html { redirect_to @provider, notice: t('view.providers.correctly_updated') }\n format.json { head :ok }\n else\n format.html { render action: 'edit' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n rescue ActiveRecord::StaleObjectError\n redirect_to edit_provider_url(@provider), alert: t('view.providers.stale_object_error')\n end", "def update\n respond_to do |format|\n if @v1_provider_operation.update(v1_provider_operation_params)\n format.html { redirect_to @v1_provider_operation, notice: 'Provider operation was successfully updated.' }\n format.json { render :show, status: :ok, location: @v1_provider_operation }\n else\n format.html { render :edit }\n format.json { render json: @v1_provider_operation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @provider = Provider.find(params[:id])\n\n\n if @provider.update_attributes(params[:provider])\n redirect_to(@provider, :success => 'Provider was successfully updated.')\n\n else\n\t\trender :action => \"edit\" \n \n end\n\n end", "def update\n @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])\n\n respond_to do |format|\n if @shop_platinum_offer.update_attributes(params[:shop_platinum_offer])\n format.html { redirect_to @shop_platinum_offer, notice: 'Platinum offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_platinum_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_provider!(provider, provider_info = {}, access = {})\n Api::Request.new do |request|\n request[:access] = access\n request[:method] = :PUT\n request[:path] = \"/mgmt/{{client_id}}/storages/#{provider}\"\n request[:request_body] = provider_info\n end.execute!\n\n end", "def update\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n\n respond_to do |format|\n if @shop_bonus_offer.update_attributes(params[:shop_bonus_offer])\n format.html { redirect_to @shop_bonus_offer, notice: 'Bonus offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @shop_bonus_offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_provider\n @provider = Provider.find(params[:id]) if params[:id].present?\n @providers = Goodstype.find(params[:goodstype_id]).providers if params[:goodstype_id].present?\n end", "def update\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n if @offering.update_attributes(params[:offering])\n format.html { redirect_to @offering, notice: 'Oferta atualizada com sucesso.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @supply.update(supply_params)\n format.html { redirect_to supplies_path, notice: 'Record was successfully updated.' }\n format.json { render :show, status: :ok, location: @supply }\n else\n format.html { render :edit }\n format.json { render json: @supply.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @title = t('view.providers.new_title')\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: t('view.providers.correctly_created') }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @offering.update(offering_params)\n format.html { redirect_to @offering, notice: 'La oferta de servicio ha sido actualizada correctamente.' }\n format.json { render :show, status: :ok, location: @offering }\n else\n format.html { render :edit }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @service_provider.update(service_provider_params)\n format.html { redirect_to @service_provider, notice: \"Service provider was successfully updated.\" }\n format.json { render :show, status: :ok, location: @service_provider }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @service_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(**args)\n @providers = args[:providers] if args.key?(:providers)\n end", "def update\n @provider_type = ProviderType.find(params[:id])\n\n respond_to do |format|\n if @provider_type.update_attributes(params[:provider_type])\n format.html { redirect_to(@provider_type, :notice => 'Provider type was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @provider_type.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @payment_provider = PaymentProvider.find(params[:id])\n\n respond_to do |format|\n if @payment_provider.update_attributes(params[:payment_provider])\n format.html { redirect_to @payment_provider, notice: 'Payment provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @payment_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @provider = Provider.new(params[:provider])\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @providerable, @name = find_polymorphic\n @provider = ProviderInsurance.find(params[:id])\n @provider.updated_user = current_user.login_name\n\n respond_to do |format|\n if @provider.update_attributes(params[:provider_insurance])\n format.html { redirect_to polymorphic_path([@providerable, @provider]), notice: 'Provider insurance was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @data_provider = DataProvider.find(params[:id])\n\n respond_to do |format|\n if @data_provider.update_attributes(params[:data_provider])\n format.html { redirect_to @data_provider, notice: 'Data provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @data_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @supplier_provider = Supplier::Provider.new(supplier_provider_params)\n\n respond_to do |format|\n if @supplier_provider.save\n format.html { redirect_to @supplier_provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @supplier_provider }\n else\n format.html { render :new }\n format.json { render json: @supplier_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @offering = current_user.offerings.new(offering_params)\n @offering.status = 1\n respond_to do |format|\n if @offering.save\n format.html { redirect_to @offering, notice: 'La oferta de servicio ha sido creada correctamente.' }\n format.json { render :show, status: :created, location: @offering }\n else\n format.html { render :new }\n format.json { render json: @offering.errors, status: :unprocessable_entity }\n end\n end\n end", "def new\n @provider = current_company.providers.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def update\n respond_to do |format|\n if @offer.update(offers_params)\n format.jsonapi { render :show, status: :ok, location: @offer }\n else\n format.jsonapi { render jsonapi: @offer.errors, status: :unprocessable_entity }\n end\n end\n end", "def provider_update\n @provider.attributes = params[:provider].each_value(&:strip!)\n if params[:provider][:wait_for_good_email]\n @provider.wait_for_good_email = params[:provider][:wait_for_good_email]\n else\n @provider.wait_for_good_email = 0\n end\n @provider.email_good_keywords = params[:provider][:email_good_keywords] if params[:provider][:email_good_keywords]\n if params[:provider][:wait_for_bad_email]\n @provider.wait_for_bad_email = params[:provider][:wait_for_bad_email]\n else\n @provider.wait_for_bad_email = 0\n end\n if @provider.api? \n @provider.login = params[:api_string].to_s\n @provider.email_good_keywords = params[:api_good_keywords].to_s\n end\n if @provider.save\n flash[:status] = _('Sms_provider_updated')\n redirect_to :action => 'providers' and return false\n else\n flash_errors_for(_('Sms_provider_not_updated'), @provider)\n @api_string = @provider.login.to_s\n @api_keywords = @provider.email_good_keywords\n @tariffs = current_user.sms_provider_tariffs\n render :action => :provider_edit and return false\n end\n end", "def set_provider\n @provider = Provider.find(params[:id])\n end", "def set_provider\r\n @provider = Provider.find(params[:id])\r\n end", "def update\n respond_to do |format|\n if @interest_on_housing_loan.update(interest_on_housing_loan_params)\n format.html { redirect_to @interest_on_housing_loan, notice: 'Interest on housing loan was successfully updated.' }\n format.json { render :show, status: :ok, location: @interest_on_housing_loan }\n else\n format.html { render :edit }\n format.json { render json: @interest_on_housing_loan.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_v1_provider_operation\n @v1_provider_operation = V1::ProviderOperation.find(params[:id])\n end", "def update\n @catalogs_supply = Catalogs::Supply.find(params[:id])\n\n respond_to do |format|\n if @catalogs_supply.update_attributes(params[:catalogs_supply])\n format.html { redirect_to(@catalogs_supply, :notice => 'Supply was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @catalogs_supply.errors, :status => :unprocessable_entity }\n end\n end\n end", "def set_api_v1_lifestyle\n @api_v1_lifestyle = Api::V1::Lifestyle.find(params[:id])\n end", "def set_supply\n @supply = Supply.friendly.find(params[:id])\n end", "def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render action: 'show', status: :created, location: @provider }\n else\n format.html { render action: 'new' }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @lab_supplier = LabSupplier.find(params[:id])\n\n respond_to do |format|\n if @lab_supplier.update_attributes(params[:lab_supplier])\n format.html { redirect_to @lab_supplier, notice: 'Lab supplier was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @lab_supplier.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @providerservice.update(providerservice_params)\n format.html { redirect_to @providerservice, notice: 'Providerservice was successfully updated.' }\n format.json { render :show, status: :ok, location: @providerservice }\n else\n format.html { render :edit }\n format.json { render json: @providerservice.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @provider_provider_type.user_updated_id = current_user.id\n respond_to do |format|\n if @provider_provider_type.update(provider_provider_type_params)\n format.html { redirect_to provider_provider_types_path, notice: I18n.t('provider_types.controller.update')}\n format.json { render :show, status: :ok, location: @provider_provider_type }\n else\n format.html { render :edit }\n format.json { render json: @provider_provider_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize @fuel_supply\n respond_to do |format|\n if @fuel_supply.update(fuel_supply_params)\n format.html { redirect_to @fuel_supply, notice: 'Fuel supply was successfully updated.' }\n format.json { render :show, status: :ok, location: @fuel_supply }\n else\n format.html { render :edit }\n format.json { render json: @fuel_supply.errors, status: :unprocessable_entity }\n end\n end\n end", "def update \n @administration_offering.delete_offering_merchants\n @administration_offering.add_offering_merchants(params[:administration_merchant_offering])\n respond_to do |format|\n if @administration_offering.update_attributes(params[:administration_offering])\n format.html { redirect_to(@administration_offering, :notice => 'Offering was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @administration_offering.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @livingsupply.update(livingsupply_params)\n format.html { redirect_to @livingsupply, notice: 'Livingsupply was successfully updated.' }\n format.json { render :show, status: :ok, location: @livingsupply }\n else\n format.html { render :edit }\n format.json { render json: @livingsupply.errors, status: :unprocessable_entity }\n end\n end\n end", "def provider_bonu_params\n params.require(:provider_bonu).permit(:provider_id, :intent, :bonus)\n end", "def update\n @platform = Platform.find(params[:id])\n banners = Banner.where(:id => params[:platform].delete(:banners))\n @platform.banners = banners\n\n respond_to do |format|\n if @platform.update_attributes(params[:platform])\n format.html { redirect_to @platform, notice: 'Platform was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @platform.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_provider_bonu\n @provider_bonu = ProviderBonu.find(params[:id])\n end", "def update\n respond_to do |format|\n if @healthcare_provider.update(healthcare_provider_params)\n format.html { redirect_to @healthcare_provider, notice: 'Healthcare provider was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @healthcare_provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def create\n @provider = Provider.new(provider_params)\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @providers_branch.update(providers_branch_params)\n format.html { redirect_to providers_branches_path, notice: 'Branch was successfully updated.' }\n format.json { redirect_to providers_branches_path, status: :ok, location: @providers_branch }\n else\n format.html { render :edit }\n format.json { render json: @providers_branch.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_provider\n @provider = Provider.friendly.find(params[:id])\n end", "def create\n @provider = Provider.new(provider_params)\n\n if @provider.save\n render json: @provider, status: :created, location: @provider\n else\n render json: @provider.errors, status: :unprocessable_entity\n end\n end", "def updateOffer()\n @offer_operation = :update\n end", "def update\n respond_to do |format|\n if @surgery_supply.update(surgery_supply_params)\n format.html { redirect_to @surgery_supply, notice: 'Surgery supply was successfully updated.' }\n format.json { render :show, status: :ok, location: @surgery_supply }\n else\n format.html { render :edit }\n format.json { render json: @surgery_supply.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @provider = Provider.new(provider_params)\n @provider.user_id = current_user.id\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to @provider, notice: 'Provider was successfully created.' }\n format.json { render :show, status: :created, location: @provider }\n else\n format.html { render :new }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_suggested_course_pathway\n suggested_pathway = SuggestedPathway.find_by(id: params[:id])\n suggested_pathway.name = params[:name]\n suggested_pathway.year = params[:year]\n suggested_pathway.course_id = params[:course_id]\n suggested_pathway.data = params[:data]\n suggested_pathway.save\n render json: suggested_pathway\n end", "def set_provider\n @provider = Provider.find(params[:id])\n end", "def set_provider\n @provider = Provider.find(params[:id])\n end", "def set_provider\n @provider = Provider.find(params[:id])\n end", "def set_provider\n @provider = Provider.find(params[:id])\n end", "def set_provider\n @provider = Provider.find(params[:id])\n end", "def set_provider\n @provider = Provider.find(params[:id])\n end", "def set_provider\n @provider = Provider.find(params[:id])\n end", "def light_supply_params\n params.require(:light_supply).permit(:provider, :house_id)\n end", "def create\n @provider = Provider.new(params[:provider])\n @services = Service.all\n\n respond_to do |format|\n if @provider.save\n format.html { redirect_to providers_path, notice: 'As informacoes foram salvas com sucesso.' }\n format.json { render json: @provider, status: :created, location: @provider }\n else\n format.html { render action: \"new\" }\n format.json { render json: @provider.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n redirect_unless_admin\n hide_left_menu\n\n @gift_card = GiftCard.find(params[:id])\n\n respond_to do |format|\n if @gift_card.update_attributes(params[:gift_card])\n format.html { redirect_to @gift_card, notice: 'Gift card was successfully updated.' }\n format.json { head :ok }\n else\n @type = SupplierAccountType.find_by_name(\"Vestidos Boutique\")\n @supplier_accounts = SupplierAccount.where(\"supplier_account_type_id = ?\", @type.id).approved\n \n format.html { render action: \"edit\" }\n format.json { render json: @gift_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_loan\n @loan ||= Loan.find(params[:loan_id] || params[:id])\n @borrower_type ||= :borrower\n\n if @loan.blank?\n @loan = current_user.borrower.loan # or get the co-borrower relationship\n\n if @loan.present?\n @borrower_type = :secondary_borrower\n else\n @loan = InitializeFirstLoanService.new(current_user).call\n end\n end\n # use pundit to authorize user. check LoanPolicy\n authorize @loan, :update?\n end", "def update!(**args)\n @provider_info = args[:provider_info] if args.key?(:provider_info)\n @provider_key = args[:provider_key] if args.key?(:provider_key)\n @provider_type = args[:provider_type] if args.key?(:provider_type)\n end", "def update\n respond_to do |format|\n if @service_offering.update(service_offering_params)\n format.html { redirect_to @service_offering, notice: 'Service offering was successfully updated.' }\n format.json { render :show, status: :ok, location: @service_offering }\n else\n format.html { render :edit }\n format.json { render json: @service_offering.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @offering = Offering.find(params[:id])\n\n respond_to do |format|\n if @offering.update_attributes(params[:offering])\n flash[:notice] = 'Offering was successfully updated.'\n format.html { redirect_to(admin_offering_path(@offering)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @offering.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @bundlesticker = Bundlesticker.find(params[:id])\n\n respond_to do |format|\n if @bundlesticker.update_attributes(params[:bundlesticker])\n format.html { redirect_to @bundlesticker, notice: 'Bundlesticker was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @bundlesticker.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @non_interview_provider = NonInterviewProvider.find(params[:id])\n\n respond_to do |format|\n if @non_interview_provider.update_attributes(params[:non_interview_provider])\n provider = @non_interview_provider.provider\n redirect_path = provider.pbs_list ? pbs_list_path(provider.pbs_list) : contact_log_provider_path(provider.id)\n format.html { redirect_to redirect_path, :notice => 'Non-Interview Provider Report was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @non_interview_provider.errors, :status => :unprocessable_entity }\n end\n end\n end", "def new\n @provider = Provider.new\n @provider.build_address\n @services = Service.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @provider }\n end\n end", "def update\n @offer = Offer.find(params[:id])\n checkaccountobject(\"offers\",@offer)\n respond_to do |format|\n if @offer.update_attributes(params[:offer])\n format.html { redirect_to @offer, notice: 'Offer was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @offer.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.67771786", "0.62539315", "0.618528", "0.6084787", "0.6064328", "0.6016281", "0.59802955", "0.59668136", "0.5912985", "0.5900591", "0.5874986", "0.5874986", "0.5851251", "0.5841423", "0.581742", "0.5806443", "0.5799978", "0.57990664", "0.5798691", "0.5778461", "0.573745", "0.56965655", "0.5689143", "0.56734574", "0.555036", "0.54914916", "0.5485774", "0.5481001", "0.5467496", "0.5461495", "0.5447099", "0.5444319", "0.5444002", "0.5429868", "0.542045", "0.5407689", "0.5385553", "0.5330687", "0.5327992", "0.5320378", "0.5318778", "0.5304783", "0.5301642", "0.5297704", "0.52975625", "0.529501", "0.52839875", "0.52783513", "0.52728885", "0.5264801", "0.5257633", "0.5252174", "0.5249256", "0.52338064", "0.5232185", "0.5230719", "0.52199787", "0.52154607", "0.5210466", "0.5207006", "0.5202801", "0.52004474", "0.5193909", "0.51937723", "0.5192137", "0.5190872", "0.5176035", "0.51713735", "0.51703763", "0.5166103", "0.5164001", "0.51474077", "0.51370984", "0.5133248", "0.51325077", "0.51322085", "0.5131831", "0.5130955", "0.5127661", "0.5120448", "0.51036894", "0.5103312", "0.5095787", "0.5095787", "0.5095787", "0.5095787", "0.5095787", "0.5095787", "0.5095787", "0.50937545", "0.5092656", "0.5070597", "0.5067491", "0.5067229", "0.506542", "0.5062271", "0.5061091", "0.5060463", "0.5057416", "0.5056284" ]
0.7066614
0
DELETE /supplies_providers_loans/1 DELETE /supplies_providers_loans/1.json
def destroy @supplies_providers_loan = SuppliesProvidersLoan.find(params[:id]) @supplies_providers_loan.destroy respond_to do |format| format.html { redirect_to supplies_providers_loans_url } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @supplies_loan = SuppliesLoan.find(params[:id])\n @supplies_loan.destroy\n\n respond_to do |format|\n format.html { redirect_to supplies_loans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @provider = current_company.providers.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Fornecedor apagado com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_page_url, notice: 'Поставщик успешно удален.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @supply.destroy\n respond_to do |format|\n format.html { redirect_to supplies_path, notice: 'Record was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @provider.destroy\n respond_to do |format|\n format.html { redirect_to providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @billing_info.destroy\n respond_to do |format|\n format.html { redirect_to select_plan_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @surgery_supply.destroy\n respond_to do |format|\n format.html { redirect_to surgery_supplies_url, notice: 'Surgery supply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @provider.destroy\n\n head :no_content\n end", "def delete_tenant_circle(args = {}) \n delete(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def destroy\n @supplier_provider.destroy\n respond_to do |format|\n format.html { redirect_to supplier_providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @catalogs_supply = Catalogs::Supply.find(params[:id])\n @catalogs_supply.destroy\n\n respond_to do |format|\n format.html { redirect_to(catalogs_supplies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @loan.destroy\n respond_to do |format|\n format.html { redirect_to loans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @offering.destroy\n respond_to do |format|\n format.html { redirect_to offerings_url, notice: 'Se ha eliminado la oferta de servicio.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @supplysite = Supplysite.find(params[:id])\n @supplysite.destroy\n\n respond_to do |format|\n format.html { redirect_to supplysites_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @healthcare_provider.destroy\n respond_to do |format|\n format.html { redirect_to healthcare_providers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n authorize @fuel_supply\n @fuel_supply.destroy\n respond_to do |format|\n format.html { redirect_to fuel_supplies_url, notice: 'Fuel supply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @v1_provider_operation.destroy\n respond_to do |format|\n format.html { redirect_to v1_provider_operations_url, notice: 'Provider operation was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @callplan.destroy\n respond_to do |format|\n format.html { redirect_to callplans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @point_of_sale.destroy\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @power_supply.destroy\n respond_to do |format|\n format.html { redirect_to power_supplies_url, notice: 'Power supply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @data_provider = DataProvider.find(params[:id])\n @data_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to data_providers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @claimant = Claimant.find(params[:id])\n @claimant.destroy\n\n respond_to do |format|\n format.html { redirect_to claimants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @provider.destroy\n redirect_to providers_url\n end", "def destroy\n @kota_stone.destroy\n respond_to do |format|\n format.html { redirect_to kota_stones_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @provider = Provider.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to(providers_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @info_provider.destroy\n respond_to do |format|\n format.html { redirect_to info_providers_url, notice: 'Provider was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plan.destroy\n respond_to do |format|\n format.html { redirect_to plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @power_supply.destroy\n respond_to do |format|\n format.html { redirect_to power_supplies_url }\n end\n end", "def destroy\n @provider_service.destroy\n respond_to do |format|\n format.html { redirect_to provider_services_url, notice: 'Provider service was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @payment_provider = PaymentProvider.find(params[:id])\n @payment_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to payment_providers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @unlimited.destroy\n respond_to do |format|\n format.html { redirect_to unlimiteds_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @plant.destroy\n respond_to do |format|\n format.html { redirect_to plants_url, notice: 'Your Swap was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @lab_supplier = LabSupplier.find(params[:id])\n @lab_supplier.destroy\n\n respond_to do |format|\n format.html { redirect_to lab_suppliers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @medicalsupply.destroy\n respond_to do |format|\n format.html { redirect_to medicalsupplies_url, notice: 'Medicalsupply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end", "def destroy\n @offer.destroy\n respond_to do |format|\n format.jsonapi { head :no_content }\n end\n end", "def destroy\n @billing_plan.destroy\n respond_to do |format|\n format.html { redirect_to billing_plans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @offer = Offer.find(params[:id])\n checkaccountobject(\"offers\",@offer)\n @offer.destroy\n\n respond_to do |format|\n format.html { redirect_to offers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @food_plan.destroy\n respond_to do |format|\n format.html { redirect_to applicant_food_plans_path(@applicant.id), notice: 'Food plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @provincial.destroy\n respond_to do |format|\n format.html { redirect_to admin_provincials_url, notice: 'Provincial was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @loanable.destroy\n respond_to do |format|\n format.html { redirect_to users_loanables_url, notice: 'Loanable was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if active_client_count(provider_id: @provider.symbol).positive?\n message = \"Can't delete provider that has active clients.\"\n status = 400\n Rails.logger.warn message\n render json: {\n errors: [{ status: status.to_s, title: message }],\n }.to_json,\n status: status\n elsif @provider.update(is_active: nil, deleted_at: Time.zone.now)\n unless Rails.env.test?\n @provider.send_delete_email(responsible_id: current_user.uid)\n end\n head :no_content\n else\n # Rails.logger.error @provider.errors.inspect\n render json: serialize_errors(@provider.errors, uid: @provider.uid),\n status: :unprocessable_entity\n end\n end", "def destroy\n @supplier = Supplier.find(params[:id])\n @supplier.destroy\n \n respond_to do |format|\n format.html { redirect_to suppliers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @cloud_provider = current_user.cloud_providers.find(params[:id])\n @cloud_provider.destroy\n\n respond_to do |format|\n format.html { redirect_to cloud_providers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shop_bonus_offer = Shop::BonusOffer.find(params[:id])\n @shop_bonus_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_bonus_offers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @livingsupply.destroy\n respond_to do |format|\n format.html { redirect_to livingsupplies_url, notice: 'Livingsupply was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @offering = Offering.find(params[:id])\n @offering.destroy\n\n respond_to do |format|\n format.html { redirect_to offerings_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @check_plan.destroy\n respond_to do |format|\n format.html { redirect_to check_plans_url, notice: 'Check plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plate.destroy\n respond_to do |format|\n format.html { redirect_to client_budget_mobile_url(@client, @budget, @mobile), notice: \"Chapa deletada com sucesso.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @much_withdraw.destroy\n respond_to do |format|\n format.html { redirect_to much_withdraws_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @supply_chain.destroy\n respond_to do |format|\n format.html { redirect_to supply_chains_url, notice: 'Supply chain was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @investigated.destroy\n respond_to do |format| \n format.json { head :no_content }\n end\n end", "def destroy\n @provider = Order.find(params[:id])\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to providers_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @spending_pool.destroy\n respond_to do |format|\n format.html { redirect_to spending_pools_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @loan.destroy\n respond_to do |format|\n format.html { redirect_to loans_url, notice: 'Loan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @loan.destroy\n respond_to do |format|\n format.html { redirect_to loans_url, notice: 'Loan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @loan.destroy\n respond_to do |format|\n format.html { redirect_to loans_url, notice: 'Loan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy_rest\n @item_usage = ItemUsage.find(params[:id])\n @item_usage.destroy\n\n respond_to do |format|\n format.html { redirect_to(item_usages_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @service_provider.destroy\n respond_to do |format|\n format.html { redirect_to service_providers_url, notice: \"Service provider was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @loan.destroy\n respond_to do |format|\n format.html { redirect_to loans_url, notice: \"Loan was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n logger = Logger.new(STDOUT)\n if active_client_count(provider_id: @provider.symbol) > 0\n message = \"Can't delete provider that has active clients.\"\n status = 400\n logger.warn message\n render json: { errors: [{ status: status.to_s, title: message }] }.to_json, status: status\n elsif @provider.update_attributes(is_active: nil, deleted_at: Time.zone.now)\n @provider.send_delete_email unless Rails.env.test?\n head :no_content\n else\n logger.warn @provider.errors.inspect\n render json: serialize_errors(@provider.errors), status: :unprocessable_entity\n end\n end", "def destroy\n @provider = Provider.find(params[:id])\n member_id = @provider.member_id\n @provider.destroy\n\n respond_to do |format|\n format.html { redirect_to member_url(member_id) }\n format.xml { head :ok }\n format.json {render :json=> {\"resp\" => \"ok\"} }\n end\n end", "def delete\n render json: Alien.delete(params[\"id\"])\n end", "def destroy\n @aspirant = Aspirant.find(params[:id])\n @aspirant.destroy\n\n respond_to do |format|\n format.html { redirect_to aspirants_url }\n format.json { head :ok }\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 @clonet = Clonet.find(params[:id])\n @clonet.destroy\n\n respond_to do |format|\n format.html { redirect_to clonets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @shop_platinum_offer = Shop::PlatinumOffer.find(params[:id])\n @shop_platinum_offer.destroy\n\n respond_to do |format|\n format.html { redirect_to shop_platinum_offers_url }\n format.json { head :ok }\n end\n end", "def destroy\n compute.delete_flavor(params[:id])\n \n\n respond_to do |format|\n format.html { redirect_to flavors_path }\n format.json { head :ok }\n end\n end", "def destroy\n @tx_land_grants_efn.destroy\n respond_to do |format|\n format.html { redirect_to tx_land_grants_efns_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @applicant = Applicant.find(params[:id])\n @applicant.destroy\n\n respond_to do |format|\n format.html { redirect_to applicants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @applicant = Applicant.find(params[:id])\n @applicant.destroy\n\n respond_to do |format|\n format.html { redirect_to applicants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @admin_supplier = Admin::Supplier.find(params[:id])\n @admin_supplier.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_suppliers_url }\n format.json { head :ok }\n end\n end", "def destroy\n @ecommerceplan = Ecommerceplan.find(params[:id])\n @ecommerceplan.destroy\n\n respond_to do |format|\n format.html { redirect_to ecommerceplans_url }\n format.json { head :ok }\n end\n end", "def destroy\n @admin_whitelist = Admin::Whitelist.find(params[:id])\n @admin_whitelist.destroy\n\n respond_to do |format|\n format.html { redirect_to admin_whitelists_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ally.destroy\n respond_to do |format|\n format.html { redirect_to allies_url, notice: 'Ally was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @ally.destroy\n respond_to do |format|\n format.html { redirect_to allies_url, notice: 'Ally was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @meal_plan.destroy\n respond_to do |format|\n format.html { redirect_to meal_plans_url, notice: 'Meal plan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @plant = @garden.plants.find(params[:id])\n @plant.destroy\n respond_to do |format|\n format.html { redirect_to @garden, notice: 'Plant deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @applicant.destroy\n respond_to do |format|\n format.html { redirect_to applicants_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @supplier = Supplier.find(params[:id])\n @supplier.destroy\n\n respond_to do |format|\n format.html { redirect_to suppliers_url }\n format.json { head :ok }\n end\n end", "def destroy\n return if new_record?\n \n @api.delete \"/items/#{shortcode_url}.json\"\n end", "def destroy\n return if new_record?\n \n @api.delete \"/meetings/#{shortcode_url}.json\"\n end", "def destroy\n @lunchplan = Lunchplan.find(params[:id])\n @lunchplan.destroy\n\n respond_to do |format|\n format.html { redirect_to lunchplans_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @consensu = Consensu.find(params[:id])\n @consensu.destroy\n\n respond_to do |format|\n format.html { redirect_to consensus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @grant_sector.destroy\n respond_to do |format|\n format.html { redirect_to grant_sectors_url, notice: 'Grant sector was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @shelf.destroy\n\n respond_to do |format|\n format.html { redirect_to shelves_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @tx_land_grants_special_collection.destroy\n respond_to do |format|\n format.html { redirect_to tx_land_grants_special_collections_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @interest_on_housing_loan.destroy\n respond_to do |format|\n format.html { redirect_to interest_on_housing_loans_url, notice: 'Interest on housing loan was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @farmjobsupply = Farmjobsupply.find(params[:id])\n @farmjobsupply.destroy\n\n respond_to do |format|\n format.html { redirect_to(farmjobsupplies_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @service_offering.destroy\n respond_to do |format|\n format.html { redirect_to service_offerings_url, notice: 'Service offering was successfully destroyed.' }\n format.json { head :no_content }\n end\n end" ]
[ "0.7558326", "0.6920013", "0.6920013", "0.6920013", "0.691344", "0.68868333", "0.68526495", "0.6796305", "0.6729628", "0.66929644", "0.66909593", "0.66909593", "0.66909593", "0.66542876", "0.6626142", "0.66153806", "0.66112024", "0.66065884", "0.6593572", "0.6592053", "0.6578327", "0.657454", "0.65570575", "0.6548352", "0.65319747", "0.6524779", "0.651033", "0.6489908", "0.6488983", "0.6482045", "0.64784247", "0.64768535", "0.64664835", "0.64619267", "0.64427185", "0.64427185", "0.64414024", "0.6437293", "0.6434919", "0.64319336", "0.6430074", "0.64297074", "0.6426559", "0.64240867", "0.64240867", "0.6421592", "0.6417472", "0.6416255", "0.64154345", "0.6414163", "0.6412827", "0.6403381", "0.63999134", "0.6398452", "0.63975817", "0.63953406", "0.63904303", "0.6386948", "0.63866806", "0.6384045", "0.63784647", "0.63774705", "0.6369326", "0.6367312", "0.6364803", "0.6364803", "0.6364803", "0.6362286", "0.63554925", "0.635403", "0.63539225", "0.6353462", "0.6353005", "0.6351372", "0.6348733", "0.6348217", "0.6336998", "0.6335977", "0.63330775", "0.63315713", "0.63315713", "0.6326632", "0.6314862", "0.631168", "0.6311624", "0.6311624", "0.63074154", "0.6306255", "0.6303121", "0.6297121", "0.62947875", "0.6293062", "0.6291209", "0.6287634", "0.6286473", "0.62853575", "0.6284771", "0.6284536", "0.62831557", "0.6280993" ]
0.7649287
0
Create a new minimizer
def initialize(lower, upper, proc) raise "first argument should be lower than second" if lower>=upper @lower=lower @upper=upper @proc=proc golden = 0.3819660; @expected = @lower + golden * (@upper - @lower); @max_iteration=MAX_ITERATIONS @epsilon=EPSILON @iterations=0 @log=[] @log_header=%w{I xl xh f(xl) f(xh) dx df(x)} end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def minimize\n # create a new one, or modify the current one in place,\n # and return it\n FiniteAutomaton.new \n end", "def minimize; end", "def min(expression)\n @objective = Objective.new(:minimize, expression)\n end", "def minimize\n # create a new one, or modify the current one in place,\n # and return it\n DFA.new \n end", "def maximize; end", "def optimize\n operation.class.new(operand)\n end", "def optimizer\n @optimizer ||= Optimizer.new\n end", "def minimize\n# create a new one, or modify the current one in place,\n# and return it\nfa = FiniteAutomaton.new\nkeys = @state.keys.sort\np0, p1 = [], []\nkeys.each{|k|\nif is_final?(k)\np0 = p0.push(k)\nelsif\np1 = p1.push(k)\nend\n}\nnewfa = {}\nrstate = []\nif p0 != nil then rstate.push(p0) end\nif p1 != nil then rstate.push(p1) end\npstate = []\nwhile pstate != rstate\npstate = []\nrstate.each{|r| pstate.push(r)}\nrstate = []\npstate.each{|p|\np = p.sort\nresult = split(p, pstate)\np0 = result[0]\np1 = result[1]\nresult.each{|r|\nif r != []\nr = r.sort\nrstate = rstate.push(r)\nend\n}\n}\nend\nstart = []\nfinal = []\nrstate.each{|r| newfa[r] = fa.new_state}\nlist = newfa.keys\nlist.each{|l|\nl.each{|k|\nif k == @start\nstart.push(l)\nend\nif is_final?(k)\nfinal.push(l)\nend\n}\n}\nif start != []\nstart.each{|s| if newfa[s] then fa.set_start(newfa[s]) end}\nend\nif final != []\nfinal.each{|f| fa.set_final(newfa[f], true)}\nend\nrstate.each{|r0|\nr0.each{|r1|\n@alphabet.each{|a|\nif get_transition(r1, a) != nil\nrstate.each{|r|\nif r.include?(get_transition(r1, a)[0])\nif !(fa.get_transition(newfa[r0], a))\nfa.add_transition(newfa[r0], newfa[r], a)\nif fa.get_alpha.include?(a) == false\nfa.get_alpha.push(a)\nend\nend\nend\n}\nend\n}\n}\n}\nfa\nend", "def set_objective(variables_with_weights)\n @objective = variables_with_weights\n end", "def optimize(**options)\n self.dup\n end", "def optimize\n operation.class.new(left, right)\n end", "def main\n if (ARGV.length < 1) \n puts(\"Invalid arguments: Specify an input file\")\n return\n elsif (ARGV.length > 2) \n puts(\"Invalid arguments: Too many arguments provided\")\n return\n end\n\n f = nil\n begin\n f = File.open(ARGV[0], \"r\")\n f.close()\n rescue\n puts(\"Could not open input file: #{ARGV[0]}\")\n return\n end\n \n #Create mini CSS class\n mini_css = MinimizeCSS.new(ARGV[0])\n \n if (ARGV.length == 2)\n o = nil\n begin\n o = open(ARGV[1], 'w')\n o.close()\n mini_css.minimize_to(ARGV[1])\n rescue\n puts(\"Could not open output file: #{ARGV[1]}\")\n mini_css.minimize_to(nil)\n end\n else\n mini_css.minimize_to(nil)\n end \nend", "def max(expression)\n @objective = Objective.new(:maximize, expression)\n end", "def initialize(num_mines)\n @num_mines = num_mines\n end", "def initialize(*)\n super\n @operand = optimize_operand\n end", "def optimize\n operand.class.new(wrap_left, wrap_right)\n end", "def compose_objective\n objective = {}\n\n @objective.each do |obj,weight|\n objective[\"v#{@variable_set.set_indices[obj]}\"] = weight\n end\n\n objective\n end", "def initialize size=6, mines=20\n @size = size\n @mines = mines\n end", "def initialize(*)\n super\n @predicate = Function.optimize_operand(operation.predicate)\n end", "def jqll\n counter = 1\n matrix = Jqll1.new\n File.open(\"src/problem-107/network\").each do |i|\n line = i.strip.split(',')\n (counter..39).each do |i|\n matrix.push Jqll2.new(line[i].to_i, counter, i + 1) if line[i] != \"-\"\n end\n counter += 1\n end\n result = matrix.total\n matrix.minimize\n result -= matrix.total\nend", "def minimize(&block)\n @min_block = block\n Minuit.register_fcn(self)\n begin\n Minuit.migrad\n rescue Minuit::CommandError\n puts '<NDimXML::minimize> Error! Minuit migrad command failed.'\n $!.print\n return false\n end\n true\n end", "def minimize\n # Reverse this NFA, convert to DFA, then\n # reverse it, and convert it again. Apparently this\n # produces a minimal DFA.\n\n @start_state = @start_state.reverseNFA\n nfa_to_dfa_aux\n\n @start_state = @start_state.reverseNFA\n nfa_to_dfa_aux\n\n State.normalizeStates(@start_state)\n end", "def initialize()\n @min_stack = []\n @stack = []\n \n end", "def minimize\n\t\tdfa = DFA.new\n\t\tif @alphabet.empty?\n\t\t\treturn self\n\t\tend\n\t\taccept = @final.keys\n\t\treject = @state.keys - accept\n\t\t#print \"Accept { \" + accept.join(\", \").to_s + \" }\\n\"\n\t\t#print \"Reject { \" + reject.join(\", \").to_s + \" }\\n\"\n\t\tcounter = @@nextID\n\t\ta = counter\n\t\tif(!reject.empty?)\n\t\t\tcounter+=1\n\t\tend\n\t\tb = counter\n\t\tsymbol = nil\n\t\tdestination = nil\n\t\t\n\t\tif(!reject.empty?)\n\t\t\tdfa.state_rep[a] = reject\n\t\t\tdfa.state_rep[b] = accept\n\t\telse\n\t\t\tdfa.state_rep[a] = accept\n\t\tend\n\t\t\t\n\t\tstack = Array.new\n\t\tstack.push a\n\t\tstack.push b\n\t\tpartitions = Array.new\n\t\t#dfa.prettyPrint\n\t\twhile(partitions != stack)\n\t\t\tpartitions = stack\n\t\t\tstack = Array.new\n\t\t\t#puts \"Part: \" + partitions.to_s + \"stak: \" + stack.to_s\n\t\t\t#print \"R = {\" + partitions.join(\", \").to_s + \"}\\n\"\n\t\t\tpartitions.flatten.each{ |p|\n\t\t\t\t#print \"Split partition: { \" + dfa.state_rep[p].join(\", \").to_s + \" }\\n\"\n\t\t\t\tdfa.state_rep[p], temp = split(dfa.state_rep[p], dfa.state_rep)\n\t\t\t\t#print p.to_s + \" now contains: { \" + dfa.state_rep[p].join(\", \").to_s + \" }\\n\"\n\t\t\t\t#print \"Temp: { \" + temp.join(\", \").to_s + \" }\\n\"\n\t\t\t\tif(!temp.empty?)\n\t\t\t\t\tcounter+=1\n\t\t\t\t\tc = counter\n\t\t\t\t\tstack.push p\n\t\t\t\t\tstack.push c\n\t\t\t\t\t#print c.to_s + \" now contains { \" + temp.join(\", \").to_s + \" }\\n\"\n\t\t\t\t\t#dfa.prettyPrint\n\t\t\t\t\tdfa.state_rep[c] = temp\n\t\t\t\tend\n\t\t\t\tdfa.state_rep.keys.each { |state|\n\t\t\t\t\tdfa.clear_trans(state)\n\t\t\t\t\tdfa.state_rep[state].each { |stuffs|\n\t\t\t\t\t@alphabet.each{ |c|\n\t\t\t\t\t\tdest = get_transition(stuffs, c)\n\t\t\t\t\t\tif dest != nil\n\t\t\t\t\t\t\tparks = dfa.state_rep.keys.dup\n\t\t\t\t\t\t\tparks.each{ |place|\n\t\t\t\t\t\t\t\tif dfa.state_rep[place].include?(dest)\n\t\t\t\t\t\t\t\t\t#puts \"adding (\" + state.to_s + \" \" + c.to_s + \" \" + place.to_s + \"\\n\" \n\t\t\t\t\t\t\t\t\tdfa.add_transition(state, place, c)\n\t\t\t\t\t\t\t\tend\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t\t#end\n\t\t\t\t\t\tend\n\t\t\t\t\t}\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t\t#print dfa.state.to_s + \"\\n\"\n\t\t\t\t#puts \"-------------------------------\"\n\t\t\t}\n\t\t\t#puts \"Part: \" + partitions.to_s + \"stak: \" + stack.to_s\n\t\tend\n\t\tdfa.state.keys.each{ |parts|\n\t\t\tresult = 0\n\t\t\tis_start = 0\n\t\t\t#puts parts\n\t\t\tdfa.state_rep[parts].each { |state|\n\t\t\t\tif(is_final?(state))\n\t\t\t\t\tresult = 1\n\t\t\t\tend\n\t\t\t\tif(state == @start)\n\t\t\t\t\tis_start = 1\n\t\t\t\tend\n\t\t\t\t}\n\t\t\tif result == 1\n\t\t\t\tdfa.set_final(parts)\n\t\t\tend\n\t\t\tif(is_start == 1)\n\t\t\t\tdfa.set_start(parts)\n\t\t\tend\n\t\t}\n\t\tdfa\n end", "def optimize\n operation.class.call(operand)\n end", "def init_population(minmax, pop_size)\r\n strategy = Array.new(minmax.size) do |i| # Make a new array called strategy that holds [0, (5 - (-5) * 0.5)] problem_size times. [[], []] Nested array\r\n [0, (minmax[i][1]-minmax[i][0]) * 0.05]\r\n end\r\n pop = Array.new(pop_size, {}) # Array of size pop, 100 in this case of empty hashes\r\n pop.each_index do |i| # For each element in pop which is a [{}, {}]\r\n pop[i][:vector] = random_vector(minmax) # Run random_vector on the original search space and put it in the pop[index][:vector]\r\n pop[i][:strategy] = random_vector(strategy) # Run random_vector on the strategy created earlier in this method and append it to pop[index][:strategy]\r\n end\r\n pop.each{|c| c[:fitness] = objective_function(c[:vector])} # Calculates a fitness for each vector using objective_function\r\n return pop\r\nend", "def optimize\n operand\n end", "def expand_solution(yard, heuristic_proc)\n new_states = possible_moves(yard, sstate.state).inject([]){ |states, move|\n new_state = update_astar_solution_state(move, heuristic_proc)\n # add the new state if not nil\n states += [new_state] if new_state\n states\n }\n return new_states\n end", "def initialize(options, objective)\n raise ArgumentError, \"options must be an Hash\" unless options.is_a? Hash\n raise ArgumentError, \"Objective function must be of type ObjectiveFunction\" unless\n (objective.is_a? ObjectiveFunction or\n objective.is_a? LinearObjectiveFunction or\n objective.is_a? QuadraticObjectiveFunction)\n\n @options = options\n @options[:debug] = 0 unless @options[:debug]\n @options[:tolerance] = 1E-10 unless @options[:tolerance]\n\n @objective = objective\n @size = objective.size\n @constraints = []\n @eq_size = 0\n @ineq_size = 0\n end", "def optimize\n operand\n end", "def initialize\n @x = Array.new\n @y = Array.new\n @output = Array.new\n @weights = [0.0001,0.0001,0.0001]\n end", "def minimax(agent,gameState,depth,initialIndex)\n\tbestScore = -1.0/0.0 \t\t\t\t\t\t\t# Default best(worst) result is a catastrophic failure.\n\tbestAction = Action.new({\"name\"=>\"doNothing\"})\t\t# Default best(worst) action is to stand still.\n\talpha = -1.0/0.0\t \t\t\t\t\t\t\t# Alpha\n\tbeta = 1.0/0.0\t \t\t\t\t\t# Beta\n\t#For each action...\n\tfor action in gameState.agents[initialIndex].actions.reverse\n\t\t#=========================================================================================\n\t\t# ... get the minimax value of each action..\n\t\t# Uses some Evil magic to get around ruby specific copying problems.\n\t\t#=========================================================================================\n\t\tlookAhead = eval(gameState.class.to_s+\".new(gameState.getSuccessor(gameState.agents[initialIndex], action))\")\n\t\tminimax = minValue(lookAhead, depth, alpha, beta, (initialIndex+1)%2, action)\n\t\t#=========================================================================================\n\t\t# Keep track of every better outcome.\n\t\t#=========================================================================================\n\t\tif minimax > bestScore\n\t\t\tbestScore = minimax\n\t\t\tbestAction = action\n\t\tend\n\t\t#=========================================================================================\n\t\t# Ignore children when we are bigger than beta.\n\t\t#=========================================================================================\n\t\tif bestScore > beta\n\t\t\tbreak\n\t\tend\n\t\t#=========================================================================================\n\t\t# Update alpha\n\t\t#=========================================================================================\n\t\talpha = [alpha,bestScore].max\n\tend\n\t#=========================================================================================\n\t# Return the best action.\n\t#=========================================================================================\n\treturn bestAction\nend", "def min() end", "def build_minheap\n\t\ti = @heap.length/2\n\t\twhile i >= 0\n\t\t\tminheapify(i)\n\t\t\ti -= 1\n\t\tend\n\tend", "def initialize(name, priority) \n \nend", "def initialize\n\t\t@generation = 0\n\t\t@evaluation = 0\n\t\t@best = nil\n\tend", "def initialize(x, y, num_of_mines)\n raise ArgumentError, 'too many mines' if num_of_mines > (x * y)\n @board = Board.new(x, y, num_of_mines)\n end", "def minimize()\r\n $jssh_socket.send(\"#{WINDOW_VAR}.minimize();\\n\", 0)\r\n read_socket()\r\n end", "def optimise(number_of_generations = 0)\n previous_best = best_fitness\n\n # optimise\n if number_of_generations > 0\n evolve_n_times(number_of_generations)\n else\n optimise_by_strategy\n end\n\n @best_fitness = @fitness_evaluator.fitness(best)\n\n @best_fitness > previous_best\n end", "def initialize(popSize=0,solution,args)\t\n\t\t#set desired \n\t\t@@elitism = args[:elitism]\n\t\t@@mutationRate = args[:mutationRate]\n\t\tFitness::setSolution(solution)\n\t\t@mutationNum\t= 0\n\t\t@population = Population.new(popSize,true,{:data =>args[:data]},Fitness)\n\tend", "def make\n @stats = []\n @history.each {|generation| make_stats(generation) } \n when_best\n self\n end", "def initialize(g, parameters = {} )\n\t\t\tmobility_constrainted = true\n\t\t\tno_resource_limit = true\n\t\t\terror_bound = Math::log(1 - 0.01) \n\t\t\ttq = 2\n\t\t\tif parameters[:q] == nil then q = nil else q = parameters[:q] end\n\n\t\t\tif parameters[:mobility_constrainted] == nil then mobility_constrainted = mobility_constrainted\n\t\t\telse mobility_constrainted = false end\n\n\t\t\tif parameters[:no_resource_limit] == nil then no_resource_limit = no_resource_limit\n\t\t\telse no_resource_limit = true end\n\n\t\t\toperations = [] \n\n\t\t\tif parameters[:error_bound] == nil then error_bound = Math::log(1 - 0.01)\n\t\t\telse error_bound = parameters[:error_bound] end\n\n\t\t\tif parameters[:times_q] == nil then tq = 2\n\t\t\telse tq = parameters[:times_q] end\n\n\t\t\t@q = q\n\t\t\t@bits = g.p[:n]\n\t\t\t@vertex = g.p[:v]\n\t\t\t@edge = g.p[:e]\n\t\t\t@mC = mobility_constrainted\n\t\t\t@u = Hash[DEFAULT_OPERATION_PARAMETERS.map{|k,v| [k, v[:u] ]} ]\n\t\t\t@ui = @vertex.map.with_index {|v,i| # the index of implementation\n\t\t\t\t[*0..DEFAULT_OPERATION_PARAMETERS[v][:n].length - 1].select{|ii| \n\t\t\t\t\tDEFAULT_OPERATION_PARAMETERS[v][:n][ii] >= @bits[i] }}\n\t\t\t@d = Hash[DEFAULT_OPERATION_PARAMETERS.map{|k,v| [k, v[:d] ]} ]\n\t\t\t@di = @ui.map.with_index{ |uii,i|\n\t\t\t\tuii.map{|u,ii| DEFAULT_OPERATION_PARAMETERS[@vertex[i]][:d][u] } }\n\t\t#\t@g = Hash[DEFAULT_OPERATION_PARAMETERS.map{|k,v| [k, v[:g] ]} ]\n\t\t\t@gi = @ui.map.with_index{ |uii,i|\n\t\t\t\tuii.map{|u,ii| DEFAULT_OPERATION_PARAMETERS[@vertex[i]][:g][u] } }\n\t\t#\t@p = Hash[DEFAULT_OPERATION_PARAMETERS.map{|k,v| [k, v[:p] ]} ]\n\t\t\t@pi = @ui.map.with_index{ |uii,i|\n\t\t\t\tuii.map{|u,ii| DEFAULT_OPERATION_PARAMETERS[@vertex[i][:p][u]] } }\n\t\t\t@err = Hash[DEFAULT_OPERATION_PARAMETERS.map{|k,v| [k, v[:err]]}]\n\t\t\t@errB = error_bound\n\n\t\t\t#get the vertices without vertices depending on\n\t\t\t@end = [*0..@vertex.length-1].map{|i| !@edge.map{|e| e[1]}.include?(i)}\n\t\t\t@end_vertex = [*0..@end.length - 1].select{|i| @end[i] == true}\n\t\t\t@PI_vertex = [*0..g.p[:PI].length - 1].select{|i| g.p[:PI][i] == true}\n\t\t\t@PO_vertex = [*0..g.p[:PO].length - 1].select{|i| g.p[:PO][i] == true}\n\t\t\tif (mobility_constrainted )\n\t\t\t\tret = self.ASAP\n\t\t\t\t@critical_length = ret[:latency]\n\t\t\t\tif( @q == nil) then q = @q = @critical_length * tq end\n\t\t\t\t@asap = ret[:schedule]\n\t\t\t\t@alap = self.ALAP\n\t\t\t\t@mobility = @asap.map.with_index{|m,i| @alap[i] - @asap[i] }\n\t\t\t\t@Nx = @vertex.map.with_index{|v,i| @ui[i].length * (1 + @mobility[i]) }.reduce(0,:+) \n\t\t\telse\n\t\t\t\t@Nx = @vertex.map{|v| @ui[i].length * q}.reduce(0,:+) \n\t\t\t\tif( q == nil) then q = 40 end\n\t\t\tend\n\t\t\t@Nrow =\t\n\t\t\t\t@vertex.length +\n\t\t\t\t@vertex.length + \n\t\t\t\t@edge.length + \n\t\t\t\t@end.count(true) +\n\t\t\t\t@vertex.count{|v| v != 'D'} + #error in D operation is ignored\n\t\t\t\tg.p[:PO].count(true) +\n\t\t\t\tq * @u.values.flatten.length +\n\t\t\t\t@u.values.flatten.length\n\t\t\t@Nerr = @vertex.length\n\t\t\t@Nu = @u.values.flatten.length \n\t\t\t@Ns = @vertex.length\n\t\t\t@Ncolumn = @Nx + @Nerr + @Nu + @Ns\n\t\t\t@A = \n\t\t\t@vertex.map.with_index{|v,i|\t\t#Formula (2) \n\t\t\t\tif(mobility_constrainted)\n\t\t\t\t\tstart_point = [*0..i-1].map{|j| @ui[j].length * (1 + @mobility[j]) }.reduce(0, :+)\n\t\t\t\t\t#start_point = [*0..i-1].map{|j| @u[@vertex[j]].length * (1 + @mobility[j]) }.reduce(0,:+) \n\t\t\t\t\tntail = @Ncolumn - start_point - @ui[ j ].length * (1 + @mobility[i])\n\t\t\t\t\tArray.new(start_point, 0) + Array.new(@ui[ i ].length * (1 + @mobility[i]), 1) + Array.new(ntail, 0)\n\t\t\t\telse\n\t\t\t\t\tstart_point = [*0..i-1].map{|j| @ui[j].length * q }.reduce(0,:+) \n\t\t\t\t\tntail = @Ncolumn - start_point - @ui[ i ].length * q\n\t\t\t\t\tArray.new(start_point, 0) + Array.new(@ui[ i ].length * q, 1) + Array.new(ntail, 0)\n\t\t\t\tend\n\t\t\t} +\n\t\t\t@vertex.map.with_index{|v,i|\t#Formula (3) \n\t\t\t\tif(mobility_constrainted)\n\t\t\t\t\tstart_point = [*0..i-1].map{|j| @ui[j].length * (1 + @mobility[j]) }.reduce(0,:+) \n\t\t\t\t\txArray = [*@asap[i]..@alap[i] ].map{|t| Array.new(@ui[i].length, t)}.reduce([], :+) \n\t\t\t\t\tntail = @Nx - start_point - @ui[i].length * (1 + @mobility[i] )\n\t\t\t\telse\n\t\t\t\t\tstart_point = [*0..i-1].map{|j| @ui[j].length * q }.reduce(0,:+) \n\t\t\t\t\txArray = [*0..q-1].map{|t| Array.new(@ui[i].length, t)}.reduce([], :+)\n\t\t\t\t\tntail = @Nx - start_point - @ui[i].length * q\n\t\t\t\tend\n\t\t\t\tsArray = Array.new(@vertex.length,0)\n\t\t\t\tsArray[i] = -1\n\t\t\t\tArray.new(start_point, 0) + xArray + Array.new(ntail, 0) + Array.new(@Nerr, 0) + Array.new(@Nu, 0) + sArray\n\t\t\t} +\n\t\t\t@edge.map{|e|\t#Formula (4) 41\n\t\t\t\tif(mobility_constrainted)\n\t\t\t\t\tstart_point = [*0..e[1]-1].map{|j| @ui[j].length * (1 + @mobility[j]) }.reduce(0,:+) \n\t\t\t\t\tntail = @Nx - start_point - @ui[ e[1] ].length * (1 + @mobility[e[1]])\n\t\t\t\t\txArray = [*@asap[e[1]]..@alap[e[1]]].map{|t| @di[ e[1] ] }.reduce([], :+) \n\t\t\t\telse\n\t\t\t\t\tstart_point = [*0..e[1]-1].map{|j| @ui[ j ].length * q }.reduce(0,:+) \n\t\t\t\t\tntail = @Nx - start_point - @ui[ e[1] ].length * q\n\t\t\t\t\txArray = [*0..q-1].map{|t| @di[ e[1] ] }.reduce([], :+) \n\t\t\t\tend\n\t\t\t\tsArray = Array.new(@vertex.length,0)\n\t\t\t\tsArray[e[0]] = -1\n\t\t\t\tsArray[e[1]] = 1\n\t\t\t\tArray.new(start_point, 0) + xArray + Array.new(ntail, 0) + Array.new(@Nerr, 0) + Array.new(@Nu, 0)+ sArray\n\t\t\t} +\n\t\t\t@end_vertex.map.with_index{|v,i|\t#Formula (5)\n\t\t\t\tif(mobility_constrainted)\n\t\t\t\t\tstart_point = [*0..v-1].map{|j| @ui[j]].length * (1+@mobility[j]) }.reduce(0,:+) \n\t\t\t\t\tntail = @Nx - start_point - @ui[v].length * (1+@mobility[v])\n\t\t\t\t\txArray = [*@asap[v]..@alap[v]].map{|t| @di[ v ] }.reduce([], :+)\n\t\t\t\telse\n\t\t\t\t\tstart_point = [*0..v-1].map{|j| @ui[ j ].length * q }.reduce(0,:+) \n\t\t\t\t\tntail = @Nx - start_point - @ui[ v ].length * q\n\t\t\t\t\txArray = [*0..q-1].map{|t| @di[v ] }.reduce([], :+)\n\t\t\t\tend\n\t\t\t\tsArray = Array.new(@vertex.length,0)\n\t\t\t\tsArray[v] = 1\n\t\t\t\tArray.new(start_point, 0) + xArray + Array.new(ntail, 0) + Array.new(@Nerr, 0) + Array.new(@Nu, 0)+ sArray\n\t\t\t} +\n\t\t\t@vertex.map.with_index{|v,i|\t\t\t#Formula (6) (7) error\n\t\t\t\tif(mobility_constrainted)\n\t\t\t\t\tstart_point = [*0..i-1].map{|j| @ui[j].length * (1+@mobility[j]) }.reduce(0,:+) \n\t\t\t\t\txArray = [*@asap[i]..@alap[i]].map{|t| #Array.new(@err[v])}.reduce([], :+) \n\t\t\t\t\tntail = @Nx - start_point - @u[v].length * (1+@mobility[i])\n\t\t\t\telse\n\t\t\t\t\tstart_point = [*0..i-1].map{|j| @ui[j].length * q }.reduce(0,:+) \n\t\t\t\t\txArray = [*0..q-1].map{|t| #Array.new(@err[v])}.reduce([], :+) \n\t\t\t\t\tntail = @Nx - start_point - @ui[i].length * q\n\t\t\t\tend\n\t\t\t\terrArray = Array.new(@Nerr, 0)\n\t\t\t\terrArray[i] = -1\n\t\t\t\tif g.p[:PI][i] == false\n\t\t\t\t\t@edge.select{|e| e[0] == i}.each{|e| errArray[e[1] ] = 1}\t\n\t\t\t\tend\n\t\t\t\tArray.new(start_point, 0) + xArray + Array.new(ntail, 0) + errArray + Array.new(@Nu, 0) + Array.new(@Ns, 0)\n\t\t\t} +\n\t\t\t@PO_vertex.map{|v|\t\t\t#Formula (8)\n\t\t\t\terrArray = Array.new(@Nerr, 0)\n\t\t\t\terrArray[v] = 1\n\t\t\t\tArray.new(@Nx, 0) + errArray + Array.new(@Nu, 0) + Array.new(@Ns, 0)\n\t\t\t} +\n\t\t\t[*0..q * @u.values.flatten.length - 1].map{|row_i|\t#Formula (9)\n\t\t\t\tt = row_i / @u.values.flatten.length\n\t\t\t\tdi = row_i % @u.values.flatten.length\n\t\t\t\td = @d.values.flatten[di]\n\t\t\t\tflattenUtype = @u.keys.map{|k| Array.new(@u[k].length, k)}.reduce([],:+)\n\t\t\t\tflattenUimplementation = @u.keys.map{|k| [*0..@u[k].length - 1]}.reduce([], :+)\n\t\t\t\ttype = flattenUtype[di]\n\t\t\t\timplementation = flattenUimplementation[di]\n\t\t\t\tif(mobility_constrainted) then xArray =\t@vertex.map.with_index{|v,xi| [*@asap[xi]..@alap[xi]].map{|xt| \n\t\t\t\t\t@ui[xi].map.with_index{|u,m| if v == type and xt <= t and t <= xt + d - 1 and u == implementation then 1 else 0 end}\n\t\t\t\t\t}.reduce([],:+)}.reduce([],:+)\n\t\t\t\telse xArray = @vertex.map.with_index{|v,xi|\t[*0..q - 1].map{|xt|\n\t\t\t\t\t@ui[xi].map.with_index{|u,m| if v == type and u == implementation and xt <= t and t <= xt + d - 1 then 1 else 0 end}\n\t\t\t\t\t}.reduce([],:+)}.reduce([],:+)\n\t\t\t\tend\n\t\t\t\tuArray = Array.new(@Nu, 0)\n\t\t\t\tuArray[di] = -1\n\t\t\t\txArray + Array.new(@Nerr, 0) + uArray + Array.new(@Ns, 0) \n\t\t\t} +\n\t\t\t( if no_resource_limit == false then [*0..@u.values.flatten.length - 1].map{|u|\n\t\t\t\tuArray = Array.new(@Nu, 0)\n\t\t\t\tuArray[u] = 1\n\t\t\t\tArray.new(@Nx, 0) + Array.new(@Nerr, 0) + uArray + Array.new(@Ns, 0)\n\t\t\t} else [] end)\n\t\t\t@op \t= \t\n\t\t\t\tArray.new(@vertex.length, EQ)\t\t\t\t+\t\t#Formula (2)\n\t\t\t\tArray.new(@vertex.length, EQ)\t\t\t\t+\t\t#Formula (3)\n\t\t\t\tArray.new(@edge.length, LE)\t\t\t\t+\t\t#Formula (4)\t\n\t\t\t\tArray.new(@end_vertex.length, LE )\t\t\t+\t\t#Formula (5)\n\t\t\t\t#Array.new(@vertex.length, EQ)\t\t\t\t+\t\t#Formula (6) (7)\n\t\t\t\t#Array.new(@PO_vertex.length, GE)\t\t\t+\t\t#Formula (8)\n\t\t\t\tArray.new(q * @u.values.flatten.length, LE)\t\t+\t\t#Formula (9)\n\t\t\t\t( if no_resource_limit == false then Array.new(@u.values.flatten.length, LE) else [] end)\n\t\t\t@b \t=\n\t\t\t\tArray.new(@vertex.length, 1)\t\t\t\t+\t\t#Formula (2)\n\t\t\t\tArray.new(@vertex.length, 0)\t\t\t\t+\t\t#Formula (3)\n\t\t\t\tArray.new(@edge.length, 0)\t\t\t\t+\t\t#Formula (4)\t\n\t\t\t\tArray.new(@end_vertex.length, q)\t\t\t+\t\t#Formula (5)\n\t\t\t\t#Array.new(@vertex.length , 0)\t\t\t\t+\t\t#Formula (6) (7)\n\t\t\t\t#Array.new(@PO_vertex.length, @errB)\t\t\t+\t\t#Formula (8)\n\t\t\t\tArray.new(q * @u.values.flatten.length, 0)\t\t+\t\t#Formula (9)\n\t\t\t\t( if no_resource_limit == false then @u.values.flatten else [] end) \n\t\t\t@c\t=\n\t\t\t\tif(mobility_constrainted)\n\t\t\t\t\t@vertex.map.with_index{|v,xi| [*@asap[xi]..@alap[xi]].map{|xt| @g[v] }.reduce([], :+) }.reduce([], :+)\n\t\t\t\telse\n\t\t\t\t\t@vertex.map.with_index{|v,xi| [*0..q-1].map{|xt| @g[v] }.reduce([], :+) }.reduce([], :+)\n\t\t\t\tend\t\t\t\t\t\t\t+\t\t#xArray\n\t\t\t\tArray.new(@Nerr, 0)\t\t\t\t\t+\t\t#errArray\n\t\t\t\t@p.values.flatten.map{|p| p * q }\t\t\t+\t\t#uArray\n\t\t\t\tArray.new(@Ns, 0)\t\t\t\t\t\t\t#sArray\n\t\t\t@int\t=\n\t\t\t\tArray.new(@Nx, 'B')\t\t\t\t\t+\n\t\t\t\tArray.new(@Nerr, 'C')\t\t\t\t+\n\t\t\t\tArray.new(@Nu, 'I')\t\t\t\t\t+ \n\t\t\t\tArray.new(@Ns, 'I')\n\t\t\t@lb\t=\n\t\t\t\tArray.new(@Nx, 0)\t\t\t\t\t+\n\t\t\t\tArray.new(@Nerr, -Float::INFINITY)\t+\n\t\t\t\tArray.new(@Nu, 0)\t\t\t\t\t+\n\t\t\t\tArray.new(@Ns, 0)\t\t\t\t\t\n\t\t\t@ub\t=\n\t\t\t\tArray.new(@Nx, Float::INFINITY) +\n\t\t\t\tArray.new(@Nerr, 0) +\n\t\t\t\tArray.new(@Nu, Float::INFINITY) +\n\t\t\t\tArray.new(@Ns, Float::INFINITY)\n\t\t\t\n\t\tend", "def test_HEURISTIC_20\n path=\"/home/miro/NetBeansProjects/Knapsack/test/\"\n\n p=Solver.new\n\n p.read_problem(path+\"input3\")\n\n assert_equal(1979, p.heuristic)\n\n p=Solver.new\n p.read_problem(path+\"input4\")\n\n assert_equal(2168, p.heuristic)\n\n p=Solver.new\n p.read_problem(path+\"input5\")\n\n assert_equal(2516, p.heuristic)\n\n\n\n end", "def new\n @evaluations = Evaluation.new\n end", "def optimize\n operation.class.reverse.new(right, left)\n end", "def solve_stupid\n nodes_num.times.collect{|node_num| make_wave(node_num) }.min\n end", "def mock_grower(min_support, grower)\n allow(algorithm).\n to receive(:new).\n with(changesets, min_support: min_support).\n and_return(grower)\n end", "def optimize(**options)\n optimized = self.deep_dup\n #optimized.lexical = nil if optimized.respond_to?(:lexical=)\n #optimized\n end", "def initialize(tree)\n super tree\n @fitness = Fitness.new tree\n end", "def solution_proximity_heuristic(amount,comb,coins)\n (amount-comb.sum)*min_size_heuristic(amount,comb,coins)\nend", "def redesign\n new_maze = Maze.new\n #continues until it gets a valid maze\n while !new_maze.loaded?\n new_maze = self.create_minimum\n string = new_maze.save\n string.strip!\n #tries to load the maze\n new_maze.load string, (@old_maze.width-1)/2, (@old_maze.height-1)/2\n #resets the maze full of walls if it is needed again\n @maze = Maze.new\n @maze.load @old_string, (@old_maze.width-1)/2, (@old_maze.height-1)/2, true\n end\n new_maze\n end", "def initialize(win_minimum:, win_margin: DEFAULT_WIN_MARGIN)\n @score1 = 0\n @score2 = 0\n @win_minimum = win_minimum\n @win_margin = win_margin\n @deuce_minimum = win_minimum - 1\n end", "def initialize(iName, iPriority, iSizing, iResourcesMap, iSuccessorsList)\n @Name = iName\n @Priority = iPriority\n @Sizing = iSizing\n @ResourcesMap = iResourcesMap\n @Successors = iSuccessorsList\n # Also initialize internal attributes\n @Predecessors = []\n @AccessibleTasks = {}\n @SharingResourcesTasksID = nil\n end", "def initialize(x, y)\n\t\t@neurons = Array.new\n\t\tx.times do\n\t\t\tneuron = Array.new(y)\n\t\t\t\n\t\t\t#create random weights\n\t\t\tneuron.each_index do |weight|\n\t\t\t\tneuron[weight] = rand * 2.0 - 1.0\n\t\t\tend\n\t\t\t@neurons << neuron\n\t\tend\n\tend", "def optimize!(path)\n @optimizer.optimize_image!(path)\n end", "def synpred9_Jejune\n # -> uncomment the next line to manually enable rule tracing\n # trace_in( __method__, 95 )\n\n # at line 680:7: 'new' new_target ( arguments )?\n match( NEW, TOKENS_FOLLOWING_NEW_IN_synpred9_Jejune_4812 )\n @state.following.push( TOKENS_FOLLOWING_new_target_IN_synpred9_Jejune_4814 )\n new_target\n @state.following.pop\n # at line 680:24: ( arguments )?\n alt_109 = 2\n look_109_0 = @input.peek( 1 )\n\n if ( look_109_0 == LPAREN )\n alt_109 = 1\n end\n case alt_109\n when 1\n # at line 680:24: arguments\n @state.following.push( TOKENS_FOLLOWING_arguments_IN_synpred9_Jejune_4816 )\n arguments\n @state.following.pop\n\n end\n\n ensure\n # -> uncomment the next line to manually enable rule tracing\n # trace_out( __method__, 95 )\n\n end", "def minheapify(i=0)\n\t\tn_heapify(@min, i)\n\t\t@heap\n\tend", "def question_one\n stack = Stack.new\n stack.push(3)\n stack.push(5)\n stack.push(2)\n stack.push(4)\n stack.push(1)\n stack.pop\n stack.pop\n stack.pop\n stack.min\nend", "def initialize\n super\n # Default operators\n @evaluator = Evaluator.new self\n @expressor = Expressor.new self\n @evolver = Evolver.new self\n end", "def new\n @tactic = Tactic.new\n end", "def initialize(solution, cost)\n @tour = solution\n @cost = cost\n end", "def optimize!\n rsp = post(\"<optimize/>\")\n success?(rsp.body) or log_error(rsp.body)\n end", "def evaluate_simplex\n # evaluate the objective function at all non-evaluated simplex points\n 0.upto(@simplex.length - 1) do |i|\n vertex = @simplex[i]\n point = vertex.point\n if vertex.value.nan?\n @simplex[i] = PointValuePair.new(point, f(point))\n end\n end\n # sort the simplex from best to worst\n @simplex.sort!{ |x1, x2| x1.value <=> x2.value }\n end", "def optimize!(**options)\n ops = operands.map {|o| o.optimize(**options) }.select {|o| o.respond_to?(:empty?) && !o.empty?}\n @operands = ops\n self\n end", "def initialize(attack, min_range, max_range, splash=[1.0], energy_cost=1)\n @min_range = 0\n @max_range = 0\n\n self.attack = attack\n self.min_range = min_range\n self.max_range = max_range\n\n @splash = splash\n\n self.energy_cost = energy_cost\n end", "def initialize(parent, full_name, priority, source_root, middleware_stack, middleware_lookup,\n tool_class = nil)\n @parent = parent\n @settings = Settings.new(parent: parent&.settings)\n @full_name = full_name.dup.freeze\n @priority = priority\n @source_root = source_root\n @built_middleware = middleware_stack.build(middleware_lookup)\n @subtool_middleware_stack = middleware_stack.dup\n\n @acceptors = {}\n @mixins = {}\n @templates = {}\n @completions = {}\n\n @precreated_class = tool_class\n\n reset_definition\n end", "def minimax idx = nil\n\t\tmove(idx) if idx\n\t\tleaf_value = evaluate_winner\n\t\treturn leaf_value if leaf_value\n\t\tpossible_moves.map { |idx|\n\t\t\tminimax(idx).send(@turn == \"x\" ? :- : :+, @movelist.count+1)\n\t\t}.send(@turn == \"x\" ? :max : :min)\n\tensure\n\t\tunmove if idx\n\tend", "def initialize\n\t\t@calculator = []\n\tend", "def minweight(w)\n @weight = w if w<@weight\n end", "def windowed_max_range_v2(arr,w)\n stack = MinMaxStackQueue.new\n \n\nend", "def initialize start_vector, goal_vector, options = {}\n @debug_level = options[:debug_level] || 1\n @epsilon = options[:epsilon] || 0.01\n @max_iterations = options[:max_iterations] || 1000\n @banned_points = options[:banned_points] || {}\n @start_vector = start_vector\n @goal_vector = goal_vector\n end", "def initialize(problem)\n @problem = problem\n @best_configuration = Array.new\n @current_configuration = Array.new\n @best_fitness = 0\n @weights = @problem.M + 1\n @itemsSize = @problem.n + 1\n @table = Array.new(@weights) { Array.new(@itemsSize) }\n @error=0\n \n \n for i in 0..@weights - 1\n @table[i][0] = 0\n end\n end", "def create\n @optimu = Optimu.new(params[:optimu])\n\n respond_to do |format|\n if @optimu.save\n format.html { redirect_to @optimu, notice: 'Optimu was successfully created.' }\n format.json { render json: @optimu, status: :created, location: @optimu }\n else\n format.html { render action: \"new\" }\n format.json { render json: @optimu.errors, status: :unprocessable_entity }\n end\n end\n end", "def minima\n return Features.minima(@data)\n end", "def min_cost_climbing_stairs(cost)\n [step(cost, 0), step(cost, 1)].min\nend", "def initialize(args={})\n @params = {:elite => 0.1, :mutate => 0.02}\n @params.merge! args\n @population = []\n end", "def set_weights(weights); self;end", "def createPowerEfficient\n stations = createSpaceStation\n \n return PowerEfficientSpaceStation.new(stations[0])\n end", "def _process_queue\n [@queue.length, @max_minifiers - @working_minifiers.length].min.times {\n _spawn_minifier\n }\n end", "def minimax(cells, current_player)\n return score(cells) if game_ended?(cells)\n\n scores = {}\n potential_move = []\n potential_move = available_cells_position(cells)\n\n# each potential move will be placed on the board and the outcome will give the score\n potential_move.each do |position|\n possible_cells = cells.dup\n if current_player == 2\n possible_cells[position] = 2\n else\n possible_cells[position] = 1\n end\n\n scores[position] = minimax(possible_cells, switch_player(current_player))\n end\n\n# the move that score the highest will be used\n if current_player == 2\n @best_move, best_score = scores.max_by { |_k, v| v }\n return best_score\n else\n @best_move, best_score = scores.min_by { |_k, v| v }\n return best_score\n end\n end", "def create_minimax_tree(ttt)\n \n\n #\n # Checks for all possible endgame scenarios\n # If true: sets @score & resets @avail_moves\n #\n if ttt.winner?(current_player)\n set_score\n @avail_moves = []\n return @score\n elsif ttt.draw?(@data[min_player], @data[max_player]) || difficulty_level_limit(EXPERT) || computer_opens_game\n @avail_moves = []\n return @score\n end\n\n\n #\n # Creates a child node for each @avail_moves value in current node\n #\n generate_tree_nodes(ttt)\n\n\n #\n # Recursively calls each new child node created\n # Returns score values for sibling nodes, stores in score_array\n #\n score_array = []\n @children.each do |n|\n node_score = n.create_minimax_tree(ttt)\n score_array << node_score\n end\n\n\n #\n # Sets current node @score value\n # If @depth even, receives max score from score_array (children node score values)\n # If @depth odd, receives min score from score_array (children node score values)\n #\n @score = @depth.even? ? score_array.max : score_array.min\n\n return @score\n end", "def apply_move(key, cost)\n State.new(@maze, key, @keys + key, @base_cost + cost, @subset_mask | Maze.key_bit(key))\n end", "def withRestr(_rule, minbs, maxbs, legendary)\r\n ret = PokemonChallengeRules.new.addPokemonRule(BaseStatRestriction.new(minbs, maxbs))\r\n if legendary == 0\r\n ret.addPokemonRule(NonlegendaryRestriction.new)\r\n elsif legendary == 1\r\n ret.addPokemonRule(InverseRestriction.new(NonlegendaryRestriction.new))\r\n end\r\n return ret\r\nend", "def simplify; self; end", "def min_2(x, y)\nend", "def initialize(problem, population_size, mutation_rate, generations)\n @problem = problem\n @best_fitness = 0;\n @best_configuration = nil\n @error = 0\n @generations = generations\n \n @population_size = population_size\n @mutation_rate = mutation_rate\n \n \n if @population_size%2 != 0 || @population_size < 1\n raise(\"Population size must be even and higher than 1.\")\n end\n \n @population = Array.new\n for i in 0..@population_size - 1\n conf = Configuration.new(@problem)\n ch = Chromosome.new(conf)\n @population.push(ch)\n \n if @best_configuration == nil || @best_fitness < ch.fitness\n @best_configuration = ch.configuration.conf\n @best_fitness = ch.fitness\n end\n \n end\n \n @selection = TournamentSelection.new\n @reproduction = UniformReproduction.new(@problem)\n @mutation = SimpleMutation.new(@problem, @mutation_rate)\n \n \n end", "def new_input_set()\n return SiteStatsInputSet.new()\n end", "def new\n @pornstar = Pornstar.new\n end", "def initialize(priority, weight, port, target)\n @priority = priority.to_int\n @weight = weight.to_int\n @port = port.to_int\n @target = Name.create(target)\n end", "def initialize(args = {})\n @cfg = {\n :dim => 2,\n :exp_f => 1.5, \n :cnt_f => 0.5,\n :tol => 0.001,\n :niter => 50,\n :pconv => true,\n :plotopt=> {:title => 'Nelder Mean Method Convergence',\n :xlabel => 'No. iteration',\n :ylabel => 'Objective function value',\n :yrange => [ -1 , 3 ],\n :grid => \"set grid\"\n }\n }\n @cfg.merge! args\n @simplex = Simplex.new(@cfg[:dim])\n @start_points = []\n @status = :filling\n @iteration = 0\n if @cfg[:pconv] == true # this is the plot\n @gp = GNUPlotr.new(\"/opt/local/bin/gnuplot\")\n # enable command history recording\n @gp.record = true\n # Issue raw gnuplot commands\n @gp.raw @cfg[:plotopt][:grid]\n # Some magic mapping works too:\n @gp.set_grid\n @gp.set_title @cfg[:plotopt][:title] , :font => \"Times New Roman,18\"\n @gp.set_xlabel @cfg[:plotopt][:xlabel], :font => \"Times New Roman,18\"\n @gp.set_ylabel @cfg[:plotopt][:ylabel], :font => \"Times New Roman,18\"\n @gp.set_xrange( 0 .. @cfg[:niter])\n @gp.set_yrange(@cfg[:plotopt][:yrange][0] .. @cfg[:plotopt][:yrange][1])\n end\n end", "def mini_max\nend", "def initialize(name)\n super\n @can_add = BattlerRequirement.new\n @can_remove = BattlerRequirement.new\n\n # @exp = {}\n # 100.times{|n| @exp[n] = n * 5 } #TODO find better calc\n # @exp_multiplicator = 1.0\n end", "def min; end", "def min; end", "def get_or_create_algorithm(name, sym)\n a = @algorithms.select { |a| a.name == name }.first\n if ! a\n a = Algorithm.new(name, sym)\n add_algorithm_obj(a)\n end\n\n a\n end", "def maze_gaming(across,down,op)\n maze = Maze.new(across,down)\n if(op == 'size')\n load_input(maze)\n else\n maze.load(op)\n maze.display if(maze.valid == true)\n end\n if(maze.valid == true)\n solve_and_redesign(maze)\n end\n end", "def minmax_technique\n possible_solutions = []\n @set.each { |solution|\n possible_solutions << solution if evaluate(@guess, solution) == @feedback_to_evaluation\n }\n @set = possible_solutions\n @guess = @set.sample\n @set.delete(@guess)\n return @guess\n end", "def minimized(value)\n @ole.Minimized = value\n nil\n end", "def minimized(value)\n @ole.Minimized = value\n nil\n end", "def initialize(*)\n super\n @left = optimize_left\n @right = optimize_right\n end", "def fitness\n return @fitness if @fitness\n\n cls = (options[:kappa]).times.map { |i| [] }\n @data.each_with_index { |g, i| cls[g].push i}\n\n p_b2 = cls.map { |c| penalty_before(c) }\n p_a2 = cls.map { |c| penalty_after(c) }\n\n impr2 = p_b2.zip(p_a2).map do |b,a|\n b > 0 ? ((b - a)/b) : 0\n end.inject(0,:+)\n\n @fitness = impr2\n end" ]
[ "0.6874386", "0.66997546", "0.648011", "0.64729565", "0.58447284", "0.5651434", "0.54799885", "0.5431681", "0.5418742", "0.53496504", "0.534537", "0.52192473", "0.51591676", "0.51274407", "0.5107791", "0.51020116", "0.504293", "0.501242", "0.49088362", "0.48684236", "0.4814103", "0.48067904", "0.47836804", "0.47749433", "0.47506276", "0.47449318", "0.47416598", "0.47330675", "0.47304317", "0.469314", "0.46420294", "0.4639041", "0.46382496", "0.46352082", "0.46111986", "0.46077648", "0.4606024", "0.45977995", "0.45840114", "0.45672196", "0.45642447", "0.4562063", "0.4555856", "0.4538339", "0.45335558", "0.4524043", "0.45053023", "0.45049784", "0.44965747", "0.44833606", "0.44813773", "0.4475781", "0.44745174", "0.44642344", "0.445548", "0.44499037", "0.44472826", "0.4443017", "0.44254133", "0.44217572", "0.4412414", "0.4410452", "0.44055682", "0.44022015", "0.43956324", "0.43922034", "0.43889552", "0.43877634", "0.43732744", "0.4372825", "0.43658382", "0.43626013", "0.43624052", "0.4357396", "0.43554464", "0.43533814", "0.43524787", "0.43424517", "0.43422675", "0.43387842", "0.43374115", "0.43365607", "0.43349543", "0.43264547", "0.43211174", "0.43169683", "0.43122542", "0.43116847", "0.43084222", "0.43081293", "0.43037462", "0.43025365", "0.42959276", "0.42959276", "0.42933702", "0.42926353", "0.42910767", "0.42905506", "0.42905506", "0.42899463", "0.42892885" ]
0.0
-1
Iterate to find the minimum
def iterate raise "You should implement this" end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_min_iterative(array)\n minimum = nil\n\n array.each { |element| minimum = element if minimum.nil? || element < minimum }\n\n minimum\nend", "def my_min_once\n min = first\n each do |num|\n if num < min\n min = num\n end\n end\n min\n end", "def my_min(list)\n min = list.first \n\n list.each do |el|\n if el < min \n min = el \n end\n end\n min\nend", "def my_min_2(list)\n min = list.first\n list.each do |num|\n if num < min \n min = num\n end\n end\n min\nend", "def my_min_ii(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min(list)\n smallest = list.first\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min(list)\r\n smallest = list.first\r\n list.each do |ele|\r\n smallest = ele if ele < smallest\r\n end\r\n return smallest\r\nend", "def iterate_once_my_min(integers)\n min = integers.first\n integers.each do |integer|\n min = integer if integer < min\n end\n min\nend", "def my_min(list)\n min = 0\n list.each do |ele|\n list.each do |ele2|\n min = ele if ele < ele2 && ele < min\n end\n end\n min\nend", "def my_min2(arr)\n minimum = arr.first\n arr.each do |num|\n minimum = num if num < minimum\n end\n minimum\nend", "def min\n min = @m[0][0]\n for i in 0...fi\n for k in 0...co\n if @m[i][k] < min then\n min=@m[i][k]\n end\n end\n end \n min\n end", "def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end", "def my_min_better(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min(list)\n\n min = nil\n\n list.each do |ele|\n min ||= ele\n list.each do |ele2|\n if ele2 < min\n min = ele2\n end\n end\n end\n\n min\nend", "def min() end", "def my_min_fast(list)\n smallest = list.first\n\n list[1..-1].each { |n| smallest = n if n < smallest }\n smallest\nend", "def my_min(list)\r\n smallest = 0\r\n \r\n list.each_with_index do |ele1, idx1|\r\n list.each_with_index do |ele2, idx2|\r\n if idx2 > idx1 \r\n if ele1 < smallest\r\n smallest = ele1\r\n end\r\n if ele2 < smallest\r\n smallest = ele2\r\n end\r\n end\r\n end\r\n end\r\n\r\n smallest\r\nend", "def my_min(list)\n\n # phase 1\n # min = list.first\n # list.each_with_index do |ele_1, i_1|\n # list.each_with_index do |ele_2, i_2|\n # if i_2 != i_1\n # if min > ele_2\n # min = ele_2\n # end\n # end\n # end\n # end\n # min\n\n # phase 2\n min = list.first\n list[1..-1].each do |ele|\n if min > ele\n min = ele\n end\n end\n min\nend", "def my_min2(list)\n min = 0\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def good_my_min(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min(arr)\n min = arr[0]\n arr.each do |num|\n if num < min\n min = num\n end\n end\n min\n\nend", "def my_min(arr)\n min = arr.first\n\n arr.each do |el|\n min = el if el < min\n end\n\n min\nend", "def min(&block)\n flag = true # 1st element?\n result = nil\n self.each{|*val|\n val = val.__svalue\n if flag\n # 1st element\n result = val\n flag = false\n else\n if block\n result = val if block.call(val, result) < 0\n else\n result = val if (val <=> result) < 0\n end\n end\n }\n result\n end", "def my_min_linear(list)\n smallest_number = list.first\n \n list.each do |num|\n smallest_number = num if num < smallest_number\n end\n\n smallest_number\nend", "def my_min(array)\n\n smallest = array.first\n array.each_with_index do |el, i|\n smallest = el if el < smallest\n end\n smallest\n\nend", "def my_min_2(list)\n smallest = 0\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min(arry)\n mini = arry.first\n arry.each do |ele|\n if ele < mini\n mini = ele\n end\n end\n mini\nend", "def my_min(arr)\n smallest = nil\n\n arr.each do |n|\n smallest = n if smallest.nil? || n < smallest\n end\n\n smallest\nend", "def minimum( *numbers )\n min = numbers.first\n numbers.each { |number| min = number if number < min }\n min\nend", "def minimum( *numbers )\n min = numbers.first\n numbers.each { |number| min = number if number < min }\n min\nend", "def my_min2(array)\n lowest_num = array.first\n array.each do |el1|\n next if lowest_num == el1\n if el1 < lowest_num\n lowest_num = el1\n end\n end\n lowest_num\nend", "def my_min2(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min2(list)\n min = list[0]\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min2(list)\n result = list.first\n list.each do |el|\n result = el if el < result\n end\n result\n\nend", "def my_min_2(arr)\n least = arr[0]\n\n arr.each do |i|\n arr.each do |y|\n if i < y && i < least\n least = i\n end\n end\n end\n\n least\n\n\nend", "def my_min(list)\n min = list[0]\n (1...list.length).each do |i| \n min = list[i] if list[i] < min \n end\n min\nend", "def my_min_2(list)\n min = nil\n\n list.each do |num|\n min = num if min.nil? || num < min\n end\n\n min\nend", "def my_min(list)\n min = list[0]\n\n list.each do |ele| \n case min <=> ele\n when 1\n min = ele\n when 0\n next\n when -1\n min = min \n end\n end\n\n min\nend", "def my_min(list)\n list.each do |el|\n smallest = true\n list.each do |second_el|\n if second_el < el\n smallest = false\n end\n end\n if smallest == true\n return el\n end\n end\nend", "def find_min_brute(nums)\n smallest = nums[0]\n nums.each do |n|\n (smallest = n) if n < smallest \n end\n return smallest\nend", "def my_min2(list)\n smallest_number = list.first\n list.each do |num|\n smallest_number = num if num <= smallest_number\n end\n smallest_number\nend", "def find_min(arr)\n smallest_value = arr.first\n for value in arr\n if value <= smallest_value\n smallest_value = value\n end\n end\n smallest_value\nend", "def my_min_fast(arr)\n smallest = arr[0]\n arr.each do |ele|\n if ele < smallest\n smallest = ele\n end\n end\n return smallest\nend", "def better_my_min(array)\n smallest = array[0]\n array[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min(list)\r\n smaller_ele = []\r\n list.each do |ele1|\r\n list.each do |ele2|\r\n smaller_ele << [ele1,ele2].min \r\n end\r\n end\r\n return smaller_ele.min\r\nend", "def my_min2(arr)\n smallest = arr.first\n\n arr.each do |i|\n smallest = i if smallest > i\n end\n\n smallest\nend", "def phase_1_min(list)\n smallest = 0\n list.each_with_index do |num1, indx1|\n list.each_with_index do |num2, indx2|\n next if indx1 == indx2\n smallest = num1 if num1 < num2 && num1 < smallest\n end\n end\n smallest\nend", "def my_min2(arr)\n minimum = arr[0]\n arr[1..-1].each do |el|\n minimum = el if el < minimum\n end\n minimum\nend", "def my_min(list)\n smallest_num = nil\n list.each do |num|\n if smallest_num == nil || smallest_num > num\n smallest_num = num\n end\n end\n smallest_num\nend", "def my_min2(array)\n min = array.first\n array.each do |el|\n min = [el, min].min\n end\n min\nend", "def my_min(list)\n i = 0\n min = list[0]\n while i < list.length - 1\n if list[i + 1] < min\n min = list[i + 1]\n end\n i += 1\n end\n min\nend", "def my_better_min(list)\n min = list[0] #1\n\n list.each_with_index do |ele_1, i| #n\n if ele_1 < min # 1 *n\n min = ele_1 #1 *n\n end\n end\n\n min #1\n # (i...list.length).each do |j|\n # if list[i] list[j]\nend", "def find_min2(array)\n min = array[0]\n \n array.each do |num|\n if num < min\n min = num\n end\n end\n \n return min\nend", "def my_min2(arr)\n min = arr.first \n arr.each {|ele| min = ele if ele < min }\n min\nend", "def my_min(list)\n min = list[0]\n (0...list.length).each do |i| \n min = list[i] if list[i] < min\n end\n min\nend", "def my_min_linear(array)\n min = array[0]\n\n array.each do |num|\n min = num if num < min\n end\n min\nend", "def my_min(arr)\n min = arr.first\n\n arr.each_with_index do |ele1, i| \n arr.each_with_index do |ele2, j|\n next if i == j \n min = ele2 if ele2 < min \n end\n end\n\n min\nend", "def my_min_2(list) \n min = list.first \n list.each {|num| min = num if min > num }\n min\nend", "def my_min_improved(arr)\n min = arr[0]\n\n arr.each do |el|\n min = el if el < min\n end\n\n return min\nend", "def my_min2(arr)\n smallest = arr[0]\n arr[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min2(arr)\r\n min = arr[0]\r\n arr.each { |num| min = num if num < min }\r\n min\r\nend", "def my_min2(arr)\n min = arr.first\n arr.each { |el| min = el if el < min }\n min\nend", "def min(list)\n tiny = list[0]\n list.each do |n|\n if n < tiny\n tiny = n\n end\n end\n puts tiny\nend", "def my_min2(array)\n minimum = array.first\n array.each_index do |idx|\n if array[idx] < minimum\n minimum = array[idx]\n end\n end\n minimum\nend", "def my_min_v2(array)\n minimum = array.first\n\n array[1..-1].each do |element|\n minimum = element if minimum > element\n end\n\n minimum\nend", "def my_min(arr)\n min = arr[0]\n (0...arr.size).each do |i1|\n (i1 + 1...arr.size).each do |i2|\n min = arr[i2] if arr[i2] < min\n end\n end\n min\nend", "def my_min(arr) # Find\n min = arr[0]\n\n arr.each do |el| # Go through array once O(n)\n min = el if el < min # update min while going through if found min\n end\n min\nend", "def simple_loop(list)\n smallest = list.first\n \n (1...list.length).each do |idx|\n smallest = list[idx] if list[idx] < smallest\n end\n \n smallest\nend", "def min(*x, &block)\n return x.first if x.size == 1\n return min2(x[0], x[1], &block) if x.size == 2\n a = x.first\n (1...x.size).each { |b| \n a = min2(a,x[b], &block) }\n a\n end", "def min\n min = get(0,0)\n\tfor i in 0...@filas\n for j in 0...@columnas\n if (get(i,j) < min)\n min = get(i,j)\n end\n end\n end\n min\n end", "def min\n\n minimo = 0.to_f\n for i in 0...matriz.size \n if matriz[i] != nil \n matriz[i].each do |key, value|\n if matriz[i][key].to_f < minimo\n minimo = matriz[i][key].to_f\n end\n end\n end \n end\n minimo\n\tend", "def my_min_2(arr) #O(N)\n min_num = arr.first\n \n arr.each { |num| min_num = num if num < min_num }\n \n min_num\n end", "def my_min2(array)\n lowest_val = Float::INFINITY\n array.each do |el|\n lowest_val = el if el < lowest_val\n end\n\n lowest_val\nend", "def my_min2(array)\n min = array.first\n array.each {|item| min = item if item <= min}\n return min\nend", "def my_min(arr)\n min = arr[0]\n (1...arr.length).each do |i|\n if arr[i] < min\n min = arr[i]\n end\n end\n min\nend", "def compare_every_element_my_min(integers)\n min = nil\n\n integers.each do |integer_1|\n is_min = true\n\n integers.each do |integer_2|\n is_min = false if integer_1 > integer_2\n end\n\n min = integer_1 if is_min\n break if min\n end\n\n min\nend", "def my_min2(int_list)\n min = 0\n\n int_list.each do |int|\n min = int if int < min\n end\n\n min\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 my_min(array)\n min = array.first\n array.each {|el| min = el if min > el}\n min\nend", "def find_min\r\n return nil if !@head\r\n cursor = @head\r\n min = cursor.data\r\n while cursor\r\n if cursor.data < min\r\n min = cursor.data\r\n end\r\n cursor = cursor.next\r\n end\r\n return min\r\n end", "def find_min()\r\n self.min\r\n end", "def linear_my_min(arr)\n # arr.inject do |min, ele|\n # min > ele \n # end\n # arr.first \n\n min = arr.first \n\n arr.each do |ele|\n min = ele if ele < min \n end\n min \n\nend", "def my_min(arr)\n\n smallest_value = arr[0]\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n # smallest_value = ele1 if ele1 < smallest_value\n if arr.all?{|ele2| ele1 <= ele2 } #O(n)\n smallest_value = ele1\n end\n end\n\n smallest_value\n\nend", "def better_min(array)\n min_val = array.first\n\n array.each do |el| #O(n)\n if el < min_val\n min_val = el\n end\n end\n min_val\n end", "def my_min_once(arr)\n min = arr.first \n\n (0...arr.count).each do |i|\n min = arr[i] if arr[i] < min \n end\n\n min \nend", "def my_min(list)\n list.each do |el|\n equal_or_smaller = []\n list.each do |el2|\n equal_or_smaller << el2 if el2 < el\n end\n return el if equal_or_smaller.empty?\n end\nend", "def my_min_2(list) # n\n min_value = list.first\n i = 0\n while i < list.length\n min_value = list[i] if list[i] < min_value\n i += 1\n end\n min_value\nend", "def min\n min = @valor[0][0]\n i = 0\n self.fil.times do |i|\n j = 0\n self.col.times do |j|\n if (@valor[i][j] < min)\n min = @valor[i][j]\n end\n j=j+1\n end\n i=i+1\n\tend\n min\n end", "def find_min(arr)\n min = arr.first\n (1...arr.length).each do |idx|\n min = arr[idx] if arr[idx] < min\n end\n min\nend", "def my_min(arr)\n min = arr.first\n (0...arr.length).each do |idx1|\n (idx1...arr.length).each do |idx2|\n if (idx2 != idx1) && (arr[idx1] < arr[idx2]) && (arr[idx1] < min)\n min = arr[idx1]\n end\n\n end\n end\n min\n\nend", "def faster_my_min(arr) # O(n)\n min = arr[0]\n arr.each do |ele|\n min = ele if ele < min\n end\n min\nend", "def my_min_2(nums) # O(n)\n smallest = 0\n nums.each do |num|\n smallest = num if num < smallest\n end\n smallest\nend", "def my_min(arr) #linear\n arr.reduce do |smallest, num|\n if smallest < num\n smallest\n else\n smallest = num\n end\n end\nend", "def my_min(arr) #O(n2)\n min = arr.first\n arr.each_with_index do |el_1 , i|\n (i+1...arr.length).each do |el_2|\n if arr[el_2] < el_1 && arr[el_1] < min \n min = arr[el_2]\n end \n end \n end \n min \n end", "def find_min\n loc = find_min_locator and loc.value\n end", "def minimum(arr)\n m = arr.min\n m\n end", "def my_min(list)\n minimum_num = [] \n list.each do |num1| \n minimum_num = num1 if list.all? {|ele| ele >= num1}\n end\n minimum_num\nend", "def my_min(arr)\n answer = 0\n arr.each_with_index do |ele1, idx1|\n arr.each_with_index do |ele2, idx2|\n if idx2 > idx1 && ele1 < ele2\n answer = ele1 if answer >= ele1\n end\n end\n end\n answer \nend", "def find_min_value(array)\n min = 0\n array.length.times do |count|\n if count == 0\n min = array[count]\n else\n if array[count] < min\n min = array[count]\n end\n end\n end\n min\nend", "def my_min(arr)\n output = arr.first\n \n (1...arr.length).each do |i|\n (i+1...arr.length).each do |j|\n output = arr[j] if arr[j] < output\n end\n end\n \n output\nend", "def min (row_num)\n row = @rows[row_num]\n min = row[0]\n row.each do |num|\n if min == 0 then\n min = num\n end\n if (num < min) && (num != 0) then\n min = num\n end\n end\n return min\n end" ]
[ "0.8006529", "0.7908942", "0.7890087", "0.78867567", "0.78739315", "0.7829374", "0.78068745", "0.7798616", "0.77788436", "0.7738859", "0.7732248", "0.7707186", "0.7694867", "0.7687151", "0.7677542", "0.7669644", "0.76679945", "0.765929", "0.7656066", "0.7653131", "0.76226556", "0.7615951", "0.76116186", "0.760813", "0.7599831", "0.75931126", "0.7592115", "0.75735754", "0.7564585", "0.7564585", "0.75527805", "0.7551103", "0.75458664", "0.75385433", "0.7506247", "0.7503007", "0.7500534", "0.7489431", "0.7483085", "0.7473314", "0.7462616", "0.7459223", "0.7457092", "0.74486613", "0.744398", "0.74272937", "0.73999435", "0.7397216", "0.738791", "0.7385927", "0.73835546", "0.73829114", "0.7381482", "0.73774153", "0.73734224", "0.7369638", "0.7355157", "0.73545206", "0.7354215", "0.7353472", "0.7346923", "0.7332423", "0.7326646", "0.7321454", "0.731489", "0.72898823", "0.7285765", "0.72844493", "0.7280189", "0.72793734", "0.7258368", "0.72484434", "0.7230673", "0.7222484", "0.7215594", "0.71885157", "0.71866846", "0.71632683", "0.71532494", "0.71485955", "0.71482366", "0.71415526", "0.7134253", "0.7132313", "0.7127423", "0.71127903", "0.7096402", "0.7079561", "0.70757085", "0.70698225", "0.7069002", "0.7040821", "0.7036379", "0.70338094", "0.703062", "0.7014778", "0.70091265", "0.7001254", "0.69780844", "0.69642305", "0.6955649" ]
0.0
-1
Start the minimization process If you want to control manually the process, use brent_iterate
def iterate k=0 bracketing if @do_bracketing while k<@max_iteration and (@x_lower-@x_upper).abs>@epsilon k+=1 result=brent_iterate raise FailedIteration,"Error on iteration" if !result begin @log << [k, @x_lower, @x_upper, @f_lower, @f_upper, (@x_lower-@x_upper).abs, (@f_lower-@f_upper).abs] rescue =>@e @log << [k, @e.to_s,nil,nil,nil,nil,nil] end end @iterations=k return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def start_rating_run\n @rating_run.process\n end", "def minimize; end", "def run\n while 1\n if step == 1 then break end\n end\n end", "def minimize(&block)\n @min_block = block\n Minuit.register_fcn(self)\n begin\n Minuit.migrad\n rescue Minuit::CommandError\n puts '<NDimXML::minimize> Error! Minuit migrad command failed.'\n $!.print\n return false\n end\n true\n end", "def start\n puts 'Start Simulator'\n set_map\n x = 1\n while x <= @num_prospectors\n joe = Prospector.new(@map, MapFinder.new)\n run_simulation(x, joe)\n joe.see_results(x)\n x += 1\n end\n 1\n end", "def run\n generate_initial_population #Generate initial population\n\n @max_generation.times do |i|\n\n message = \"Generation: #{i}, best fitness: #{@population[0].fitness}\"\n @options[:stats][:gen] ||= []\n @options[:stats][:gen][i] = {\n fitness: @population[0].fitness,\n time: Time.now - @options[:stats][:start_run]\n }\n puts message\n unless @options[:rb_channel].nil?\n @options[:rb_channel].publish({data: message, event: 'output'}.to_json)\n end\n\n selected_to_breed = selection #Evaluates current population\n offsprings = reproduction selected_to_breed #Generate the population for this new generation\n replace_worst_ranked offsprings\n end\n return best_chromosome\n end", "def start_run; end", "def run\n generate_initial_population() #Generate initial population \n\n (1..@max_generation).each do |generation_number|\n puts \"\\nGeneration #{generation_number}\"\n\n fitness_range = get_fitness_range(@population)\n\n next if fitness_range.max == fitness_range.min\n\n @population.sort!()\n\n selected_to_breed = selection() # Evaluates current population \n\n offsprings = reproduction(selected_to_breed) # Generate the population for this new generation\n\n replace_worst_ranked(offsprings)\n\n puts to_s()\n\n mutate()\n\n increment_age()\n end\n\n #return best_chromosome()\n return @population.sort { |a, b| b.fitness <=> a.fitness}\n end", "def start_processing\n @ran = true\n @start_time = Time.now\n end", "def start\n loop do\n run\n end\n end", "def run(number = 1)\n number.times do\n break if associated?\n update_next_neuron\n @associated = true if minimal_energy? or known_sample?\n end\n current\n end", "def minimize\n # create a new one, or modify the current one in place,\n # and return it\n FiniteAutomaton.new \n end", "def start\n s = Sentimize::Analyze.new\n e = EventMachine::run {\n stream = Twitter::JSONStream.connect(\n :path => '/1/statuses/filter.json',\n :auth => auth,\n :method => meth,\n :content => term\n )\n stream.each_item do |item|\n element = JSON.parse(item)\n text = element['text']\n \n # Make the call to sentimate to start passing twitter feeds\n # into function to be sentimized\n s.sentimate(text)\n $stdout.flush\n end\n }\n end", "def start\n activate\n @process_should_stop_mutex.synchronize do\n @process_should_stop = false\n end\n process_worker_thread\n process_monitor_thread\n end", "def start!\n process.start\n end", "def run_while!\n\n before_run\n\n i=1\n\n while yield i do\n\n break if maximum_round? i\n\n before_round i\n\n if i == 1\n # some things are different for the first round, namely nodes with activation = start\n run_first_round!\n else\n run_round!\n end\n\n after_round i\n i+=1\n end\n\n after_run\n\n self\n\n end", "def optimize\n raise Runtimeerror.new( 'only terminated workflows can be validated') unless @terminated\n @optimizations = 0\n puts\n puts \"Start optimization of Workflow '#{ label }'\"\n optimize_workflow\n puts \"No of optimized transition states: #{ @optimizations }\"\n puts\n end", "def start\r\n @proc.call\r\n end", "def run_simulation(num_prospector, joe)\n num_prospector = num_prospector.to_i\n return nil if num_prospector < 0\n\n # Iterate through each turn\n success = 1\n count = 0\n y = 0\n puts \"\\nRubyist #{num_prospector} starting in #{@map[y][0]}\"\n while count < @num_turns\n joe.mine(count, y)\n count += 1\n y = joe.next_location(y, @seed, num_prospector) unless count >= @num_turns\n end\n success\n end", "def start\n require 'irbtools'\n end", "def start\n yield self if block_given?\n classpath = self.classpath.is_a?(Array) ? self.classpath : []\n start_process(classpath)\n end", "def run_data_miner!\n data_miner_script.start\n end", "def start\n jammit\n end", "def _process_queue\n [@queue.length, @max_minifiers - @working_minifiers.length].min.times {\n _spawn_minifier\n }\n end", "def start!\n until should_stop? do work end\n end", "def exec_range_alpha\n if $run_alpha_range\n puts \"Iterating over range of alpha values. This may take a while...\"\n else\n puts \"Running nCOP with alpha = #{$alpha_range[0]}. Prioritizing genes...\"\n end\n \n aggrStats = RunInfo.new\n \n # for each alpha and beta\n $alpha_range.each do |n|\n start_alp = Time.now\n \n # scale alpha and beta appropriately\n $ALPHA = n.round(4)\n $BETA = ((1 - $ALPHA).to_f/$normalization_const).round(4)\n \n # initialize an empty array for bad starting nodes\n $bad_starting_genes = []\n\n # run it NUM_ITER times\n exec_iter_fixed_alpha aggrStats\n \n puts \" alpha = #{n} done\"\n #puts \"avg iter for $ALPHA = #{n} completed after = #{proper_time_since(start_alp)}\" if $run_alpha_range\n end\n \n # remember the stats\n $aggrStats = aggrStats\n \n puts \"Done.\"\nend", "def start_simulated_annealing(args)\n #The app's output is saved in \"result\" variable\n result = `./app/models/C/simulated_annealing #{args}`\n result_array = result.split(' ')\n \n return result_array\n end", "def iterate\n fill_first_task\n step until status.finished?\n save_tree if @printing\n end", "def exec!\n listener = Collector.listen!\n Thread.new do\n loop do\n sleep(15)\n planner.next_histogram(Collector.next_workload_histogram!)\n end\n end\n end", "def start_application\n sleep(1)\n loop do\n puts \"\\nWhat price are you looking for?\"\n input = gets.chomp\n next if input.empty?\n\n @analyzer.process_request(input)\n end\n end", "def minimize\n# create a new one, or modify the current one in place,\n# and return it\nfa = FiniteAutomaton.new\nkeys = @state.keys.sort\np0, p1 = [], []\nkeys.each{|k|\nif is_final?(k)\np0 = p0.push(k)\nelsif\np1 = p1.push(k)\nend\n}\nnewfa = {}\nrstate = []\nif p0 != nil then rstate.push(p0) end\nif p1 != nil then rstate.push(p1) end\npstate = []\nwhile pstate != rstate\npstate = []\nrstate.each{|r| pstate.push(r)}\nrstate = []\npstate.each{|p|\np = p.sort\nresult = split(p, pstate)\np0 = result[0]\np1 = result[1]\nresult.each{|r|\nif r != []\nr = r.sort\nrstate = rstate.push(r)\nend\n}\n}\nend\nstart = []\nfinal = []\nrstate.each{|r| newfa[r] = fa.new_state}\nlist = newfa.keys\nlist.each{|l|\nl.each{|k|\nif k == @start\nstart.push(l)\nend\nif is_final?(k)\nfinal.push(l)\nend\n}\n}\nif start != []\nstart.each{|s| if newfa[s] then fa.set_start(newfa[s]) end}\nend\nif final != []\nfinal.each{|f| fa.set_final(newfa[f], true)}\nend\nrstate.each{|r0|\nr0.each{|r1|\n@alphabet.each{|a|\nif get_transition(r1, a) != nil\nrstate.each{|r|\nif r.include?(get_transition(r1, a)[0])\nif !(fa.get_transition(newfa[r0], a))\nfa.add_transition(newfa[r0], newfa[r], a)\nif fa.get_alpha.include?(a) == false\nfa.get_alpha.push(a)\nend\nend\nend\n}\nend\n}\n}\n}\nfa\nend", "def optimise(number_of_generations = 0)\n previous_best = best_fitness\n\n # optimise\n if number_of_generations > 0\n evolve_n_times(number_of_generations)\n else\n optimise_by_strategy\n end\n\n @best_fitness = @fitness_evaluator.fitness(best)\n\n @best_fitness > previous_best\n end", "def run\n while @running\n step\n end\n end", "def snooze\n # puts \"inside snooze\"\n @min += 1\n end", "def start\n while @next_command_index < @commands_array.length\n apply_command(@commands_array[@next_command_index])\n @next_command_index += 1\n end\n end", "def run_all\n jammit\n end", "def pre_loop; end", "def iter_hegemon_auto_loop(i=0)\n do_state_tasks(i)\n update_state(:only_auto)\n end", "def start(num_requested=1, workitem_id=nil, user_data=nil)\n \n # find instances with that image id\n logger.info \"Considering request to start #{num_requested} #{role.name} instances \"\n\n total_running = (instances.select{ |i| i.running? }).size\n \n node_array = instances.select{ |i| i.available? }\n\n num_to_start = 0\n \n if total_running >= max\n logger.info \"Instance limit for #{num_requested} reached. Will not start any more instances.\"\n #lets reserve all nodes so they don't get shutdown in the meantime.\n node_array.each do |node|\n node.state = 'reserved'\n node.save\n end\n WorkitemHelper.send_reply(workitem_id) unless workitem_id.nil?\n \n else\n logger.info \"Reserving for: #{num_requested} #{role.name} instances \"\n # reserve those nodes that are running, and then start / create the balance\n node_array.each do |node|\n break if num_requested < 1\n node.state = 'reserved'\n node.save\n num_requested = num_requested.to_i - 1\n \n end\n\n #now lets start the rest of the nodes needed, assuming we don't go past the max limit!\n #first lets get a count of how many nodes are LAUNCHED, IDLE, BUSY, or RESERVED\n total_left = max - total_running\n num_to_start = total_left < num_requested.to_i ? total_left : num_requested.to_i\n\n \n #start num_to_start instances via Instance. Enqueue these in delayed job because they may take a while\n start_and_create_instances(num_to_start, user_data) unless num_to_start < 1\n \n #now also enqueue the workitem reply if needed\n WorkItemHelper.send_reply(workitem_id) unless workitem_id.nil?\n \n logger.info \"Starting #{num_to_start} more #{ami_id} instances. Note that this may take a moment. \"\n EventLog.info \"Starting #{num_to_start} more #{ami_id} instances. Note that this may take a moment. \"\n \n end\n \n return num_to_start\n \n \n end", "def minimize()\r\n $jssh_socket.send(\"#{WINDOW_VAR}.minimize();\\n\", 0)\r\n read_socket()\r\n end", "def run(iterations=1000)\n iterations.times { step }\n end", "def run_experiment\n test_fitness\n experiment_status\n while !concluded?\n new_generation\n test_fitness\n experiment_status\n end\n end", "def iterate_over_exec_elem(fen_stage=0, win_status=nil, &aproc)\n cnt = 0\n\n #@genes[81..109].each { |gn|\n @genes.each { |gn|\n @gene = gn\n \n #skip project 3 gene rbcL\n next if @gene.name == \"rbcL\"\n #debugging\n #172 = secE, the smallest gene, without transfers\n #132 = thrC, the second smallest gene, with transfers\n #152 = oppA, problem in window 10/12-275-313 with all gaps\n #next if @gene.id != 152\n #puts \"cnt: #{cnt}, gn.id: #{@gene.id}, gn.name: #{@gene.name}, @genes[cnt]: #{@genes[cnt].id}\"\n\n if @stage==\"hgt-par\"\n iterate_over_win(fen_stage,win_status){ |win|\n aproc.call \"gn: #{@gene.id}, win: #{win}\"\n }\n else\n aproc.call \"gn: #{@gene.id}\"\n end\n\n #index starts at 0, so incremented at the end\n cnt += 1\n }\n\n\n\n end", "def start\n prepare\n loop { fork_one_job }\n end", "def optimize_workflow\n end", "def run\n @pid = fork {\n $0 = \"zeus spawner: #{@name}\"\n pid = Process.pid\n $w_pids.puts \"#{pid}:#{Process.ppid}\\n\"\n puts \"\\x1b[35m[zeus] starting spawner `#{@name}`\\x1b[0m\"\n trap(\"INT\") {\n puts \"\\x1b[35m[zeus] killing spawner `#{@name}`\\x1b[0m\"\n exit 0\n }\n\n @actions.each(&:call)\n\n $LOADED_FEATURES.each do |f|\n $w_features.puts \"#{pid}:#{f}\\n\"\n end\n\n pids = {}\n @stages.each do |stage|\n pids[stage.run] = stage\n end\n\n loop do\n begin\n pid = Process.wait\n rescue Errno::ECHILD\n raise \"Stage `#{@name}` has no children. All terminal nodes must be acceptors\"\n end\n if (status = $?.exitstatus) > 0\n exit status\n else # restart the stage that died.\n stage = pids[pid]\n pids[stage.run] = stage\n end\n end\n\n }\n end", "def preloop\n end", "def start_composition\n current_solution = generate_initial_solution\n calculate_weight(current_solution)\n args = create_arguments(current_solution)\n result_array = start_simulated_annealing(args)\n \n solution_cost = result_array[result_array.length-3].to_f\n width_grow = result_array[result_array.length-2].to_i\n height_grow = result_array[result_array.length-1].to_i\n if(width_grow!=0 or height_grow !=0)\n enlarge_white_space(width_grow, height_grow)\n end\n times_to_try = 3\n \n while solution_cost > 1.0 and times_to_try>0 \n if values_bits[Constants::V_Type_of_BG]<=4.5\n reduce_font_size\n end\n \n current_solution = generate_initial_solution\n calculate_weight(current_solution)\n \n args = create_arguments(current_solution)\n result_array = start_simulated_annealing(args)\n \n solution_cost = result_array[result_array.length-3 ].to_f\n \n times_to_try -= 1\n end\n\n loop_n = (result_array.length - 2)/3 \n \n loop_n.times do |n|\n @groups[n].x_pos = result_array[0+n*3].to_i;\n @groups[n].y_pos = result_array[1+n*3].to_i;\n @groups[n].alignment = result_array[2+n*3].to_i==0 ? 'right' : 'left';\n end\n\n if values_bits[Constants::V_Type_of_BG] > 4.5\n cut_white_space_edges\n end\n\n @groups.length.times do |n|\n @groups[n].process_texts_position(@width)\n end\n \n end", "def x_start\n run_callbacks :execute do\n # binding.pry\n context.resource_runtimes.each do |runtime|\n runtime.execute(:start)\n # binding.pry\n # runtime.start do |queue|\n # binding.pry\n # queue.run\n # queue.map(&:to_a).flatten.each do |msg|\n # Cnfs.logger.warn(msg)\n # end\n # end\n end\n end\n end", "def run\n process.on_sigint { stop_supervised }\n process.on_sigquit { stop_supervised }\n process.on_sigterm { stop_supervised }\n run_supervised\n end", "def run_optimisation(path, name)\n # Ensure the file is a PNG.\n unless path.to_s =~ /\\.png/\n say_status 'skipped', \"#{name} - not a PNG\", :yellow\n return\n end\n\n before = path.size\n say \" optimising #{name} \"\n reduction = Polymer::Optimisation.optimise_file(path)\n\n if reduction > 0\n saved = '- saved %.2fkb (%.1f' %\n [reduction.to_f / 1024, (reduction.to_f / before) * 100]\n say_status \"\\r\\e[0K optimised\", \"#{name} #{saved}%)\", :green\n else\n say_status \"\\r\\e[0K optimised\", \"#{name} - no savings\", :green\n end\n end", "def start\r\n\t\t\tsay \"#{self.name}: Starting up...\"\r\n\t\t\tstartup\r\n\t\t\t\t\r\n\t\t\tbegin\r\n\t\t\t\tnode = Armory::Node.new\r\n\t\t\t\tsay \"#{self.name}: Starting speedy worker #{self.name}\"\r\n\t\t\trescue Exception => e\r\n\t\t\t\tlog_exception(nil, node, \"Node lock\", e)\r\n\t\t\tend\r\n\r\n\t\t\tretries = 0\r\n\t\t\tbegin\r\n\t\t\t\tself.speedy_worker(node)\r\n\t\t\t# Something bad happened :(\r\n\t\t\trescue Exception => e\r\n\t\t\t\tlog_exception(nil, node, \"Catch-all (#{retries})\", e)\r\n\t\t\t\tArmory::Job.clear_locks!(self.name)\r\n\t\t\t\t\r\n\t\t\t\tretries += 1\r\n\t\t\t\tretry if retries <= 5 and RAILS_ENV == \"production\"\r\n\t\t\tensure\r\n\t\t\t\tArmory::Job.clear_locks!(self.name)\r\n\t\t\tend\r\n\t\t\t\r\n\t\t\tsay \"#{self.name}: Finished\"\r\n\t\tend", "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 start\n while @running\n @fork_worker ? fork_and_work : work\n end\n end", "def accelerate\n\tputs \"Stepping on the gas\"\n\tputs \"Speeding up\"\nend", "def accelerate\n\tputs \"Stepping on the gas\"\n\tputs \"Speeding up\"\nend", "def accelerate\n\tputs \"Stepping on the gas\"\n\tputs \"Speeding up\"\nend", "def start\n @log.info \"starting trader\"\n @should_terminate = false\n iterate()\n end", "def first_hires\n (1..10).each do |number|\n add_to_waitlist(number)\n end\n hire(6)\n self\n end", "def start_run\n # Abstract\n end", "def start_run\n # Abstract\n end", "def process()\n scan_dir('.', '.')\n end", "def start()\n prepare() unless @prepared\n @flows.each_value { |f| f.start() }\n end", "def step\n log_iteration_start\n\n\n @current_task = tasks_list.shift\n status.no_tasks! and return unless current_task #empty tasks list\n\n solve_current_task\n\n return unless current_basis_plan # no optimal plan, so we don't change record and continue\n\n if current_target_function <= record # not interested as previsous record is higher\n status.target_less_than_record!\n elsif task.satisfies_integer?(current_basis_plan)\n change_record\n else\n split_current_task\n end\n log_status\n end", "def start\n start_thread\n wait(20) # This so that you wait until either the step is done or 20 seconds is up.\n # It doesn't have to wait the whole 20 seconds if the step finishes quickly.\n end", "def start\n EM.synchrony do\n run\n end\n end", "def run!(not_used_arg)\n while work = @master.get_work\n puts work.inspect\n Experiment::Config.set work[:options]\n @current_cv = work[:cv]\n @dir = work[:dir]\n @data = work[:input]\n #@data = work[:input]\n execute_experiment!\n \t\t\tresult = analyze_result!(@dir + \"/raw-#{@current_cv}.txt\", @dir + \"/analyzed-#{@current_cv}.txt\")\n \t\t\twrite_performance!\n \t\t\t@master.submit_result @current_cv, result, @abm.first\n end\n\n end", "def warmup(prc=nil, &block)\n @warmup = prc || block\n end", "def warmup(prc=nil, &block)\n @warmup = prc || block\n end", "def solve_stupid\n nodes_num.times.collect{|node_num| make_wave(node_num) }.min\n 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 apply(iteration)\n load_ps_table\n return if @ps_table.empty?\n\n @gears.ids.each do |uuid|\n begin\n state = @gears.state(uuid)\n #pids = pgrep(uuid)\n pids = ps(uuid)\n\n case state\n when State::NEW\n # Caught gear while being created... leave it alone.\n\n when State::UNKNOWN\n @logger.info %Q(watchman gear #{uuid} in unknown state, will be restarted.)\n restart(uuid)\n\n when State::STOPPED\n stop(uuid) unless pids.empty?\n\n when State::IDLE\n idle(uuid) unless pids.empty?\n\n else\n # Gear has a stop_lock file and a state of running... remove stop_lock\n if @gears.stop_lock?(uuid)\n FileUtils.rm_f(@gears.stop_lock(uuid))\n Syslog.info %Q(watchman deleted stop lock for gear #{uuid} because the state of the gear was #{state})\n end\n\n restart(uuid) if pids.empty?\n end\n rescue Exception => e\n Syslog.info %Q(watchman GearStatePlugin failed for gear #{uuid}: #{e.message}. Processing remaining gears.)\n @logger.info %Q(#{e.message}\\n#{e.backtrace.join(\"\\n\")})\n end\n end\n\n @ps_table = nil # free resources\n end", "def start\n #Parallel.each_with_index(files.take(3), in_processes: 10) do |file_name, index|\n files.each_with_index do |file_name, index|\n begin\n content = JSON.parse(File.read(file_name), symbolize_names: true)\n pr_number_to_be_migrated = content[:number]\n response_temp_file_creation = create_temp_file(file_name, pr_number_to_be_migrated)\n create_ref_to_temp_file(pr_number_to_be_migrated, response_temp_file_creation[:commit][:sha])\n response_pull_request_creation = create_pull_request(pr_number_to_be_migrated)\n update_pull_request(response_pull_request_creation[:number], content)\n delete_ref_to_temp_file(pr_number_to_be_migrated)\n puts '*'\n rescue Exception => e\n puts \"Error: #{e.message}\"\n end\n end\n end", "def run!\n @size.times do\n schedule { throw :exit }\n end\n @pool.map(&:join)\n end", "def start_game\n\t\ti = 0\n\t\tsrand seed.to_i\n\t\t#This is the loop that runs the simulation 5 times.\n\t\tloop do\n\t\t\ti += 1\n\t\t\tnew_run(i)\n\t\t\tif i == 5\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\t\ti\n\tend", "def run_sim\n @continue_running = @started = true\n processed = []\n\n (0...@num_rounds).each do |round|\n puts \"Round #{round}\"\n (0...Board::BOARD_ROWS).each do |i|\n (0...Board::BOARD_COLUMNS).each do |j|\n\n Thread.stop unless continue_running? \n\n grid_object = @board.matrix[i][j]\n next if grid_object.nil? or grid_object == :Grass\n\n # do not process the same agent twice; this happens when an agent\n # moves down (to the next row) and maybe other cases\n processed.include?(grid_object) ? next : processed << grid_object\n\n options = @board.get_move_options(i,j)\n\n if grid_object.respond_to?(:evaluate_moves) then\n result = grid_object.evaluate_moves(options)\n\n # Check if we should move or delete the object\n result == :delete ? @board.delete(i,j) : move(@board.matrix,i,j,result)\n\n # Check if the agent is ready to reproduce and handle accordingly\n # NOTE: It is important to understand that the base spawn address is where\n # the agent started NOT where it was moved. That doesn't really make sense,\n # but I didn't bother to address it.\n # TODO: Fix that...\n if grid_object.ready_to_reproduce?\n grid_object.reset_food_consumption\n @board.spawn_agents(grid_object.class,i,j) \n end\n\n grid_object.decrement_life\n else\n next\n end\n\n options = nil\n sleep(@speed)\n end\n end\n\n @board.grow_grass()\n processed = []\n end\n end", "def start\n @min\n end", "def start\n run_all if @options[:all_on_start]\n end", "def running; end", "def running; end", "def prepare_search\n # puts \"prepare_search called\"\n @current_point = @start_vector\n @interval_index = 0\n @path = [@start_vector]\n @initial_run = true\n \n @current_cost = get_cost @current_point\n end", "def launch (raw_exp, workitem)\n\n onotify(:launch, raw_exp.fei, workitem)\n\n apply(raw_exp, workitem)\n end", "def init\n return if @initialized\n\n # Fill start places with tokens to let the process start\n put_token(start_place)\n start_place[:enabled] = true\n\n # Terminators are used to identify which transitions can be executed\n @terminators = {}\n @net.places.select(&:start?).each do |start_place|\n outgoing_transitions(start_place).each do |transition|\n (@terminators[transition] ||= []) << start_place\n end\n end\n\n # Without weights assigned transition execution path search won't work\n PetriTester::DistanceWeightIndexator.new(@net).reindex\n\n @initialized = true\n execute_automated!\n end", "def run\n supervisors.map(&:run).each(&:join)\n end", "def start\n\t\twhile true\n\t\t\tclean\n\t\t\tscore_table\n\t\t\tarray_start(1)\n\t\t\tif player_win(1) == false || test_fin == false \n\t\t\t\tbreak\n\t\t\tend\n\t\t\tclean\n\t\t\tscore_table\n\t\t\tarray_start(2)\n\t\t\tif player_win(2) == false || test_fin == false\n\t\t\t\tbreak\n\t\t\tend\n\t\tend\n\tend", "def start\n workers.map { _1.start.wait! }\n end", "def call_start\n restart = true\n while restart\n restart = start\n end\n end", "def start(name, &block)\n\t\t\t\tProcess.fork(name: name, &block)\n\t\t\tend", "def stage_by_thrust\n loop do \n if vessel.thrust == 0 \n ctrl.activate_next_stage\n sleep(0.1)\n break\n end \n end \n end", "def start\n run_all if options[:all_on_start]\n end", "def start\n run_all if options[:all_on_start]\n end", "def start\n run_all if options[:all_on_start]\n end", "def main\n if (ARGV.length < 1) \n puts(\"Invalid arguments: Specify an input file\")\n return\n elsif (ARGV.length > 2) \n puts(\"Invalid arguments: Too many arguments provided\")\n return\n end\n\n f = nil\n begin\n f = File.open(ARGV[0], \"r\")\n f.close()\n rescue\n puts(\"Could not open input file: #{ARGV[0]}\")\n return\n end\n \n #Create mini CSS class\n mini_css = MinimizeCSS.new(ARGV[0])\n \n if (ARGV.length == 2)\n o = nil\n begin\n o = open(ARGV[1], 'w')\n o.close()\n mini_css.minimize_to(ARGV[1])\n rescue\n puts(\"Could not open output file: #{ARGV[1]}\")\n mini_css.minimize_to(nil)\n end\n else\n mini_css.minimize_to(nil)\n end \nend", "def run_program_for_inputs(intcode_computer, starting_memory, noun, verb)\n memory = starting_memory.dup\n memory[1] = noun\n memory[2] = verb\n\n intcode_computer.memory = memory\n intcode_computer.process!\n intcode_computer.memory[0]\nend" ]
[ "0.6143362", "0.5938945", "0.5543928", "0.5486886", "0.5454133", "0.5428745", "0.54168546", "0.541079", "0.5341115", "0.5298029", "0.52548355", "0.5242311", "0.52418405", "0.5219404", "0.5192127", "0.5189375", "0.51527756", "0.5152327", "0.5151647", "0.51488686", "0.51398736", "0.5125957", "0.5076019", "0.5075358", "0.5068813", "0.506514", "0.50609547", "0.5054354", "0.5049795", "0.50248194", "0.50243926", "0.50178885", "0.5011283", "0.5008581", "0.5006746", "0.500585", "0.5001027", "0.49912935", "0.499103", "0.4982623", "0.4970828", "0.49569204", "0.49527043", "0.49485183", "0.4943596", "0.4931923", "0.49187484", "0.4911969", "0.49101856", "0.49089515", "0.49021912", "0.48980868", "0.48968887", "0.4884287", "0.4881839", "0.4881839", "0.4881839", "0.48807275", "0.48564163", "0.4856291", "0.4856291", "0.48528183", "0.48482436", "0.48478803", "0.48463863", "0.48299032", "0.4820131", "0.4812929", "0.4812929", "0.48122987", "0.48023307", "0.48023307", "0.48023307", "0.48023307", "0.48023307", "0.48023307", "0.48023307", "0.48023307", "0.48001057", "0.47933182", "0.4792171", "0.47739705", "0.47597754", "0.4758208", "0.475612", "0.47533038", "0.47533038", "0.47500366", "0.47402745", "0.47393543", "0.47375834", "0.47254738", "0.4724035", "0.4702859", "0.46965107", "0.4692546", "0.4692062", "0.4692062", "0.4692062", "0.46914446", "0.46890578" ]
0.0
-1
== Parameters: point: Coordinates of the point value: Function value at the point
def initialize(point, value) @point = point.clone @value = value end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reflect(center, point, alpha=1.0)\n #center.map.with_index{|e,i| e + alpha * ( e - point[i] )} # version for simple arrays\n p = center + ( center - point ) * alpha\n p.result = func(p)\n p\n end", "def contract_inside(center, point, gamma=0.5)\n p = center + ( point - center ) * gamma\n p.result = func(p)\n p\n end", "def update(point)\n\t\t\n\tend", "def update(point)\n\t\t\n\tend", "def point(x,y)\n [x,y]\nend", "def function(x)\n 3.70 + -0.048 * x\nend", "def position=(point); end", "def setpoint\n @setpoint\n end", "def points; end", "def f(x0, y0)\n @f.call(x0, y0)\n end", "def press(point)\n\t\t@origin = point\n\tend", "def update(point)\n\t\t\t\t\n\t\t\tend", "def add_to_point! point\n vectors.each do |v|\n point.add! v\n end\n point\n end", "def press(point)\n\t\t\n\tend", "def add_to_point point\n add_to_point! point.dup\n end", "def add_cpoint(point)\n end", "def distance_to_point(point)\n to_a.zip(point.to_a).map{|a, b| (b - a) ** 2}.reduce(:+) ** 0.5\n end", "def curve_points(points)\n cur_page.curve_points(points)\n end", "def add_point(point)\n # again, as with add_bbox(), we do not know whether to add the point\n # \"to the left\" or \"to the right\". So we do it three times:\n # as is, 360 to the left, 360 to the right, and choose the one\n # which minimizes the new side length\n @north = [@north, point[\"lat\"].to_f].max\n @south = [@south, point[\"lat\"].to_f].min\n lng = point[\"lng\"].to_f\n @east, @west = optimize_east_west_add(lng, lng)\n normalize\n end", "def normal_matrix_at_point(point)\n MSPhysics::Newton::CurvySlider.get_normal_martix_at_point(@address, point)\n end", "def x\n @point[0]\n end", "def transform_point(point, bias=nil) \n # here: col_index and row_index of the potential vote oval, using the 'timing mark' coordinate system\n bc_fractional = point_b2f(point)\n # here: ballot_coord is the position of the vote oval, in ballot fraction coordinates\n if bias == :bottombias\n bc_in_pixels = point_f2p_bottom_bias(bc_fractional)\n else\n bc_in_pixels = point_f2p(bc_fractional)\n end\n\n # here: bc_in_pixels is the position of the vote oval, after accounting for the offset of the origin from pixel(0,0)\n # bc_rotated = bc_in_pixels.rotate BPoint.deg_to_rad(self.angle) \n # here: rotated_bc is the position of the vote oval in inch coordinates from the origin, after accounting for rotation\n bc_corrected = BPoint.new(bc_in_pixels.x+i2p(TM_Width/2.0), bc_in_pixels.y+i2p(TM_Height/2.0))\n # here: bc_corrected is the position of the center of the target vote oval\n return bc_corrected\n end", "def add_point\n end", "def add_point(point)\n return if point.x < 1 || point.y < 1 || point.x > @max_x-1 || point.y > @max_y-1\n if @glade['toolbar_move'].active?\n if @first_point \n @start = point\n @first_point = false\n @points = [@start]\n print\n else\n @finish = point\n @points = []\n move\n end\n elsif @glade['toolbar_record_points'].active?\n if @x_coords[point.x]\n @glade['statusbar'].push(@context, \"Este programa não suporta 2 ou mais pontos com mesma X-coordenada!\")\n else\n @points << point\n @x_coords[point.x] = point\n end\n print\n end\n end", "def each_point\n @points.each {|pt| yield pt }\n end", "def forwardDeg!(point)\r\n point.x *= Proj4::DEG_TO_RAD\r\n point.y *= Proj4::DEG_TO_RAD\r\n forward!(point)\r\n end", "def add_point(point)\n puts \"adding p: #{point}\" if @debug\n @points << point\n if self.mec && self.mec.center\n unless self.mec.contains?(point)\n iterate\n end\n else\n iterate\n end\n end", "def add!(point)\r\n @x += point.x\r\n @y += point.y\r\n end", "def map(points)\n points\n end", "def funcion1(x)\n\t y = -x * Math.sin(Math.sqrt(x.abs))\n\t # y = -x * Math.sin(Math.sqrt(x.abs * (Math::PI / 180.0 )))\n\t\ty\n\tend", "def f(x)\n 0.4 * x + 1\nend", "def points\n 1\n end", "def cost_at(point)\n @cost_strategy.cost_at(point)\n end", "def point_convertor(point)\n point.map do |coordonate|\n (coordonate * 255).to_i\n end\n end", "def draw_point_id(point)\n draw_point(@points[point])\n end", "def f(x)\n Math.sin(x)\nend", "def setup(point)\n\t\t\n\tend", "def origin=(point)\n end", "def add_to_point! point\n vec = as_bearing_vector\n dest = point.destination_point vec.bearing, vec.distance.in_kms\n point.lat = dest.lat\n point.lng = dest.lng\n point\n end", "def point_estimate(column)\n col_type = schema.type column\n Veritable::Util.check_datatype(col_type, \"Point estimate -- \")\n if col_type == 'boolean' or col_type == 'categorical'\n # use the mode\n (counts(column).max_by {|k, v| v})[0]\n elsif col_type == 'real' or col_type == 'count'\n # use the mean\n values = distribution.collect {|row| row[column]}\n mean = (values.inject(0) {|memo, obj| memo + obj}) / values.size.to_f\n col_type == 'real' ? mean : mean.round.to_i\n end\n end", "def press(point)\n\t\t\t\t\n\t\t\tend", "def to_local(point)\n inverse * point\n end", "def to_outer(point)\n transform * point\n end", "def point(x, y)\n primitive 'point ' + sprintf('%g,%g', x, y)\n end", "def matte_point(x, y)\n f = copy\n f.alpha(OpaqueAlphaChannel) unless f.alpha?\n pixel = f.pixel_color(x, y)\n pixel.alpha = TransparentAlpha\n f.pixel_color(x, y, pixel)\n f\n end", "def vector_to(point2)\n end", "def update_visualization(point)\n\t\t\n\tend", "def update_visualization(point)\n\t\t\n\tend", "def update_visualization(point)\n\t\t\n\tend", "def update_visualization(point)\n\t\t\n\tend", "def point_inside?(point)\n Geom.point_in_polygon_2D(point, hexagon(position, RADIUS), true)\n end", "def load_at(point)\n @load_curve[point]\n end", "def point?(x)\n x.int? || x.point2d?\nend", "def [](point)\n @array[point.first][point.last]\n end", "def calculate_from_test_point(target_point)\n dist1 = calculate_distance(target_point, @point1)\n dist2 = calculate_distance(target_point, @point2)\n dist3 = calculate_distance(target_point, @point3)\n\n calculate_from_distances(dist1, dist2, dist3)\n end", "def test_point_to_trackpoint\n pt = [-118, 34]\n waypoint = GPX::GeoJSON.send(:point_to_track_point, pt, nil)\n assert_equal(34, waypoint.lat)\n assert_equal(-118, waypoint.lon)\n end", "def point(latitude, longitude, srid: 4326)\n st_point = <<~sql\n DECLARE @point geography = geography::STPointFromText('POINT(#{longitude} #{latitude})', #{srid});\n SELECT @point as point;\n sql\n db.fetch(st_point).first[:point]\n end", "def initialize(point)\n @point = point\n end", "def on_update(new_point)\n end", "def accumulate_points(points)\n points.map{|point| point.value}.reduce(0, :+)\n end", "def index2point(x)\n\t\treturn (@tam_ancho/2-x)\n\tend", "def update_visualization(point)\n\t\t\t\t\n\t\t\tend", "def point_code\n @payload.fetch('point')\n end", "def optimize\n case @Function[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n # Join segments that have the same slope\n lNewPoints = [ @Function[:Points][0] ]\n lLastSlope = (@Function[:Points][1][1]-@Function[:Points][0][1])/(@Function[:Points][1][0]-@Function[:Points][0][0])\n lIdxSegment = 1\n while (lIdxSegment < @Function[:Points].size - 1)\n # Compute this segment's slope\n lSlope = (@Function[:Points][lIdxSegment+1][1]-@Function[:Points][lIdxSegment][1])/(@Function[:Points][lIdxSegment+1][0]-@Function[:Points][lIdxSegment][0])\n if (lLastSlope != lSlope)\n # We are changing slopes\n lNewPoints << @Function[:Points][lIdxSegment]\n lLastSlope = lSlope\n end\n lIdxSegment += 1\n end\n # Add last point\n lNewPoints << @Function[:Points][-1]\n # Change points\n @Function[:Points] = lNewPoints\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n end", "def forward(point)\r\n forward!(point.dup)\r\n end", "def midpoint(point)\n la, lo = Ubiquity::Geoformulas.midpoint self.lat, self.lon, point.lat, point.lon\n self.class.new la, lo\n end", "def compare_position(point)\n (v2.x - v1.x) * (point.y - v1.y) - (point.x - v1.x) * (v2.y - v1.y)\n end", "def unionXWithFunction_PiecewiseLinear(iOtherFunction)\n lPoints = @Function[:Points]\n lOtherPoints = iOtherFunction.function_data[:Points]\n # Get all the abscisses sorted\n lXList = (lPoints.map { |iPoint| next iPoint[0] } + lOtherPoints.map { |iPoint| next iPoint[0] }).sort.uniq\n # Read segments abscisse by abscisse\n lIdxSegment = 0\n lIdxOtherSegment = 0\n lXList.each do |iX|\n if (lPoints[lIdxSegment] == nil)\n # No abscisse on lPoints for this iX\n # Forcefully we have lOtherPoints[lIdxOtherSegment][0] == iX\n yield(iX, nil, lOtherPoints[lIdxOtherSegment][1])\n lIdxOtherSegment += 1\n elsif (lOtherPoints[lIdxOtherSegment] == nil)\n # No abscisse on lOtherPoints for this iX\n # Forcefully we have lPoints[lIdxSegment][0] == iX\n yield(iX, lPoints[lIdxSegment][1], nil)\n lIdxSegment += 1\n elsif (lPoints[lIdxSegment][0] == iX)\n # lPoints has this abscisse\n if (lOtherPoints[lIdxOtherSegment][0] == iX)\n # If both functions have a point here, it's easy.\n yield(iX, lPoints[lIdxSegment][1], lOtherPoints[lIdxOtherSegment][1])\n lIdxOtherSegment += 1\n else\n # Compute the Y value for the other function\n yield(iX, lPoints[lIdxSegment][1], lOtherPoints[lIdxOtherSegment-1][1] + ((lOtherPoints[lIdxOtherSegment][1] - lOtherPoints[lIdxOtherSegment-1][1])*(iX - lOtherPoints[lIdxOtherSegment-1][0]))/(lOtherPoints[lIdxOtherSegment][0] - lOtherPoints[lIdxOtherSegment-1][0]))\n end\n lIdxSegment += 1\n else\n # We have forcefully lOtherPoints[lIdxOtherSegment][0] == iX\n # Compute the Y value for this function\n yield(iX, lPoints[lIdxSegment-1][1] + ((lPoints[lIdxSegment][1] - lPoints[lIdxSegment-1][1])*(iX - lPoints[lIdxSegment-1][0]))/(lPoints[lIdxSegment][0] - lPoints[lIdxSegment-1][0]), lOtherPoints[lIdxOtherSegment][1])\n lIdxOtherSegment += 1\n end\n end\n end", "def adjacent_points_function\n @adjacent_points_function ||\n ->(current_point) {\n current_point.repeated_permutation(current_point.size)\n }\n end", "def on_mouse_move(new_point)\n end", "def point_is_inside(point)\n result = false\n vertex1 = @points.length - 1\n for vertex2 in 0...@points.length\n if ((@points[vertex2].y > point.y) != (@points[vertex1].y >= point.y)) && (point.x <= (points[vertex1].x - points[vertex2].x) * (point.y - points[vertex2].y) / (points[vertex1].y - points[vertex2].y) + points[vertex2].x)\n result = !result\n end\n vertex1 = vertex2\n vertex2 += 1\n end\n return result\n end", "def add_to_point point\n vec = as_bearing_vector\n point.destination_point vec.bearing, vec.distance.in_kms\n end", "def update(point)\n\t\t@active.update point if @active\n\tend", "def pt___x(n, y); ptdist(n, 1.0 - y); end", "def new_point(p)\n case p\n when :infinity\n infinity\n when Array\n x, y = p\n Point.new(self, x, y)\n when Integer\n generator.multiply_by_scalar(p)\n else\n raise ArgumentError, \"Invalid point specifier #{p.inspect}.\"\n end\n end", "def contains_point?(point)\n x, y = point.x, point.y\n tuples = @points.zip(@points[1..-1] + [@points[0]])\n crossings =\n tuples.select do |a, b|\n (b.y > y != a.y > y) && (x < (a.x - b.x) * (y - b.y) / (a.y - b.y) + b.x)\n end\n\n crossings.size % 2 == 1\n end", "def add_point(position)\n MSPhysics::Newton::CurvySlider.add_point(@address, position)\n end", "def add_point(position)\n MSPhysics::Newton::CurvySlider.add_point(@address, position)\n end", "def + point\n\t\tPoint.new(@x+point.x, @y+point.y)\n\tend", "def press(point)\n\t\t# mark the initial point for reference\n\t\t@origin = point\n\t\t@start = @entity[:physics].body.p.clone\n\tend", "def distance_to(point)\n d=Ubiquity::Geoformulas.distance self.lat, self.lon, point.lat, point.lon\n if self.elems && self.elems.has_key?('ele') && point.elems.has_key?('ele')\n d=Ubiquity::Geoformulas.distance_correction d, self.elems['ele'], point.elems['ele']\n end\n d\n end", "def normalizePoint(point, normalizer)\n x = point[0] + normalizer[0]\n y = point[1] + normalizer[1]\n # make sure we didn't wrap one way or the other.\n # taking the shortest great circle distance.\n x = x <= -180 ? x +360 : x\n x = x >= 180 ? x +360 : x\n return [x,y]\n end", "def apply_map_function(iMapFunction)\n case @Function[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n case iMapFunction.function_data[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n # Both functions are piecewise linear\n # Algorithm:\n # * For each segment of our function:\n # * We look at the segments from the map function.\n # * For each found segment:\n # *** We find at which abscisses this segment will change values\n # *** We change the sub-segment between those abscisses\n lPoints = @Function[:Points]\n lMapPoints = iMapFunction.function_data[:Points]\n lNewPoints = []\n lIdxSegment = 0\n while (lIdxSegment < lPoints.size-1)\n lBeginX = lPoints[lIdxSegment][0]\n lBeginY = lPoints[lIdxSegment][1]\n lEndX = lPoints[lIdxSegment+1][0]\n lEndY = lPoints[lIdxSegment+1][1]\n # The direction in which we are going to look for the map segments\n lIncMapSegment = nil\n if (lEndY >= lBeginY)\n lIncMapSegment = true\n else\n lIncMapSegment = false\n end\n # Find the map function's segment containing the beginning of our segment\n lIdxMapSegment = 0\n if (lBeginY == lMapPoints[-1][0])\n lIdxMapSegment = lMapPoints.size - 2\n else\n while (lBeginY >= lMapPoints[lIdxMapSegment+1][0])\n lIdxMapSegment += 1\n end\n end\n # Compute the new value of our segment beginning\n lNewBeginY = lMapPoints[lIdxMapSegment][1] + ((lMapPoints[lIdxMapSegment+1][1]-lMapPoints[lIdxMapSegment][1])*(lBeginY-lMapPoints[lIdxMapSegment][0]))/(lMapPoints[lIdxMapSegment+1][0]-lMapPoints[lIdxMapSegment][0])\n lNewPoints << [ lBeginX, lNewBeginY ]\n # Get the next map segments unless we reach our segment's end\n # !!! Find the next map segment according to the direction\n if (lIncMapSegment)\n while (lEndY > lMapPoints[lIdxMapSegment+1][0])\n # We have a new map segment to consider in our segment\n # Find the absciss at which our Y coordinates get the value lMapPoints[lIdxMapSegment+1][0]\n lNewSegmentX = lBeginX + ((lEndX-lBeginX)*(lMapPoints[lIdxMapSegment+1][0] - lBeginY))/(lEndY-lBeginY)\n lNewPoints << [ lNewSegmentX, lMapPoints[lIdxMapSegment+1][1] ]\n lIdxMapSegment += 1\n end\n # Our segment ends before next map segment\n else\n while (lEndY < lMapPoints[lIdxMapSegment][0])\n # We have a new map segment to consider in our segment\n # Find the absciss at which our Y coordinates get the value lMapPoints[lIdxMapSegment][0]\n lNewSegmentX = lBeginX + ((lEndX-lBeginX)*(lMapPoints[lIdxMapSegment][0] - lBeginY))/(lEndY-lBeginY)\n lNewPoints << [ lNewSegmentX, lMapPoints[lIdxMapSegment][1] ]\n lIdxMapSegment -= 1\n end\n # Our segment ends before previous map segment\n end\n # Write the segment end if it is the last one (otherwise it will be written by the next iteration)\n if (lIdxSegment == lPoints.size-2)\n lNewEndY = lMapPoints[lIdxMapSegment][1] + ((lMapPoints[lIdxMapSegment+1][1]-lMapPoints[lIdxMapSegment][1])*(lEndY-lMapPoints[lIdxMapSegment][0]))/(lMapPoints[lIdxMapSegment+1][0]-lMapPoints[lIdxMapSegment][0])\n lNewPoints << [ lEndX, lNewEndY ]\n end\n lIdxSegment += 1\n end\n # Replace with new points\n @Function[:Points] = lNewPoints\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n optimize\n end", "def get_midpoint(point)\n Point.new(*to_a.zip(point.to_a).map { |a, b| (a + b) / 2.0 })\n end", "def point_match(point, nominal)\n point[0].should be_within(0.01).of(nominal[0])\n point[1].should eq nominal[1]\nend", "def forwardDeg(point)\r\n forwardDeg!(point.dup)\r\n end", "def center(point, transformation)\n\t point = transformation.transform(point) if transformation\n\t [10, format_value(point.x), 20, format_value(point.y)]\n\tend", "def takfp x, y, z\n return z unless y < x\n takfp( takfp(x-1.0, y, z),\n takfp(y-1.0, z, x),\n takfp(z-1.0, x, y))\nend", "def contains?(point)\n contains_xy?(point.x, point.y)\n end", "def curve\n end", "def curve\n end", "def *(coef)\n Point.new(@x * coef, @y * coef)\n end", "def test_point_to_waypoint\n pt = [-118, 34]\n waypoint = GPX::GeoJSON.send(:point_to_waypoint, pt, nil)\n assert_equal(34, waypoint.lat)\n assert_equal(-118, waypoint.lon)\n end", "def draw_fn(a, b, &func)\n draw_axes\n\n a, b = reduce_interval(a, b)\n\n step = 0.38\n c_step = step\n arg = a\n\n while arg < b do\n c_step = step\n begin\n c_step = reset_step(arg, step) {|xx| fn(xx)}\n rescue Math::DomainError\n arg += c_step * 0.1\n else\n draw_point(arg, func.call(arg), mul, 'lime')\n ensure\n arg += c_step\n end\n end\n end", "def rand_point()\n \n end", "def sub(point)\r\n new_point = Marshal.load(Marshal.dump(self))\r\n new_point.x = @x - point.x\r\n new_point.y = @y - point.y\r\n return new_point\r\n end", "def f(x)\n x*(x+1)\nend", "def cos\n pass\nend", "def boiling_point(elevation, boiling_ft)\n \televation * boiling_ft + 100\nend", "def boiling_point(elevation, boiling_ft)\n \televation * boiling_ft + 100\nend", "def emit_points(metric, points, options= {})\n scope = override_scope options\n\n points.each do |p|\n p[0].kind_of? Time or raise 'Not a Time'\n p[0] = p[0].to_i\n p[1] = p[1].to_f # TODO: stupid to_f will never raise an exception\n end\n\n @metric_svc.submit(metric, points, scope, options)\n end" ]
[ "0.62752974", "0.6051425", "0.6048171", "0.6048171", "0.6047147", "0.59952956", "0.5847952", "0.58306503", "0.5822637", "0.58110577", "0.57494825", "0.57016295", "0.5674655", "0.5629805", "0.5625533", "0.5616871", "0.5611975", "0.5608872", "0.5605202", "0.55977094", "0.5588817", "0.55500627", "0.5533428", "0.55203736", "0.5500654", "0.548241", "0.54641783", "0.5462387", "0.5454955", "0.5451236", "0.54273397", "0.54199415", "0.5410354", "0.5405928", "0.5401256", "0.53984267", "0.53928256", "0.5389406", "0.53767544", "0.53487575", "0.53427196", "0.53119683", "0.5303363", "0.5302667", "0.5296378", "0.5267463", "0.5265135", "0.5265135", "0.5265135", "0.5265135", "0.52581465", "0.52576303", "0.524788", "0.5241063", "0.52268714", "0.5223144", "0.5209646", "0.5190525", "0.5189932", "0.5189236", "0.5184331", "0.51816607", "0.5178516", "0.51772785", "0.5176273", "0.5174807", "0.5163731", "0.51546776", "0.5150364", "0.51353747", "0.51290727", "0.51236683", "0.5119158", "0.51024854", "0.5100691", "0.5090338", "0.50853884", "0.50853884", "0.5077609", "0.50641406", "0.5063974", "0.5056655", "0.505237", "0.50456303", "0.5039715", "0.503722", "0.50357103", "0.50316167", "0.5029691", "0.5026532", "0.5026532", "0.5026277", "0.5019136", "0.5009729", "0.5009543", "0.49923167", "0.49921814", "0.49889207", "0.4987049", "0.4987049", "0.49864548" ]
0.0
-1
returns a copy of the point
def get_point_clone return @point.clone end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def sub(point)\r\n new_point = Marshal.load(Marshal.dump(self))\r\n new_point.x = @x - point.x\r\n new_point.y = @y - point.y\r\n return new_point\r\n end", "def to_point\n if length == 2\n p = Point.new(*self)\n elsif length == 1\n p = self[0].clone\n end\n return p\n end", "def identity\r\n new_point = Marshal.load(Marshal.dump(self))\r\n new_point.x = 0\r\n new_point.y = 0\r\n new_point.x = @x / @x.abs if @x != 0\r\n new_point.y = @y / @y.abs if @y != 0\r\n return new_point\r\n end", "def now\n ret = self.dup\n ret.xset self.x\n ret.yset self.y\n ret\n end", "def add_to_point point\n add_to_point! point.dup\n end", "def get_point\n p = nil\n @m.synchronize{\n p = @p[0]\n @p.delete_at(0)\n }\n return p\n end", "def -(p)\n Point.new(@x - p.x, @y - p.y)\n end", "def copy\n self.class.new(@x,@y)\n end", "def + (point)\n return Point2D.new(@x + point.x, @y + point.y)\n end", "def get_first_point\n @points.each do |pt|\n @points.delete(pt)\n return pt\n end\n end", "def add(point)\r\n new_point = Marshal.load(Marshal.dump(self))\r\n new_point.x = @x + point.x\r\n new_point.y = @y + point.y\r\n return new_point\r\n end", "def inverse(point)\r\n inverse!(point.dup)\r\n end", "def + point\n\t\tPoint.new(@x+point.x, @y+point.y)\n\tend", "def sub!(point)\r\n @x -= point.x\r\n @y -= point.y\r\n end", "def -(other_point)\n Point.new(self.x - other_point.x, self.y - other_point.y)\n end", "def get_real_point\n pos_x = x * get_scale(:x)\n pos_y = y * get_scale(:y)\n return Point.new(pos_x, pos_y) unless (has_layer?)\n real_point = get_layer.get_real_point\n return Point.new(\n (real_point.x + pos_x),\n (real_point.y + pos_y)\n )\n end", "def identity_x\r\n new_point = identity\r\n new_point.y = 0\r\n return new_point\r\n end", "def copy\n Ripple.new(@pos)\n end", "def copy\n Water.new(@pos)\n end", "def to_p\n Point2.new(@x, @y)\n end", "def points #:nodoc:\n [self]\n end", "def points #:nodoc:\n [self]\n end", "def initialize(point, value)\n @point = point.clone\n @value = value\n end", "def matte_point(x, y)\n f = copy\n f.alpha(OpaqueAlphaChannel) unless f.alpha?\n pixel = f.pixel_color(x, y)\n pixel.alpha = TransparentAlpha\n f.pixel_color(x, y, pixel)\n f\n end", "def <<(point)\n @points << ensure_point_is_location_object(point)\n @points.uniq!\n self\n end", "def + (point)\n self.class.new(x + point.x, y + point.y)\n end", "def to_point\n size = attribute :size\n point = attribute :position\n point.x += size.width / 2\n point.y += size.height / 2\n point\n end", "def create_unprojected_point(x, y)\n Rails.logger.debug \"RgeoGeometryAdapter Creating unprojected point geometry from x = #{x}, y = #{y}\"\n projected_geometry = @geometry_factory.projection_factory.point(x, y)\n Rails.logger.debug \"Projected Point = #{projected_geometry.to_s}\"\n @geometry_factory.unproject(projected_geometry)\n end", "def -@\n Point.new(-x, -y)\n end", "def perp\n self.class.new( -@y, @x )\n end", "def to_local(point)\n inverse * point\n end", "def position=(point); end", "def copy\n GameObject.new(@animation.dup, @pos.dup)\n end", "def +(other_point)\n Point.new(self.x + other_point.x, self.y + other_point.y)\n end", "def to_point\n CGPoint.new(first, second)\n end", "def identity_y\r\n new_point = identity\r\n new_point.x = 0\r\n return new_point\r\n end", "def add!(point)\r\n @x += point.x\r\n @y += point.y\r\n end", "def copy\n\t\t\treturn self.dup\n\t\tend", "def to_point\n attribute(:position).center(attribute :size)\n end", "def to_point\n attribute(:position).center(attribute :size)\n end", "def to_gpos\n Point[ self.x, self.y ]\n end", "def at_x new_x\n PIXI::Point.new(new_x , self.y)\n end", "def s_copy\n Vector3f.new(@x, @y, @z)\n end", "def clone\n return Rect.new(self.x, self.y, self.width, self.height)\n end", "def point(x,y)\n [x,y]\nend", "def transform(otherProjection, point)\r\n transform!(otherProjection, point.dup)\r\n end", "def setpoint\n @setpoint\n end", "def clone\n self.copy\n end", "def clone\n self.copy\n end", "def add point\n self.x += point.x\n self.y += point.y\n self\n end", "def x\n @point[0]\n end", "def forward(point)\r\n forward!(point.dup)\r\n end", "def to_xy\n a = self\n a = [a[0].x, a[0].y] if length == 1\n return *a\n end", "def origin=(point)\n end", "def identity_random\r\n new_point = identity\r\n if new_point.x != 0 and new_point.y != 0\r\n if rand(2) > 0\r\n new_point.x = 0\r\n else\r\n new_point.y = 0\r\n end\r\n end\r\n return new_point\r\n end", "def -(other)\n raise TypeError, \"Subtract between Point and #{ other.class } is not defined\" unless other.is_a?(Point)\n Point.new(self.x - other.x, self.y - other.y)\n end", "def up\n Point.new(@x, @y + 1)\n end", "def up\n Point.new(@x, @y + 1)\n end", "def get(point)\n super || set(point, participant_at(point))\n end", "def +(point)\n\t\t\t\tx = nil\n\t\t\t\ty = nil\n\t\t\t\t\n\t\t\t\tif !@x.nil? || !point.x.nil?\n\t\t\t\t\tx = @x.to_i + point.x.to_i\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tif !@y.nil? || !point.y.nil?\n\t\t\t\t\ty = @y.to_i + point.y.to_i\n\t\t\t\tend\n\t\t\t\t\n\t\t\t\tself.class.new(x, y)\n\t\t\tend", "def to_coordinates\n\n CGPointMake(self.x.to_coordinates, self.y.to_coordinates)\n end", "def +(other)\n Point2D.new(@x + other.x, @y + other.y)\n end", "def create_rod(sPoint, a)\r\n pts = []\r\n pts[0] = sPoint\r\n pts[1] = Geom::Point3d.new(sPoint[0] + a, sPoint[1], sPoint[2])\r\n return pts\r\nend", "def make_absolute(point)\n absolute_position + point * Core::Point.new(width, height)\n end", "def scaled_point\n val = self.class.base.new(@value * self.class.size)\n val.kind_of?(ScaledPoint) ? val : val.scaled_point\n end", "def to_point\n Straightedge::Mark.new(*self)\n end", "def points; end", "def *(coef)\n Point.new(@x * coef, @y * coef)\n end", "def dup\n result = self.class.new(dimension, geometric_resolution, order)\n result.send(:initialize_copy, self)\n result\n end", "def mirror\n point3.mirror!\n end", "def -(p)\n Pair.new(@x - p.x, @y - p.y)\n end", "def become(v)\n @x = v.x\n @y = v.y\n self\n end", "def copy\n dup\n end", "def projection_point(p)\n Point.project(p - p1, self.direction.to_point) + p1\n end", "def to_a\n [x_point,y_point]\n end", "def rand_point\n return nil if @width == 0 || @height == 0\n Point.new(1 + @x + rand(@x + @width), 1 + @y + rand(@y + @height))\n end", "def points\n []\n end", "def save_point\n @save_points\n end", "def opposite(p)\n return CGAL::Point_2.build(self.y, self.x)\n end", "def coords_to_pos(point)\n (size - 1 - point.y) * size + point.x\n end", "def clone\n other = dup\n other.freeze if self.frozen?\n other\n end", "def points\n object.polygon.points\n end", "def add_cpoint(point)\n end", "def dup\n result = self.class.new(geometric_resolution, order)\n result.initialize_copy(self)\n result\n end", "def set_diff_point(new_diff_point)\n @diff_point = new_diff_point\n end", "def copy\n Gene.new(@city, @lat, @lon)\n end", "def clone\n other = dup\n other.freeze if frozen?\n other\n end", "def clone\n o = dup\n o.freeze if frozen?\n o\n end", "def perp\n Vect2.new(-@y, @x)\n end", "def ovwrite_me(other)\n @x = other.x\n @y = other.y\n @z = other.z\n self\n end", "def clone\n copy(false)\n end", "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 update(point)\n\t\t\n\tend", "def update(point)\n\t\t\n\tend", "def intersectPoint p\n if real_close_point(x,y,p.x,p.y) then self\n else NoPoints.new\n end\n end", "def clone_position(character)\n # copy real_x and real_y\n @real_x, @real_y = character.real_x, character.real_y\n # get pixel movement rate\n pix = $BlizzABS.pixel\n # if battler and not battler before\n if self.is_a?(Map_Battler) && !character.is_a?(Map_Battler)\n # copy coordinates with correction\n @x, @y = character.x * pix, character.y * pix\n # if not battler and battler before\n elsif !self.is_a?(Map_Battler) && character.is_a?(Map_Battler)\n # copy coordinates with correction\n @x, @y = character.x / pix, character.y / pix\n else\n # just copy coordinates\n @x, @y = character.x, character.y\n end\n end", "def add_point\n end", "def patch_point(source)\n @patch_points.push [@assembler.location, source]\n end", "def get_copy(board)\n copy_piece = ChessPiece.get_new_piece(board, @color, get_type)\n copy_piece.row = @row\n copy_piece.col = @col\n copy_piece.has_moved = @has_moved\n return copy_piece\n end", "def point\n x = []\n y = []\n case geometry.type\n when 'MultiPolygon'\n coordinates.each { |list| append_list list, x, y }\n when 'LineString'\n append coordinates, x, y\n when 'Point'\n x << coordinates.first\n y << coordinates.last\n else\n append_list coordinates, x, y\n end\n lon = x.reduce(&:+) / x.size\n lat = y.reduce(&:+) / y.size\n [lon.round(7), lat.round(7)]\n end" ]
[ "0.7704209", "0.73078203", "0.7215952", "0.71435744", "0.70725566", "0.7001392", "0.67546225", "0.67159456", "0.66975594", "0.66770905", "0.6642301", "0.6609255", "0.65990114", "0.6576018", "0.65734076", "0.6562474", "0.6559707", "0.6537596", "0.6490234", "0.63733876", "0.63716936", "0.63716936", "0.6333952", "0.63096917", "0.63085645", "0.6278405", "0.6265209", "0.62574697", "0.6224166", "0.6218704", "0.6215569", "0.62017834", "0.6193215", "0.61460483", "0.61412674", "0.6117794", "0.6107915", "0.6098077", "0.6095737", "0.6095737", "0.603173", "0.6029912", "0.6020034", "0.60183054", "0.59720874", "0.5959835", "0.5936959", "0.59155256", "0.59155256", "0.5907841", "0.58910763", "0.5876785", "0.5875711", "0.5868087", "0.58572316", "0.5851107", "0.5840464", "0.5840464", "0.58303756", "0.5808078", "0.5802077", "0.58014584", "0.57994217", "0.5796238", "0.5794294", "0.5765771", "0.5756748", "0.5752233", "0.574302", "0.57374805", "0.57324445", "0.573117", "0.5718416", "0.570094", "0.5694823", "0.569255", "0.5687481", "0.5685889", "0.5684785", "0.5680228", "0.5655232", "0.56545466", "0.5648282", "0.56478906", "0.56366926", "0.56251496", "0.5623099", "0.56101686", "0.560927", "0.5591464", "0.5586582", "0.5583012", "0.5581671", "0.5581671", "0.5559361", "0.55529076", "0.5552424", "0.55432874", "0.5540438", "0.5536206" ]
0.87721944
0
increment iteration counter by 1
def increment_iterations_counter @iterations += 1 raise "iteration limit reached" if @iterations > @max_iterations end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def increment_iteration\n @iteration += 1\n end", "def inc\n $i + 1\n end", "def increment\n @counter = @counter + 1\n end", "def increase_index\n @i +=1\n end", "def increment_counter\n unless self.count.nil?\n self.count += 1\n else\n self.count = 1\n end\n end", "def increment \n\t\t@counter = @counter + 1\n\tend", "def incr_count\n @count ||= 0\n @count += 1\n end", "def increment!\n\t\t\t\t@vertices += 1\n\t\t\t\t@count += 1\n\t\t\tend", "def incr\n add(1)\n end", "def increment_count(current_count)\n current_count.to_i + 1\n end", "def next\n @count += 1\n self\n end", "def increment\n self.class.increment(self)\n end", "def increment_counter(counter)\n\tcounter += 1\n\treturn counter\nend", "def add_to_count\n @count += 1\n end", "def increment\n @value += 1\n end", "def count number\r\n number.times do\r\n number += 1\r\n end\r\nend", "def incr(x) x + 1 end", "def next\n\t\tself + 1\n\tend", "def increment_tries\n @tries += 1\n end", "def increment\n curr_value = counter\n self.counter = curr_value + 1\n save\n curr_value\n end", "def increment(key)\n @counter[key] += 1\n end", "def increment_order!\n @current += 1\n end", "def increment_count\n session[:count] += 1\n @count = session[:count]\n end", "def iterate\n self.update\n @time += 1\n end", "def increment!\n @value += @increment\n \n self\n end", "def accumulate *_\n self.count += 1\n end", "def count\n @count ||= 0\n @count += 1\n end", "def next()\n @array[@k+=1]\n end", "def next_row\n @current_row += 1\n end", "def increment(*)\n @build += 1\n end", "def increment\n @attempt += 1\n log\n end", "def increment(node)\n change_by node, 1\n end", "def my_count\n i = 0\n self.my_each {|x| i += 1}\n i\n end", "def count!\n if not self.count.nil? then self.count += 1; else self.count = 1; end\n end", "def increment_nums!()\n i = 0\n self.each do |element|\n if element.class() == Fixnum\n self[i] = self[i] + 1\n i += 1\n else\n i += 1\n end\n end\n end", "def current_iteration\n iterations.first\n end", "def inc_l\n end", "def increment_click_count!\n self.increment! :click_count\n end", "def incrby(key, increment); end", "def incrby(key, increment); end", "def increment_number\n @number_of_repos += 1\n end", "def increment_player_idx\n @current_player_idx = (@current_player_idx + 1) % 2\n end", "def increase_item_count(index)\n current_value = @item_counts[index] ||= 0\n\n @item_counts[index] = current_value + 1\n end", "def next!\r\n @cur = @cache[@idx+=1]\r\n end", "def next\n\t\t\t\t@index += 1\n\t\t\t\tself._update\n\t\t\t\tself\n\t\t\tend", "def iterate\n @iterations.times do |i|\n puts \"Running iteration: #{i + 1}\"\n\n @times << yield\n end\n end", "def to count\n take count + 1\n end", "def document_counter(idx)\n idx + 1\n end", "def next\n @pointer += 1\n end", "def increment(stat, sample_rate=1); count stat, 1, sample_rate end", "def number\n before.count + 1\n end", "def inc_c\n end", "def inc(key)\n \n end", "def increment *args\n accumulators.incr(scope(*args))\n end", "def increment element\n element.perform :increment\n end", "def increment_guess_count(count)\n\treturn count += 1\nend", "def increase_by(i)\n start = 0\n lambda { start += i } \n end", "def increment_scores_index\n @scores_idx +=1 if valid_scores_idx?(@scores_idx + 1)\n self\n end", "def inc_a\n end", "def step count\n @algorithm.call count\n end", "def increment\n self.visits = self.visits.to_i.next\n self.save\n end", "def do_something_with_my_count\r\n @my_count += 1\r\n end", "def increment_counter(key)\n if @counters.key?(key)\n @counters[key] += 1\n else\n @counters[key] = 1\n end\n end", "def increment_hits\n @node.increment_hits! if @node\n end", "def increment_transaction_count!\n @transaction_count += 1\n end", "def hit_count_increament\n self.hit_count = self.hit_count + 1\n self.update\n end", "def each()\n i = 0\n while i < @total\n yield at(i)\n i += 1\n end\n self\n end", "def inc_match\n @matchedCount += 1\n end", "def increment_click_count\n update(click_count: click_count + 1)\n end", "def increment_counter(counter_name, id)\n update_all \"#{counter_name} = #{counter_name} + 1\", \"#{primary_key} = #{id}\"\n end", "def increment!\n self.times += 1\n self.save\n end", "def advance\n @current += 1 unless at_end?\n return previous\n end", "def next_turn\n @turns += 1\n end", "def __internal_count(iteration_counter, counter, n, block)\n return counter if count == 0\n\n new_counter = if iteration_counter % n == 0 && test(first, block)\n counter + 1\n else\n counter\n end\n tail.__internal_count( iteration_counter + 1, new_counter, n, block)\n end", "def iter\n f1,f2,k = 1,1,2\n f1,f2,k = f2,f1+f2,k+1 while f2.to_s.size < 1000\n puts k\nend", "def next()\n x = @arr[@i]\n @i += 1\n x\n end", "def increment_counter\n session[:counter] += 1 if session[:counter].present?\n end", "def inc_value(iIncrement = 1)\n super\n end", "def __to_inc__\n self\n end", "def count_next_index()\n if @operation == :pour\n if @second_index + 1 >= @original_state.size\n @second_index = 0\n @first_index += 1\n else\n @second_index += @second_index + 1 == @first_index ? 2 : 1\n end\n if @first_index + 1 == @original_state.size && @second_index + 1 >= @original_state.size\n @operation = :nop\n end\n else\n if @first_index + 1 < @original_state.size\n @first_index += 1\n else\n @first_index = 0\n @operation = @operation == :fill ? :empty : :pour\n end\n end\n end", "def increment(points_count)\n\t\t@story_count += 1\n\t\t@points_count += points_count\n\tend", "def inc_e\n end", "def count()\n return @i\n end", "def count1(collection)\n true_counter = 0\n collection.each { |element| true_counter += 1 if yield(element) }\n true_counter\nend", "def count\n count = 0\n each do |data|\n count += 1\n end\n count\n end", "def increment_operator\n incremented = false\n i = 0\n while (incremented == false && i<(@operator_value.size) && @operator_increment_completed==false)\n if @operator_value[i] < (@operators.size-1)\n @operator_value[i] += 1\n incremented = true\n else\n @operator_value[i] = 0\n i+=1\n end\n end\n incremented\n end", "def id_counter\n @id_counter += 1\n end", "def next_number\n counter.call(files.last_number).to_s\n end", "def succ!\n @next_run += @interval\n end", "def mutate(num)\n num += 1\n end", "def counter_2(x)\n (1..x).each { |n| puts n }\nend", "def next_object_id\n\t\t\t@@object_count += 1\n\t\tend", "def next\n peek.tap { @position += 1 }\n end", "def count_with_increment(start, inc)\n lambda do\n tmp = start\n start += inc\n tmp\n end\nend", "def incr(key); end", "def incr(key); end", "def next_element_number\n self.survey_elements.count + 1\n end", "def next_number\n self.to_a.size + 1\n end", "def increment_processed_items\n processed_items = $redis.hgetall(redis_key)['processed_items'].to_i\n processed_items += 1\n\n $redis.hset(redis_key, :processed_items, processed_items)\n end", "def increment_counter(counter_name, id)\n rec = collection.findOne({:_id => id})\n rec[counter_name] += 1\n collection.save(rec)\n end" ]
[ "0.8831108", "0.78934926", "0.7621582", "0.75952846", "0.7546926", "0.74968636", "0.74813884", "0.72551954", "0.71128196", "0.6923429", "0.69094497", "0.6895905", "0.6869051", "0.6825437", "0.67964745", "0.6777269", "0.67709917", "0.6759741", "0.6640851", "0.6631496", "0.66294354", "0.66254073", "0.6593088", "0.6588083", "0.655384", "0.6520718", "0.64470154", "0.6420872", "0.6420631", "0.6410208", "0.63854694", "0.6375743", "0.63751644", "0.63705415", "0.63598543", "0.6334097", "0.6327873", "0.63037384", "0.63003546", "0.63003546", "0.62957436", "0.6284781", "0.6279673", "0.6268248", "0.6258676", "0.6253894", "0.62422234", "0.6239796", "0.6231348", "0.6229487", "0.6218485", "0.6210827", "0.619657", "0.6196364", "0.6183301", "0.6182995", "0.61679", "0.6155503", "0.6144152", "0.61374366", "0.6126099", "0.61225", "0.6117844", "0.61019033", "0.60935664", "0.60931456", "0.6089332", "0.6087247", "0.6079486", "0.6077598", "0.60742545", "0.6073229", "0.6070688", "0.6067744", "0.6065965", "0.6050024", "0.60485375", "0.6043717", "0.6042975", "0.6041288", "0.6024695", "0.60239786", "0.6015563", "0.60111076", "0.60110116", "0.60098", "0.6007262", "0.6000648", "0.5997986", "0.59942925", "0.59933686", "0.5990158", "0.59868354", "0.5982115", "0.5953498", "0.5953498", "0.59517163", "0.59440935", "0.59434766", "0.5942213" ]
0.78155714
2
compares 2 PointValuePair points
def compare(v1, v2) if v1.value == v2.value return 0 elsif v1.value > v2.value return 1 else return -1 end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def compare(x, y); end", "def eql?(other_point)\n @x == other_point.x && @y == other_point.y\n end", "def compare_position(point)\n (v2.x - v1.x) * (point.y - v1.y) - (point.x - v1.x) * (v2.y - v1.y)\n end", "def eq_for_coordinates(p, s, t)\n q, r = first_point, second_point\n s, t = s.to_s+\"_to\", t.to_s + \"_to\"\n p.send(t,q)+r.send(s,q)+\"-\"+p.send(s,q)+r.send(t,q)\n end", "def == (other)\n @points == other.points\n end", "def ==(other)\n @points == other.points\n end", "def compare( tuples, i, j )\n a, x = tuples[i][0], tuples[i][1]\n b, y = tuples[j][0], tuples[j][1]\n\n a, x, b, y, i, j = b, y, a, x, j, i if x > y\n a / b.to_f > b**((y - x) / x.to_f) ? i : j\n end", "def compare_coords(x1, _y1, x2, _y2)\n return x1 > x2\n end", "def compareTriplets(a, b)\n a_points = 0\n b_points = 0\n x = 0\n while x < a.length\n if a[x] != b[x]\n a[x] > b[x] ? a_points += 1 : b_points += 1\n end\n x += 1\n end\n return [a_points, b_points]\nend", "def par_compare(a, b)\n if a.par_price.price > b.par_price.price\n -1\n elsif a.par_price.price < b.par_price.price\n 1\n else\n @formed.find_index(a) < @formed.find_index(b) ? -1 : 1\n end\n end", "def compare_coords(_x1, y1, _x2, y2)\n return y1 > y2\n end", "def ==(other)\n case other\n when Osgb::Point\n other = other.transform_to(self.datum) unless other.datum == self.datum\n self.lat == other.lat && self.lng == other.lng && self.datum == other.datum\n when Array\n self.to_a == other\n when String\n self == other.to_latlng(:datum => self.datum) # serves to normalise string representation\n end\n end", "def ==(other)\n return false unless other.is_a?(Point)\n (x - other.x).abs < EQUITY_TOLERANCE && (y - other.y).abs < EQUITY_TOLERANCE\n end", "def ==(other_point)\r\n if other_point.class != self.class\r\n false\r\n else\r\n @x == other_point.x and @y == other_point.y and @z == other_point.z and @m == other_point.m\r\n end\r\n end", "def compare_by_points(other, break_ties = true)\n diff = other.points <=> points\n return diff if diff != 0 || !break_ties\n\n diff = compare_by_highest_place(other)\n return diff if diff != 0\n\n diff = compare_by_most_recent_place(other)\n return diff if diff != 0\n\n 0\n end", "def equal?(point)\r\n return true if @x == point.x and @y == point.y\r\n return false\r\n end", "def eql?(other)\n return false unless other.respond_to?(:coords)\n equal = true\n self.coords.each_with_index do |c, i|\n if (c - other.coords.to_a[i])**2 > PRECISION\n equal = false\n break\n end\n end\n equal\n end", "def == point\t\n\t\t@x == point.x && @y == point.y\t\n\tend", "def ==(p)\n @x == p.x && @y == p.y \n end", "def approxmatching(a,b)\n\treturn (a==b)\nend", "def <=>(other_point)\n ret = self.x <=> other_point.x\n if ret == 0\n ret = self.y <=> other_point.y\n end\n ret\n end", "def eql?(other)\n return false if !other.is_a?(Point) || other.group != group\n x == other.x && y == other.y\n end", "def <=>(other)\nreturn nil unless other.instance_of? Point\n@x**2 + @y**2 <=> other.x**2 + other.y**2\nend", "def isEqual(p)\n (p.x == x) && (p.y == y)\n end", "def bbpFuzzyEqual(first_point, second_point, variance)\n\n if first_point.x - variance <= second_point.x and second_point.x <= first_point.x + variance\n\n if first_point.y - variance <= second_point.y and second_point.y <= first_point.y + variance\n\n return true\n end\n end\n\n false\n end", "def intersect point1, point2, a1, b1, x1, x2\n a2 = (point2.latitude - point1.latitude)/(point2.longitude-point1.longitude)\n b2 = point1.latitude - a2*point1.longitude\n x = (b2-b1)/(a1-a2)\n x3 = point1.longitude < point2.longitude ? point1.longitude : point2.longitude\n x4 = point1.longitude > point2.longitude ? point1.longitude : point2.longitude\n x >= x1 && x <= x2 && x >= x3 && x <= x4\n end", "def ==(other)\n return false unless other.is_a?(Point)\n @x == other.x && @y == other.y && @z == other.z && @m == other.m\n end", "def <=>(other)\n return nil unless other.instance_of? Point\n @x**2 + @y**2 <=> other.x**2 + other.y**2\n end", "def test_distance_to_point2\n point1 = Point.new(0, 0)\n point2 = Point.new(3, 4)\n assert_equal 5, point1.distance_to(point2)\n end", "def compareTriplets(a, b)\n alice_points = 0\n bob_points = 0\n\n a.zip(b).each do |a_val, b_val|\n if a_val > b_val\n alice_points += 1\n elsif a_val < b_val\n bob_points += 1\n end\n end\n puts \"#{alice_points} #{bob_points}\"\n [alice_points, bob_points]\nend", "def <=>(other)\n# Define the <=> operator\nreturn nil unless other.instance_of? Point\nself.x**2 + self.y**2 <=> other.x**2 + other.y**2\nend", "def ==( other )\n [ self.lattitude, self.longitude, self.radius ] == [ other.lattitude, other.longitude, other.radius ]\n end", "def < (point2)\n end", "def <=>(other)\n return nil unless other.instance_of? Point\n @x**2 + @y**2 <=> other.x**2 + other.y**2\n end", "def <=>(other)\n return nil unless other.instance_of? Point\n @x**2 + @y**2 <=> other.x**2 + other.y**2\n end", "def <=>(other)\n return nil unless other.instance_of? Point\n @x**2 + @y**2 <=> other.x**2 + other.y**2\n end", "def <=>(other)\n if x_param == other.x_param && y_param == other.y_param\n 0\n elsif other.x_param <= x_param && other.y_param <= y_param\n 1\n else\n -1\n end\n end", "def compare_ranking_lines(a, b)\n res = 0\n\n if a['points'] < b['points']\n res = 1\n\n elsif b['points'] < a['points']\n res = -1\n\n else\n a_won_games = a['3_points'] + a['2_points']\n b_won_games = b['3_points'] + b['2_points']\n\n if a_won_games < b_won_games\n res = 1\n\n elsif b_won_games < a_won_games\n res = -1\n\n else\n #tied in won games, look at ratio won sets/lost sets\n a_ratio = a['won_sets'].to_f / a['lost_sets']\n b_ratio = b['won_sets'].to_f / b['lost_sets']\n\n if a_ratio < b_ratio\n res = 1\n elsif b_ratio < a_ratio\n res = -1\n end\n end\n end\n\n return res\n end", "def differences_between_arrays(first_points, second_points)\n YquotesSignalTools.truncate_to_shortest!(first_points, second_points)\n differences = []\n first_points.each_with_index { |fp, index| differences << fp - second_points[index] }\n differences\n end", "def point_point_distance(a, b)\n (((a.x - b.x) ** 2 + (a.y - b.y) ** 2) ** 0.5).abs\n end", "def span_test(other)\n other = Point.new(other[0], other[1]) if other.is_a?(Array)\n raise TypeError, 'Must pass only Point.' unless other.is_a?(Point)\n\n return 0 if self.p1 == other\n\n rel_pos = other - self.p1\n return 1 if self.direction.to_point.dot(rel_pos) > 0\n \n return -1\n end", "def find_closest_pair(pairs)\n zz = {:x => 0, :y => 0}\n distances_from_zz = pairs.map { |p| {:distance => distance(p, zz), :point => p} } # O(n)\n cloest_pair = distances_from_zz.sort { |p1, p2|\n dist = abs(p1[:distance] - p2[:distance])\n puts dist\n dist\n }.take(2)\n cloest_pair.map { |p| \"#{p[:point][:x]}, #{p[:point][:y]} -- distance: #{p[:distance]}\" }\nend", "def ==(other)\n other.x == @x && other.y == @y\n end", "def ==(other)\n return false unless other.is_a?(LatLng)\n lat == other.lat && lng == other.lng\n end", "def ==(other)\n return false unless other.is_a?(LatLng)\n lat == other.lat && lng == other.lng\n end", "def same?(point, delta = POINT_DELTA)\n if ((@x + delta > point.x && @x - delta < point.x &&\n @y + delta > point.y && @y - delta < point.y))\n return true\n end\n return false\n end", "def compare_triplets(a,b)\n scores = [0,0]\n a.each_with_index do |val, index|\n case val <=> b[index]\n when 1\n scores[0] += 1\n when -1\n scores[1] += 1\n end\n end\n scores\n end", "def distance_between_points(a, b)\n Math.sqrt( (b.x - a.x)**2 + (b.y - a.y)**2 ).round(6)\nend", "def point_match(point, nominal)\n point[0].should be_within(0.01).of(nominal[0])\n point[1].should eq nominal[1]\nend", "def reactive_pair?(a, b)\n (a.ord - b.ord).abs == MATCH_DIFF\n end", "def get_key(point1, point2)\n x1, y1 = point1.first, point1.last\n x2, y2 = point2.first, point2.last\n if(x1 == x2)\n c = -1 * x1\n return [1, 0, c]\n end\n if(y1 == y2)\n c = -1 * y1\n return [0, 1, c]\n end\n tx = x1 - x2\n ty = y1 - y2\n mcd = max_common_divisor(tx.abs, ty.abs)\n k1 = ty / mcd\n k2 = tx / mcd\n b = y1 - x1 * k1 / k2\n return [k1, k2, -1, b]\nend", "def test(points, r1, r2)\n points = points.map do |pair, response|\n [response[:asks][0][\"price\"], response[:bids][0][\"price\"]]\n end.flatten\n\n puts \"UEBU correct\" if r1 == 1000 / points[0] * points[3] * points[5]\n puts \"UBEU correct\" if r2 == 1000 / points[4] / points[2] * points[1]\n end", "def eql?(other)\n\t if other.is_a?(Array)\n\t\t@elements.eql? other\n\t elsif other.is_a?(PointIso)\n\t\tvalue = other.value\n\t\t@elements.all? {|e| e.eql? value }\n\t elsif other.is_a?(PointOne)\n\t\t@elements.all? {|e| e.eql? 1 }\n\t elsif other.is_a?(PointZero)\n\t\t@elements.all? {|e| e.eql? 0 }\n\t else\n\t\tsuper other\n\t end\n\tend", "def larger_point_of_intersection(other)\n a = points_of_intersection(other)\n a.sort_by{|p| [p.x, p.y]}.last\n rescue\n false\n end", "def main(points) # array with all the points\n #copy of the array by an especific cordinate\n #nlogn\n # This is a primitive, aka operations that are costless compared to the\n # total complexity we are aming for\n px = sort_by_cordinate(points, 0)\n py = sort_by_cordinate(points, 1)\n\n result = closest_pair(px, py)\nend", "def Point2dEqual(arg0, arg1)\n ret = _invoke(1610743832, [arg0, arg1], [VT_BYREF | VT_DISPATCH, VT_BYREF | VT_DISPATCH])\n @lastargs = WIN32OLE::ARGV\n ret\n end", "def compare(x,y)\n a = CachedProduct.find_by_product_id(x['product_id'].to_s)\n b = CachedProduct.find_by_product_id(y['product_id'].to_s)\n return a.max_small <=> b.max_small\n end", "def coverPoints(a, b)\n x, y = 0, 0\n distance = 0\n (1...a.length).each do |i|\n x = (a[i] - a[i -1]).abs\n y = (b[i] - b[i -1]).abs\n distance += [x, y].min\n end\n distance\n end", "def distance(point2)\n end", "def test_distance_between_boston_and_new_york\n boston = { latitude: 42.3541165, longitude: -71.0693514 }\n new_york = { latitude: 40.7791472, longitude: -73.9680804 }\n\n distance = Vincenty.distance_between_points(boston, new_york)\n\n assert_in_delta 298_396.057, distance, 0.001\n end", "def <=>(other)\n\t\treturn nil unless other.instance_of? Point\n\t\t@x**2 + @y**2 <=> other.x**2 + other.y**2\n\tend", "def distCalc(point1, point2)\n first = ((point2[:x] - point1[:x]) **2)\n second = ((point2[:y] - point1[:y]) **2)\n sum = (first + second)\n dist = Math.sqrt(sum)\n return dist\nend", "def ==(other)\n case other\n when Point\n float_equal(x, other.x) && float_equal(y, other.y)\n when Array\n self == Geom2D::Point(other)\n else\n false\n end\n end", "def <=>(other)\n # if SUBJECT_POINTS[self.name] > SUBJECT_POINTS[other.name]\n # return 1\n # elsif SUBJECT_POINTS[self.name] < SUBJECT_POINTS[other.name]\n # return -1\n # else\n # return 0\n # end\n # shorter way to do this :O WOW! just tell which\n # things(quantities) to compare, and rubys comparable does it for you\n # so as long as the quantities you want to compare are builtin ones,\n # just call <=> straight instead of doing the if..elsif..else\n SUBJECT_POINTS[self.name] <=> SUBJECT_POINTS[other.name]\n end", "def eql?(other)\n (@x == other.x) && (@y == other.y)\n end", "def ==(comp)\n comp.x === x && comp.y === y\n end", "def dominates?(point1, point0)\n column_names.all? { |name| point1[name] < point0[name] }\n end", "def equal_by_trans?(g1, g2)\n check_pre((\n (graph_obj?(g1)) and\n (graph_obj?(g2))\n ))\n\n # pick two points\n # sub p1 from p2\n # translate p2 by diff\n # check equal_by_tree\n\n if not equal_by_dim?(g1, g2)\n return false\n end\n\n p1 = shape_lowest_left_point(g1)\n p2 = shape_lowest_left_point(g2)\n\n tp1 = p1 - p2\n tg1 = g2.translate(tp1)\n\n return equal_by_tree?(g1, tg1)\nend", "def ==(other_vector, precision = 6)\n @x.round(precision) == other_vector.x.round(precision) and\n @y.round(precision) == other_vector.y.round(precision)\n end", "def ==(other)\n if other.kind_of?(PairType)\n self.key == other.key && self.value == other.value\n else\n false\n end\n end", "def x_equal_y\n x = @x.content\n y = @y.content\n z = Array.new @z.length, 1\n\n @z.length.times do |i|\n unless x[i] == y[i]\n z = Array.new @z.length, 0\n break\n end\n end\n\n @z.content = z\n end", "def diff_feature(f, s1, s2, k1, k2)\n d = 0.0\n \n if s1.has_key?(f) and s2.has_key?(f) # no missing value\n d = (s1[f] == s2[f]) ? 0.0 : 1.0\n elsif not s1.has_key?(f) and not s2.has_key?(f) # two missing values\n fvs = get_feature_values(f).uniq\n fvs.each do |mv|\n d -= calc_p(f, mv, k1)*calc_p(f, mv, k2)\n end\n d += 1\n elsif not s1.has_key?(f) # s1: one missing value\n # diff(f, s1, s2) = 1 - P(value(f, s2)|class(s1))\n d = 1 - calc_p(f, s2[f], k1)\n else # s2: one missing value\n # diff(f, s1, s2) = 1 - P(value(f, s1)|class(s2))\n d = 1 - calc_p(f, s1[f], k2)\n end\n \n d\n end", "def eqs_for_free_points(p)\n return [] if p.free?\n q, r = first_point, second_point\n eqs = []\n uv = [:x,:y,:z] # uv stands for unused vars\n %w{x y z}.map(&:to_sym).each do |v|\n if 0 == (q.send(v).to_f - r.send(v).to_f)\n eqs << p.send(v.to_s+\"_to\", q) # <-- A bit different equation\n uv.delete(v)\n end\n end\n if uv.size == 3\n eq_for_non_free_points(p) # The equations are the same as the\n # non-free-points options\n elsif uv.size == 2\n eqs << eq_for_coordinates(p, *uv)\n end\n eqs\n end", "def test_slow_converge\n start = { latitude: 0.0, longitude: 0.0 }\n finish = { latitude: 0.5, longitude: 179.5 }\n\n distance = Vincenty.distance_between_points(start, finish)\n\n assert_in_delta 19_936_288.579, distance, 0.001\n end", "def == other\n other = subtrahend other\n (@lat == other.lat) && (@lon == other.lon)\n end", "def ==(other)\n\t if other.is_a?(Array)\n\t\t@elements.eql? other\n\t elsif other.is_a?(PointIso)\n\t\tvalue = other.value\n\t\t@elements.all? {|e| e.eql? value }\n\t elsif other.is_a?(PointOne)\n\t\t@elements.all? {|e| e.eql? 1 }\n\t elsif other.is_a?(PointZero)\n\t\t@elements.all? {|e| e.eql? 0 }\n\t else\n\t\tsuper other\n\t end\n\tend", "def test_distance_to_point_left_below\n point1 = Point.new(3, 4)\n point2 = Point.new(0, 0)\n assert_equal 5, point1.distance_to(point2)\n end", "def <=>(other)\n return 0 if x == other.x && y == other.y\n\n 1\n end", "def common_point(e1, e2)\n p1, p2 = @points_of_edge[e1]\n p3, p4 = @points_of_edge[e2]\n if p1 == p3 || p1 == p4\n p1\n elsif p2 == p3 || p2 == p4\n p2\n else\n nil\n end\n end", "def points_distance(x1, y1, x2, y2)\n Math.sqrt((x1 - x2).abs2 + (y1 - y2).abs2)\n end", "def approx_same_values_as?(other)\n delta = s_copy.sub(other).to_a.inject(0.0) do |result, element|\n result + element**2.0\n end\n delta < EPSILON\n end", "def near_matches(other_code)\n own_code = self.hash_code\n oth_code = other_code.hash_code\n\n near_matches = 0\n exact_matches = self.exact_matches(other_code)\n\n own_code.each do |key, value|\n # if both hashes have the key, than you should take the lowest value\n if oth_code.keys.include?(key)\n near_matches += [oth_code[key], own_code[key]].min\n end\n end\n near_matches - exact_matches\n end", "def compare(pair1, pair2) # each pair in the form [base, exponent]\n Math.log(pair1[0]) * pair1[1] > Math.log(pair2[0]) * pair2[1]\nend", "def ==(p)\n (self.lat == p.lat) && (self.lon == p.lon)\n end", "def compareTriplets(a, b)\n i = 0\n score = [0, 0]\n \n while i < a.size\n \n if a[i] > b[i]\n score[0] += 1\n elsif\n a[i] < b[i]\n score[1] += 1\n end\n i += 1\n end\n score\nend", "def <=>(point)\n raise \"Must compare to another point\" unless point.is_a? Point\n if self.x < point.x\n -1\n elsif self.x > point.x\n 1\n else\n if self.y < point.y\n -1\n elsif self.y > point.y\n 1\n else\n 0\n end\n end\n end", "def test_distance_to_point_right_below\n point1 = Point.new(0, 4)\n point2 = Point.new(3, 0)\n assert_equal 5, point1.distance_to(point2)\n end", "def ==( other )\n @x == other.x and @y == other.y and @type == other.type\n end", "def obstructed?(new_x, new_y); end", "def test_distance_to_point_right_up\n point1 = Point.new(0, 0)\n point2 = Point.new(1, 1)\n assert_equal Math.sqrt(2), point1.distance_to(point2)\n end", "def ==(vector2)\n end", "def eql(other)\n\t\traise TypeError if other.class != Player\n\t\treturn 1 if self.points > other.points\n\t\treturn -1 if self.points < other.points\n\t\treturn 0 if self.points == other.points\n\tend", "def get_distance_from_point_arrays(a1, a2)\n\t\t\tp1 = geofactory.point(a1[0],a1[1])\n\t\t\tp2 = geofactory.point(a2[0],a2[1])\n\n\t\t\treturn p1.distance(p2)\n\t\tend", "def vars_eq?(x1, x2) ; x1[0] == x2[0] ; end", "def assert_positions_match(position1,position2)\n\t\tassert_models_match(position1,position2)\n\tend", "def same_pos?(pos1, pos2)\n pos1 = pos1.pos if pos1.respond_to?(:pos)\n pos2 = pos2.pos if pos2.respond_to?(:pos)\n pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z\n end", "def same_pos?(pos1, pos2)\n pos1 = pos1.pos if pos1.respond_to?(:pos)\n pos2 = pos2.pos if pos2.respond_to?(:pos)\n pos1.x == pos2.x and pos1.y == pos2.y and pos1.z == pos2.z\n end", "def same(x, y)\n find(x) == find(y)\n end", "def compare\n # Creates an array of matched offers\n output = []\n @result_a.trips.each do |trip_1|\n @result_b.trips.each do |trip_2|\n next if trip_1.price.nil? || trip_2.price.nil? # safeguard if the trip is an empty object\n output << Offer.new(\n origin_a: @origin_a,\n origin_b: @origin_b,\n destination_city: trip_1.destination_city,\n date_there: @date_there,\n date_back: @date_back,\n total: trip_1.price + trip_2.price,\n # we agnosticize QPXTripOption here\n roundtrips: [\n RoundTrip.new(qpx_trip_option: trip_1),\n RoundTrip.new(qpx_trip_option: trip_2)\n ]\n )\n end\n end\n output\n end", "def compare(other)\n score = 0.0\n firstname_dist = Levenshtein.distance(normalized_firstname, other.normalized_firstname)\n lastname_dist = Levenshtein.distance(normalized_lastname, other.normalized_lastname)\n\n mod = 1.0\n if lastname_found?\n if normalized_firstname[0] == other.normalized_firstname[0]\n mod += 3.0\n if normalized_firstname.length < 3 or other.normalized_firstname.length < 3\n mod += 3.0\n end\n if lastname_dist == 0\n mod += 4.0\n end\n end\n end\n\n if normalized_firstname.length > 0 and other.normalized_firstname.length > 0\n score += 0.25 * (firstname_dist / (normalized_firstname.length.to_f) + firstname_dist / (other.normalized_firstname.length.to_f)) / mod\n end\n if normalized_lastname.length > 0 and other.normalized_lastname.length > 0\n score += 0.25 * (lastname_dist / (normalized_lastname.length.to_f) + lastname_dist / (other.normalized_lastname.length.to_f))\n end\n\n score\n end", "def compareTriplets(a, b)\n array_a = a\n array_b = b\n results = [0,0]\n array_a.collect.with_index do |value, index|\n if value > array_b[index]\n results[0] += 1\n elsif value < array_b[index]\n results[1] += 1\n end\n end\n return results\nend" ]
[ "0.66092783", "0.65819407", "0.6482415", "0.6312989", "0.62846106", "0.6251068", "0.62440825", "0.6167803", "0.6143469", "0.61307764", "0.6111861", "0.61116445", "0.6055054", "0.604694", "0.5974834", "0.5952699", "0.5909076", "0.58601165", "0.5855901", "0.5842174", "0.5786715", "0.57795006", "0.5778465", "0.5736623", "0.57347417", "0.57201153", "0.5719688", "0.57173574", "0.57025975", "0.5699793", "0.5699614", "0.56892097", "0.5684395", "0.5654011", "0.5654011", "0.5654011", "0.56348914", "0.56304306", "0.5618158", "0.5612879", "0.5608206", "0.560125", "0.5595311", "0.5593363", "0.5593363", "0.5590742", "0.55739415", "0.5564518", "0.55583155", "0.5554077", "0.55435544", "0.554288", "0.55399275", "0.55361545", "0.5523199", "0.55018026", "0.5500072", "0.5491698", "0.5484913", "0.5460867", "0.5459492", "0.54582983", "0.5439668", "0.54218435", "0.5421279", "0.54193753", "0.5409417", "0.537429", "0.5360429", "0.5350969", "0.53350645", "0.533195", "0.5327423", "0.53270215", "0.53255355", "0.5324772", "0.53162825", "0.53160304", "0.530991", "0.53078735", "0.52979475", "0.52952355", "0.5295079", "0.52947354", "0.52921", "0.52832836", "0.5269325", "0.5236305", "0.52335316", "0.5230149", "0.52253944", "0.5222089", "0.52107763", "0.5208637", "0.5203755", "0.52023304", "0.52023304", "0.51991343", "0.51979697", "0.5182325", "0.51772594" ]
0.0
-1
checks whether the function is converging
def converging? # check the convergence in a given direction comparing the previous and current values def point_converged?(previous, current) pre = previous.value curr = current.value diff = (pre - curr).abs size = [pre.abs, curr.abs].max return !((diff <= (size * @relative_threshold)) and (diff <= @absolute_threshold)) end # returns true if converging is possible atleast in one direction if @iterations > 0 # given direction is converged converged = true 0.upto(@simplex.length - 1) do |i| converged &= !point_converged?(@previous[i], @simplex[i]) end return !converged end # if no iterations were done, convergence undefined return true end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def converge(state) ; end", "def converge_complete\n end", "def converge\n transition_to(:converge)\n end", "def converge\n transition_to(:converge)\n end", "def solvable?\n steps > 0\n end", "def solved?\n self.fittest.fitness >= 1.0\n end", "def converge?(a, b)\n difference = find_difference(a, b)\n\n a_runner = a\n b_runner = b\n\n if difference > 0\n difference.times do\n b_runner = b_runner.next\n end\n else\n (-difference).times do\n a_runner = a_runner.next\n end\n end\n\n until a_runner.nil?\n return true if a_runner == b_runner\n a_runner = a_runner.next\n b_runner = b_runner.next\n end\n\n false\nend", "def done?\n puts \"iteration: #{@iterations += 1}\"\n return true if @iterations >= @max_iterations\n return false unless @simplex.permutation(2).map { |e|\n l = Math.sqrt((e[0] - e[1]).to_a.map{ |f| f**2 }.inject(&:+))\n l <= 0.5\n }.all?\n\n _f = 1/3 * @simplex.map(&:result).inject(&:+)\n _d = 1/3 * @simplex.map{ |e| (e.result - _f)**2 }.inject(&:+)\n _d <= TOLERANCE**2\n end", "def solvable?\n\t\tsteps > 0\n\tend", "def usable?\n\n @trajectory.each do |a_point|\n if a_point.alt > 1000000.0\n return false\n end\n end\n\n return true\n\n end", "def conversion_processing?\n !(conversion_complete? || conversion_successful? || conversion_error?)\n end", "def solvable?\n find_solution > 0\n end", "def finite?() end", "def continue? (new_thetas, old_thetas, features, outputs)\n old_thetas_mse = mean_squared_error(old_thetas, features, outputs)\n new_thetas_mse = mean_squared_error(new_thetas, features, outputs)\n change = old_thetas_mse - new_thetas_mse\n raise HonorRoll::MeanSquaredErrorDivergenceError if change < 0\n change.abs > @convergence_threshold\n end", "def converged?\n\t\tnew_board = Board.new\n\t\tnew_board.board = board.dup\n\t\tnew_board.free_positions.each do |position|\n\t\t\tif new_board.add_queen_to_board(position)\n\t\t\t\treturn false\n\t\t\tend\n\t\tend\n\n\t\treturn true\n\tend", "def failed?\n complete? && !all_nodes_succeeded?\n end", "def failed?\n complete? && !all_nodes_succeeded?\n end", "def vt_forever?\n vtend_at == InfinityValue\n end", "def energized?\n @cur_energy > 0\n end", "def integrity_check\n start_values = condition.start_values\n generations.each do |g|\n # FIXME -- use the registered fitness function\n if IterativeLearning::FunctionLearning.sum_of_error(g.start_values, start_values) != 0\n return false\n end\n start_values = g.best_task_response\n end\n return true\n end", "def compiling?\n !@converging\n end", "def estimated?\n !estimate.nil?\n end", "def solved?\n result = false\n @data.each do |turn|\n result = turn[:key].red >= 4 if !turn[:key].nil?\n break if result == true\n end\n @solved = result\n result\n end", "def converge_complete\n detect_unprocessed_resources\n end", "def passed?\n !failed?\n end", "def passed?\n !failed?\n end", "def target_reached?\n @current_value == @target_value\n end", "def evaluate_next_step_on_change?\n false\n end", "def convergence\n variance\n end", "def finite?\n end", "def interval?() triangulated? and complement.comparability?; end", "def dead?()\n @fitness <= 0\n end", "def in_future?\n elapsed.negative?\n end", "def valid?\n !!@factor && !@factor.zero? && @factor.finite?\n end", "def improve\n return false unless valid?\n true\n end", "def success?\r\n\treturn true if @fund >= @target_fund\r\n\treturn false if @fund < @target_fund\r\nend", "def failed?\n @value == 0 || @value.to_i < 0\n end", "def is_solved?\n return false unless is_rows_valid?\n return false unless is_columns_valid?\n return false unless is_subgrids_valid?\n true\n end", "def valid_result_range\n self.result && self.result > -2 ? true : false\n end", "def check_fitness\r\n\t\tcourse = Course.find_by(courseID: courseID)\r\n\t\treturn course.intensity > 0\r\n\tend", "def convertable?(argument)\n argument.respond_to? conversion_method\n end", "def linear?\n !circular?\n end", "def has_stopping_criterion_been_met?(best_fit)\n return false if @optimal_func_val.nil?\n\n answer =\n if @is_high_fit\n best_fit >= @optimal_func_val\n else\n best_fit <= @optimal_func_val\n end\n answer\n end", "def tt_forever?\n ttend_at == InfinityValue\n end", "def finished?\n self.round_count > 0\n end", "def vector_work?\n false\n end", "def made?\n result >= 0\n end", "def update_transition?\r\n # Abort loop if transition processing\r\n if $game_temp.transition_processing\r\n return true\r\n end\r\n return false\r\n end", "def solved?\n end", "def finished? nodes\n nodes.each { |k,v| return false if !v.done && v.distance != -1 }\n return true \n end", "def cost\r\n\t\t@lr.compute_cost.class != NaN\r\n\tend", "def finished?\n @turns_allowed < 0\n end", "def maint?\n ck_valid\n return true if @num.to_i == 0\n false\n end", "def approximate?\n !exact?\n end", "def solved?\n !@grid.nil? && @grid.missing == 0\n end", "def values_positive?\n is_ok = self.start_value > 0.0\n \n if is_ok\n self.value_changes.each do |offset, setting|\n setting.value > 0.0\n end\n end\n return is_ok\n end", "def doGreedy? forceValidation\r\n\t\tif ! @trainTestStruct.equalTestSetAndResults?\r\n\t\t\tif ! forceValidation\r\n\t\t\t\treturn false\r\n\t\t\telse\r\n\t\t\t\tdoValidation \r\n\t\t\tend\r\n\t\tend\r\n\t\ttrue\r\n\tend", "def check_float(a, b)\n tolerance = Math::TOLERANCE\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend", "def check_float(a, b)\n tolerance = Math::TOLERANCE\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend", "def validation(x, y)\n if(x >= plane[0].length || x < 0)\n puts \"invalid start or end point on across direction\"\n return false\n end\n if(y >= plane.length || y < 0)\n puts \"invalid start or end point on down direction\"\n return false\n end\n return true\n end", "def applyGrowth(x)\n if (x.parameter_type != 0) == @value\n return true\n else\n return false\n end\n end", "def zero?\n toReturn = true\n \n @coefs.each do |coef|\n if coef != ' '\n toReturn = false\n break\n end\n end\n end", "def finite?\n !infinite?\n end", "def test_failure_to_converge\n start = { latitude: 0.0, longitude: 0.0 }\n finish = { latitude: 0.5, longitude: 179.7 }\n\n assert_raises Vincenty::FailToConverge do\n Vincenty.distance_between_points(start, finish)\n end\n end", "def check_float(a, b)\n tolerance = 1e-12\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\nend", "def check_approx(exp, act, eps = 1e-6)\n return ((exp >= (act - eps)) and (exp <= (act + eps)))\n end", "def has_transformation_input?(from, to)\n !!find_transformation_input(from, to)\n end", "def has_transformation_input?(from, to)\n !!find_transformation_input(from, to)\n end", "def is_solution? \n zero= false\n 0.upto(@width-1) do |x|\n 0.upto(@height-1) do |y|\n if @pole[x][y]==0\n zero = true\n break\n end\n end\n end\n print \"Je to reseni, pyco!\\n\" if !zero\n return !zero \n end", "def solved?\n !@grid.nil? && @grid.missing == 0\n end", "def valid?\n return false if @max_cfvo.nil?\n return false if @max_color.nil?\n return false if @mid_cfvo.nil?\n return false if @mid_color.nil?\n return false if @min_cfvo.nil?\n return false if @min_color.nil?\n return true\n end", "def result_of_checking; end", "def success?\n finished? and !exception\n end", "def converge_failed(exception)\n detect_unprocessed_resources\n end", "def too_low? temp # check if temp is below absolute zero\n temp < 0\nend", "def check_float(a, b)\n #tolerance = 1e-12\n tolerance = 1e-2\n a = a.to_f\n b = b.to_f\n if a.finite? and b.finite?\n (a-b).abs < tolerance\n else\n true\n end\n end", "def is_invalid?(num_1, num_2, num_3)\r\n\tflatlined = false\r\n\r\n\tif num_2 == num_1 || num_2 == num_3 || num_2.to_f.nan? || num_2 == 0 || !num_2.valid_float?\r\n\t\tflatlined = true\r\n\tend\r\n\r\n\treturn flatlined\r\nend", "def fcn(flag,pars,derivs)\n chi2 = 0.0;\n @data_pts.each{|pt| \n val = @min_block.call(pt.vars,pars)\n chi2 += ((pt.value - val)/pt.error)**2\n } \n return chi2\n end", "def success_threshold; end", "def accuracy_check(acc)\n return acc > rand \nend", "def finished?\n self.round.finished?\n end", "def success?() end", "def final_decision?\n final_decision\n end", "def converted?\n status[:status] == :done\n end", "def ok? \n @funct == nil ? (return false) : (return true)\n end", "def check_fit(to_check)\n\n checks = [:check_r2, :check_edges, :check_saturation, :check_separation, :check_error]\n\n to_check.finishedFitting and checks.all? { |c| self.send(c, to_check) }\n\n end", "def validate?\n ( @x <= @y && @d > 0 )\n end", "def over?\n\n end", "def solved_check\n ->() { true }\n end", "def conversion_complete?\n ipaper_document && ipaper_document.conversion_status != 'PROCESSING'\n end", "def failed?\n if score.present? and min_score.present?\n score < min_score\n end\n end", "def temperature_check\r\n Proc.new do |observations|\r\n (observations.any? { |obs| Helper.float_above_value(obs, TEMPERATURE_THRESHOLD) })\r\n end\r\n end", "def upc?\n numbers.first.zero?\n end", "def mismatch_input_to_output!\n input.each_feature do |finst|\n feature = finst.feature\n next unless feature.unset?\n\n feature_arity_check(feature)\n out_feat_instance = out_feat_corr_of_in(finst)\n feature.each_value do |val|\n finst.value = val if val != out_feat_instance.value\n end\n end\n eval # re-evaluate constraint violations b/c changed input\n self\n end", "def predicting?\r\n @predict_state != :none\r\n end", "def check_data_validation\r\n if @tx_interest.text.to_f > 0 and \r\n @tx_interest.text.to_f < 0.1 and\r\n @tx_amount.text.to_i >= 1000 and\r\n @tx_years.text.to_i >= 1 then\r\n tf = true\r\n else\r\n tf = false\r\n end\r\n return tf\r\n end", "def finish_step?\n return !goto_true && !goto_false\n end", "def processing_derivatives?\n !file_nodes.first.original_file?\n end", "def successful?\n complete? && all_nodes_succeeded?\n end", "def successful?\n complete? && all_nodes_succeeded?\n end" ]
[ "0.6986648", "0.6911506", "0.6849328", "0.6849328", "0.6108658", "0.6070145", "0.606297", "0.6011228", "0.59503126", "0.57450545", "0.56002283", "0.55354744", "0.55287474", "0.5504217", "0.5498693", "0.5497953", "0.5497953", "0.54847443", "0.5481534", "0.54738367", "0.5472005", "0.5441233", "0.53992105", "0.5387717", "0.5385258", "0.5376423", "0.53738064", "0.53713214", "0.5371117", "0.5364033", "0.53523374", "0.5343274", "0.53241223", "0.5306065", "0.5294332", "0.5293422", "0.52879846", "0.5283821", "0.52808523", "0.5269029", "0.5267302", "0.52671814", "0.52593315", "0.5256218", "0.52537966", "0.52375495", "0.52303874", "0.5207617", "0.5197577", "0.51965433", "0.51935655", "0.51927376", "0.5190705", "0.51885563", "0.518721", "0.5177287", "0.51547813", "0.51440036", "0.51440036", "0.51428795", "0.513682", "0.51312613", "0.5126622", "0.5123105", "0.51172805", "0.5103012", "0.509395", "0.509395", "0.5088908", "0.5086304", "0.50785977", "0.50781435", "0.5074035", "0.50681645", "0.5067762", "0.50576276", "0.5049945", "0.5049156", "0.5038531", "0.50352836", "0.49899074", "0.49852046", "0.49823606", "0.49732715", "0.49688104", "0.4965544", "0.4963373", "0.49610293", "0.49582937", "0.4957019", "0.49550587", "0.49509287", "0.495089", "0.49469018", "0.49447662", "0.49435923", "0.49412462", "0.4940825", "0.49402422", "0.49402422" ]
0.7549439
0
only the relative position of the n vertices with respect to the first one are stored
def start_configuration=(steps) n = steps.length @start_configuration = Array.new(n) { Array.new(n, 0) } 0.upto(n - 1) do |i| vertex_i = @start_configuration[i] 0.upto(i) do |j| raise "equals vertices #{j} and #{j+1} in simplex configuration" if steps[j] == 0.0 0.upto(j) do |k| vertex_i[k] = steps[k] end end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vertices\n vertices = []\n\n vertices << [(@origin[0] + @l/2.0), (@origin[1] + @h/2.0), (@origin[2] + @w/2.0)]\n vertices << [(@origin[0] + @l/2.0), (@origin[1] + @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] + @l/2.0), (@origin[1] - @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] + @l/2.0), (@origin[1] - @h/2.0), (@origin[2] + @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] - @h/2.0), (@origin[2] + @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] - @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] + @h/2.0), (@origin[2] - @w/2.0)]\n vertices << [(@origin[0] - @l/2.0), (@origin[1] + @h/2.0), (@origin[2] + @w/2.0)]\n\n vertices\n end", "def vertices\n end", "def vertices\n end", "def vertices\n [\n @origin,\n { x: x_max, y: y_min, z: z_min },\n { x: x_min, y: y_max, z: z_min },\n { x: x_min, y: y_min, z: z_max },\n { x: x_max, y: y_max, z: z_min },\n { x: x_max, y: y_min, z: z_max },\n { x: x_min, y: y_max, z: z_max },\n { x: x_max, y: y_max, z: z_max }\n ]\n end", "def vertices\n @vert\n end", "def vertices\n result = [[@origin_x, @origin_y, @origin_z]]\n dimensions = [@length, @width, @height]\n \n dimensions.each_with_index do |dimension, index|\n temp = result[0].dup\n temp[index] += dimension\n result << temp\n (index...dimensions.length).each do |index2|\n next if index == index2\n temp2 = temp.dup\n temp2[index2] += dimensions[index2]\n result << temp2\n end\n end\n result << [@origin_x + @length, @origin_y + @width, @origin_z + @height]\n result\n end", "def vertices\n\tend", "def vertices\n @vertices\n end", "def vertices\n (0...vertex_count).map { |i| self[i] }\n end", "def vertices\n [\n pos,\n Vertex.new(pos.x, pos.y + dims.y, pos.z),\n Vertex.new(pos.x + dims.x, pos.y + dims.y, pos.z),\n Vertex.new(pos.x + dims.x, pos.y, pos.z),\n Vertex.new(pos.x, pos.y, pos.z + dims.z),\n Vertex.new(pos.x, pos.y + dims.y, pos.z + dims.z),\n Vertex.new(pos.x + dims.x, pos.y, pos.z + dims.z),\n Vertex.new(pos.x + dims.x, pos.y + dims.y, pos.z + dims.z)\n ]\n end", "def x_vertex(p_hn, p_v)\n case p_v\n when :n, :s then return xp_from_hn(p_hn) + rhl\n when :ne, :se then return xp_from_hn(p_hn) + fw \n else return xp_from_hn(p_hn) \n end \n end", "def calc_vertices\n @worksheet.position_object( @params[:start_col],\n @params[:start_row],\n @params[:x_offset],\n @params[:y_offset],\n @params[:width],\n @params[:height]\n )\n end", "def mesh_vertices\r\n # private ?\r\n d = TT::Instance.definition( @instance )\r\n transformation = @instance.model.edit_transform\r\n points = mesh_points( final_subdivs, transformation )\r\n vertices = raw_mesh_vertices()\r\n\r\n # <debug>\r\n unless points.size == vertices.size\r\n Console.log( 'mesh_vertices' )\r\n Console.log( \"> Points: #{points.size}\" )\r\n Console.log( \"> Vertices: #{vertices.size}\" )\r\n end\r\n # </debug>\r\n\r\n patch_vertices = []\r\n for point in points\r\n vertex = vertices.find { |v| v.position == point } # (!) Optimize\r\n patch_vertices << vertex\r\n vertices.delete( vertex )\r\n end\r\n patch_vertices\r\n end", "def vertices\n @vertices\n end", "def start_vertex_normal\n end", "def nodes\n vertices\n end", "def build_vertex_offset_list\n vertex_offsets =\n get_records_with_filter do |records, record_type, offset, ptr|\n new_vertex_offset = case record_type\n when 68 then 40 # Color\n when 69 then 56 # Color, Normal\n when 70 then 64 # Color, Normal, UV\n when 71 then 48 # Color, UV\n else nil\n end\n records.push(new_vertex_offset) unless new_vertex_offset.nil?\n end\n vertex_offsets.insert(0, 8)\n cumulative = 0\n vertex_offsets.map{|vo| cumulative += vo}\n end", "def read_vertices\n (0..num_vertices - 1).map do |v|\n adj_lists[v] = Vertex.new(graphfile[v + 2], nil)\n end\n end", "def vertices\n VertexList.new(1, nil, [@centre])\n end", "def flip_range_xy(points); points.collect{ |v| Vertex.new(-v.y,-v.x)}; end", "def other_vertex(vertex1)\n end", "def other_vertex(vertex1)\n end", "def vertex_number\n @vertices.count\n end", "def get_vertices\n @vertices.keys\n end", "def neighbors(vertex)\n\tend", "def vertices\n @vertices.keys\n end", "def find_indexes_of_source_vertices\n # start with all vertices' indexes\n indexes = [*0..@vertices.length-1]\n\n @vertices.each do |vertex|\n vertex.neighbours.each_with_index do |value, neighbour_index|\n if (value == true)\n indexes = indexes - [neighbour_index]\n end\n end\n end\n\n indexes\n end", "def vertices\n (@structure.keys | @structure.values).flatten.uniq\n end", "def x_location_vertex\n return @ob_vx_location\n end", "def next_position\n (@position + face_vector).column(0).to_a\n end", "def numVertices\n @vertices.size\n end", "def numVertices\n @vertices.size\n end", "def get_neigbouring_positions(pos)\n [ pos1(pos), pos2(pos), pos3(pos), pos4(pos), pos5(pos), pos6(pos), pos7(pos), pos8(pos) ]\n end", "def raw_mesh_vertices\r\n vertices = []\r\n definition = TT::Instance.definition( @instance )\r\n for entity in definition.entities\r\n next unless entity.is_a?( Sketchup::Edge )\r\n vertices.concat( entity.vertices )\r\n end\r\n vertices.uniq!\r\n vertices\r\n end", "def flip_range_neg_xy(points); points.collect{ |v| Vertex.new(v.y,v.x)}; end", "def get_vertices\n getVertices.to_route(:graph => self, :element_type => :vertex)\n end", "def get_vertices\n getVertices.to_route(:graph => self, :element_type => :vertex)\n end", "def num_vertices()\n return vertex_list().length()\n end", "def install_order(arr)\n vertices = {}\n max = 0 \n arr.each do |tuple|\n vertices[tuple[0]] = Vertex.new(tuple[0]) unless verticles[tuple[0]]\n vertices[tuple[1]] = Vertex.new(tuple[1]) unless verticles[tuple[1]]\n # create an edge for each pair \n\n Edge.new(vertices[tuple[1]], vertices[tuple[0]])\n\n max = tuple.max if tuple.max > max \n end \n\n independent = []\n (1..max).each do |i| \n independent << i unless vertices[i]\n end \n\n independent + topological_sort(vertices.values).map { |v| v.value }\nend", "def deserialize(n, edges)\n vertices = {}\n while n > 0\n n -= 1\n vertices[n] = Vertex.new(n)\n end\n for edge in edges\n v1 = edge[0]\n v2 = edge[1]\n vertices[v1].edges.push(vertices[v2])\n vertices[v2].edges.push(vertices[v1])\n end\n\n # UNCOMMENT OUT THIS AREA IF YOU WOULD LIKE TO SEE THE GRAPH YOU'VE BUILT:\n #\n # for id, vertex in vertices\n # puts ''\n # puts 'ID: ' + vertex.id.to_s\n # for edge in vertex.edges\n # puts 'Edge ID: ' + edge.id.to_s\n # end\n # end\n\n # p vertices\n return vertices[0]\nend", "def vertices\n to_a\n end", "def vertex_creation(line)\n x = line.chomp(\"\\n\").split(';')\n id = x[0].to_i\n data = x[1]\n if x[2]\n neighbors = x[2].split(',')\n neighbors = neighbors.map(&:to_i)\n else\n neighbors = []\n end\n [id, data, neighbors]\nend", "def vertex(v)\n\t\tif v==0\n\t\t\treturn @Vertices[0]\n\t\tend\n\n\t\treturn @Vertices[@Hash[v]]\n\tend", "def relative_range_era(points)\n relative_range = []\n player = $game_player\n x,y = player.x, player.y\n points.each do |v|\n relative_range.push(Vertex.new(v.x + x, v.y + y))\n end\n relative_range\n end", "def flip_range_x(points); points.collect{ |v| Vertex.new(v.x, -v.y)}; end", "def get_vertices\n getVertices.iterator.to_route(:graph => self, :element_type => :vertex)\n end", "def vertex_list()\n return @source.keys()\n end", "def adjacent_vertices v\n\t\ttemp_array = []\n\t\tfor i in 0..num_edges-1\n\t\t\tif @Edges[i].points[0] == v.label\n\t\t\t\ttemp_array << @Vertices[@Hash[@Edges[i].points[1]]]\n\t\t\tend\n\t\t\tif @Edges[i].points[1] == v.label\n\t\t\t\ttemp_array << @Vertices[@Hash[@Edges[i].points[0]]]\n\t\t\tend\n\t\tend\n\n\t\treturn temp_array\n\n\tend", "def add_vertex coords\n vertices << coords.map(&:to_f)\n end", "def num_vertices\n\t\treturn @Vertices.length\n\tend", "def topological_sort(vertices)\n \nend", "def create_graph\n all_coordinates = get_all_coordinates\n all_coordinates.each do |key|\n neighbors = get_neighbor_arr(key)\n add_vertex(key,neighbors)\n end\n @vertices\n end", "def identifier_triangle_points\n point_to_triangles = []\n (@maillage_points.length+1).times do\n point_to_triangles << []\n end\n @triangles.length.times do |i|\n t = @triangles[i]\n point_to_triangles[t.p1.num] << i\n point_to_triangles[t.p2.num] << i\n point_to_triangles[t.p3.num] << i\n end\n return point_to_triangles\n end", "def center\n @center ||= begin\n xs, ys = vertices.transpose\n [xs.inject(:+)/xs.size.to_f, ys.inject(:+)/ys.size.to_f]\n end\n end", "def getVertices( x0, y0, x1, y1) # arguments define bounding box\n\t\tw, h = x1 - x0, y1 - y0\n\t\td = 5 # size of corner chip\n\n\t\t[\n\t\t\t[ d, 0], [ w - d, 0],\n [ w, d], [w, h - d],\n [ w - d, h], [ d, h],\n [ 0, h - d], [ 0, d]\n\t\t].map do |v| [ v[0] + x0, v[1] + y0 ] end.flatten\n\tend", "def update_shape()\n\t\t\t# define current position for faster access\n\t\t\t@position = self.bounds.center\n\t\t\tedges = self.definition.entities.to_a { |ent| ent.class == Sketchup::Edge }\n\t\t\t\n\t\t\t# set vertices array\n\t\t\tvertices = Array.new\n\t\t\tedges.each do |edge|\n\t\t\t\tvertices << edge.vertices\n\t\t\tend\n\t\t\tvertices.flatten!\n\t\t\tvertices.uniq!\n\t\t\t\n\t\t\t# now calculate each vertex global position\n\t\t\t@points = Array.new\n\t\t\ttransformation = self.transformation\n\t\t\tvertices.each do |vertex|\n\t\t\t\t@points << (vertex.position.transform! transformation)\n\t\t\tend\n\t\t\t\n\t\t\t@trans_array = transformation.to_a\n\t\t\treturn nil\n\t\tend", "def get_other_vertex(v_id)\n (vertices - [v_id])[0]\n end", "def add_vertex(v)\n array = []\n array[v] = 0\n @vertices[v] ||= array\n end", "def initialize\n @vertices = {}\n end", "def out_neighbors(vertex)\n\tend", "def mes(v,g)\n l_succ = Set.new\n g.adjacent_vertices(v).each { |sv| l_succ << @l[sv] }\n i = 0\n i += 1 until l_succ.member?(i) == false\n @l[v] = i \n end", "def vertex_up(vertex)\n @vertices[vertex] = true\n end", "def hint_idx_to_coord(i)\n j = i % SIZE\n\n if i >= 0 && i < SIZE\n # top\n r = (0..(SIZE-1)).to_a.map{ |a| {x: j, y: a} }\n elsif i >= SIZE && i < (SIZE * 2)\n r = (0..(SIZE-1)).to_a.reverse.map{ |a| {x: a, y: j} }\n elsif i >= (SIZE * 2) && i < (SIZE * 3)\n r = (0..(SIZE-1)).to_a.reverse.map{ |a| {x: (SIZE - 1) - j, y: a} }\n else\n r = (0..(SIZE-1)).to_a.map{ |a| {x: a, y: (SIZE - 1) - j} }\n end\n r\nend", "def hint_idx_to_coord(i)\n j = i % SIZE\n\n if i >= 0 && i < SIZE\n # top\n r = (0..(SIZE-1)).to_a.map{ |a| {x: j, y: a} }\n elsif i >= SIZE && i < (SIZE * 2)\n r = (0..(SIZE-1)).to_a.reverse.map{ |a| {x: a, y: j} }\n elsif i >= (SIZE * 2) && i < (SIZE * 3)\n r = (0..(SIZE-1)).to_a.reverse.map{ |a| {x: (SIZE - 1) - j, y: a} }\n else\n r = (0..(SIZE-1)).to_a.map{ |a| {x: a, y: (SIZE - 1) - j} }\n end\n r\nend", "def increment!\n\t\t\t\t@vertices += 1\n\t\t\t\t@count += 1\n\t\t\tend", "def test_each_vertex\n i=1; @g.each_vertex {|v| assert_equal(i, v[:id]); i+=1}\n end", "def vertices\n self.connections.map {|c| c.end}\n end", "def list_vertices\n\t\treturn @Vertices\n\tend", "def generate_coordinates\n coordinates = []\n (0..@column_count - 1).to_a.each do |i|\n (0..@row_count - 1).to_a.each do |j|\n coordinates << {x: i, y: j, z: 0}\n end\n end\n coordinates\n end", "def getVertices( x0, y0, x1, y1) # arguments define bounding box\n\t\tw, h = x1 - x0, y1 - y0\n\t\thh = (h/2).to_i\n\n\t\t[\n\t\t\t[ hh, 0], [ w - hh, 0], [ w, hh], [ w - hh, h], [ hh, h], [ 0, hh]\n\t\t].map do |v| [ v[0] + x0, v[1] + y0 ] end.flatten\n\tend", "def coords_to_pos(point)\n (size - 1 - point.y) * size + point.x\n end", "def get_vertices\n vertices = {}\n @schema['Vertices'].each do |raw_vertex|\n id = raw_vertex[0].to_s\n coordinates = raw_vertex[1]['Position']\n vertices[id] = Vertex.new(coordinates['X'].to_f, coordinates['Y'].to_f)\n end\n vertices\n end", "def xy_nodes_from_position(positions = Array.new)\n empty1, enemy1, ally1 = *x_axes\n empty2, enemy2, ally2 = *y_axes\n\n positions << empty1 + empty2\n positions << enemy1 + enemy2\n positions << ally1 + ally2\n\n positions\n end", "def position\n _parent = self.parent\n ((@nv - _parent.nv) / _parent.snv)\n end", "def end_vertices(e)\n\t\ttemp_array = []\n\t\tfor i in 0..num_edges-1\n\t\t\tif @Edges[i].label==e.label\n\t\t\t\ttmp2 = @Edges[i].points\n\t\t\tend\n\t\tend\n\t\ttemp_array << @Vertices[@Hash[tmp2[0]]]\n\t\ttemp_array << @Vertices[@Hash[tmp2[1]]]\n\t\treturn temp_array\n\tend", "def points\n [top_left, top_right, bottom_left, bottom_right]\n end", "def bezier3d(p1, p2, p3, p4, n)\n\tar = []\n\tar.push(p1)\n\tn.times do |i|\n\t\tt = (i+1).to_f / (n+1)\n\t\tp5 = intp3d(p1, p2, t)\n\t\tp6 = intp3d(p2, p3, t)\n\t\tp7 = intp3d(p3, p4, t)\n\t\tp8 = intp3d(p5, p6, t)\n\t\tp9 = intp3d(p6, p7, t)\n\t\tpz = intp3d(p8, p9, t)\n\t\tar.push(pz)\n\tend\n\tar.push(p4)\nend", "def starting_position\n if n.even?\n Position.new(0,0)\n else\n Position.new(square_root - 1, square_root - 1)\n end\n end", "def generate_adj_pos (x, y)\n adj_pos = Array.new()\n top_y = position_translate(y) - 1\n bottom_y = top_y + 2\n left_x = position_translate(x) - 1\n right_x = left_x + 2\n new_x = position_translate(x)\n new_y = position_translate(y)\n if valid_edge(top_y, new_x)\n adj_pos.push([x , y - 1])\n end\n if valid_edge(bottom_y, new_x)\n adj_pos.push([x, y + 1])\n end\n if valid_edge(new_y, left_x)\n adj_pos.push([x - 1, y])\n end\n if valid_edge(new_y, right_x)\n adj_pos.push([x + 1, y])\n end\n return adj_pos\n end", "def select_n\n tab_return = []\n tab_dist = []\n\n dist = 0\n p = tab_point[0]\n for point in tab_point\n dist+=point.distPoints(p)\n tab_dist.push(dist)\n p = point\n end\n\n q = tab_dist.last/(NBPOINT-1)\n tab_return.push(tab_point[0])\n for i in 1..NBPOINT-1\n\n j = find_elt(tab_dist,q*i)\n\n a = tab_point[j]\n b = tab_point[j+1]\n\n ac = q*i-tab_dist[j]\n ab = a.distPoints(b)\n\n aby = b.y-a.y\n acy = aby*(ac/ab)\n\n abx = b.x-a.x\n acx = abx*(ac/ab)\n\n cx = acx + a.x\n cy = acy + a.y\n tab_return.push(Point.new(cx.to_i, cy.to_i))\n end\n tab_return\n end", "def neighbor_vertices\n @meeting_edges.map &:to\n end", "def adj pt\n return [[pt[0]-1,pt[1]], [pt[0]+1,pt[1]], [pt[0],pt[1]-1], [pt[0],pt[1]+1]]\nend", "def vertex_count\n @graph.length\n end", "def draw_vertexes\n vs.each_index do |n|\n vs[n].draw @drawer\n end\n end", "def update_vertices(vertices)\n self.source = find_vertex(:source, vertices)\n self.target = find_vertex(:target, vertices)\n end", "def find_farthest_points(vertices_hash)\n @positive_x = center.x + radius\n @positive_y = center.y + radius\n # In case the convexity is pointing down the negative direction of the x or y axis.\n @negative_x = center.x - radius\n @negative_y = center.y - radius\n end", "def GetAdjacentPts(pts, i)\r\n res = []\r\n if (i == 0) \r\n res[0] = pts[pts.length-1]\r\n else \r\n res[0]= pts[i-1]\r\n end \r\n res[1] = pts[i]\r\n if (i == pts.length-1) \r\n res[2]= pts[0]\r\n else \r\n res[2] = pts[i+1]\r\n end \r\n return res\r\nend", "def out_degree(vertex)\n\tend", "def getCoords (index)\n return index%10, index/10\n end", "def initialize(n)\n @n = n\n init_positions\n end", "def triangulate(vertices)\n\t\tedges = []\n tris = []\n # sort by X coord\n vertices = vertices.sort_by {|p|p.x}\n # center/radius cache used by circum_circle\n cc_cache = {}\n\n # Set up the supertriangle\n # This is a triangle which encompasses all the sample points.\n # The supertriangle coordinates are added to the end of the\n # vertex list. The supertriangle is the first triangle in\n # the triangle list.\n number_of_vertices = vertices.size\n\t\tbounding_p1, bounding_p2, bounding_p3 = get_bounding_vertices(vertices)\n\t\tvertices << bounding_p1 << bounding_p2 << bounding_p3\n\t\ttris << ITRIANGLE.new(number_of_vertices, number_of_vertices+1, number_of_vertices+2)\n\n # Include each point one at a time into the existing mesh\n vertices.each_with_index { |current_point, i|\n edges.clear\n # Set up the edge buffer.\n # If the point (xp,yp) lies inside the circumcircle then the\n # three edges of that triangle are added to the edge buffer\n # and that triangle is removed.\n j = 0\n\t\t\ttris_size = tris.size\n\t\t\twhile j < tris_size\n\t\t\t\tcurrent_triangle = tris[j]\n if !current_triangle.complete\n p1 = vertices[current_triangle.p1]\n p2 = vertices[current_triangle.p2]\n p3 = vertices[current_triangle.p3]\n inside,xc,yc,r = circum_circle(current_point, p1, p2, p3, cc_cache)\n if (xc + r) < current_point.x\n current_triangle.complete = true\n end\n if inside\n\t\t\t\t\t\tedges << IEDGE.new(current_triangle.p1, current_triangle.p2)\n edges << IEDGE.new(current_triangle.p2, current_triangle.p3)\n edges << IEDGE.new(current_triangle.p3, current_triangle.p1)\n tris.delete_at(j)\n\t\t\t\t\t\ttris_size -= 1\n j -= 1\n end\n end\n j += 1\n end #while j\n\t\t\t\n\t\t\twhile !edges.empty?\n\t\t\t\tedge = edges.shift\n\t\t\t\trejected = edges.reject! {|e| e == edge}\n\t\t\t\ttris << ITRIANGLE.new(edge.p1, edge.p2, i) if rejected.nil? \n\t\t \tend\n \n } #each i\n \n\t\t# Remove supertriangle vertices\n\t\t3.times do \n\t\t\tvertices.pop\n\t\tend\n\t\tnumber_of_vertices = vertices.size\n\n # Remove triangles with supertriangle vertices\n # These are triangles which have a vertex number greater than number_of_vertices\n\t\ttris.delete_if {|tri| tri.p1 >= number_of_vertices || tri.p2 >= number_of_vertices || tri.p3 >= number_of_vertices}\n\n [ vertices, tris ]\n end", "def add_vertex!(vertex)\n\tend", "def add_vertex!(vertex)\n\tend", "def set_lower_position\n write_attribute :position, related_object.send(\"#{field_name}_asset_relations\").map(&:position).compact.max.to_i + 1\n end", "def size\n @vertices.length\n end", "def position\n V[x, y]\n end", "def expand_vertex(v)\n raise \"Vertex #{v} doesn't exist\" if v < 0 || v >= @v_size\n @edges[v].clone\n end", "def end_vertex_normal\n end", "def findPrincessPosition(n, grid)\n return calculate_position_coordinates(n, grid, 'p')\nend", "def add_vertices_from(edge)\n unless (@vertices << (@apical_vertices << edge.protein_1_id).last unless @vertices.include? edge.protein_1_id)\n @vertices << (@apical_vertices << edge.protein_2_id).last unless @vertices.include? edge.protein_2_id\n end\n edge\n end", "def third_degree_neighbors(edges, start)\nend" ]
[ "0.6600981", "0.6527703", "0.6527703", "0.63610095", "0.6318691", "0.62971103", "0.6211614", "0.61948067", "0.6161065", "0.6149511", "0.6082587", "0.607094", "0.6035557", "0.5992011", "0.595214", "0.59265494", "0.5912111", "0.5870704", "0.58693504", "0.5868207", "0.58451927", "0.58451927", "0.58232886", "0.573666", "0.5708233", "0.5706729", "0.57052153", "0.5685853", "0.5673347", "0.5664228", "0.56533974", "0.56533974", "0.5646501", "0.5645571", "0.56426394", "0.5602666", "0.5602666", "0.5596999", "0.55607724", "0.55373436", "0.55298865", "0.5514429", "0.5513226", "0.55126584", "0.5512648", "0.5511247", "0.54741275", "0.54631793", "0.5461588", "0.5455881", "0.5455172", "0.54378843", "0.54321873", "0.5423205", "0.54142797", "0.5409268", "0.5409204", "0.5404517", "0.5401574", "0.5396258", "0.5392343", "0.5391189", "0.53888726", "0.53888726", "0.53867596", "0.5381841", "0.5378296", "0.53778404", "0.5361394", "0.5355384", "0.5345478", "0.53283197", "0.5328084", "0.5327716", "0.5313742", "0.5264751", "0.5260579", "0.5249167", "0.5233625", "0.52291733", "0.5224662", "0.52233213", "0.52232766", "0.52131176", "0.52095705", "0.5201728", "0.5193283", "0.5190576", "0.5186202", "0.51861334", "0.51774585", "0.5157928", "0.5157928", "0.51542836", "0.5147973", "0.5147475", "0.51462907", "0.51462436", "0.5141382", "0.51345235", "0.51338696" ]
0.0
-1
Build an initial simplex == Parameters: start_point: starting point of the minimization search
def build_simplex(start_point) n = start_point.length raise "dimension mismatch" if n != @start_configuration.length # set first vertex @simplex = Array.new(n+1) @simplex[0] = PointValuePair.new(start_point, Float::NAN) # set remaining vertices 0.upto(n - 1) do |i| conf_i = @start_configuration[i] vertex_i = Array.new(n) 0.upto(n - 1) do |k| vertex_i[k] = start_point[k] + conf_i[k] end @simplex[i + 1] = PointValuePair.new(vertex_i, Float::NAN) end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def initial_simplex(x1=ParameterSet.new(-4.0,-4.0),c=8)\n p= c/Math.sqrt(2) * (Math.sqrt(3)-1)/2\n q= ParameterSet.new(p,p)\n x2 = x1 + q + ParameterSet.new(1.0,0.0) * (c/Math.sqrt(2))\n x3 = x1 + q + ParameterSet.new(0.0,1.0) * (c/Math.sqrt(2))\n @simplex = [x1,x2,x3]\n end", "def evaluate_simplex\n # evaluate the objective function at all non-evaluated simplex points\n 0.upto(@simplex.length - 1) do |i|\n vertex = @simplex[i]\n point = vertex.point\n if vertex.value.nan?\n @simplex[i] = PointValuePair.new(point, f(point))\n end\n end\n # sort the simplex from best to worst\n @simplex.sort!{ |x1, x2| x1.value <=> x2.value }\n end", "def solve_start(first)\n starting_edge = Edge.new(first,first,0, 0)\n @queue.push(starting_edge)\n solve(first)\n end", "def initialize (starting_pos)\n # @starting_pos = starting_pos\n @root_node = PolyTreeNode.new(starting_pos)\n # kpf = KnightPathFinder.new([0, 0])\n @used_pos = [starting_pos]\n end", "def generate_initial_condition\n initial_condition_elements = []\n \n num_wave_points = (\n (@parameters[:period]/2) / @parameters[:x_interval]\n ).to_i\n \n num_zero_points_before = \n (\n @parameters[:spatial_offset] * \n @parameters[:number_of_spatial_points]\n ).to_i\n \n num_zero_points_after = \n @parameters[:number_of_spatial_points] - \n num_wave_points - \n num_zero_points_before\n \n (0..num_zero_points_before).each do |n|\n initial_condition_elements << 0.0\n end\n \n (0...num_wave_points).each do |n|\n initial_condition_elements << sine_wave_point(\n n * @parameters[:x_interval]\n )\n end\n \n (0..num_zero_points_after).each do |n|\n initial_condition_elements << 0.0\n end\n \n @initial_condition = Vector.elements(initial_condition_elements)\n end", "def prepare_search\n # puts \"prepare_search called\"\n @current_point = @start_vector\n @interval_index = 0\n @path = [@start_vector]\n @initial_run = true\n \n @current_cost = get_cost @current_point\n end", "def a_star pitch, start, goal\n\t\t# The set of nodes already evaluated.\n\t\tclosedset = []\n\t\t# The set of tentative nodes to be evaluated.\n\t\topenset = []\n\t\t# Visited nodes\n\t\tfrontier = []\n\t\topenset << start\n\t\t# The map of navigated nodes.\n\t\tcame_from = { }\n\t\t# Distance from start along optimal path.\n\t\tg_score, h_score, f_score = { }, { }, { }\n\t\tg_score[start] = 0\n\t\th_score[start] = dist start, goal, :manhattan\n\t\t# Estimated total distance from start to goal through y.\n\t\tf_score[start] = h_score[start]\n\n\t\t# Main loop\n\t\twhile not openset.empty?\n\t\t\t# Fetching the node among openset with the least f_score\n\t\t\tx, _value = [], 1_000_000\n\t\t\topenset.each do |key|\n\t\t\t\tx, _value = key, f_score[key] if f_score[key] < _value\n\t\t\tend\n\n\t\t\tbreak if x == goal # We reached target point and thus finished looking for it !!\n\n\t\t\t# Moving x from openset to closedset\n\t\t\topenset.delete x\n\t\t\tclosedset << x\n\n\t\t\t(-1..1).each do |i|\n\t\t\t\t(-1..1).each do |j|\n\t\t\t\t\ty = [x[0] + i, x[1] + j]\n\t\t\t\t\tunless i == 0 and y == 0\n\t\t\t\t\t\tif pitch[y].nil? # We only want to explore neighbours\n\t\t\t\t\t\t\tnext if closedset.include? y # If already in closedset, we skip it\n\n\t\t\t\t\t\t\tbetter = false\n\t\t\t\t\t\t\th = dist x, y, :manhattan\n\t\t\t\t\t\t\tg = g_score[x] + h\n\n\t\t\t\t\t\t\tif not openset.include? y then\n\t\t\t\t\t\t\t\treturn [] if frontier.include? y\n\t\t\t\t\t\t\t\tfrontier << y\n\t\t\t\t\t\t\t\topenset << y # Adding current neighbours to openset\n\t\t\t\t\t\t\t\tbetter = true\n\t\t\t\t\t\t\telsif g < g_score[y]\n\t\t\t\t\t\t\t\tbetter = true\n\t\t\t\t\t\t\telse\n\t\t\t\t\t\t\t\tbetter = false\n\t\t\t\t\t\t\tend\n\n\t\t\t\t\t\t\t# Updating what needs to be\n\t\t\t\t\t\t\tif better then\n\t\t\t\t\t\t\t\tcame_from[y] = x\n\t\t\t\t\t\t\t\tg_score[y] = g\n\t\t\t\t\t\t\t\th_score[y] = dist y, goal, :manhattan # heuristic estimate of distance (y, coords)\n\t\t\t\t\t\t\t\tf_score[y] = g_score[y] + h_score[y]\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\n\t\t# Finally assembling path and returning it\n\t\tpath = []\n\t\t_cur = goal\n\t\twhile _cur != start do\n\t\t\tpath << _cur\n\t\t\t_cur = came_from[_cur]\n\t\tend\n\n\t\treturn path.reverse\n\tend", "def start_point\n o = st_start_point\n [o.y, o.x]\n end", "def shortest_path(start, finish)\n queue << [start, 0]\n loop do\n break if queue.empty?\n vertex, d = queue.pop\n graph[*vertex] = d\n break if vertex == finish\n enqueue_neighbours(*vertex, d + 1)\n end\n queue.clear\n !blank?(finish) ? build_path(start, finish) : []\n end", "def startpoint=(startPoint)\n @elementHash[:startpoint] = startPoint\n end", "def dijkstra(start_vertex)\n # 1. Start empty result map and fringe with just the start\n # vertex. Yield initialization message.\n\n # 2. Each time, extract the minimum cost entry from the fringe. Add\n # it to the result. Yield extraction message.\n\n # 3. Process all outgoing edges from the vertex by using\n # add_vertex_edges.\n\n # 4. When done processing edges for the extracted entry, yield\n # competion message.\n\n # 5. When entirely all done, *return* (not yield) the result map.\nend", "def minimize\n # create a new one, or modify the current one in place,\n # and return it\n FiniteAutomaton.new \n end", "def initialize(repo,start,stepper)\n @repo=repo\n @stepper=stepper\n @start=start\n @visited=Set.new\n # a binding binding :start to each current value of start\n @solution=if @start.is_a? RDF::Query\n start.execute(@repo)\n elsif @start.is_a? Array\n start.map{|u|RDF::Solution.new(:end=>u)}\n elsif @start.is_a? RDF::URI\n [RDF::Query::Solution.new(:end=>@start)]\n else\n raise \"Should supply start as query or uriref or array of urirefs\"\n end\n end", "def minimize\n # Reverse this NFA, convert to DFA, then\n # reverse it, and convert it again. Apparently this\n # produces a minimal DFA.\n\n @start_state = @start_state.reverseNFA\n nfa_to_dfa_aux\n\n @start_state = @start_state.reverseNFA\n nfa_to_dfa_aux\n\n State.normalizeStates(@start_state)\n end", "def construct_solution\n path = [@root]\n tabu_list = [@root]\n until @ends.include?(last = path.last)\n step = next_step last, tabu_list\n path << step\n end\n path\n end", "def start_configuration=(steps)\n n = steps.length\n @start_configuration = Array.new(n) { Array.new(n, 0) }\n 0.upto(n - 1) do |i|\n vertex_i = @start_configuration[i]\n 0.upto(i) do |j|\n raise \"equals vertices #{j} and #{j+1} in simplex configuration\" if steps[j] == 0.0\n 0.upto(j) do |k|\n vertex_i[k] = steps[k]\n end\n end\n end\n end", "def spanning_forest(start, routine)\n predecessor = {}\n roots = []\n te = Proc.new { |e| predecessor[e.target] = e.source }\n rv = Proc.new { |v| roots << v }\n send routine, :start => start, :tree_edge => te, :root_vertex => rv\n [predecessor, roots]\n end", "def start_point\n raise Error::UnsupportedOperation, \"Method Curve#start_point not defined.\"\n end", "def start_at(x, y = nil)\n from.coord x, y\n end", "def initialize(start)\n\t\tif start.kind_of?(Integer)\n\t\t\t@start = start\n\t\t\t@current = start\n\t\t\t@seq = {}\n\t\t\t@count = 0\n\n\t\t\t# Force computation\n\t\t\tcompute\n\t\tend\n\tend", "def shortest_path\n initial_position_obj = { position: start_position, source: {} }\n\n knights_path = [initial_position_obj]\n\n while knights_path.present?\n current_position = knights_path.shift\n\n position = current_position[:position]\n\n if position == end_position\n return path_to_destination(current_position, initial_position_obj)\n end\n\n add_possible_destination(position, current_position, knights_path)\n end\n end", "def initialize(graph, start = graph.detect { |x| true })\n super(graph)\n @start_vertex = start\n set_to_begin\n end", "def dijkstras(start=@vertices.keys.sort[0],goal=nil)\n\t\t# Set of visited nodes\n\t\tvisited = []\n\n\t\t# Step 1 \n\t\t# - Start node weighs 0\n\t\t# - Set all other to infinity its done in constructor already\n\t\t@vertices[start] = 0\n\n\t\t# Step 2 \n\t\t# - Set initial node as current\n\t\t# - Mark all nodes unvisited except start node\n\t\tunvisited = @vertices.keys - [start]\n\t\tcurrent = start\n\n\t\twhile(!unvisited.empty?)\n\t\t\t# Step 3\n\t\t\t# - Consider all neighbors of current node\n\t\t\t# - Calculate distance cost: current path weight + edge weight\n\t\t\t# - Update distance if this distance is less than recorded distance\n\t\t\t\n\t\t\t@map[current].each do |neighbor|\n\t\t\t\tnext if visited.include?(neighbor.to)\n\t\t\t\tweight = @vertices[current] + neighbor.weight.to_i\n\t\t\t\tif weight < @vertices[neighbor.to]\n\t\t\t\t\t@vertices[neighbor.to] = weight\n\t\t\t\t\t@prev[neighbor.to] = current\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Step 4\n\t\t\t# - Add current node to visited\n\t\t\t# - Remove current node from unvisited\n\t\t\tvisited << current\n\t\t\tunvisited -= [current]\n\n\t\t\t# Find the smallest weighted node, could use a PQueue instead\n\t\t\tsmallest = @infinity\n\t\t\tcurrent = @infinity\n\t\t\tunvisited.each do |node|\n\t\t\t\tif @vertices[node] < smallest\n\t\t\t\t\tsmallest = @vertices[node]\n\t\t\t\t\t# Step 6\n\t\t\t\t\t# - Set smallest weighted node as current node, continue\n\t\t\t\t\tcurrent = node\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Step 5\n\t\t\t# - If goal is in visited, stop\n\t\t\t# - If full traversal without a goal? \n\t\t\t# \tCheck for infinity weighted node\n\t\t\tif visited.include? goal\t\t\n\t\t\t\tpath(goal)\n\t\t\t\treturn\n\t\t\tend\n\t\t\tbreak if current == @infinity\n\t\tend\n\t\t\n\t\t# Print all shortest paths\n\t\tputs \"Initial Node: #{start}\"\n\t\tvisited.each do |x|\n\t\t\tpath(x)\n\t\t\tputs\n\t\tend\n\tend", "def start_point; get(start_param) end", "def build_path(start, finish)\n path = [finish]\n loop do\n vertex = path.last\n d = graph[*vertex]\n neighbours = get_neighbours(*vertex)\n next_vertex = neighbours.select{|n_vert| graph[*n_vert] == d - 1}.first\n path << next_vertex if next_vertex\n break if vertex == start\n end\n path\n end", "def find_initial_task_basis_plan\n kill_one_artificial until status.got_task?\n BasisPlan.new optimal_plan_real_part, real_task_basis\n end", "def set_starting_position\n start_rows = find_possible_centers(@matrix.length)\n start_columns = find_possible_centers(@matrix[0].length)\n determine_center_position(start_rows, start_columns)\nend", "def initial_solution\n loop do\n # clear solution after each iteration\n @solution = []\n vertices = shuffle_and_slice_vertices\n generate_routes(vertices, @depot).each { |route| @solution << route }\n break if routes_are_correct?\n end\n end", "def dijkstras(start=@vertices.keys.sort[0],goal=nil)\n\t\t# Set of visited nodes\n\t\tvisited = []\n\n\t\t# Step 1 \n\t\t# - Start node weighs 0\n\t\t# - Set all other to infinity its done in constructor already\n\t\t@vertices[start] = 0\n\n\t\t# Step 2 \n\t\t# - Set initial node as current\n\t\t# - Mark all nodes unvisited except start node\n\t\tunvisited = @vertices.keys - [start]\n\t\tcurrent = start\n\n\t\twhile(!unvisited.empty?)\n\t\t\t# Step 3\n\t\t\t# - Consider all neighbors of current node\n\t\t\t# - Calculate distance cost: current path weight + edge weight\n\t\t\t# - Update distance if this distance is less than recorded distance\n\t\t\t\n\t\t\t@map[current].each do |neighbor|\n\t\t\t\tnext if visited.include?(neighbor.to)\n\t\t\t\tweight = @vertices[current] + neighbor.weight.to_i\n\t\t\t\tif weight < @vertices[neighbor.to]\n\t\t\t\t\t@vertices[neighbor.to] = weight\n\t\t\t\t\t@prev[neighbor.to] = current\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# Step 4\n\t\t\t# - Add current node to visited\n\t\t\t# - Remove current node from unvisited\n\t\t\tvisited << current\n\t\t\tunvisited -= [current]\n\n\t\t\t# Find the smallest weighted node\n\t\t\tcurrent = unvisited.collect { |node| [@vertices[node],node] }\n\t\t\tcurrent.empty? ? current = @infinity : current = current.min[1]\n\n\t\t\t# Step 5\n\t\t\t# - If goal is in visited, stop\n\t\t\t# - If full traversal without a goal? \n\t\t\t# \tCheck for infinity weighted node\n\t\t\tif visited.include? goal\t\t\n\t\t\t\tpath(goal)\n\t\t\t\treturn\n\t\t\tend\n\t\t\tbreak if current == @infinity\n\t\tend\n\t\t\n\t\t# Print all shortest paths\n\t\tputs \"Initial Node: #{start}\"\n\t\tvisited.each do |x|\n\t\t\tpath(x)\n\t\t\tputs\n\t\tend\n\tend", "def initialize(starting_x: 0, starting_y: 400)\n @starting_x = starting_x\n @starting_y = starting_y\n @flat_group = nil\n @sheet = WikiHouse.sheet.new\n Sk.find_or_create_layer(name: outside_edge_layer_name)\n Sk.find_or_create_layer(name: inside_edge_layer_name)\n @components_flattened = []\n end", "def start_solution plan\n solutions = []\n 15.times do\n s = mutate_pairs plan, valid_solution2(false)\n solutions << s\n end\n\n #0.times do\n # s = random_solution plan\n #end\n\n 10.times do\n s = structured_solution plan\n solutions << mutate_pairs(plan, s)\n end\n sort_soluitons plan, solutions\n end", "def set_start(v)\n add_state(v)\n @start = v\n end", "def set_start(v)\n add_state(v)\n @start = v\n end", "def build_paths(start)\n step = 0\n visited = []\n unvisited = [[board_node_by_location(start),step]]\n \n while !unvisited.empty?\n node = unvisited[0][0]\n step = unvisited[0][1] + 1\n \n node.neighbors.each do |x|\n if not_visited(board_node_by_location(x),visited, unvisited)\n unvisited << [board_node_by_location(x),step]\n end\n end\n visited << unvisited.shift\n end\n return visited\nend", "def initialize(states, start)\n @states = states\n @start = start\n end", "def start\n @min\n end", "def set_start(v)\nadd_state(v)\n@start = v\nend", "def initialize\n @start = nil\n end", "def setInitialCosts(nodes, start) \n costs = {}\n # set all costs to Infinity from the start node\n nodes.each do |node|\n costs[node] = {\n cost: Float::INFINITY,\n parent: start\n }\n end\n \n # set start node cost to 0 for itself\n costs[start] = {cost: 0}\n return costs\n end", "def starting(starts_at)\n merge(starts: starts_at)\n end", "def shortest_path_to_all_nodes(initial)\n initial.distance = 0\n\n current = initial\n loop do\n unvisited.delete(current)\n\n calculate_neighbor_shortest_distances(current)\n\n return graph.vertices if no_reachable_nodes\n\n current = unvisited.min_by(&:distance)\n end\n end", "def line_start(matrix_elements = [0])\n return self if self[matrix_elements[0]] == 0\n beginning = self.dup\n matrix_elements.each { |dimension| beginning[dimension] = 0 }\n beginning\n end", "def generate_follow_set_starting_from_index_on_production(head_of_production, production, variable, index)\n elements = production.clone\n index += 1\n if index >= elements.size\n if head_of_production != variable\n set = generate_follow_set head_of_production\n follow_set_add variable, set\n end\n return\n end\n element = elements[index]\n if terminal? element\n follow_set_add variable, element unless equal_epsilon element\n else\n loop do\n set = first(element)\n unless set.include? epsilon\n follow_set_add variable, set\n break\n end\n set = set.reject { |x| x == epsilon }\n follow_set_add variable, set\n index += 1\n if index >= elements.size\n if head_of_production != variable\n set = generate_follow_set head_of_production\n follow_set_add variable, set\n end\n break\n end\n element = elements[index]\n end\n end\n end", "def start(begin_offset = 0)\n super\n @on = resolve(@on)\n @origin = resolve(@origin)\n @base = @origin\n @end = resolve(@end)\n @delta = resolve(@end) - @origin + 1\n @end, @origin = @origin, @end if @end < @origin\n @factor = resolve(@factor)\n end", "def minimize\n# create a new one, or modify the current one in place,\n# and return it\nfa = FiniteAutomaton.new\nkeys = @state.keys.sort\np0, p1 = [], []\nkeys.each{|k|\nif is_final?(k)\np0 = p0.push(k)\nelsif\np1 = p1.push(k)\nend\n}\nnewfa = {}\nrstate = []\nif p0 != nil then rstate.push(p0) end\nif p1 != nil then rstate.push(p1) end\npstate = []\nwhile pstate != rstate\npstate = []\nrstate.each{|r| pstate.push(r)}\nrstate = []\npstate.each{|p|\np = p.sort\nresult = split(p, pstate)\np0 = result[0]\np1 = result[1]\nresult.each{|r|\nif r != []\nr = r.sort\nrstate = rstate.push(r)\nend\n}\n}\nend\nstart = []\nfinal = []\nrstate.each{|r| newfa[r] = fa.new_state}\nlist = newfa.keys\nlist.each{|l|\nl.each{|k|\nif k == @start\nstart.push(l)\nend\nif is_final?(k)\nfinal.push(l)\nend\n}\n}\nif start != []\nstart.each{|s| if newfa[s] then fa.set_start(newfa[s]) end}\nend\nif final != []\nfinal.each{|f| fa.set_final(newfa[f], true)}\nend\nrstate.each{|r0|\nr0.each{|r1|\n@alphabet.each{|a|\nif get_transition(r1, a) != nil\nrstate.each{|r|\nif r.include?(get_transition(r1, a)[0])\nif !(fa.get_transition(newfa[r0], a))\nfa.add_transition(newfa[r0], newfa[r], a)\nif fa.get_alpha.include?(a) == false\nfa.get_alpha.push(a)\nend\nend\nend\n}\nend\n}\n}\n}\nfa\nend", "def minimize; end", "def ins_start(value)\n if @head != nil && @head.node_sig != nil\n n = @head\n @head = Node.new(value, n, nil)\n n.edi_ant(@head)\n elsif @head != nil\n n = @head\n @head = Node.new(value, n, nil)\n n.edi_ant(@head)\n @tail = n\n else\n @head = Node.new(value, nil, nil)\n @tail = @head\n end\n end", "def start\n @start ||= operands.detect {|op| op.is_a?(Start)}\n end", "def min(expression)\n @objective = Objective.new(:minimize, expression)\n end", "def start(start_key)\n self.class.new(collection, range.merge({begin: start_key, begin_inclusive: true}))\n end", "def getStartPoint()\n geoObject().firstPoint() ;\n end", "def get_moves(start)\n x = start.x\n y = start.y\n moves = []\n moves << Node.new(x+2, y+1)\n moves << Node.new(x+2, y-1)\n moves << Node.new(x+1, y+2)\n moves << Node.new(x+1, y-2)\n moves << Node.new(x-1, y+2)\n moves << Node.new(x-1, y-2)\n moves << Node.new(x-2, y+1)\n moves << Node.new(x-2, y-1)\n moves = moves.reject do |node|\n node.x < 0 || node.x > 8\n end\n moves = moves.reject do |node|\n node.y < 0 || node.y > 8\n end\n moves.each { |move| move.next_node = start }\nend", "def build_start_end_for(aNonTerminal)\n return if start_vertex_for.include?(aNonTerminal)\n\n new_start_vertex = StartVertex.new(aNonTerminal)\n start_vertex_for[aNonTerminal] = new_start_vertex\n add_vertex(new_start_vertex)\n\n new_end_vertex = EndVertex.new(aNonTerminal)\n end_vertex_for[aNonTerminal] = new_end_vertex\n add_vertex(new_end_vertex)\n end", "def get_start(processed_maze)\n # start_horizontal; start_vertical = nil\n processed_maze.each_with_index do |row, vertical_index|\n row.each_with_index do |item, horizontal_index|\n if item == 'o'\n @start_vertical = vertical_index\n @start_horizontal = horizontal_index\n end\n end\n end\n end", "def solve\r\n matrix = @maze\r\n finished = false\r\n\r\n start = Discovered.new(@starting_point[:x],@starting_point[:y],nil)\r\n frontier = []\r\n visited = []\r\n frontier << start\r\n\r\n while !frontier.empty? && !finished\r\n \r\n current_node = frontier.shift # take first item from queue\r\n if visited.include? [current_node.x,current_node.y]\r\n next\r\n else\r\n visited << [current_node.x,current_node.y]\r\n x = current_node.x\r\n y = current_node.y\r\n if (matrix[y][x] == 'G')\r\n finished = true\r\n else\r\n frontier << look_for_valid_moves(x,y,matrix,current_node,visited)\r\n frontier.flatten!\r\n end\r\n end\r\n end\r\n\r\n if finished\r\n @labyrinth.maze[:graphic_matrix][current_node.y][current_node.x] = 'X'\r\n while !current_node.parent.nil?\r\n current_node = current_node.parent\r\n @labyrinth.maze[:graphic_matrix][current_node.y][current_node.x] = @labyrinth.maze[:graphic_matrix][current_node.y][current_node.x] == 'S' ? 'S' : '.'\r\n end\r\n puts \"Maze solved:\\n\"\r\n @labyrinth.to_screen\r\n else\r\n print \"Goal was not found... :(\"\r\n end\r\n end", "def minimize\n # create a new one, or modify the current one in place,\n # and return it\n DFA.new \n end", "def set_starting_point(_x, _y)\n @starting_point = take_input[2, 2]\n @starting_point.join(',')\n end", "def search(start, goal)\n openset = Set.new\n closedset = Set.new\n current = start\n\n if @maximize_cost # serves to invert the comparison\n openset_min_max = openset.method(:max_by)\n flip = -1\n else\n openset_min_max = openset.method(:min_by)\n flip = 1\n end\n\n openset.add(current)\n while not openset.empty?\n current = openset_min_max.call{|o| o.g + o.h }\n if current == goal\n path = []\n while current.parent\n path << current\n current = current.parent\n end\n path << current\n return path.reverse\n end\n openset.delete(current)\n closedset.add(current)\n @graph[current].each do |node|\n next if closedset.include? node\n\n if openset.include? node\n new_g = current.g + current.move_cost(node)\n if (node.g - new_g) * flip > 0\n node.g = new_g\n node.parent = current\n end\n else\n node.g = current.g + current.move_cost(node)\n node.h = heuristic(node, start, goal)\n node.parent = current\n openset.add(node)\n end\n end\n end\n return nil\n end", "def a_star(start,goal)\n\t\treturn false # TODO make this actually work\n\t\t###########################################\n\t\tchecked = []\n\t\toptions = [start]\n\t\tpath = []\n\t\tg_score = Array.new($dimensions[:y], Array.new($dimensions[:x], Infinity))\n\t\th_score = Array.new($dimensions[:y], Array.new($dimensions[:x], Infinity))\n\t\tf_score = Array.new($dimensions[:y], Array.new($dimensions[:x], Infinity))\n\t\tg_score[start[:y]][start[:x]] = 0\n\t\th_score[start[:y]][start[:x]] = distance(start, goal, :diagonal)\n\t\tf_score[start[:y]][start[:x]] = h_score[start[:y]][start[:x]]\n\t\tuntil options.empty?\n\t\t\toption_scores = options.map{|o| f_score[o[:y]][o[:x]]}\n\t\t\tcurr = options.delete_at option_scores.index(option_scores.min)\n\t\t\tputs curr\n\t\t\treturn false if curr == goal\n\t\t\tchecked << curr\n\t\t\tcollect_adjacent_points(curr).each do |neighbor|\n\t\t\t\tnext if checked.include? neighbor\n\t\t\t\ttentative_g_score = g_score[curr[:y]][curr[:x]] + 1 # 1 == dist_between(curr,neighbor)\n\t\t\t\tif !options.include? neighbor\n\t\t\t\t\toptions << neighbor\n\t\t\t\t\ttentative_is_better = true\n\t\t\t\telsif tentative_g_score < g_score[neighbor[:y]][neighbor[:x]]\n\t\t\t\t\ttentative_is_better = true\n\t\t\t\telse\n\t\t\t\t\ttentative_is_better = false\n\t\t\t\tend\n\t\t\t\tif tentative_is_better\n\t\t\t\t\tg_score[neighbor[:y]][neighbor[:x]] = tentative_g_score\n\t\t\t\t\th_score[neighbor[:y]][neighbor[:x]] = distance(neighbor, goal)\n\t\t\t\t\tf_score[neighbor[:y]][neighbor[:x]] = g_score[neighbor[:y]][neighbor[:x]] + h_score[neighbor[:y]][neighbor[:x]]\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\ttrue\n\tend", "def min_cost_climbing_stairs(cost)\n [step(cost, 0), step(cost, 1)].min\nend", "def assign_start_list\n @start_list = nil\n end", "def shortest_paths(source)\n init(source)\n relax_edges\n PathBuilder.new(source, @visitor.parents_map).paths(@graph.vertices)\n end", "def build_path(start, end_pos)\n node = Node.new(start[0], start[1])\n target = Node.new(end_pos[0], end_pos[1])\n visited_nodes = []\n next_moves = [node]\n until next_moves.empty? do\n node = next_moves.shift\n puts \"Current node: #{node.x}, #{node.y}\"\n if node.x == target.x && node.y == target.y \n return node\n end\n visited_nodes.push(node)\n node.moves = get_moves(node)\n node.moves.reject do |square|\n visited_nodes.include?(square)\n end\n node.moves.each do |move| \n next_moves.push(move)\n end\n end\n return node\nend", "def indgen!(start = 0.0)\n RAtlas::indgen!(@storage, start)\n return self\n end", "def fill_first_task\n first_basis = @first_basis || basis_for_initial_task\n return unless first_basis # no initial basis for current task\n dual_task = Tasks::RestrictedDualSimplex.new_without_plan(\n task.task,\n first_basis,\n task.sign_restrictions\n )\n tasks_list << dual_task # add current task to queue\n end", "def initialize start_vector, goal_vector, options = {}\n @debug_level = options[:debug_level] || 1\n @epsilon = options[:epsilon] || 0.01\n @max_iterations = options[:max_iterations] || 1000\n @banned_points = options[:banned_points] || {}\n @start_vector = start_vector\n @goal_vector = goal_vector\n end", "def initialize(start_point, end_point)\n @starting_point = start_point\n @ending_point = end_point\n end", "def dijkstra(start_vertex)\n # 1. Start empty result map and fringe with just the start\n # vertex. Yield initialization message.\n map = ResultMap.new\n start_entry = ResultEntry.new(start_vertex, nil, 0)\n fringe = Fringe.new.add_entry(start_entry)[:fringe]\n Fiber.yield(InitializationMessage.new(map, fringe))\n # 2. Each time, extract the minimum cost entry from the fringe. Add\n # it to the result. Yield extraction message.\n until fringe.empty?\n extract_result = fringe.extract\n min_cost_entry = extract_result[:best_entry]\n fringe = extract_result[:fringe]\n map = map.add_entry(min_cost_entry)\n Fiber.yield(ExtractionMessage.new(map, fringe, min_cost_entry))\n # 3. Process all outgoing edges from the vertex by using\n # add_vertex_edges.\n fringe = add_vertex_edges(map, fringe, min_cost_entry)\n # 4. When done processing edges for the extracted entry, yield\n # competion message.\n Fiber.yield(UpdateCompletionMessage.new(map, fringe, min_cost_entry))\n # 5. When entirely all done, *return* (not yield) the result map.\n end\n\n return map\nend", "def start=(value)\n\t\t\t@start = value\n\t\tend", "def start(question)\n puts \"==== QUESTION ====\"\n print getQuestion(question), \"\\n\"\n puts \"==== RESULTS ====\"\n result = initVectorial\n # showResult(result)\n resultsToXML(result)\n return result\n end", "def start(begin_offset = 0)\n super\n @on = resolve(@on)\n @origin_x = resolve(@origin_x)\n @origin_y = resolve(@origin_y)\n @delta_x = resolve(@end_x) - @origin_x\n @delta_y = resolve(@end_y) - @origin_y\n end", "def start(begin_offset = 0)\n super\n @on = resolve(@on)\n @origin_x = resolve(@origin_x)\n @origin_y = resolve(@origin_y)\n @delta_x = resolve(@end_x) - @origin_x\n @delta_y = resolve(@end_y) - @origin_y\n end", "def pouring_problem(capX, capY, goal, start_x=0, start_y=0)\n\tstart_state = [start_x, start_y]\n\tif start_state.include? goal\n\t\treturn start_state\n\tend\n\n\texplored = Set.new\n\tfrontier = Array.new\n\n\tfrontier << [['Start', start_state]]\n\texplored.add start_state\n\n\tuntil frontier.empty?\n\t\tpath = frontier.shift\n\t\tcurr_state = path.last.last\t\n\n\t\tx = curr_state[0]\n\t\ty = curr_state[1]\n\n\t\tsuccessors(x, capX, y, capY).each do |state, action|\n\t\t\tunless explored.include? state\n\t\t\t\texplored.add state\n\t\t\t\tnew_path = path.dup << [action, state]\n\t\t\t\tif state.include? goal\n\t\t\t\t\treturn new_path\n\t\t\t\telse\n\t\t\t\t\tfrontier << new_path\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend\nend", "def compute(source, num_nodes)\n x = [source]\n source.length = 0\n until x.length == num_nodes\n min_edge = nil\n min_distance = Float::INFINITY\n x.each do |xnode|\n xnode.outgoing_edges.each do |xedge|\n next if xedge.visited?\n curr_distance = xnode.length + xedge.distance\n if curr_distance <= min_distance\n min_distance = curr_distance\n min_edge = xedge\n end\n end\n end\n min_edge.head.length = min_distance\n x << min_edge.head\n end\n x\nend", "def initSingleSource(graph, source)\n\t\n\tfor i in 0..(graph.size - 1)\n\t\tgraph.changeDistance(i, Float::INFINITY)\n\t\tgraph.changePredecessor(i, nil)\n\tend\n\t\n\tgraph.initSource(source)#initializes the source node\nend", "def dijkstra(priorityArray, graph, startingNode)\n\tinitSingleSource(graph, startingNode)\n\tset = NodeSet.new\n\tqueue = PriorityQueue.new(graph.giveGraph, priorityArray)\n\t\n\twhile !queue.empty? do\n\t\tu = queue.extractMin[0]\n\t\tset.merge(u)\n\t\tgraph.adjacent(u).each {|adj| relax(u, graph.getNode(adj.first), adj.last)}\n\tend\n\nend", "def compute_shortest_path\n update_distance_of_all_edges_to(Float::INFINITY)\n @distance_to[@source_node] = 0\n\n # The prioriy queue holds a node and its distance from the source node.\n @pq.insert(@source_node, 0)\n while @pq.any?\n node = @pq.remove_min\n node.adjacent_edges.each do |adj_edge|\n relax(adj_edge)\n end\n end\n end", "def shortest_circuit()\n shortest_cir = Array.new\n shortest_weight = 99999\n\n vert = vertex_list()\n start_point = vert[0]\n vert.delete_at(0)\n\n vert_perm = vert.permutation.to_a()\n\n vert_perm.each{ |x|\n x.insert(0,start_point)\n x.insert(x.length,start_point)\n weight = path_weight(x)\n \n if weight == nil\n weight = 99999\n end\n\n if weight < shortest_weight\n shortest_weight = path_weight(x)\n shortest_cir = x\n end\n }\n return \"Shortest Circuit = \",shortest_cir.inspect, \"\\nWeight = \", shortest_weight\n\n end", "def reset_start!\n @start = nil\n end", "def prepare_supertriangle!\n # This is a triangle which encompasses all the sample points.\n st_matrix = @matrix.boundaries\n\n # The supertriangle coordinates are added to the end of the\n # vertex list.\n st_matrix.each { |bpt| @matrix << bpt }\n\n # The supertriangle is the first triangle in the triangle list.\n @triangles << TriangleCandidate.new(@numpoints, @numpoints + 1, @numpoints + 2)\n end", "def generate_first_set_based_on_production(production, variable)\n elements = production.clone\n element = elements.shift\n return if element == variable\n if terminal? element\n first_set_add variable, element\n else\n loop do\n set = generate_first_set element\n if elements.empty?\n first_set_add variable, set\n break\n end\n if set.include? epsilon\n set = set.reject { |x| x == epsilon }\n first_set_add variable, set\n element = elements.shift\n else\n first_set_add variable, set\n break\n end\n end\n end\n end", "def start\n j_instance.getStart\n end", "def min_cost(stairs)\n min_step_cost = [stairs[0], stairs[1]]\n idx = 2\n while idx < stairs.length\n min_step_cost[idx] = stairs[idx] + [min_step_cost[idx - 1], min_step_cost[idx - 2]].min\n idx += 1\n end\n p min_step_cost\n [min_step_cost[-2], min_step_cost[-1]].min\nend", "def boardSolver1st()\n @used[@index_start1][@index_start2] = 1 \n prefix = @board[@index_start1][@index_start2]\n boardSolver2(@index_start1,@index_start2,prefix)\n move()\n end", "def build_start_parse ctxt= ParseContext.new\n base_production = symbol(start_symbol_name)\n # we set the root parse child in a hook so that we can\n # inspect it as soon as possible, before the node builds its children\n parse = base_production.build_parse(ctxt, RootParse) do |p|\n p.after_gets_parse_id do |pp|\n RootParse.only_child = pp\n end\n end\n parse\n end", "def lex_start line\n starts << line.strip\n end", "def test_unbounded\n simplex = Simplex.new(\n [1, 1, 1],\n [\n [3, 1, -2],\n [4, 3, 0]\n ],\n [5, 7]\n )\n assert_raises Simplex::UnboundedProblem do\n simplex.solution\n end\n end", "def starting_position\n if n.even?\n Position.new(0,0)\n else\n Position.new(square_root - 1, square_root - 1)\n end\n end", "def starting; end", "def _get_square_starting_points()\n square_starting_points = []\n row_index = 0\n column_index = 0\n 3.times do\n 3.times do\n square_starting_points << [row_index, column_index]\n column_index += 3\n end\n row_index += 3\n column_index = 0\n end\n square_starting_points\n end", "def build_move_tree #=> build the tree\n self.root_node = PolyTreeNode.new(start_pos) #=> root_node set to the start pos\n\n # build the tree out in breadth-first fashion\n nodes = [root_node]\n until nodes.empty?\n current_node = nodes.shift\n\n current_pos = current_node.value\n new_move_positions(current_pos).each do |next_pos|\n next_node = PolyTreeNode.new(next_pos)\n current_node.add_child(next_node)\n nodes << next_node\n end\n end\n end", "def shortest_length(start, finish)\n infinity = (2**(0.size * 8 - 2) - 1) # max Fixnum integer value\n distances = {} # smallest distance from starting vertex to this one\n previous = {}\n cyclic = start == finish # true if starting vertex = ending vertex\n loops = 0 # useful for cyclic path\n vertex_pq = PriorityQueue.new\n\n adj_lists.each do |vertex|\n vname = vertex.name\n if vname == start\n distances[vname] = 0\n vertex_pq.enq(vname, 0)\n else\n distances[vname] = infinity\n vertex_pq.enq(vname, infinity)\n end\n previous[vname] = nil\n end\n\n while vertex_pq\n loops += 1\n # if cyclic, pretend starting vertex is unvisited. put it back in queue.\n if cyclic && loops == 2\n vertex_pq.enq(start, infinity)\n distances[start] = infinity\n end\n # vertex currently being checked. picks closest one first.\n current = vertex_pq.deq\n vname = current.keys.first\n\n # if we've arrived at final vertex, return shortest distance\n # if cyclic, skip this code during first loop\n if vname == finish && loops > 1\n shortest_path = []\n vname2 = vname\n while previous[vname2]\n shortest_path << vname2\n vname2 = previous[vname2]\n previous[start] = nil if cyclic # pretend starting vertex is unvisited\n end\n shortest_path = [start] + shortest_path.reverse\n print \"Shortest path: #{shortest_path}, Length = #{path_length(shortest_path)}\\n\"\n return distances[finish]\n end\n\n # leave if we never get to final vertex\n break if vname == nil || distances[vname] == infinity\n\n adj_vertices(vname, adj_lists).each do |vertex|\n alt_distance = distances[vname] + dist(vname, vertex)\n # if total distance to neighbor < last minimum total distance\n # to neighbor, replace it with this new distance\n if alt_distance < distances[vertex]\n distances[vertex] = alt_distance\n previous[vertex] = vname\n vertex_pq.enq(vertex, alt_distance)\n end\n end\n end\n\n end", "def start\n raise RuntimeError if @start\n @start = Time.now if !@start\n self\n end", "def new_start(arg0, arg1, *rest)\n end", "def build_move_tree\n self.root_node = PolyTreeNode.new(@start_pos)\n\n nodes = [root_node]\n until nodes.empty?\n current_node = nodes.shift\n current_pos = current_node.value\n\n new_move_positions(current_pos).each do |pos|\n next_node = PolyTreeNode.new(pos)\n current_node.add_child(next_node)\n nodes << next_node\n end\n end\n end", "def start=(_arg0); end", "def selected_first_edges\n @next_summit = @edges_distances.select{ |edges| edges.include?(@first_position.select{ |distance| distance > 0}.min)if edges != @first_position }\n end", "def get_path(start, finish) \n @retreat_algorithm.set_graph(memory.construct_grid) \n @retreat_algorithm.run(start, finish)\n end", "def findPath(startPoint, endPoint)\n # Initialize node array\n # This array will host all the map points we are going to visit\n # On each visit the point will be removed and marked as visited\n q = []\n # This is tie visited array that keeps the visit index\n @visited = Array.new(@width * @height, 0)\n \n # Add first point to visited\n @visited[self.getXYIndex(startPoint)] = 1\n \n # Add current point (the start point) to the search pool\n currentPoint = XYLoc.new(startPoint.x, startPoint.y)\n q.push(currentPoint)\n\n # Search until all points are searched\n while (q.count() > 0)\n # Get first item (and remove from the pool)\n pnext = q.shift\n \n # Get neighbors/children\n succList = self.getNeighbors(pnext)\n for succ in succList\n # Check if point already visited\n if (@visited[self.getXYIndex(succ)] >= 1)\n next\n end\n # Set visited index as the current visited index + 1\n @visited[self.getXYIndex(succ)] = @visited[self.getXYIndex(pnext)] + 1\n \n # Check if the end point is found\n if (succ.x == endPoint.x && succ.y == endPoint.y)\n # Extract path\n return self.extractPath(endPoint)\n end\n \n # Point is not the goal point.\n # Push the point into the search pool.\n q.push(succ)\n end\n end\n \n # The search pool is empty and the goal point hasn't\n # been reached. Return empty path.\n return []\n end", "def start(begin_offset = 0)\n super\n @on = resolve(@on)\n @origin = resolve(@origin)\n @delta = resolve(@end) - @origin\n end" ]
[ "0.6069061", "0.5490917", "0.54820216", "0.53754777", "0.53543246", "0.5308169", "0.5261818", "0.5249094", "0.5223264", "0.51858115", "0.5159656", "0.51582664", "0.50935674", "0.50349516", "0.503476", "0.5029023", "0.49839765", "0.49836835", "0.49726254", "0.495024", "0.49359512", "0.48963496", "0.48802212", "0.4828466", "0.48237643", "0.48234808", "0.479703", "0.47799435", "0.47788575", "0.477301", "0.4764779", "0.47620338", "0.47620338", "0.47472918", "0.47464675", "0.4744817", "0.47446257", "0.47425503", "0.47239196", "0.4719942", "0.47191104", "0.47051707", "0.4705074", "0.47013432", "0.46962407", "0.468677", "0.4666427", "0.46507406", "0.46455723", "0.46450344", "0.46438068", "0.46339375", "0.46272346", "0.46101722", "0.4607215", "0.46066386", "0.46014237", "0.45956975", "0.45829818", "0.45777088", "0.45525286", "0.4547245", "0.4534861", "0.45328063", "0.452874", "0.45092443", "0.4508886", "0.45059666", "0.45054445", "0.4504065", "0.44799364", "0.44799364", "0.44757816", "0.4472277", "0.44718376", "0.44703746", "0.44686565", "0.44651365", "0.44632193", "0.4452298", "0.44512472", "0.44501722", "0.44407326", "0.44311854", "0.44282207", "0.44240466", "0.44163874", "0.44156346", "0.4408717", "0.44066852", "0.44048423", "0.43990767", "0.4392415", "0.4388022", "0.43826813", "0.43782777", "0.4374119", "0.43705633", "0.43659455", "0.43519884" ]
0.8126109
0
Evaluate all the nonevaluated points of the simplex
def evaluate_simplex # evaluate the objective function at all non-evaluated simplex points 0.upto(@simplex.length - 1) do |i| vertex = @simplex[i] point = vertex.point if vertex.value.nan? @simplex[i] = PointValuePair.new(point, f(point)) end end # sort the simplex from best to worst @simplex.sort!{ |x1, x2| x1.value <=> x2.value } end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def evaluate\n SQ.inject { |x, n| x + (@colors[n] == @mx ? (PST[n] + VALUE[@pieces[n]]) :\n @colors[n] == @mn ? -(PST[n] + VALUE[@pieces[n]]) : 0) }\n end", "def solve!\n while empty_squares.any?\n square = empty_squares.detect { |square| legal_values_for_square(square).size == 1 }\n square.value = legal_values_for_square(square).first\n end\n end", "def possible_points\n (self.evals.reduce(0) {|sum, eval| sum += eval.max_score.to_i; sum})\n end", "def full_evaluation \n @direction_sum = {true => 0, false => 0} # sum of value contributions for each direction (artery)\n @coordinations.each do |coord| \n value = eval_coord(coord)\n @coord_contribution[coord] = value\n @direction_sum[coord.left_to_right] += value \n end\n \n store_current_value\n end", "def accumulate_points(points)\n points.map{|point| point.value}.reduce(0, :+)\n end", "def eqs_for_free_points(p)\n return [] if p.free?\n q, r = first_point, second_point\n eqs = []\n uv = [:x,:y,:z] # uv stands for unused vars\n %w{x y z}.map(&:to_sym).each do |v|\n if 0 == (q.send(v).to_f - r.send(v).to_f)\n eqs << p.send(v.to_s+\"_to\", q) # <-- A bit different equation\n uv.delete(v)\n end\n end\n if uv.size == 3\n eq_for_non_free_points(p) # The equations are the same as the\n # non-free-points options\n elsif uv.size == 2\n eqs << eq_for_coordinates(p, *uv)\n end\n eqs\n end", "def evaluate!(input_set)\n # FEED FORWARD\n # 1. Apply input vectors to input neurons\n input.each.with_index do |neuron, j|\n neuron.net_input = input_set[j]\n end\n\n # 2, 3, 4. Calculate the net input values to the hidden neurons\n # Calculate the outputs from the hidden layer neurons\n # Calculate the net input values for the output layer\n (hidden + [output]).each do |layer|\n layer.each do |neuron|\n sum = neuron.predecessors.inject(0) do |acc, pred|\n acc + pred.output * neuron.edge(pred)\n end\n neuron.net_input = neuron.bias_weight + sum\n end\n end\n\n # 5. Calculate the output values for the output layer\n output.map(&:output)\n end", "def negation_solution(x, y)\n negation_value(coords_of_square_neighbors(x, y), x, y) ||\n negation_value(coords_of_row_neighbors(x, y), x, y) ||\n negation_value(coords_of_column_neighbors(x, y), x, y)\n end", "def x!() @x.value end", "def square! #of each element inside of the array if true\r\n self.map!{|x| x**2} #2. it will return [] blank array if false, not a zero.\r\n end", "def isAllWhite \n for x in 0..3\n for y in 0..3\n v = self.val(x,y) ;\n if(v == 1) \n return false ;\n end\n end\n end\n return true ;\n end", "def test_unbounded\n simplex = Simplex.new(\n [1, 1, 1],\n [\n [3, 1, -2],\n [4, 3, 0]\n ],\n [5, 7]\n )\n assert_raises Simplex::UnboundedProblem do\n simplex.solution\n end\n end", "def unassigned_evaluate_proposals\n self.evaluate_proposal.unassigned # use a StonePath provided named scopes\n end", "def sor(n, a, b, x0, w, error, n_max)\n n = n - 1\n\n x = Array.new(n + 1)\n for k in (0..n_max)\n sumatoria = (1..n).inject(0) { |sum, j| sum + a[0][j] * x0[j] }\n x[0] = (1 - w) * x0[0] + w * (b[0] - sumatoria).fdiv(a[0][0])\n\n (1..n - 1).each do |i|\n sumatoria_1 = (0..i - 1).inject(0) { |sum, j| sum + a[i][j] * x[j] }\n sumatoria_2 = (i + 1..n).inject(0) { |sum, j| sum + a[i][j] * x0[j] }\n x[i] = (1 - w) * x0[i] + w * (b[i] - sumatoria_1 - sumatoria_2).fdiv(a[i][i])\n end\n\n sumatoria = (0..n - 1).inject(0) { |sum, j| sum + a[n][j] * x[j] }\n x[n] = (1 - w) * x0[n] + w * (b[n] - sumatoria).fdiv(a[n][n])\n\n resta = x.map.with_index { |xi, i| xi - x0[i] }\n modulo = Math::sqrt(resta.inject(0) { |sum, i| sum + i ** 2 })\n if modulo < error\n puts \"Una solucion aproximada es X = #{x}.\"\n return x\n end\n\n x0.replace(x)\n end\n\n puts \"Se alcanzo el numero maximo de iteraciones n_max pero no la tolerancia.\"\nend", "def empty_neighbours point\n neighbours(point).select do |(x, y)|\n at(x, y) < 0\n end\n end", "def compute_values \n arr = inputs_matrix.map{|e| @evaluator.call(*e)}\n matrix = NArray[arr].reshape(@width, @height)\n end", "def unionXWithFunction_PiecewiseLinear(iOtherFunction)\n lPoints = @Function[:Points]\n lOtherPoints = iOtherFunction.function_data[:Points]\n # Get all the abscisses sorted\n lXList = (lPoints.map { |iPoint| next iPoint[0] } + lOtherPoints.map { |iPoint| next iPoint[0] }).sort.uniq\n # Read segments abscisse by abscisse\n lIdxSegment = 0\n lIdxOtherSegment = 0\n lXList.each do |iX|\n if (lPoints[lIdxSegment] == nil)\n # No abscisse on lPoints for this iX\n # Forcefully we have lOtherPoints[lIdxOtherSegment][0] == iX\n yield(iX, nil, lOtherPoints[lIdxOtherSegment][1])\n lIdxOtherSegment += 1\n elsif (lOtherPoints[lIdxOtherSegment] == nil)\n # No abscisse on lOtherPoints for this iX\n # Forcefully we have lPoints[lIdxSegment][0] == iX\n yield(iX, lPoints[lIdxSegment][1], nil)\n lIdxSegment += 1\n elsif (lPoints[lIdxSegment][0] == iX)\n # lPoints has this abscisse\n if (lOtherPoints[lIdxOtherSegment][0] == iX)\n # If both functions have a point here, it's easy.\n yield(iX, lPoints[lIdxSegment][1], lOtherPoints[lIdxOtherSegment][1])\n lIdxOtherSegment += 1\n else\n # Compute the Y value for the other function\n yield(iX, lPoints[lIdxSegment][1], lOtherPoints[lIdxOtherSegment-1][1] + ((lOtherPoints[lIdxOtherSegment][1] - lOtherPoints[lIdxOtherSegment-1][1])*(iX - lOtherPoints[lIdxOtherSegment-1][0]))/(lOtherPoints[lIdxOtherSegment][0] - lOtherPoints[lIdxOtherSegment-1][0]))\n end\n lIdxSegment += 1\n else\n # We have forcefully lOtherPoints[lIdxOtherSegment][0] == iX\n # Compute the Y value for this function\n yield(iX, lPoints[lIdxSegment-1][1] + ((lPoints[lIdxSegment][1] - lPoints[lIdxSegment-1][1])*(iX - lPoints[lIdxSegment-1][0]))/(lPoints[lIdxSegment][0] - lPoints[lIdxSegment-1][0]), lOtherPoints[lIdxOtherSegment][1])\n lIdxOtherSegment += 1\n end\n end\n end", "def evaluate\n\n end", "def fcn(flag,pars,derivs)\n chi2 = 0.0;\n @data_pts.each{|pt| \n val = @min_block.call(pt.vars,pars)\n chi2 += ((pt.value - val)/pt.error)**2\n } \n return chi2\n end", "def polynomialize_features(features)\n features.collect do |feature|\n (1..@polynomial_degree).collect do |n|\n feature.map{ |f| f**n }\n end.flatten\n end\n end", "def _reduce_693(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def evaluate_expression vector\n\t\t\t\traise NotImplementedError\n\t\t\tend", "def evaluate(x)\n eval_sum = Rallot::Integer(0, @sub_prime)\n\n @coefficients.each_with_index do |coeff, index|\n eval_sum = eval_sum + coeff * (x ** index)\n end\n\n return eval_sum\n end", "def _reduce_699(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def initial_simplex(x1=ParameterSet.new(-4.0,-4.0),c=8)\n p= c/Math.sqrt(2) * (Math.sqrt(3)-1)/2\n q= ParameterSet.new(p,p)\n x2 = x1 + q + ParameterSet.new(1.0,0.0) * (c/Math.sqrt(2))\n x3 = x1 + q + ParameterSet.new(0.0,1.0) * (c/Math.sqrt(2))\n @simplex = [x1,x2,x3]\n end", "def unclustered_points\n points.select {|point| not point.clustered? }\n end", "def _reduce_724(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def evaluate_policy_exact\n if @policy_A\n # update only those rows for which the policy has changed\n @policy_A_action.zip(@array_policy)\n .each_with_index do |(old_action_n, new_action_n), state_n|\n next if old_action_n == new_action_n\n update_policy_Ab state_n, new_action_n\n end\n else\n # initialise the A and the b for Ax = b\n num_states = model.num_states\n @policy_A = NMatrix.float(num_states, num_states)\n @policy_A_action = [-1] * num_states\n @policy_b = NVector.float(num_states)\n\n @array_policy.each_with_index do |action_n, state_n|\n update_policy_Ab state_n, action_n\n end\n end\n\n value = @policy_b / @policy_A # solve linear system\n @array_value = value.to_a\n nil\n end", "def evaluate\n @output_value = Math.tanh(@input_value - @bias)\n #p \"output value #{@output_value}\"\n @forward_nodes.each do |node, weight|\n #p \"weight #{weight} old input #{node.input_value}\"\n node.input_value += @output_value * weight\n #p \"new input #{node.input_value}\"\n end\n @input_value = 0\n end", "def _reduce_699(val, _values, result)\n result = [:dot, val[0][1]]\n\n result\nend", "def eval\n constraint_list.each do |con|\n set_viols(con, con.eval_candidate(self))\n end\n self\n end", "def value_anneal\n value_anneal_iteration(@iteration)\n end", "def _reduce_585(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def y!() @y.value end", "def calculate_sum_of_sqd_distances\n copy_truth_points = @truth_points.map{|p| p} #deep copy\n ssds = 0\n @user_points.each do |up|\n break if copy_truth_points.empty? #we've gone through all the points\n min_distance_sqd_and_its_point = min_distance_away(copy_truth_points, up)\n next if min_distance_sqd_and_its_point.first > MaxDistanceToBeCounted ** 2\n ssds += min_distance_sqd_and_its_point.first\n copy_truth_points.delete(min_distance_sqd_and_its_point.last) #kill point in truth points array\n end\n ssds\n end", "def evaluate_pn(list)\n\n while item = list.pop\n\n case item.name\n when \"numeric\" then @stack.push(item.to_f)\n when \"variable\" then @stack.push(item.value)\n when \"constant\" then @stack.push(constant(item.value))\n when \"value\" then do_value(item.value)\n when \"operator\" then operation(item.value)\n when \"funcname\" then EvalFunction.eval(item.value, @stack)\n end\n end\n\n result = @stack.pop\n if result.respond_to?(:hidden?)\n result\n else\n ElectrValue.number(ensure_number(result))\n end\n\n rescue UnboundVariableError => e\n @stack.clear\n ElectrValue.error(\"Error: unbound variable #{e.message}\")\n\n rescue NilEvaluationError\n @stack.clear\n ElectrValue.error(\"Error: nil evaluation\")\n\n end", "def _reduce_711(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def points\n\t\tpoints = 0\n\t\tassignments.each do |assignment|\n\t\t\tpoints += assignment.worth\n\t\tend\n\t\treturn points\n\tend", "def sqr\n\t\t\t@elem[0] ** 2 + @elem[1] ** 2 + @elem[2] ** 2 + @elem[3] ** 2 \n\t\tend", "def sqr\n\t\t\tself.dot( self )\n\t\tend", "def _reduce_712(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def fitness(vals)\n begin\n IterativeLearning::FunctionLearning.sum_of_error(self.target_values, vals)\n rescue StandardError\n condition.fitness(vals)\n end\n end", "def _reduce_585(val, _values, result)\n result = [:dot, val[0][1]]\n\n result\nend", "def x\n @x ||= X.new( c*r, a, (-1*c*(b - c*n)), (r*r*a - (b - c*n)*(b - c*n)) )\n end", "def x\n @x ||= X.new( c*r, a, (-1*c*(b - c*n)), (r*r*a - (b - c*n)*(b - c*n)) )\n end", "def p; @p.nil? ? p=sqrt(x**2+y**2) : @p; end", "def zero_grad\n each_value(&:zero_grad)\n end", "def r\n v = 0\n # for e in @elements ; v += e*e ; end\n my_elems = @elements\n my_size = my_elems.size\n for i in 0..my_size-1 do\n e = my_elems[i]\n v += e * e\n end\n return Math.sqrt(v)\n end", "def v\n @v ||= operand(0).evaluate\n end", "def points(prog); @points[@progs[prog]]; end", "def _reduce_556(val, _values, result)\n lhs, _, rhs = val\n\n lhs = value_expr lhs\n rhs = value_expr rhs\n\n result = s(:dot2, lhs, rhs).line lhs.line\n\n result\nend", "def _reduce_588(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def sum_values\n points.sum\n end", "def points_n2\n result = [:infinity]\n (0...@p).each do |x|\n (0...@p).each do |y|\n point = [x,y]\n result << point if valid?(point)\n end\n end\n result\n end", "def points\n @results.inject(0.0) { |t, r| t += r.points }\n end", "def points\n return 0 if event.trial? || event.trialed?\n\n points_if_not_trial\n end", "def _reduce_590(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def linfit(x,y)\n sum_x = 0.0\n sum_y = 0.0\n sum_prod = 0.0\n sum_x2 = 0.0\n n = x.size\n n.times {|i| \n sum_x += x[i]\n sum_y += y[i]\n sum_prod += x[i]*y[i]\n sum_x2 += x[i]*x[i]\n }\n b = (n*sum_prod - sum_x*sum_y) / (n*sum_x2 - sum_x*sum_x)\n a = (sum_y - b*sum_x) / n\n raise NotEnoughData if a.nan? or b.nan?\n [a,b]\n end", "def sum_of_squares values\n values.collect { |v| v**2 }.reduce(:+)\nend", "def cal()\n @v = 0.0;\n @n.times {|i|\n @v += @wn[i] * @xn[i];\n }\n nil;\n end", "def r\n Math.sqrt(@elements.values.inject(0) { |v, e| v + ( e * e ) } )\n end", "def empty_squares\r\n @data.select {|_, square| square.empty?}.values # .values returns [] of squares [square1, square3,..etc] (not hash as .select does)\r\n end", "def solution\n throw 'No Solution yet' unless @cs\n lambda do |x|\n res = 0;\n @cs.each.with_index do |c,i|\n res += c*phi(i,x)\n end\n res\n end\n end", "def pnormal__X_(y); pnormalxXX_(y + 0.5); end", "def decision_function(x)\n x = ::Rumale::Validation.check_convert_sample_array(x)\n\n x.dot(@weight_vec)\n end", "def dj_dp0(p0, p1)\n raise \"Training set x,y array sizes are not equal\" if @x_t.length != @y_t.length\n sum = 0.0\n for i in 0...@m\n sum += (p0 + p1*@norm_x_t[i] - @norm_y_t[i])\n end\n sum/@m\n end", "def unset_points!(points)\n\t\tpoints.each do |point|\n\t\t\tunset_point!(point)\n\t\tend\n\tend", "def compute_result(f, t, n)\n\twynik = Array.new(n)\n\n\tfor i in Range.new(0, n-1)\n\t\tif i > 0\n\t\t\tprint \" + \" if @debug == true\n\t\tend\n\t\tprint \"x^#{i}(\" if @debug == true\n\t\twynik[i] = 0\n\t\tfor j in Range.new(i, n-1)\n\t\t\tx = newton(j, j-i, t)\n\t\t\tif x.count > 0\n\t\t\t\tfor a in x\n\t\t\t\t\ttmp = f[j]\n\t\t\t\t\tif j != i\n\t\t\t\t\t\tif (((j-i) % 2) == 0)\n\t\t\t\t\t\t\ttmp = f[j]\n\t\t\t\t\t\t\tprint \" + \" if @debug == true\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\ttmp = -tmp\n\t\t\t\t\t\t\tprint \" - \" if @debug == true\n\t\t\t\t\t\tend\n\t\t\t\t\tend\n\t\t\t\t\tprint \"f[#{j}]\" if @debug == true\n\t\t\t\t\tfor b in a\n\t\t\t\t\t\tprint \"*\" if @debug == true\n\t\t\t\t\t\tprint b if @debug == true\n\t\t\t\t\t\ttmp *= b\n\t\t\t\t\tend\n\t\t\t\t\twynik[i] += tmp\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\t\tprint \")\" if @debug == true\n\tend\n\treturn wynik\nend", "def polynomialEval(p, x)\n\t\ty = p[0]\n\n\t\t1.upto(p.size - 1) do |i|\n\t\t\ty = multiply(y, x) ^ p[i]\n\t\tend\n\n\t\ty\n\tend", "def reducepoints(xd, yd, n)\n nd = equal_length(xd, yd)\n inquiry [{ double: n }, { double: n }] do |x, y|\n # Different from Julia. x, y are initialized zero.\n super(nd, xd, yd, n, x, y)\n end\n end", "def reducepoints(xd, yd, n)\n nd = equal_length(xd, yd)\n inquiry [{ double: n }, { double: n }] do |x, y|\n # Different from Julia. x, y are initialized zero.\n super(nd, xd, yd, n, x, y)\n end\n end", "def inverse!\n\t\t\tsmag = self.sqr\n\t\t\t@elem = [\n\t\t\t\t-@elem[0] / smag,\n\t\t\t\t-@elem[1] / smag,\n\t\t\t\t-@elem[2] / smag,\n\t\t\t\t @elem[3] / smag\n\t\t\t]\n\t\tend", "def dj_dp1(p0, p1)\n raise \"Training set x,y array sizes are not equal\" if @x_t.length != @y_t.length\n sum = 0.0\n for i in 0...@m\n sum += @norm_x_t[i]*(p0 + p1*@norm_x_t[i] - @norm_y_t[i])\n end\n sum/@m\n end", "def eps_closure(stateSet)\n stk = stateSet.to_a\n while !stk.empty?\n s = stk.pop\n s.edges.each do |lbl,dest|\n if lbl.contains? EPSILON\n if stateSet.add?(dest)\n stk.push(dest)\n end\n end\n end\n end\n end", "def generate_points(u_count, v_count)\n points = []\n v_count.times do |iv|\n row = []\n u_count.times do |iu|\n u = map1d(iu, (0..u_count), U_RANGE)\n v = map1d(iv, (0..v_count), V_RANGE)\n # default scale: 50, param: Array.new(12, 1) and mesh_distortion: 0\n row << superformula(u: u, v: v)\n end\n points << row\n end\n points\nend", "def _reduce_593(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def build_simplex(start_point)\n n = start_point.length\n raise \"dimension mismatch\" if n != @start_configuration.length\n # set first vertex\n @simplex = Array.new(n+1)\n @simplex[0] = PointValuePair.new(start_point, Float::NAN)\n\n # set remaining vertices\n 0.upto(n - 1) do |i|\n conf_i = @start_configuration[i]\n vertex_i = Array.new(n)\n 0.upto(n - 1) do |k|\n vertex_i[k] = start_point[k] + conf_i[k]\n end\n @simplex[i + 1] = PointValuePair.new(vertex_i, Float::NAN)\n end\n end", "def evaluation(input)\n evaluations = body.each_with_object([]) do |evaluator, aggregate|\n evaluation = evaluator.evaluation(input)\n aggregate << evaluation\n return evaluation_negative(input, aggregate) unless evaluation.output\n end\n\n evaluation_positive(input, evaluations)\n end", "def each_sat\n return to_enum(:each_sat) unless block_given?\n sat_loop(self) do |sat, solver|\n yield sat\n negated_vars = sat.terms.map do |t|\n t.is_a?(NotTerm) ? t.terms[0] : ~t\n end\n solver << PropLogic.all_or(*negated_vars)\n end\n end", "def minimize; end", "def evaluate(values, gene)\n # If the lengths not equal, then return false\n if values.length != gene.length\n \n return false\n \n end\n \n # Get product\n product = Basic.array_product(values, gene)\n \n # Validate\n if product == nil\n \n return -1\n end\n \n # Get sum\n return Basic.sum_of_elements(product)\n \nend", "def process_lasgn exp\n exp = exp.dup\n exp.rhs = process exp.rhs\n exp\n end", "def test_evaluate2\r\n model = DNN::Models::Sequential.new\r\n model << DNN::Layers::InputLayer.new(3)\r\n model.setup(DNN::Optimizers::SGD.new, DNN::Losses::MeanSquaredError.new)\r\n x = Xumo::SFloat[[0, 0.5, 1], [0.5, 1, 0]]\r\n y = Xumo::SFloat[[0, 1, 0.5], [0, 1, 0.5]]\r\n evaluator = DNN::Evaluator.new(model)\r\n assert_equal 0.5, evaluator.evaluate(x, y).first\r\n end", "def compute_squares(arr)\r\n\r\n # empty array created\r\n compute_squares = []\r\n\r\n # iterate using each loop method\r\n arr.each {|el| compute_squares << el**2}\r\n\r\n # returns result\r\n compute_squares\r\nend", "def sum_of_squares\n end", "def evaluation(input)\n evaluations = body.each_with_object([]) do |evaluator, aggregate|\n evaluation = evaluator.evaluation(input)\n aggregate << evaluation\n return evaluation_positive(input, aggregate) if evaluation.output\n end\n\n evaluation_negative(input, evaluations)\n end", "def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end", "def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end", "def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end", "def points; end", "def sum_of_squares\n self.inject(0) { |sos, n| sos + n**2 }\n end", "def _reduce_696(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def _reduce_597(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end", "def intersectNoPoints np\n np # could also have NoPoints.new here instead\n end", "def _reduce_589(val, _values, result)\n result = [:dot, val[0][1]]\n \n result\nend", "def solve_stupid\n nodes_num.times.collect{|node_num| make_wave(node_num) }.min\n end", "def perceptron\n @feature_count = data.first.first.length\n iterations = 0\n weights = @feature_count.times.map { |x| 0.0001 }\n\n while iterations != @iterations\n data.each do |entry|\n feature_vector = entry.first\n activation = activation_output(weights, feature_vector)\n error = entry.last - activation\n error = (error == 0) ? 0.0001 : error\n @bias += @m*error\n weights = vector_add(weights, scalarXvector(error*@m, feature_vector))\n end\n iterations += 1\n end\n weights\nend", "def evaluate_expression vector\n\t\t\t\tsum = 0\n\t\t\t\t@coefficients.length.times { |index|\n\t\t\t\t\tsum+=@coefficients[index]*vector[index]\n\t\t\t\t}\n\t\t\t\treturn 1.0/sum\n\t\t\tend", "def calc_fitness\n @population.each do |p|\n p.fitness(@target)\n end\n end" ]
[ "0.5377877", "0.52260196", "0.51628906", "0.5126159", "0.50868887", "0.50844866", "0.504259", "0.5021839", "0.5016635", "0.5001472", "0.49847087", "0.4974209", "0.49550626", "0.49518788", "0.4950949", "0.49488753", "0.4925819", "0.49192926", "0.49045908", "0.49043077", "0.49018896", "0.49012828", "0.48998177", "0.48622736", "0.48599336", "0.4832082", "0.4811886", "0.48049527", "0.48016238", "0.47922987", "0.47861016", "0.4780869", "0.47804713", "0.4741835", "0.4730307", "0.4728096", "0.47277087", "0.47203472", "0.47172388", "0.47133726", "0.47072154", "0.470697", "0.47057727", "0.46873513", "0.46873513", "0.46821108", "0.4679297", "0.4675345", "0.46715024", "0.46696454", "0.46688202", "0.46669766", "0.4663003", "0.4649963", "0.463579", "0.46319", "0.46304125", "0.46288988", "0.46128333", "0.46114746", "0.4596198", "0.45897487", "0.45870334", "0.45857662", "0.45837155", "0.45755705", "0.4571514", "0.45683333", "0.45635468", "0.4560693", "0.4560693", "0.45581704", "0.45563936", "0.45560578", "0.45505", "0.4545468", "0.45446566", "0.45444095", "0.4541699", "0.45369565", "0.45319846", "0.45314574", "0.45301443", "0.4527558", "0.45217228", "0.45178434", "0.4514821", "0.4514821", "0.4514821", "0.4514257", "0.4508221", "0.45063174", "0.4504305", "0.45013136", "0.45013136", "0.4490045", "0.44875515", "0.44835484", "0.4481855", "0.44745243" ]
0.79259807
0
Replace the worst point of the simplex by a new point == Parameters: point_value_pair: point to insert
def replace_worst_point(point_value_pair) n = @simplex.length - 1 0.upto(n - 1) do |i| if (compare(@simplex[i], point_value_pair) > 0) point_value_pair, @simplex[i] = @simplex[i], point_value_pair end end @simplex[n] = point_value_pair end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def add_to_point point\n add_to_point! point.dup\n end", "def evaluate_simplex\n # evaluate the objective function at all non-evaluated simplex points\n 0.upto(@simplex.length - 1) do |i|\n vertex = @simplex[i]\n point = vertex.point\n if vertex.value.nan?\n @simplex[i] = PointValuePair.new(point, f(point))\n end\n end\n # sort the simplex from best to worst\n @simplex.sort!{ |x1, x2| x1.value <=> x2.value }\n end", "def remove_noise_abscisses(iMinDistance)\n case @Function[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n lNewPoints = [ @Function[:Points][0] ]\n lIdxPoint = 0\n while (lIdxPoint < @Function[:Points].size - 1)\n # Now we skip the next last point among iMinDistance range\n lPointX = @Function[:Points][lIdxPoint][0]\n lIdxOtherPoint = lIdxPoint + 1\n while ((lIdxOtherPoint < @Function[:Points].size) and\n (@Function[:Points][lIdxOtherPoint][0] - lPointX < iMinDistance))\n lIdxOtherPoint += 1\n end\n # Either lIdxOtherPoint is beyond the end, or it points to the first point that is beyond iMinDistance\n # We add the previous point if it is not already ours\n if (lIdxOtherPoint-1 > lIdxPoint)\n lNewPoints << @Function[:Points][lIdxOtherPoint-1]\n # And we continue searching from this new added point\n lIdxPoint = lIdxOtherPoint-1\n else\n # It is our point, continue on to the next one\n lNewPoints << @Function[:Points][lIdxOtherPoint]\n lIdxPoint = lIdxOtherPoint\n end\n end\n @Function[:Points] = lNewPoints\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n optimize\n end", "def update(point)\n\t\t@stack.last.update point\n\tend", "def ordered_insert(value)\n if @coordinates.empty?\n @coordinates << value\n else\n idx = @coordinates.find_index { |x| x[:latitude] > value[:latitude] && x[:longitude] > value[:longitude] }\n if idx.nil?\n @coordinates << value\n else\n temp = @coordinates.slice!(idx, @coordinates.length - idx)\n @coordinates << value\n @coordinates.concat temp\n end\n end\n end", "def update_closest(array, city, new_dist)\n if !array.include?([city, new_dist])\n insert_point = binary_insert(array, new_dist)\n array.insert(insert_point,[city, new_dist])\n end\nend", "def insert(value) # works according to VisualAlgo\n @values.push(value)\n index = @values.length - 1\n while index > 0 do\n parent_index = ((index-1)/2).to_i\n break if @values[parent_index] > @values[index]\n @values[index] = @values[parent_index]\n @values[parent_index] = value\n index = parent_index\n end\n return self\n end", "def insert_piece(piece,x,y) \n piece.points.each { |point| \n #puts \"Inserting #{point[0]},#{point[1]} to #{x},#{y}\" \n @pole[x+point[0]][y-point[1]] = piece.name\n }\n end", "def find_and_replace(list,user,score,k)\n\t\tto_insert=OpenStruct.new(:user=>user,:score=>score)\n\t\tif list.length<k\n\t\t\tlist.push(to_insert)\n\t\telse\n\t\t\tminium=list[0]\n\t\t\tlist.each_index do |i|\n\t\t\t\tif list[i].score<to_insert.score #swap the insert one with current element\n\t\t\t\t\ttemp=list[i]\n\t\t\t\t\tlist[i]=to_insert\n\t\t\t\t\tto_insert=temp\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\tend", "def add_point(point)\n return if point.x < 1 || point.y < 1 || point.x > @max_x-1 || point.y > @max_y-1\n if @glade['toolbar_move'].active?\n if @first_point \n @start = point\n @first_point = false\n @points = [@start]\n print\n else\n @finish = point\n @points = []\n move\n end\n elsif @glade['toolbar_record_points'].active?\n if @x_coords[point.x]\n @glade['statusbar'].push(@context, \"Este programa não suporta 2 ou mais pontos com mesma X-coordenada!\")\n else\n @points << point\n @x_coords[point.x] = point\n end\n print\n end\n end", "def main(points) # array with all the points\n #copy of the array by an especific cordinate\n #nlogn\n # This is a primitive, aka operations that are costless compared to the\n # total complexity we are aming for\n px = sort_by_cordinate(points, 0)\n py = sort_by_cordinate(points, 1)\n\n result = closest_pair(px, py)\nend", "def position=(point); end", "def update(point)\n\t\t\n\tend", "def update(point)\n\t\t\n\tend", "def initialize(point, value)\n @point = point.clone\n @value = value\n end", "def update_p_best\r\n return unless @fitness > p_best_fitness\r\n\r\n @p_best_fitness = @fitness\r\n @p_best_position = @position\r\n end", "def optimize\n case @Function[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n # Join segments that have the same slope\n lNewPoints = [ @Function[:Points][0] ]\n lLastSlope = (@Function[:Points][1][1]-@Function[:Points][0][1])/(@Function[:Points][1][0]-@Function[:Points][0][0])\n lIdxSegment = 1\n while (lIdxSegment < @Function[:Points].size - 1)\n # Compute this segment's slope\n lSlope = (@Function[:Points][lIdxSegment+1][1]-@Function[:Points][lIdxSegment][1])/(@Function[:Points][lIdxSegment+1][0]-@Function[:Points][lIdxSegment][0])\n if (lLastSlope != lSlope)\n # We are changing slopes\n lNewPoints << @Function[:Points][lIdxSegment]\n lLastSlope = lSlope\n end\n lIdxSegment += 1\n end\n # Add last point\n lNewPoints << @Function[:Points][-1]\n # Change points\n @Function[:Points] = lNewPoints\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n end", "def add_to_point! point\n vectors.each do |v|\n point.add! v\n end\n point\n end", "def add_point(point)\n point.cluster.remove_point point if point.cluster\n self.points << point\n point.cluster = self\n end", "def arrangeStudentsAfterSchool\n @tour.size.times do |i|\n point = @points[@tour[i]]\n if point.is_a? Student\n student_school = point.school\n new_position = -1\n @tour.each_with_index do |s, j|\n school = @points[s]\n if school.is_a? Turn\n if school.school.id == student_school.id\n new_position = j\n break;\n end\n end\n end\n if new_position >= 0 and new_position > i\n @tour.insert(new_position, @tour.delete_at(i))\n end\n end\n end\n end", "def immediate_neighbours(point)\n\t\t\tneighbours = []\n\t\t\t@new_points.each{|p|\n\t\t\t\tnext if p.items == point.items\n\t\t\t\td = distance(point.items,p.items)\n\t\t\t\tneighbours.push(p) if d < @epsilon\n\t\t\t}\n\t\t\tneighbours\n\t\tend", "def forward(point)\r\n forward!(point.dup)\r\n end", "def generatePairs\n for i in 0...@parameters.paramsArr.length-1 do \n for j in i+1 ...@parameters.paramsArr.length do\n tmppairs = Pairs.new i,j\n for k in 0...@parameters.paramsArr[i].elementsArr.length do\n for h in 0...@parameters.paramsArr[j].elementsArr.length do \n tmppair = Pair.new k,h #there we store the index of value but not the true value\n @parameters.paramsArr[i].elementsArr[k].addTimes\n @parameters.paramsArr[j].elementsArr[h].addTimes\n tmppairs.addPair tmppair #temppairs just like ABpairs not all AB AC BC\n \n end\n end\n @pairs << tmppairs #@pairs is all the pairs like AB AC BC \n end\n end\n\n #if has limit then update the pairs with limit conditions\n if @haslimit\n \tputs \"update pairs with limit....\"\n updatePairsWithLimit\n end\n end", "def update(point)\n\t\t\t\t\n\t\t\tend", "def assign(key, value)\n pair_idx = @map.index { |pair| pair[0] == key}\n if pair_idx.nil?\n @map << [key, value]\n else\n @map[pair_idx][1] = value\n end\n #refractored\n # pair_idx ? @map[pair_idx][1] = value : @map << [key, value]\n [key, value]\n end", "def flip_range_neg_xy(points); points.collect{ |v| Vertex.new(v.y,v.x)}; end", "def get_first_point\n @points.each do |pt|\n @points.delete(pt)\n return pt\n end\n end", "def add_stop_to_point(stops_array, stop_to_find, new_stop)\n index_of_stop= stops_array.index(stop_to_find)\n result = stops_array.insert((index_of_stop + 1), new_stop)\n return result\nend", "def <<(point)\n @points << ensure_point_is_location_object(point)\n @points.uniq!\n self\n end", "def remove_point(point)\n self.points.delete point\n point.cluster = nil\n end", "def build_simplex(start_point)\n n = start_point.length\n raise \"dimension mismatch\" if n != @start_configuration.length\n # set first vertex\n @simplex = Array.new(n+1)\n @simplex[0] = PointValuePair.new(start_point, Float::NAN)\n\n # set remaining vertices\n 0.upto(n - 1) do |i|\n conf_i = @start_configuration[i]\n vertex_i = Array.new(n)\n 0.upto(n - 1) do |k|\n vertex_i[k] = start_point[k] + conf_i[k]\n end\n @simplex[i + 1] = PointValuePair.new(vertex_i, Float::NAN)\n end\n end", "def update_pair(pair)\n local_ant = pair[0]\n ph_value = pair[1]\n @state.transaction do\n until local_ant.size == 1\n @state[:trails][[local_ant[0], local_ant[1]]] += ph_value\n local_ant.shift\n end\n end\n end", "def insert(p0, p1) end", "def replace_min(value, priority=value, subpriority=nil)\n subpriority ||= @totalcount\n @totalcount += 1\n loc = find_min_locator\n loc.update(value, priority, subpriority)\n loc\n end", "def adjust_points\n coords = current_object.coordinates\n if sw and ne\n @sw.lat = coords.lat if sw.lat > coords.lat\n @sw.lon = coords.lon if sw.lon > coords.lon\n @ne.lat = coords.lat if ne.lat < coords.lat\n @ne.lon = coords.lon if ne.lon < coords.lon\n @center.lat = (ne.lat - sw.lat )/2 + sw.lat\n @center.lon = (ne.lon - sw.lon )/2 + sw.lon\n else\n @sw = coords.dup\n @ne = coords.dup\n @center = coords.dup\n end\n \n true\n end", "def flip_range_xy(points); points.collect{ |v| Vertex.new(-v.y,-v.x)}; end", "def arrangeStudentsBeforeSchool\n @tour.size.times do |i|\n point = @points[@tour[i]]\n if point.is_a? Student\n student_school = point.school\n new_position = -1\n @tour.reverse.each_with_index do |s, j|\n school = @points[s]\n if school.is_a? Turn\n if school.school.id == student_school.id\n new_position = @tour.size - j - 1\n break;\n end\n end\n end\n if new_position >= 0 and new_position < i\n @tour.insert(new_position, @tour.delete_at(i))\n end\n end\n end\n end", "def add_point(point)\n puts \"adding p: #{point}\" if @debug\n @points << point\n if self.mec && self.mec.center\n unless self.mec.contains?(point)\n iterate\n end\n else\n iterate\n end\n end", "def insert_after value\n node = Node.new value, @nxt, self\n @nxt.prv = node if @nxt\n @nxt = node\n end", "def closest_pair1(points)\n min_distance = Float::MAX\n best_pair = nil\n (0...points.length).each do |i|\n (i...points.length).each do |j|\n if i != j\n curr_distance = distance1(points[i], points[j])\n if curr_distance < min_distance\n min_distance = curr_distance\n best_pair = [points[i], points[j]]\n end\n end\n end\n end\n best_pair\nend", "def add_square(point)\n @squares << point\n end", "def place(x, y, buddy)\n # Skip invalid states, when the buddy may fall down from the table\n if validate_pos(x, y)\n buddy.x = x\n buddy.y = y\n end\n end", "def add!(point)\r\n @x += point.x\r\n @y += point.y\r\n end", "def apply_map_function(iMapFunction)\n case @Function[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n case iMapFunction.function_data[:FunctionType]\n when FCTTYPE_PIECEWISE_LINEAR\n # Both functions are piecewise linear\n # Algorithm:\n # * For each segment of our function:\n # * We look at the segments from the map function.\n # * For each found segment:\n # *** We find at which abscisses this segment will change values\n # *** We change the sub-segment between those abscisses\n lPoints = @Function[:Points]\n lMapPoints = iMapFunction.function_data[:Points]\n lNewPoints = []\n lIdxSegment = 0\n while (lIdxSegment < lPoints.size-1)\n lBeginX = lPoints[lIdxSegment][0]\n lBeginY = lPoints[lIdxSegment][1]\n lEndX = lPoints[lIdxSegment+1][0]\n lEndY = lPoints[lIdxSegment+1][1]\n # The direction in which we are going to look for the map segments\n lIncMapSegment = nil\n if (lEndY >= lBeginY)\n lIncMapSegment = true\n else\n lIncMapSegment = false\n end\n # Find the map function's segment containing the beginning of our segment\n lIdxMapSegment = 0\n if (lBeginY == lMapPoints[-1][0])\n lIdxMapSegment = lMapPoints.size - 2\n else\n while (lBeginY >= lMapPoints[lIdxMapSegment+1][0])\n lIdxMapSegment += 1\n end\n end\n # Compute the new value of our segment beginning\n lNewBeginY = lMapPoints[lIdxMapSegment][1] + ((lMapPoints[lIdxMapSegment+1][1]-lMapPoints[lIdxMapSegment][1])*(lBeginY-lMapPoints[lIdxMapSegment][0]))/(lMapPoints[lIdxMapSegment+1][0]-lMapPoints[lIdxMapSegment][0])\n lNewPoints << [ lBeginX, lNewBeginY ]\n # Get the next map segments unless we reach our segment's end\n # !!! Find the next map segment according to the direction\n if (lIncMapSegment)\n while (lEndY > lMapPoints[lIdxMapSegment+1][0])\n # We have a new map segment to consider in our segment\n # Find the absciss at which our Y coordinates get the value lMapPoints[lIdxMapSegment+1][0]\n lNewSegmentX = lBeginX + ((lEndX-lBeginX)*(lMapPoints[lIdxMapSegment+1][0] - lBeginY))/(lEndY-lBeginY)\n lNewPoints << [ lNewSegmentX, lMapPoints[lIdxMapSegment+1][1] ]\n lIdxMapSegment += 1\n end\n # Our segment ends before next map segment\n else\n while (lEndY < lMapPoints[lIdxMapSegment][0])\n # We have a new map segment to consider in our segment\n # Find the absciss at which our Y coordinates get the value lMapPoints[lIdxMapSegment][0]\n lNewSegmentX = lBeginX + ((lEndX-lBeginX)*(lMapPoints[lIdxMapSegment][0] - lBeginY))/(lEndY-lBeginY)\n lNewPoints << [ lNewSegmentX, lMapPoints[lIdxMapSegment][1] ]\n lIdxMapSegment -= 1\n end\n # Our segment ends before previous map segment\n end\n # Write the segment end if it is the last one (otherwise it will be written by the next iteration)\n if (lIdxSegment == lPoints.size-2)\n lNewEndY = lMapPoints[lIdxMapSegment][1] + ((lMapPoints[lIdxMapSegment+1][1]-lMapPoints[lIdxMapSegment][1])*(lEndY-lMapPoints[lIdxMapSegment][0]))/(lMapPoints[lIdxMapSegment+1][0]-lMapPoints[lIdxMapSegment][0])\n lNewPoints << [ lEndX, lNewEndY ]\n end\n lIdxSegment += 1\n end\n # Replace with new points\n @Function[:Points] = lNewPoints\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n else\n log_err \"Unknown function type: #{@Function[:FunctionType]}\"\n end\n optimize\n end", "def add_to_point(other)\n check_group! other\n\n # Assertions:\n # raise \"point given (#{point.inspect}) does not belong to #{group.name}\" if !group.include?(point)\n # raise \"point (#{inspect}) does not belong to #{group.name}\" if !group.include?(self)\n\n # Rules 1 and 2\n return other if infinity?\n return self if other.infinity?\n\n # Rule 3\n return group.infinity if x == other.x && y == field.mod(-other.y)\n\n # Rule 4\n if x != other.x\n gamma = field.mod((other.y - y) * field.inverse(other.x - x))\n sum_x = field.mod(gamma * gamma - x - other.x)\n sum_y = field.mod(gamma * (x - sum_x) - y)\n return self.class.new(group, sum_x, sum_y)\n end\n\n # Rule 5\n return double if self == other\n\n raise \"Failed to add #{inspect} to #{other.inspect}: No addition rules matched.\"\n end", "def hop(point)\n @curr_point = point\n @num_hops += 1\n end", "def assign_spot(board,open,x, y,val, xblks, yblks)\n open.delete([x,y])\n\n board[x][y] = val\n for position in open\n\t # the last part of this is is checking blocks mapping of x,y -> blk = x/xblks + yblks*(y/yblks) using integer division\n\t if (position[0] == x or position[1] == y or (position[0]/xblks +yblks*(position[1]/yblks) == x/xblks + yblks*(y/yblks) ) )\n\t\t #This segment is a little tricky and deserves further explanation:\n\t\t #This function is called when you are assign a value to a cell\n\t\t #with 100% certaintiy, either through initial input or through constraint inference\n\t\t #Consequently, propogation removes this value from all constrainted cells\n\n\t\t #The first scenario is where the constrainted cell has only one value, matching\n\t\t #the value we know the updating cell to be. This represents an invalid sudoku board\n\n\t\t #The second check is a programming check to avoid the situation where a constrained\n\t\t #cell has only a length 1 array\n\t\t #If this value happens to be the one we're deleting we're back to case 1\n\t\t #Even if it's a different value:\n\t\t #If unchecked, this would crash since delete operates on an array\n\t\t #However delete would \"fail\" silently anyway since the value we intended to delete\n\t\t #would not be found, so we lose nothing by skipping this case\n\t\t #By default delete just returns nil if the value is not found in list, which\n\t\t #we chose to silently ignore, this is essentially saying:\n\t\t # delete the value from constrainted cells IF it exists in them\n if board[position[0]][position[1]]== val or\n (board[position[0]][position[1]].length == 1 and board[position[0]][position[1]][0] ==val)\n # puts \"WE HAVE A PROBLEM\", position[0], position[1], val\n\t\t\t return false\n\t\t end\n\t\t if board[position[0]][position[1]].is_a?(Array) == true\n\t\t\t board[position[0]][position[1]].delete(val)\n\t\t end\n\n\t end\n end\n return true\n end", "def set_top(position, piece)\n if position < 0 || position > 2\n \"Not a valid spot, please put the piece in the 0-2 spot\" \n else\n @top.delete_at(position)\n @top.insert(position, piece)\n end\n end", "def insert(value)\n self.heap.append(value)\n self.sift_up(self.heap.length-1, self.heap)\n end", "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 assign_until_unique(piece)\n x = Random.new.rand(1..@size)\n y = Random.new.rand(1..@size)\n unless coordinates.include? [x, y]\n piece.coordinates = [x, y]\n return piece\n end\n assign_until_unique(piece)\n end", "def update_score!(points)\n increment!(:score, points)\n end", "def replace_existing_element(matrix,element, current_row, current_col)\r\n matrix[current_row][current_col] = element\r\n end", "def find_closest_pair(pairs)\n zz = {:x => 0, :y => 0}\n distances_from_zz = pairs.map { |p| {:distance => distance(p, zz), :point => p} } # O(n)\n cloest_pair = distances_from_zz.sort { |p1, p2|\n dist = abs(p1[:distance] - p2[:distance])\n puts dist\n dist\n }.take(2)\n cloest_pair.map { |p| \"#{p[:point][:x]}, #{p[:point][:y]} -- distance: #{p[:distance]}\" }\nend", "def replace!(population, offspring, num_elites)\n population[0...num_elites] = (population.sort)[0...num_elites]\n population[num_elites..-1] = offspring\nend", "def set_finish_point\n self.reload\n if circle == \"1\"\n lp = points.first\n tracksegments.last.points.create(:longitude => lp.longitude, \n :latitude => lp.latitude, \n :elevation => lp.elevation)\n logger.info \"Finish point appended\"\n end\n end", "def add_lexeme(values)\n fix = {}\n\n values.select { |v| @set[v] }.each do |w|\n sw = @set[w]\n if fix[sw]\n s_prime = sw[:back]\n else\n s_prime = @node.new(sw[:back], sw, [])\n s_prime.instance_eval { @hash = (@@cnt += 1) }\n @tail = s_prime if @tail == sw\n sw[:back][:forward] = s_prime if sw[:back]\n sw[:back] = s_prime\n fix[sw] = true\n end\n\n s_prime[:data] << w\n sw[:data].delete(w)\n @set[w] = s_prime\n end\n\n fix.keys.select { |n| n[:data].size == 0 }.each do |e|\n e[:forward][:back] = e[:back] if e[:forward]\n e[:back][:forward] = e[:forward] if e[:back]\n end\n end", "def RemovePoints(score)\n\tscore = score - 50\nend", "def set_vertex_value(x, v)\n raise\n end", "def insert(value)\n @heap.append(value)\n self.sift_up(@heap.length - 1, @heap)\n end", "def replace_worst_ranked(offsprings)\n size = offsprings.length\n\n @population.sort!() # Make sure population is sorted so we replace the worst \n\n raise \"@population.first.fitness() >= @population.last.fitness()\" unless @population.first.fitness() >= @population.last.fitness()\n\n @population = @population [0..((-1*size)-1)] + offsprings\n end", "def setVacantSquare(nthVacantSquare, piece)\n\t\tto_av.select{|x| x.nil?}[nthVacantSquare].set(piece)\n\tend", "def insert(value)\n search_result = binary_search_internal(value)\n unless search_result[0]\n @inner.length.downto(search_result[1] + 1) { |i| @inner[i] = @inner[i - 1] }\n @inner[search_result[1]] = value\n end\n return search_result[1]\n end", "def identity_x\r\n new_point = identity\r\n new_point.y = 0\r\n return new_point\r\n end", "def insert(value)\n node = @current\n @current = LinkNode.call(value, node, :circle_after, self, &@match_value)\n if self.size == 0 # only\n self.head = @current\n self.tail = @current\n elsif self.tail == node\n self.tail = @current\n @current.next = self.head\n self.head.prev = @current\n end\n self.size += 1\n end", "def place!(val, &block)\n pos = nil\n orig_size = self.size\n block ||= lambda{|a, b| a <=> b}\n self.each_with_index do |e, i|\n if block.call(e, val) == 1\n pos = i\n break\n end\n end\n return nil unless pos\n self.insert(pos, val)\n while self.size > orig_size\n self.pop\n end\n val\n end", "def find_insert_pair(backward_consensus, forward_consensus, pair_within)\n insert_pair = []\n\n forward_consensus_dup = forward_consensus.dup\n backward_consensus.each do |consensus_b|\n start_pos_b = consensus_b.start_pos - pair_within\n end_pos_b = consensus_b.end_pos + pair_within\n\n skip = 0\n forward_consensus_dup.each_with_index do |consensus_f, index|\n start_pos_f = consensus_f.start_pos - pair_within\n end_pos_f = consensus_f.end_pos + pair_within\n if end_pos_f < start_pos_b\n skip = index\n next\n elsif (start_pos_f <= end_pos_b && end_pos_b <= end_pos_f) || (start_pos_f <= start_pos_b && start_pos_b <= end_pos_f)\n insert_pair << [consensus_b, consensus_f]\n elsif end_pos_b < start_pos_f\n forward_consensus_dup = forward_consensus_dup[skip..-1] # update\n break\n end\n end\n end\n return insert_pair\n end", "def swap_if_needed(value, bucket)\n return value if table[bucket] == TOMBSTONE_MARKER\n\n if amount_displaced(value, bucket) < amount_displaced(table[bucket], bucket)\n puts \"Doing Robin Hood swapping.\"\n value, table[bucket] = table[bucket], value\n end\n\n value\n end", "def swap_elements(array)\n array.insert(1,array.delete_at(2))\nend", "def flip_range_x(points); points.collect{ |v| Vertex.new(v.x, -v.y)}; end", "def simplify_polygon_heap(polygon, threshold)\n # First, add all the points to the heap\n attributed_points = SimplifyHeapArray.new\n 0.upto(polygon.length - 1) do |x|\n this_point = polygon[x]\n last_point = polygon[x-1]\n next_point = polygon[x+1]\n area = check_area(last_point, this_point, next_point)\n attributed_points.add(this_point, x, area)\n end\n # Link all the points in the heap to its neighbor (this is fast\n # because we build a hash to do that when we add the points the\n # first time)\n 1.upto(polygon.length - 2) do |x|\n attributed_points.link(x, x+1, x-1)\n end\n attributed_points.link(0, 1, polygon.length - 1) \n attributed_points.link(polygon.length - 1, 0, polygon.length - 2)\n # Do the actual simplification\n while (1)\n if (polygon.length < 4)\n # This polygon has been simplified out of existence!\n polygon.delete_all\n return\n end\n check = attributed_points.pop\n if (check && check.attrib < threshold)\n polygon.delete(check.point)\n else\n return\n end\n end\nend", "def swap_values_at i, j\n value_i = @heap[i]\n value_j = @heap[j]\n\n @heap[i] = value_j\n @heap[j] = value_i\n\n map_swap(value_i, value_j, i, j)\n end", "def assign(key,value)\n #first check to see if the key value pair already exists\n pair_index = nil\n @map.each_with_index do |sub_array,idx|\n pair_index = idx if sub_array[0] == key\n end\n if pair_index.nil?\n @map << [key,value]\n else\n @map[pair_index]=[key,value]\n end\n end", "def insert_front(value)\n \n end", "def update_earned_points\n self.update_column(:earned_points, earned_points_calculated_off_point_activities)\n end", "def set_points_earned\n if !self.action.has_custom_points?\n self.update(points_earned: self.action.point_value)\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 insert_after( node, value )\n # Find the specified node, and add a new node\n # with the given value between that found node\n # and the next\n node = find node\n node_after = node.next\n node_inserted = Node.new value\n node.next = node_inserted\n node_inserted.next = node_after\n node_inserted\n end", "def neigbour_helper(current_node, x, y)\n new_x = current_node.value[0] + x\n new_y = current_node.value[1] + y\n new_node = Node.new(new_x, new_y)\n current_node.neighbour_nodes << new_node if valid?(new_node)\n end", "def insert(index,element)\n return nil if index < 0 || index > @size\n if element.new?\n pair = [element,element.class]\n else\n pair = [element.rod_id,element.class]\n end\n @map.keys.sort.reverse.each do |key|\n if key >= index\n value = @map.delete(key)\n @map[key+1] = value\n end\n end\n @map[index] = @added.size\n @added << pair\n #@commands << [:insert,pair]\n @size += 1\n self\n end", "def flip_range_y(points); points.collect{ |v| Vertex.new(-v.x,v.y)}; end", "def updateSquare(data, x, y)\n data[x] = Hash.new if !data.has_key?(x)\n \n result = fetchValue(data, x-1, y+1) + fetchValue(data, x, y+1) + fetchValue(data, x+1, y+1) +\n fetchValue(data, x-1, y) + fetchValue(data, x+1, y) +\n fetchValue(data, x-1, y-1) + fetchValue(data, x, y-1) + fetchValue(data, x+1, y-1)\n \n data[x][y] = result\nend", "def insert(value)\n\t\tcurrent_node = @head \n\t\tif current_node.value >= value \n\t\t\t@head = Node.new(value, current_node)\n\t\tend \n\t\tuntil current_node.next_node.value =< value \n\t\t\tbreak if current_node.next_node == nil \n\t\t\tcurrent_node = current_node.next_node\n\t\tend \n\t\tcurrent_node.next_node = Node.new(value, current_node.next_node)\n\tend", "def assign(key, value)\n pair_index = @map.index {|pair| pair[0] == key}\n pair_index ? @map[pair_index][1] = value : @map.push([key, value])\n [key, value]\n end", "def add_point(point)\n # again, as with add_bbox(), we do not know whether to add the point\n # \"to the left\" or \"to the right\". So we do it three times:\n # as is, 360 to the left, 360 to the right, and choose the one\n # which minimizes the new side length\n @north = [@north, point[\"lat\"].to_f].max\n @south = [@south, point[\"lat\"].to_f].min\n lng = point[\"lng\"].to_f\n @east, @west = optimize_east_west_add(lng, lng)\n normalize\n end", "def swap_elements(array)\n array.insert(1, array.delete_at(2))\nend", "def shift_points(structure)\n structure[:points].collect!{|point|\n z = point[2]\n if (((z - @z_from) % @z_step).round(@dp) == 0.0)\n point[2] = z - @shift_value \n end\n point\n }\n end", "def put_small_ship(row,column)\n verify_small_ship_location(row,column)\n @coords[row][column] = SmallShip.new\n end", "def fix_value( val )\n Pos.abs( ( @container.pos.x! + val.x! ), ( @container.pos.y! + val.y! ) )\n end", "def mirror_update pt\n pt.x = pt.x * (-1)\nend", "def find_pair(person)\n total = @pairs.length\n pick = rand(total)\n if invalid_pair? pick,person\n pair = @pairs.delete_at(pick)\n else \n pair = find_pair(person) \n end \n pair \nend", "def set_points!(points, color)\n\t\tpoints.each do |point|\n\t\t\tset_point!(point, color)\n\t\tend\n\tend", "def put_large_ship(row,column)\n \tverify_large_ship_location(row,column)\n \tprow,stern = LargeShipParts.parts\n @coords[row][column] = prow\n @coords[row][column+1] = stern\n end", "def insert_at(value, index)\n prev = self.at(index - 1)\n next_node = prev.next_node\n prev.next_node = Node.new(value, next_node)\n end", "def push(value)\n\t\tif values.length <= @pos\n\t\t\traise RuntimeError.exception @errormessage\n\t\tend\n\t\t\n\t\ti = @pos\n\t\t@pos += 1\n\t\t\n\t\twhile i > 0\n\t\t\tidx = (i-1)/2\n\t\t\tbreak if values[idx] <= value\n\t\t\t\n\t\t\tvalues[i] = values[idx]\n\t\t\ti = idx\n\t\tend\n\t\t\n\t\tvalues[i] = value\n\tend", "def find_neighboorhood(current_solution_vc)\n # se repite hasta que encuentre un par de valores buenos\n # puts \"vc: \" + current_solution_vc.inspect\n\n # clonar el arreglo\n current_solution = current_solution_vc.clone\n\n begin\n i = rand(current_solution.length)\n j = rand(current_solution.length)\n end while (i == current_solution.first or j == current_solution.first or i == j)\n item1 = current_solution[i]\n swapped_item1 = item1\n item2 = current_solution[j]\n current_solution[i] = item2\n current_solution[j] = swapped_item1\n\n # puts \"vn: \" + current_solution.inspect\n return current_solution\n # puts \"item1: #{item1}\"\n # puts \"item2: #{item2}\"\n\nend", "def linsert(key, where, pivot, value); end", "def linsert(key, where, pivot, value); end", "def move(currX,currY,nextX,nextY,prev)\n if @mat[currY][currX] == \"0\"\n point = Point.new(nextX,nextY)\n if !(@traceSet.include?(point.to_S))\n point.setPrev(prev)\n @traceArray.push(point)\n @traceSet.add(point.to_S)\n if point.isEqual(@final)\n @tnode = point\n end\n end\n end\n end", "def insert(value)\n if empty?\n @root = Node.new(value)\n return\n end\n\n x = Node.new(value)\n\n # find right leaf to insert under\n temp = @root\n while !temp.nil? do\n # need to track parent so when we exit the loop,\n # we can still reference the leaf node found\n found_leaf = temp\n\n if temp.val > value\n temp = temp.left\n elsif temp.val < value\n temp = temp.right\n else\n puts DUPLICATE_VAL\n return\n end\n end\n\n if found_leaf.val > value\n found_leaf.left = x\n else\n found_leaf.right = x\n end\n end" ]
[ "0.568733", "0.5383071", "0.5202251", "0.51968026", "0.51624954", "0.5158071", "0.51291203", "0.5086484", "0.5053831", "0.5042788", "0.4954", "0.49424553", "0.49386322", "0.49386322", "0.49313292", "0.4928575", "0.49139407", "0.48842263", "0.48108265", "0.47963923", "0.47878733", "0.4784212", "0.47813758", "0.47510135", "0.47459888", "0.47325015", "0.47257832", "0.47087252", "0.47049558", "0.4677911", "0.46768564", "0.46608245", "0.46590525", "0.46558625", "0.46544653", "0.46495014", "0.4648989", "0.4642663", "0.46410513", "0.46214038", "0.46178174", "0.46015438", "0.45839238", "0.45727926", "0.45701772", "0.4527765", "0.4525691", "0.45250297", "0.45214054", "0.45199984", "0.4515534", "0.45147657", "0.4511909", "0.4501606", "0.44960272", "0.44807708", "0.4475357", "0.44736436", "0.44685948", "0.4462224", "0.44596174", "0.44438344", "0.4438204", "0.44304037", "0.4426039", "0.44249094", "0.44236693", "0.4420266", "0.44195744", "0.44112182", "0.4401494", "0.43991485", "0.43954325", "0.43927097", "0.43924528", "0.43899217", "0.43843707", "0.4381862", "0.43790215", "0.4371952", "0.4368796", "0.43684092", "0.4368396", "0.43657202", "0.4365108", "0.43644834", "0.43641013", "0.4354797", "0.4353006", "0.43529296", "0.43440244", "0.43345475", "0.43333426", "0.43328205", "0.43305188", "0.43269402", "0.4323673", "0.4323673", "0.4315246", "0.4314137" ]
0.8584808
0
loads structure file csv, returns structure as array
def loadStructure(file) csv_text = File.read(file) return CSV.parse(csv_text, :headers => true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def csv_to_array(csv); end", "def csvReader(file, headers)\n begin\n csvTable = CSV.read(file, {col_sep:\"\\t\", quote_char:\"\\0\", headers:headers})\n rescue ArgumentError\n puts \"Error: Unsupported encoding, tabulated/CSV file must be in UTF-8 format.\"\n abort\n end\n parsedObj = OpenStruct.new()\n parsedObj.rowArray = []\n parsedObj.belArray = []\n csvTable.each do |row|\n unless row.length == 0\n current = OpenStruct.new()\n current.bel_id = row[0]\n current.bel_id.slice! \"BEL:\"\n current.bel = row[1]\n current.sentence = row[2]\n current.sentence_id = row[3]\n current.sentence_id.slice! \"SEN:\"\n current.pmid = row[4]\n parsedObj.rowArray << current\n parsedObj.belArray << row[1]\n end\n end\n parsedObj.linecount = csvTable.length\n return parsedObj\nend", "def load_csv(csv_filepath)\n gifts = []\n CSV.foreach(csv_filepath) do |row|\n gifts << row[0] # Nosso csv só tem uma coluna\n end\n return gifts\nend", "def parse_csv(path)\n require 'csv'\n\n str = Nitro::Template.new.render(File.read(path))\n\n reader = CSV::Reader.create(str)\n header = reader.shift\n\n reader.each_with_index do |row, i|\n data = {}\n row.each_with_index do |cell, j|\n data[header[j].to_s.strip] = cell.to_s.strip\n end\n self[\"#{@name}_#{i+1}\"] = obj = instantiate(data)\n @objects << obj\n end\n end", "def convert_csv_file_to_object\n begin\n CSV.foreach(@file_name) do |row|\n @csv_object.push(row)\n end \n rescue => exception\n raise FileReadError, exception\n end\n end", "def load_data(filename)\n return CSV.read(filename, headers: true).map { |line| line.to_h }\nend", "def get\n arr = []\n\n process(csv_file).each do |record|\n arr << SOA_CSV_RECORD.new(*record.fields)\n end\n\n arr\n end", "def parse_csv(file_path)\n record_list = []\n header = []\n is_header = true\n \n CSV.foreach(file_path) do |row|\n if (is_header)\n\theader = row\n\tis_header = false\n else\n\trecord = Record.new\n\trecord.create(header, row)\n\trecord_list.push(record)\n end\n end\n return record_list\n end", "def parse_to_load_file(csv)\n csv.each_with_index do |student, index|\n student = {month: csv[index][0] , name: csv[index][1], city: csv[index][2], hobby: csv[index][3]}\n @students << student\n end\nend", "def parse_csv(csv_name, schema)\n CSV.read(csv_name).map {|row| map_row_to_entity(row, schema) }\nend", "def load_data(filename)\n data = CSV.open(filename, 'r', headers: true).map do |line|\n line.to_h\n end\n return data\nend", "def csv_to_array(csv_name)\n\tCSV.read(csv_name)\nend", "def parse\r\n\t\tCSV.foreach(self.filepath) {|row| @list << row}\r\n\t\t@list.flatten!\r\n\tend", "def loadCSVFile(filePath)\n data = []\n CSV.foreach(filePath, :headers => true) do |row|\n row = row.to_h\n row.each do |k, v|\n v = v.to_s\n row[k] = v\n end\n data << row\n end\n data\n end", "def load_data(filename)\n data = CSV.read(filename, headers: true).map(&:to_h)\n return data\nend", "def load_data\n @data ||= CSV.read(@file)\n end", "def read_1d_csv_file(state_table_path) \r\n rows_read=0\r\n\t\tstate_transition_list= Array.new\r\n\t\tignore_first_row = true\r\n\r\n\t\tCSV::Reader.parse(File.open(state_table_path, 'r').read.gsub(/\\r/,\"\\n\")) do |row_array|\r\n\t\t\t# First row should be the header\r\n\t\t\tif ignore_first_row\r\n\t\t\t\tignore_first_row=false\r\n\t\t\telse\r\n\t\t\t\ttransition = TransitionHolder.new(row_array[STATE1].to_s,row_array[ACTION].to_s,row_array[STATE2].to_s)\r\n\t\t\t\tputs_debug \"Read in transitions: #{transition}\"\r\n\t\t\t\tstate_transition_list.push transition \r\n\t\t\tend # if first row\r\n\t\t\trows_read +=1\r\n\t\tend # end csv block\r\n\r\n raise \"CSV File Empty\" if rows_read==0\r\n raise \"Missing Data in CSV File\" if rows_read==1\r\n \r\n\t\t# return state table, its a raw list of transition objects\r\n\t\treturn state_transition_list\r\n\r\n\tend", "def csvfile_to_array(csv_f, header=true)\n arr_of_arrs = FasterCSV.read(csv_f)\n #puts arr_of_arrs.inspect()\n arr_of_arrs.shift() if header\n arr_of_arrs.flatten!\n\n return arr_of_arrs\n end", "def load_csv (csv_file)\n\tret = []\n\tFile.open(csv_file, \"r\") do |f|\n\t\tf.each_line do |line|\n\t\t\t#puts line\n\t\t\tret << line.split(';')\n\t\tend\n\tend\n\treturn ret\nend", "def load_data(filename)\n athlete_array = []\n CSV.read(filename, headers: true).each do |athlete|\n athlete_array << athlete.to_h\n end\n return athlete_array\nend", "def parse_csv(file)\n\t\tdata = []\n\t\t# Break open CSV and go through rows\n\t\tbegin\n\t\t\tdata = CSV.read(file, :headers => true,:skip_blanks => true,:header_converters => :symbol, :encoding => 'UTF-8')\n\t\trescue\n\t\t\t# Convert to UTF-8 if necessary\n\t\t\tdata = CSV.read(file, :headers => true,:skip_blanks => true,:header_converters => :symbol, :encoding => 'Windows-1252:UTF-8')\n\t\tend\n\t\tdata\n\tend", "def load_csv()\n f = File.read(INPUT_CSV)\n CSV.parse(f, :headers => true, :col_sep => \",\").map do |row|\n as_hash = row.to_hash\n\n geom = { \n type: \"Point\",\n coordinates: as_hash['coordinates'].split.map { |num| num.to_f }\n }\n\n as_hash.delete('coordinates')\n as_hash['geom'] = geom\n\n if (as_hash['pic_url'].strip.length < 1)\n as_hash.delete('pic_url')\n end\n\n if (as_hash['place_image'].strip.length < 1)\n as_hash.delete('place_image')\n end\n\n as_hash\n end\nend", "def loadCSV\n csvFile = File.open(\"app/assets/csv/test.csv\", \"r\") #Open file with readpermissions\n if csvFile #if file was successfully opened \n csvRowArray = IO.readlines(csvFile) # Turn each row into an array element\n rowId=1 #0 is the Header Row, 1 is the first dataset.\n recordsArray = Array.new(csvRowArray.size-1)\n while csvRowArray[rowId] do #for each row that exists \n rowEntry = csvRowArray[rowId]\n rowEntry.gsub!(/\"/,'') # Remove all the '\"'s\n wordArr = rowEntry.split(\",\") #Split the array on ','s into a new array \n newRecord = Record.new\n newRecord.REF_DATE = wordArr[0]\n newRecord.GEO = wordArr[1]\n newRecord.DGUID = wordArr[2]\n newRecord.Sex = wordArr[3]\n newRecord.Age_group = wordArr[4]\n newRecord.Student_response = wordArr[5]\n newRecord.UOM = wordArr[6]\n newRecord.UOM_ID = wordArr[7]\n newRecord.SCALAR_FACTOR = wordArr[8]\n newRecord.SCALAR_ID = wordArr[9]\n newRecord.VECTOR = wordArr[10]\n newRecord.COORDINATE = wordArr[11]\n newRecord.VALUE = wordArr[12]\n newRecord.STATUS = wordArr[13]\n newRecord.SYMBOL = wordArr[14]\n newRecord.TERMINATED = wordArr[15]\n newRecord.DECIMALS = wordArr[16]\n newRecord.save\n puts rowId\n rowId = rowId+1 \n end\n return recordsArray\n else #file not opened\n puts \"Unable to open file\" \n return \n end \n end", "def load(path)\n if File.exists?(path)\n @data = CSV.read(path)\n @data.shift(1)\n else\n log.warning \"No data file found at #{path}\"\n @data = []\n end\n @data\n end", "def load_data(file_name)\n\t\tindata = []\n\t\t#csv reader as shown in class; typecasted because I ran into some weird bugs\n\t\tCSV.foreach(\"#{file_name}\", col_sep: \"\\t\") do |row| \n\t\t\tindata.push({\"user_id\"=>row[0].to_i, \"movie_id\"=>row[1].to_i, \"rating\" => row[2].to_i, \"timestamp\" => row[3].to_i})\n\t\tend\n\t\treturn indata\n\tend", "def parse_csv_file\n csv_data = CSV.read(\"../artists_for_seed_data.csv\")\n csv_data.shift\n # iterate over each element and send back a hash\n # need to shift again at the beginning to get rid of id on the row\n painter_object_array = []\n csv_data.each do |painter_row_arr|\n \n painter_row_arr.shift\n painter_object = {\n :name => painter_row_arr[0],\n :years => painter_row_arr[1],\n :genre => painter_row_arr[2],\n :nationality => painter_row_arr[3],\n :bio => painter_row_arr[4],\n :painter_num => painter_row_arr[6]\n }\n painter_object_array.push(painter_object)\n end\n painter_object_array.flatten\nend", "def parsed_data\n @parsed_data ||= begin\n CSV.read(full_filename, col_sep: col_sep, quote_char: quote_char, encoding: encoding)\n rescue => e #CSV::MalformedCSVError => er\n @parse_error = e.to_s\n rows = []\n #one more attempt. If BOM is present in the file.\n begin\n f = File.open(full_filename, \"rb:bom|utf-8\")\n rows = CSV.parse(f.read.force_encoding(\"ISO-8859-1\"))\n ensure\n return rows\n end\n end\n end", "def load_students(filename = \"students.csv\")\n # CSV.open(filename, \"r\") {|file|\n CSV.foreach(filename) do |line| # contains name, cohort\n # file.readlines.each do |line|\n name, cohort = line\n student_into_array(name, cohort.to_sym)\n end\n\nend", "def load\n CSV.foreach(@csv_file, headers: :first_row, header_converters: :symbol) do |row|\n @data << Employee.new(row)\n end\n end", "def import_csv_full\n \n end", "def load_csv(csv_path)\n raise Error::InvalidCSV unless File.exist? csv_path\n begin\n vals = CSV.read(csv_path)\n rescue CSV::MalformedCSVError\n raise Error::InvalidCSV\n end \n\n raise Error::BlankCSV if vals.length == 0\n raise Error::InvalidCSV if vals[0].length != 3\n\n # remove optional header\n vals.shift if vals[0][0] == HEADER_VAL\n\n @data = vals.collect do |data|\n {\n \"image_path\" => data[0],\n \"id\" => data[1],\n \"label\" => data[2]\n }\n end\n end", "def create_people_raw\n @@people_raw = CsvMapper.import('test_ward.csv') do\n read_attributes_from_file\n end\nend", "def parse_csv(filename)\n @file=CSV.read(filename)\n # Read order of headers\n headers = @file.shift\n @file.each do |line|\n next if line.length==0 || (line.length==1 && line[0]==nil)\n # Read fields from line based on headers\n value=ReturnValue.new( line[headers.index('label')],\n line[headers.index('name') || headers.index('label')],\n line[headers.index('type')],\n line[headers.index('unit')],\n line[headers.index('per_unit')],\n line[headers.index('default')] )\n @values.push value\n end\n validate\n end", "def parse_json(csv_file)\n data_frame = Daru::DataFrame.from_csv(csv_file)\n data_frame\nend", "def csv_to_array(file)\n @recipes = []\n CSV.foreach(file){|row| @recipes << Recipe.new(row[0], row[1].to_i, row[2].to_i, row[3].to_i)}\n end", "def load_csv\n CSV.foreach(@file_path) do |row|\n # Our CSV stores strings only - so we must initialize all our recipes\n recipe = Recipe.new(row[0],row[1])\n # We push them into the cookbook recipes array\n @recipes << recipe\n end\n end", "def load_csv\n options = { headers: :first_row, header_converters: :symbol }\n\n CSV.foreach(@csv_path, options) do |row|\n row[:id] = row[:id].to_i\n row[:price] = row[:price].to_i\n @elements << Meal.new(row)\n end\n @next_id = @elements.empty? ? 1 : @elements.last.id + 1\n end", "def parse_csv_file(delim, file_name) \n \n temp_array = Array.new #Create an array\n file = File.open(file_name, \"r\") #Open a file for reading\n \n \n #Iterate file, parse strings and store\n file.each_line do |line|\n temp_array.push(parse_line(delim, line))\n end\n\n #Close resource\n file.close\n \n return temp_array\nend", "def import_csv_smart\n \n end", "def parse(file_path)\n begin\n rows = CSV.read(file_path, headers: true, header_converters: :symbol, converters: [:all, :blank_to_nil])\n rescue CSV::MalformedCSVError => e\n raise \"Could not parse CSV file. Original error: #{e.message}\"\n rescue StandardError => e\n raise \"Could not load CSV file. Make sure the file has CSV headers. Original error: #{e.message}\"\n end\n @contracts = rows.collect {|row| row.to_hash }\n end", "def import_csv\n @records = CSV.read(@filename, :headers => true, :row_sep => :auto)\n unless @records.blank?\n @linenum = 0\n if @filename.index('att') || @filename.index('Att')\n @school_year = Time.parse(@records[0][\"AbsenceDate\"]).year\n end\n @records.each { |rec |\n @linenum += 1\n @record = rec\n next unless check_record(@record)\n seed_record(@record)\n process_record(@record, rec2attrs(@record)) if rec2attrs(@record) != false\n }\n end \n end", "def parse_painter_csv_file\n csv_data = CSV.read(\"db/painter_seed_data.csv\")\n csv_data.shift\n # iterate over each element and send back a hash \n # need to shift again at the beginning to get rid of id on the row\n painter_object_array = []\n csv_data.each do |painter_row_arr|\n painter_row_arr.shift\n painter_object = {\n :name => painter_row_arr[0],\n :years => painter_row_arr[1],\n :genre => painter_row_arr[2],\n :nationality => painter_row_arr[3],\n :bio => painter_row_arr[4],\n :painting_num => painter_row_arr[6],\n :portrait => painter_row_arr[7]\n }\n painter_object_array.push(painter_object) \n end\n painter_object_array.flatten\nend", "def read_data\n\t\tindex = 0\n\t\torders = []\n\t\tCSV.parse(@data_file.read()) do |row|\n\t\t\tif index == 0\n\t\t\t\t#header row\n\t\t\t\t@columns = parse_columns(row[0])\n\t\t\t\t# p @columns\n\t\t\telse\n\t\t\t\t# p row[0]\n \t\t\tdata = row[0].split(\"\\t\")\n \t\t\torders << parse_order(data) \n\t\t\tend\n \t\tindex += 1\n\t\tend\n\t\treturn orders\n\tend", "def load_csv\n CSV.foreach(@csv_file_path) do |row|\n @recipes << Recipe.new(name: row[0], description: row[1], rating: row[2], prep_time: row[3], tried: row[4])\n end\n end", "def read_in_csv_data(csv_file_name)\n begin\n CSV.foreach(csv_file_name, headers: true) do |row|\n @songs << Song.new(row['name'], row['location'])\n end\n rescue Exception\n @songs = nil\n end\n @songs\n end", "def read(string)\n lines = string.split(\"\\n\")\n header = lines[0]\n attributes = header.split(',').map! { |v| v.to_sym }\n # Struct.new('CSVEntry', *attributes)\n ret = []\n lines.drop(1).each do |line|\n values = line.split(',')\n opts = {}\n values.each_with_index do |val, idx|\n opts[attributes[idx]] = val\n end\n ret << Struct::CSVEntry.new(opts)\n end\n\n ret\n end", "def load_imported_sites\n arr = Array.new\n CSV.foreach(file.path, headers: true) do |row|\n site = Site.find_by_code(row[\"code\"]) || Site.new\n\n site.build_address if site.address.nil?\n site.build_partner if site.partner.nil?\n site.build_audit if site.audit.nil?\n\n site.attributes = row.to_hash.slice(*Site.accessible_attributes)\n\n site.address.attributes = row.to_hash.dup.inject({}) do |result, (k, v)|\n result[k.gsub(/^address_/,'')] = v if k.start_with?('address_')\n result\n end\n\n site.partner.attributes = row.to_hash.dup.inject({}) do |result, (k, v)|\n result[k.gsub(/^partner_/,'')] = v if k.start_with?('partner_')\n result\n end\n\n site.audit.attributes = row.to_hash.dup.inject({}) do |result, (k, v)|\n result[k.gsub(/^audit_/,'')] = v if k.start_with?('audit_')\n result\n end\n\n sector_attributes = row.to_hash.dup.inject({site_id: site.id}) do |result, (k, v)|\n result[k.gsub(/^sector_/,'')] = v if k.start_with?('sector_')\n result\n end\n\n s = site.sectors.where(\"site_id = ? AND code = ?\", site.id, sector_attributes[\"code\"]).first\n if s.nil?\n s = site.sectors.build(sector_attributes)\n else\n s.attributes = sector_attributes\n end\n\n antenna_attributes = row.to_hash.dup.inject({sector_id: s.id}) do |result, (k, v)|\n result[k.gsub(/^antenna_/,'')] = v if k.start_with?('antenna_')\n result\n end\n\n a = s.antennas.where(\"sector_id = ? AND id = ?\", s.id, antenna_attributes[\"id\"]).first\n if a.nil?\n s.antennas.build(antenna_attributes)\n else\n a.attributes = antenna_attributes\n end\n\n\n arr.push(site)\n end\n arr\n end", "def csv\n @csv_table ||= begin\n csv_raw = File.read(CSV_PATH)\n CSV.parse(csv_raw, headers: true)\n end\n\nend", "def load()\n\tFile.open(\"instructors.csv\", \"r\") { |f|\n\t\tdata = f.read()\n\t\treturn data\n\t}\nend", "def load_csv\n # read each line frmo csv and append to recipes collection\n CSV.foreach(@csv_file) do |row|\n # puts \"#{row[0]} | #{row[1]}\"\n @recipes << Recipe.new(name: row[0], description: row[1], cooking_time: row[2], difficulty: row[3], tested: row[4])\n end\n end", "def get_csv_data(csv_data)\r\n csv_file = nil\r\n\r\n #Get the path and name of the CSV file\r\n if csv_data.to_s.include? '.csv'\r\n csv_file = File.join(File.dirname(__FILE__), \"../venture/config/csv_data/#{csv_data}\")\r\n elsif (\r\n csv_file = File.join(File.dirname(__FILE__), \"../venture/config/csv_data/#{csv_data}.csv\")\r\n )\r\n end\r\n\r\n csv_arr = CSV.read( csv_file, {:headers => true, :header_converters => :symbol, :encoding => 'UTF-8'} )\r\n keys = csv_arr.headers.to_a\r\n # read attribute example => csv[index][:column1]\r\n return csv_arr.to_a.map {|row| Hash[ keys.zip(row) ] }\r\nend", "def initialize(csv_file_path)\n # take recipe from csv file\n @csv_file_path = csv_file_path\n @recipes = []\n parse\n end", "def load\n CSV.foreach(@csv_file, headers: :first_row, header_converters: :symbol) do |row|\n @meals << Meal.new(row)\n end\n end", "def load(contents, opts={})\n table = infer_csv_contents(contents, opts)\n return nil unless contents\n table.each do |row|\n self.add(*row)\n end\n end", "def load_file full_name\n file = FasterCSV.open( full_name , { :col_sep => \"\\t\"} ) \n @header = file.shift\n @data = file.readlines\n #puts @header\n @header.each do |col|\n #puts \"col=#{col}= mapped to =#{@mapping[col]}=\"\n end\n index = 0\n while index < @data.length\n row = @data[index]\n #puts \"row is \" + row.join(\"--\")\n @mapping.each do |key,val|\n #puts \"Row:#{val} at #{@mapping.index(val)} is --#{@header.index(@mapping.index(val))}--value---\"\n #puts \"--#{at_in(val,row)}--\" if @header.index(@mapping.index(val))\n end\n prod = get_product(row)\n set_attributes_and_image( prod , row )\n set_taxon(prod , row)\n #puts \"saving -\" + prod.description + \"- at \" + at_in(:price,row) #if at_in(:price,row) == \"0\"\n prod.save!\n throw \"no master for #{prod.name}\" if prod.master == nil \n# pr = get_product( row )\n# puts \"TAXONs #{pr.taxons}\"\n \n puts \"saved -\" + prod.description + \"- at \" + at_in(:price,row) #if at_in(:price,row) == \"0\"\n index = slurp_variants(prod , index + 1) #read variants if there are, returning the last read line\n end\n\n end", "def import(file_path)\n array = import_ori(file_path)\n counts = array.shift\n cell_counts = get_cell_counts(counts)\n array_splitted = array.map {|a| a.split(\",\")} \n array_transpose = array_splitted.transpose\n return array_splitted, array_transpose, cell_counts\n end", "def load_students(filename = \"students.csv\")\n file = File.open(filename, \"r\")\n file.readlines.each do |line|\n name, cohort, hobby, country = line.chomp.split(\",\")\n add_student_to_array(name, cohort, hobby, country)\n end\n file.close\nend", "def read_csv_file(csv_table_path)\r\n \r\n table_dimensions = detect_state_table_dim(csv_table_path)\r\n \r\n if table_dimensions==:one_d\r\n return read_1d_csv_file(csv_table_path)\r\n elsif table_dimensions==:two_d\r\n return read_2d_csv_file(csv_table_path)\r\n else\r\n raise \"Error: CSV File dimensions: #{table_dimensions}\"\r\n end # end if else \r\n \r\n end", "def tsv2array( data )\n return_data = [] \n data_by_line = data.split(\"\\n\")\n \n data_by_line.each do |d|\n intermediate = {}\n data_by_item = d.split(\"\\t\")\n for i in 0 .. ( data_by_item.size() - 1 )\n intermediate[ self.attributes[i] ] = data_by_item[i]\n end\n return_data.push( intermediate )\n end\n \n return return_data\n end", "def read_csv(file)\n reading_list = []\n CSV.foreach(file, :headers => true) do |row|\n reading_list << Book.new({\n 'book_title' => row['book_title'],\n 'isbn' => row['isbn'],\n 'description' => row['description'],\n 'read_date' => row['read_date']\n })\n end\n reading_list\nend", "def initialize \n #local variable csv will be created. It will = instance of CSV reader, drawn from \"./zipcode-db.cvs\"\n csv = CSVReader.new(\"./free-zipcode-database.csv\")\n #areas will have default value of an empty array\n @areas = []\n #I will run csv.read, which will return a hash based on a file of information.\n csv.read do |item|\n #the hash I get from csv.read will be formatted according to the Area class, and then put into the @areas array.\n @areas << Area.new(item)\n end\n end", "def read_file(path)\n struct=Struct.new(:u_id, :m_id,:rating,:time)\n puts path\n return [] if !File.exists? path\n File.open(path, \"r\") do |f|\n #splits each line by ws and convert to integer and build structures from values\n return f.each_line.map { |line| struct.new(*line.split.map {|x| x.to_i}) }\n end\n end", "def read_csv_data file\n rows = []\n readerIn = CSV.open(file, 'r')\n row = readerIn.shift\n while row!= nil && !row.empty?\n rows << row\n row = readerIn.shift\n end\n readerIn.close\n \n return rows\nend", "def readData(filename)\n\t\t@dataArray = Array.new\n\t\tfile = File.open(filename)\n\t\t\n\t\tfile.each_line do |line|\n\t\t\tarray = line.split(/,/)\n\t\t\tentry = Struct::ContactEntry.new(array[0], array[1], array[2])\n\t\t\t@dataArray.push(entry)\n\t\tend\n\t\n\t\tfile.close\n\t\t\n\tend", "def read_2d_csv_file(state_table_path) \r\n rows_read=0\r\n\t\tstate_transition_list= Array.new\r\n\t\tgrab_first_row = true\r\n too_states=Array.new\r\n row_trans_list=Array.new\r\n \r\n\t\tCSV::Reader.parse(File.open(state_table_path, 'r').read.gsub(/\\r/,\"\\n\") ) do |row_array|\r\n\t\t \r\n\t\t\t# First row should contain state names\r\n\t\t\tif grab_first_row\r\n\t\t\t\tgrab_first_row=false\r\n\t\t\t\ttoo_states = row_array\r\n\t\t\t\ttoo_states.shift\r\n\t\t\telse\r\n\t\t\t row_trans_list=row_array\r\n\t\t\t this_rows_start_state = row_trans_list.shift\r\n\t\t\t \r\n\t\t\t row_trans_list.each_index do |cell_index|\r\n\t\t\t if row_trans_list[cell_index] != nil\r\n\t\t\t # Remove leading, trailing and multiple spaces\r\n\t\t\t cell_contents=row_trans_list[cell_index].strip.squeeze(\" \")\r\n\t\t\t puts_debug(\"Cell contents: #{cell_contents}\")\r\n\t\t\t cell_contents.split(/ /).each do |an_action|\r\n\t\t\t transition = TransitionHolder.new(this_rows_start_state.to_s, an_action, too_states[cell_index].to_s)\r\n\t\t puts_debug \"Read in transition (from 2d state table): #{transition}\"\r\n\t\t\t\t # Store that transition\r\n\t\t\t\t state_transition_list.push transition\r\n\t\t end # end each\r\n\r\n\t\t\t end # if nil\r\n\t\t\t end # end each index\r\n\t\t\t \r\n\t\t\tend # if first row\r\n\t\t\trows_read +=1\r\n\t\tend # end csv block\r\n\r\n raise \"CSV File Empty\" if rows_read==0\r\n raise \"Missing Data in CSV File\" if rows_read==1\r\n \r\n\t\t# return state table, its a raw list of transition objects\r\n\t\treturn state_transition_list\r\n end", "def load(io)\r\n data = parse(io.read)\r\n \r\n if rows\r\n data = data[rows]\r\n end\r\n \r\n if columns\r\n data.collect! do |cols|\r\n cols[columns]\r\n end\r\n end\r\n \r\n data\r\n end", "def parseCSV(csvfile)\n begin\n if csvfile != nil\n file_ext = File.extname(csvfile.original_filename)\n if file_ext == \".csv\"\n content = File.read(csvfile.tempfile)\n arr_of_arrs = CSV.parse(content)\n return arr_of_arrs, 0\n else\n return nil, 4\n end\n else\n return nil, 1\n end\n rescue ArgumentError\n return nil, 2\n rescue CSV::MalformedCSVError\n return nil, 3\n end\n end", "def parse_imports(params)\n data = params[:rawdata]\n rows = data.split(/[\\n\\r]+/)\n rowsandcolumns = []\n\n\n rows.each do |row|\n columns = row.split(\"\\t\")\n rowsandcolumns.push columns\n end\n\n @data = rowsandcolumns\n end", "def load\n arr = []\n begin\n while(!@file.eof?)\n line = @file.readline.chomp\n arr.concat(line.split)\n end\n ensure\n @file.close\n end\n arr\n end", "def _parse_file_using_import(file, layout, model)\n attributes = {}\n count = 0\n value_sets = []\n column_names = model.columns.map{ |column| column.name }\n not_nces_fields = column_names.select { |name| name[/id/] }\n field_names = column_names - not_nces_fields\n options = { :validate => false }\n mstate_index = field_names.index(\"MSTATE\")\n while (line = file.gets) do\n next if line.strip == ''\n values = []\n layout.each do |label, start_pos, end_pos, length, data_type, description|\n data_str = line[(start_pos-1)..(end_pos-1)].strip.gsub(/[^[:print:]]/, '')\n data_value = case data_type\n when 'N'\n data_str.to_i\n when 'D'\n data_str.to_f\n else\n data_str\n end\n values << data_value\n end\n if @states_and_provinces\n if @states_and_provinces.include?(values[mstate_index])\n value_sets << values\n end\n else\n value_sets << values\n end\n if value_sets.length >= 10\n records = model.import(field_names, value_sets, options)\n value_sets = values = []\n end\n count += 1\n if count % 500 == 0\n print '.'\n STDOUT.flush\n end\n end\n if value_sets.length > 0\n model.import(field_names, value_sets, options)\n end\n puts \"\\n#{count} records processed from #{file.path}\"\n end", "def csv_content(filename)\n CSV.parse(@contents[filename].force_encoding('UTF-8'), headers: true, quote_char: '\"', col_sep: ', ').collect do |row|\n OpenStruct.new(row.to_h)\n end\n end", "def load_report(path)\n plain_data = CSV.parse(File.read(path))\n # PP.pp plain_data, $stderr\n csv_data = []\n # do some debug logging of csv_data\n\n plain_data.each do |row|\n csv_data_row = {}\n row.each_with_index do |column,index|\n csv_data_row[@columns[index]] = column\n end\n if csv_data_row.has_key?('idx')\n csv_data.push csv_data_row\n end\n end\n csv_data\nend", "def csv_parsed\n transform_to_hash(@csv_array, @header)\n end", "def rows\n csv.rows.map { |row_array|\n Row.new(header: header, row_array: row_array).to_a\n }\n end", "def read_from_tsv(tsv)\n # First read in the data from the file\n movies = Array.new\n tsv.parse do |row|\n # Check the conditions before creating the object. That is, ensure the entry is both a movie and not an adult film.\n if row[@tsv_columns[:type]] == \"movie\" && row[@tsv_columns[:adult]] == '0'\n # Store the information about the movie into a movie object, and add it to the array to be later imported\n movie = Movie.new\n movie.title = row[@tsv_columns[:title]]\n movie.year = row[@tsv_columns[:year]]\n movie.runtime = row[@tsv_columns[:runtime]]\n movie.genres = row[@tsv_columns[:genres]].chomp\n movies << movie\n end\n end\n # Return the list of movies\n movies\n\nend", "def readCSV(filename)\n resultArray = Array.new\n\n # read csv file\n File.open(filename) { |file|\n while line = file.gets\n row = CSV.parse_line( Kconv::kconv(line, Kconv::UTF8, Kconv::SJIS) )\n resultArray.push( row )\n end\n }\n\n return resultArray\nend", "def create_league(csv)\n league = []\n CSV.foreach(csv, headers: true, header_converters: :symbol) do |row|\n hash = Hash[row]\n league << hash\n end\n league\n\nend", "def parseCSV(csvfile)\n begin\n if csvfile != nil && csvfile != \"\"\n file_ext = File.extname(csvfile.original_filename)\n if file_ext == \".csv\"\n content = File.read(csvfile.tempfile)\n arr_of_arrs = CSV.parse(content)\n return arr_of_arrs, 0\n else\n return nil, 4\n end\n else\n return nil, 1\n end\n rescue ArgumentError\n return nil, 2\n rescue CSV::MalformedCSVError\n return nil, 3\n end\n end", "def load_students (filename = \"students.csv\")\n #open the filename or students.csv as default\n File.open(filename, \"r\") do |file|\n #iterate over each line in the file\n file.readlines.each do |line|\n #split at the comma and parallel assign name to the first value, cohort to the second\n name, cohort = line.chomp.split(\",\")\n #create a hash and push to the @students array using method\n @students << {name: name, cohort: cohort}\n end\n end\nend", "def parse_csv(csv)\n objects = CSV.parse(csv)\n headers = objects.shift\n objects.to_a.map! { |row| Hash[headers.zip(row)] }\n end", "def load_file(f)\n\t\tdata = []\n f.each do |line| \n user_id, movie_id, rating, timestamp = line.split(\"\\t\")\n data.push({\"user_id\"=> user_id.to_i, \"movie_id\"=>movie_id.to_i,\"rating\"=> rating.to_i,\"timestamp\"=>timestamp.to_i})\n\t\tend\n\t\treturn data\n\tend", "def read_csv_numeric_dataset(file)\r\n dataset = []\r\n File.readlines(file).each do |line|\r\n if !(line.empty?) \r\n vector = []\r\n fields = line.split(\",\")\r\n response = fields.pop\r\n fields.each do |value|\r\n vector.push(value.to_f)\r\n end\r\n vector.push(response.strip)\r\n dataset.push(vector)\r\n end\r\n end\r\n return dataset\r\nend", "def get_data(file_name)\n @all_data=[]\n\n CSV.foreach(file_name, :headers => true) do |row|\n first=row[\"first_name\"]\n last=row[\"last_name\"]\n position=(row[\"position\"]).tr(\" \",\"_\")\n team=(row[\"team\"]).tr(\" \",\"_\")\n\n @all_data.push( {:Team => team, :First_Name => first, :Last_Name => last, :Position => position} )\n end\n @all_data\nend", "def create_item_rows_from_csv \n item_rows = []\n CSV.foreach('./data/items.csv', headers: true, header_converters: :symbol) do |row|\n item_rows << row\n end \n return item_rows\n end", "def get_csv_data(csv_file)\n\t\tcsv_file = File.read(csv_file)\n\t\tcsv = CSV.parse(csv_file, :headers => true)\t\n\t\tcsv\n\tend", "def load_file (filename)\n @name = nil\n File.open(filename, mode: 'r').each do |ln|\n flds = ln.split(',')\n if !@name\n @name = flds[0]\n end\n dts = flds[1];\n @obvs << \"#{dts[2..3]}-#{dts[4..5]}-#{dts[6..7]}\"\n @values << flds[2].to_f\n end\n #puts \"load_file: #{@values.size}\"\n end", "def import_from_csv(file_name)\r\n #implementation goes here\r\n csv_text = File.read(file_name)\r\n csv = CSV.parse(csv_text, headers: true, skip_blanks: true)\r\n # #8 iterate over table rows, create hash for each, then convert to Entry using 'add_entry' method\r\n csv.each do |row|\r\n row_hash = row.to_hash\r\n add_entry(row_hash[\"name\"], row_hash[\"phone_number\"], row_hash[\"email\"])\r\n end #end csv.each loop\r\n end", "def attribute_data_from_parsed_file\n\n @username = @parsed_data[:userdata][:username]\n @charity_coins = (@parsed_data[:userdata][:charity_coins]).to_i\n @budget = (@parsed_data[:userdata][:budget]).to_i\n\n #this create and push all the charity_causes into the good_causes_array\n @parsed_data[:charity_causes].each do |charity_causes_hash| \n @good_causes_array << CharityCause.new(\n charity_causes_hash[:id], \n charity_causes_hash[:area], \n charity_causes_hash[:country], \n charity_causes_hash[:category], \n charity_causes_hash[:description],\n charity_causes_hash[:charity_name], \n charity_causes_hash[:cost].to_i, \n charity_causes_hash[:completed],\n charity_causes_hash[:presentation])\n end\n\n end", "def from_csv(filename)\n @successes = []\n @problems = []\n @unfound_vita_partners = []\n\n @headers = CSV.foreach(filename).first\n return unless headers_aligned? == true\n\n data = CSV.read(filename, headers: true)\n\n state_routing_pairs = generate_state_routing_pairs(data)\n\n create_records_for_state_routing_pairs(state_routing_pairs)\n\n print_script_messages\n true\n end", "def read_csv_data_from_file(full_file_path)\n data = []\n CSV.open(full_file_path, \"r\") do |csv|\n data = csv.readlines\n end\n data\n end", "def parse_csv\n if self.csv_file.present?\n csv_text = Paperclip.io_adapters.for(self.csv_file).read\n csv = CSV.parse(csv_text, :headers => false)\n\n csv_columns = ['l', 'r', 'units']\n\n csv_to_save = {}\n\n csv.each_with_index do |row, i|\n if i == 0\n csv_to_save['weight'] = row[1].split(':')[1] # string is like Weight:201, only want the number\n csv_to_save['shoe_size'] = row[2].split(':')[1] # string is like Shoe Size:9\n elsif i >= 3\n row.each_with_index do |field, j|\n if j >= 1 and !field.blank?\n csv_to_save[generate_csv_row_key(csv_columns, row, i, j)] = field\n end\n end\n end\n end\n\n # Check to see if any of the fields are nil, then we must have not received the correct file\n is_clean = true\n csv_to_save.each do |key, val|\n if val.nil?\n is_clean = false\n break\n end\n end\n\n CsvFile.create!(csv_to_save) if is_clean\n end\n end", "def parse_csv(csv_file)\r\n\t\t\t# Fixed errors due to a Byte-Order-Mark (BOM) at the very beginning of some CSV files\r\n\t\t\t# http://stackoverflow.com/questions/23011713/illegal-quoting-error-with-ruby-csv-parsing\r\n\t\t\tparsed_csv = []\r\n\t\t\tbegin\r\n\t\t \t\tparsed_csv = CSV.read(csv_file, :encoding => 'bom|utf-8')\r\n\t\t\trescue ArgumentError\r\n\t\t \t\tbegin\r\n\t\t \t\tparsed_csv = CSV.read(csv_file, :encoding => 'bom|utf-8:ISO-8859-1')\r\n\t\t \t\trescue ArgumentError\r\n\t\t \t\traise ParserError, \"There was an error in reading the CSV encoding.\"\r\n\t\t\t\tend\r\n\t\t\tend\r\n\t\t\treturn parsed_csv\r\n\t\tend", "def array_of_articles\n articles = []\n #binding.pry\n CSV.foreach('articles.csv', headers: true) do |row|\n articles << Article.new(row[\"id\"], row[\"title\"], row[\"description\"], row[\"url\"])\n end\n articles\nend", "def entries( rows )\n rows.split(\"\\n\").map do |line|\n row = line.split\n OpenStruct.new(\n :creation_date => row[0],\n :card_state => row[1],\n :card_estimate_total => row[2],\n :card_to_do_total => row[3]\n )\n end\nend", "def process\n validate_file_type(@file_name, 'csv')\n convert_csv_file_to_object\n end", "def parse_data(file_name)\n @file = CSV.foreach(file_name, headers: true, header_converters: :symbol).collect { |row| Delivery.new(row) }\n end", "def csv_row\n #empty by default\n []\n end", "def csv_row\n #empty by default\n []\n end", "def read_csv(file_path)\n CSV.parse(File.read(file_path), headers: true)\nend", "def parse_csv\n i=0\n output_matrix = []\n trim_return_carriage(fulltext).each_line do |line|\n 5.times { |i| avoid_commas_in_special_strings(line) }\n output_matrix << trim_line_ends(line).split(delimiter) unless i == 0\n i+=1\n end\n output_matrix.each do |rec|\n temp_hsh = {}\n (0..rec.size-1).each do |i|\n temp_hsh.merge! object_attributes[i] => rec[i]\n end\n @output_table_object << temp_hsh\n end\n\n output_table_object\n end" ]
[ "0.68302494", "0.673602", "0.6607786", "0.659163", "0.6573549", "0.6573456", "0.65718514", "0.6570866", "0.6569528", "0.65678114", "0.65153396", "0.65033907", "0.6465346", "0.6458263", "0.6405393", "0.6377711", "0.6369217", "0.63432074", "0.6327245", "0.6321517", "0.6298861", "0.6295208", "0.6274616", "0.6230015", "0.62238014", "0.6223418", "0.6222677", "0.621183", "0.62082475", "0.61934465", "0.6174625", "0.61700094", "0.6160997", "0.6144625", "0.6114866", "0.61021805", "0.6087636", "0.6074288", "0.60685897", "0.6028751", "0.6018695", "0.601657", "0.601355", "0.5996622", "0.5995616", "0.59903973", "0.5971763", "0.59680384", "0.5959216", "0.59577304", "0.59290665", "0.59181607", "0.5906099", "0.59037197", "0.5902635", "0.59018725", "0.5883866", "0.5864501", "0.58631724", "0.58470154", "0.5846421", "0.58310103", "0.58280027", "0.58264065", "0.58188105", "0.580449", "0.5795365", "0.57945263", "0.578569", "0.5777567", "0.5776547", "0.57749665", "0.57746077", "0.5771261", "0.5753393", "0.5751913", "0.57430804", "0.5729307", "0.5726632", "0.57218087", "0.57146126", "0.5713123", "0.5709735", "0.57072836", "0.57045376", "0.5699752", "0.5694365", "0.5681909", "0.5681587", "0.5674832", "0.5671226", "0.56696206", "0.5663076", "0.5658201", "0.56545466", "0.56502384", "0.5647145", "0.5647145", "0.56385356", "0.5636831" ]
0.76938415
0
returns array of children
def findChildren (parent, structure) #search for items in structure where item.manager = parent children = [] #puts parent structure.each do |employee| #puts '> ' + employee.join(', ') if employee[2].eql? parent #puts 'got it!' children << employee end end return children end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def get_children\n return children\n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def children\n []\n end", "def children\n unless defined? @children\n @children = Array.new\n end\n return @children\n end", "def children\n Array.new\n end", "def children\n []\n end", "def get_children\n return @children\n end", "def children\n result = []\n @children.each do |_, child_group|\n result.concat(child_group)\n end\n\n result\n end", "def children\n _children\n end", "def children\n @children ||= []\n end", "def children\n []\n end", "def children_get()\n @children\n end", "def get_children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def children\n kids = []\n each_child { |kid| kids << kid }\n kids\n end", "def get_children\n \t@children\n end", "def children\n @children\n end", "def children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def _children\n @children\n end", "def children\n entries\n end", "def children\n self.class.children(self) \n end", "def children\n children_tree.values\n end", "def children\n children_tree.values\n end", "def children\n\t\treturn children_of @current_node\n\tend", "def get_children()\n return @space.get_children()\n end", "def children; []; end", "def children\n elements = []\n\n %x{\n var children = #@native.children;\n for(var i = 0; i < children.length; i++) {\n elements[i] = #{Element.new(`children[i]`)};\n }\n }\n\n elements\n end", "def children\n rows\n end", "def children\n node.children\n end", "def children\n children = []\n\n unless leaf?\n zipper = down\n children << zipper\n\n until zipper.last?\n zipper = zipper.next\n children << zipper\n end\n end\n\n children\n end", "def get_children_array\n\t\t\tarr = []\n\t\t\tself.children.get_active.each do |child_1|\n\t\t\t\tarr << {menu: child_1, class: 'parent'}\n\t\t\t\tchild_1.children.get_active.each do |child_2|\n\t\t\t\t\tarr << {menu: child_2, class: 'child'}\n\t\t\t\tend\n\t\t\tend\n\t\t\tarr\n\t\tend", "def children() []; end", "def children\n if no_child?\n []\n else\n [ body ]\n end\n end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def children; end", "def grand_children\n []\n end", "def children\n attributes.fetch(:children)\n end", "def children\n ary = normal_children.dup\n ary << fallback_child if fallback_child\n ary\n end", "def children()\r\n raise \"get_children is not implemented for class #{self.class}\"\r\n end", "def children\n self.node.children.collect(&:content)\n end", "def children\n [] if leaf?\n self.class.where('forestify_left_position > ?', self.forestify_left_position).where('forestify_right_position < ?', self.forestify_right_position)\n end", "def children\n res = []\n @board.rows.each_with_index do |row, x|\n row.each_with_index { |item, y| res << [x,y] }\n end\n res\n end", "def children\n\t\treturn self.search( :one, '(objectClass=*)' )\n\tend", "def children\n @ref.children.to_ruby\n end", "def descendants\n children + children.map(&:children).flatten\n end", "def children\n raise NotImplementedError\n end", "def children\n rows + tags\n end", "def children\n @children ||= {}.with_indifferent_access\n end", "def all_children\n children(all: true)\n end", "def get_childs\n childs = Category.any_in(parent_ids: [parent.id])\n\n results = Array.new\n childs.each do |child|\n results << child\n end\n\n results\n end", "def values\n @children\n end", "def children()\n bag.ls(path).map { |pat| bag.get(pat) }.compact\n end", "def children\n @resource.children\n end", "def children\n [@before, @mid, @after].compact\n end", "def children\n [@before, @mid, @after].compact\n end", "def children\n \n TapirLogger.instance.log \"Finding children for #{self}\"\n children = []\n EntityMapping.all.each do |mapping| \n\n # Go through each associated entity mapping, and find mappings where the parent_id is us\n # which means that the child_id is some other entity, and it's a child\n \n # the to_s is important, otherwise self.id returns a :Moped::BSON::ObjectID\n children << mapping.get_child if mapping.parent_id == self.id.to_s\n\n # TODO - what happens if parent_id and child_id are the same. We'll\n # end up grabbing it. Could that break any assumptions?\n end\n \n children\n end", "def children\n properties \n end", "def children\n EarLogger.instance.log \"Finding children for #{self}\"\n ObjectManager.instance.find_children(self.id, self.class.to_s)\n end", "def getChildren\n begin\n elementObject = waitForObject(@symbolicName, OBJECT_WAIT_TIMEOUT)\n children = Squish::Object.children(elementObject)\n return children\n rescue Exception => e\n\t Log.TestFail(\"#{self.class.name}::#{__method__}(): Failed to get children for #{@name}: #{e.message}\")\n return nil\n end\n end", "def children\n children = []\n children << up_child unless up_child.nil?\n children << down_child unless down_child.nil?\n children << left_child unless left_child.nil?\n children << right_child unless right_child.nil?\n children\n end", "def children\n self.class.where('? = ANY(parent_ids)', id.to_s)\n end", "def children_names; @children.keys; end", "def children\n children_nodes = Array.new\n i = 0\n while i < self.board.rows.length\n j = 0\n while j < self.board.rows.length\n if self.board.empty?([i,j])\n duped_board = self.board.dup\n duped_board.[]=([i,j],self.next_mover_mark) \n duped_node = self.class.new(duped_board,self.alternate_mark,[i,j])\n children_nodes << duped_node\n end\n j += 1\n end\n i += 1\n end\n return children_nodes\n end", "def descendants\n children + children.map(&:descendants).flatten\n end", "def children\n return @children if !@children.nil?\n @children = all_children.find_all{|collection| collection.url.count('/') == self.url.count('/') + 1}\n end", "def children\n @root.children & @initial_contents\n end", "def children()\n #Ressource.filter(:parent_id => self.id, :parent_service_id => self.service_id).all\n end", "def descendants\n children.inject([]) { |m,child|\n m << child\n m += child.descendants\n }\n end", "def descendents\n\n\t\t #children.preload(:parent).each do |child| child.descendents end\n\t\t children.each do |child|\n\t [child] + child.descendents\n\t end\n end", "def children\n list = NodeSet.new(document)\n document.decorate(list)\n\n first = self.child\n return list unless first # Empty list\n\n list << first unless first.blank?\n while first = first.next\n list << first unless first.blank?\n end\n list\n end", "def get_children(pi)\n response = Net::HTTP.get_response URI.parse(URI.escape(SERVICE_DCMDB + \"work/\" + pi + \"/children\"))\n children = Array.new\n case response\n when Net::HTTPSuccess\n doc = Document.new(response.body)\n XPath.each(doc, \"//workpid\") { |el|\n children.push(el.text)\n } \n end\n\n return children\n\n end", "def children\n self.class.find(:all, \n :select => \"a.*\",\n :joins => \"a join #{self.class.bridge_class.table_name} b on a.id = b.#{self.class.parent_foreign_key}\", \n :conditions => [\"b.#{self.class.child_foreign_key} = ? and b.#{self.class.levels_from_parent} = 1\", self.id])\n end", "def all_children\n find_all_children_with_dotted_ids\n end", "def children\n child_objects(Dependency)\n end", "def children\n child_array = []\n board.rows.each_index do |row|\n board.rows[row].each_index do |col|\n pos = [row, col]\n if board[pos].nil?\n new_board = board.dup\n new_board[pos] = next_mover_mark\n child_array << self.class.new(new_board, switch_mark(next_mover_mark), pos)\n end\n end\n end\n child_array\n end", "def children\n tree_search_class.where(tree_parent_id_field => self._id).sort(self.class.tree_sort_order()).all\n end", "def to_array\n children.each_with_object( [ self ] ) { |child, memo|\n memo.concat( child.to_array )\n }.flatten\n end", "def children\n dataset.nested.filter(self.class.qualified_parent_column => self.id)\n end", "def all_children\n @all_children ||= children + children.inject([]) {|records, child| records + child.all_children}\n end", "def children\n self.class.find(:all, :conditions => \"#{acts_as_nested_set_options[:scope]} AND #{acts_as_nested_set_options[:parent_column]} = #{self.id}\", :order => acts_as_nested_set_options[:left_column])\n end", "def map_child\n array = []\n @children.each_pair { |_, child| array << (yield child) }\n array\n end", "def children\n list = Array.new\n (0..2).each do |x|\n (0..2).each do |y|\n pos = [x,y]\n list << create_node(pos) if @board.empty?(pos)\n end\n end\n return list\n end", "def children\n (items + collections)\n end", "def getAllChildren\n children = Tree.where(\"tree_type_id = ? AND version_id = ? AND subject_id = ? AND grade_band_id = ? AND code like ?\", tree_type_id, version_id, subject_id, grade_band_id, code+'.%')\n Rails.logger.debug(\"*** tree children: #{children.inspect}\")\n return children\n end" ]
[ "0.8727291", "0.8715515", "0.8715515", "0.8684842", "0.8684842", "0.8684842", "0.86330944", "0.86246854", "0.8581901", "0.8515485", "0.8479984", "0.84476614", "0.83356273", "0.8330258", "0.82925564", "0.8259395", "0.82534695", "0.8235405", "0.82339305", "0.8206533", "0.816763", "0.816763", "0.8165246", "0.8165246", "0.8165246", "0.8165246", "0.8144987", "0.80894274", "0.80576086", "0.80576086", "0.7970492", "0.79371804", "0.7925177", "0.79208815", "0.79182154", "0.7914552", "0.79136425", "0.7903677", "0.7867031", "0.78560126", "0.7836148", "0.7836148", "0.7836148", "0.7836148", "0.7836148", "0.7836148", "0.7836148", "0.7836148", "0.7836148", "0.7836148", "0.7836148", "0.7836148", "0.78049946", "0.7785987", "0.7782425", "0.7771295", "0.7765973", "0.7742778", "0.770783", "0.7682166", "0.76616144", "0.7612646", "0.76119787", "0.7605147", "0.75979674", "0.7572665", "0.75598997", "0.7552084", "0.75497264", "0.7549615", "0.7525938", "0.7525938", "0.75122964", "0.7476613", "0.74741197", "0.74698746", "0.7429039", "0.7424812", "0.73989004", "0.7388359", "0.7387528", "0.7384873", "0.7361828", "0.7359721", "0.7340609", "0.73356277", "0.73268616", "0.7316892", "0.73131996", "0.73109055", "0.7304467", "0.72944266", "0.7285031", "0.7268749", "0.72680545", "0.7262303", "0.72566813", "0.72263485", "0.72182435", "0.72153836", "0.7213806" ]
0.0
-1
Checks MRN number to see if we have seen patient before MRN is a life time ID for FH
def new_patient?(patient) return Patient.find_by_mrn(patient.mrn).nil? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ldr07_invalid?\n return true unless leader\n leader[7] !~ /[abcdims]/\n end", "def mnf?\n\t\tgame = Game.find(game_id)\n\t\t(game.game_time.to_datetime.utc - 4.hours).monday? ? true : false\n\t\t# removing four hours so that SNF games don't show up as MNF games\n\t\t# which they would in utc time\n\tend", "def ldr06_invalid?\n return true unless leader\n leader[6] !~ /[acdefgijkmoprt]/\n end", "def aleph_cr_record?\n if @record.eds_accession_number.present? &&\n @record.eds_accession_number.start_with?('mitcr.')\n true\n else\n false\n end\n end", "def aleph_record?\n if @record.eds_accession_number.present? &&\n @record.eds_accession_number.start_with?('mit.')\n true\n else\n false\n end\n end", "def remind?\n DateTime.now < dt\n end", "def check_history_collision\n # puoi rientarre nello stesso momento in cui sei uscito\n # puoi uscire nello stesso momento in cui sei entrato\n if self.profile.punches\n .where('(punches.arrival <= ? AND punches.departure > ?) OR (punches.arrival < ? AND punches.departure >= ?)', self.arrival, self.arrival, self.departure, self.departure)\n .where('punches.id != ?', self.id || 0).any?\n self.errors.add(:base, \"Si interseca con altre entrate. Controllare le presenze incomplete dello studente.\")\n return false\n end\n true\n end", "def femme?\n identified? && sexe == 'F'\n end", "def check_for_relapsed_internal_date\n if user.last_internal_date && internal_date < (user.last_internal_date - 1.hour)\n Log.librato(:count, \"system.process_uid.relapsed_internal_date\", 1)\n user_thread.update_user(:last_uid => uid)\n return false\n else\n return true\n end\n end", "def lost?\n @life <=0\n end", "def should_patient_go_lab_examination_at_followup?\n first_dispensation = Encounter.joins(:type).where(\n 'encounter_type.name = ? AND encounter.patient_id = ? AND encounter.program_id = ?',\n DISPENSING,\n @patient.patient_id,\n @program.program_id\n ).order(encounter_datetime: :asc).first\n\n begin\n first_dispensation_date = first_dispensation.encounter_datetime\n number_of_days = (Time.current.to_date - first_dispensation_date.to_date).to_i\n (number_of_days == 56 || number_of_days == 84 || number_of_days == 140 || number_of_days == 168)\n rescue StandardError\n false\n end\n end", "def check_for_really_old_internal_date\n if internal_date < 4.days.ago\n Log.librato(:count, \"system.process_uid.really_old_internal_date\", 1)\n user_thread.update_user(:last_uid => nil, :last_uid_validity => nil)\n user_thread.stop!\n return false\n else\n return true\n end\n end", "def check_id\n gene_id_format = Regexp.new(/A[Tt]\\d[Gg]\\d\\d\\d\\d\\d/)\n return false if gene_id_format.match(@gene_id).nil?\n end", "def test_find_phantom_mrn_filter\n # add an MRN\n site = defaults.registration.participant.participant_medical_identifiers.first.site\n @pnt.add_mrn(site, Jinx::UID.generate.to_s)\n # save the patient\n verify_save(@pnt)\n # fetch the saved patient\n svd = @pnt.copy(:identifier)\n svd.find\n # the phantom PMI should be removed\n phantom = @pnt.participant_medical_identifiers.detect { |pmi| pmi.medical_record_number.nil? }\n assert_nil(phantom, \"#{svd} phantom PMI #{phantom} was not filtered out\")\n end", "def check_hours\n if @recorder.current_recording_hours >= @rec_show.req_recording_hours\n return true\n end\n false\n end", "def male?\n sequence_number.odd?\n end", "def eid_authed?\n !session[:eid].blank?\n end", "def fate\n n = friends\n @alive ? ( n >= OVERCROWDED || n <= LONELY) : FERTILE.include?(n)\n end", "def valid_proof?(last_proof, proof)\n Digest::MD5.hexdigest(\"#{last_proof}#{proof}\".encode)[0..3] == \"0000\"\n end", "def female?\n sequence_number.even?\n end", "def verification_token_valid?\n (self.verification_sent_at + 4.hours) > Time.now.utc\n end", "def future_expense_checker (record)\n\t\tdate = record.date_incurred\n \ttime = date.to_time\n \ttime.future?\n end", "def is_dead?\n is_dead = !death_event.nil?\n if (!is_dead)\n date_was_born = earliest_known_birthdate\n is_dead = (!date_was_born.nil? && date_was_born < (120.years.ago).to_date)\n end\n return is_dead\n end", "def check?\n @last_time < @check_time - 100\n end", "def date_of_birth_error_present?\n wait_for(5) { displayed?(DATE_OF_BIRTH_ERROR) }\n end", "def check_uid_validity!\n imap_uid_validity = @imap.get_uid_validity(@mailbox)\n\n if imap_uid_validity != @mailbox.uid_validity\n # empty the local cache of that mailbox\n @mailbox.messages.destroy_all\n\n # set the UIDVALIDITY\n @mailbox.uid_validity = imap_uid_validity\n @mailbox.update_attribute(:uid_validity, imap_uid_validity)\n end\n end", "def valid_id_number; end", "def munchlax?(id)\n tid = $trainer.id\n return ((tid & 0xFF) % COUNT) == 0 ||\n ((tid >> 8 & 0xFF) % COUNT) == 0 ||\n ((tid >> 16 & 0xFF) % COUNT) == 0 ||\n ((tid >> 24 & 0xFF) % COUNT) == 0\n end", "def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end", "def was_seen!\n update_attribute(:last_seen_at, Time.now) if valid? && (last_seen_at.nil? || last_seen_at < 1.hour.ago)\n end", "def old?\n # they specifically told us via chatops that they were done, so they\n # probably don't mean this one\n return true if chat_end\n\n # the incident is still open in the external incident source, so they\n # probably mean this one\n return false if open?\n\n return true if !timeline_entries.empty? && timeline_entries.last.timestamp < 1.hour.ago\n return true if timeline_entries.empty? && chat_start? && chat_start < 1.hour.ago\n\n false\n end", "def seq_number?\n @seq_number > NO_SEQ_NUMBER\n end", "def deadline_in(month_number)\n month = Time.at(self.deadline).mon\n if (month == month_number)\n return true\n else\n return false\n end\n end", "def unique_number\n _discipline = Discipline.find(discipline_id)\n if number_issuer.association? && RaceNumber.rental?(value, _discipline)\n errors.add(\"value\", \"#{value} is a rental number. #{RacingAssociation.current.short_name} rental numbers: #{RacingAssociation.current.rental_numbers}\")\n person.errors.add(\"value\", \"#{value} is a rental number. #{RacingAssociation.current.short_name} rental numbers: #{RacingAssociation.current.rental_numbers}\")\n return false\n end\n\n return true if person.nil?\n\n if new_record?\n existing_numbers = RaceNumber\n .where(value: value, discipline_id: discipline_id, number_issuer_id: number_issuer_id, year: year, person_id: person_id)\n .count\n else\n existing_numbers = RaceNumber\n .where(value: value, discipline_id: discipline_id, number_issuer_id: number_issuer_id, year: year, person_id: person_id)\n .where.not(id: id)\n .count\n end\n\n unless existing_numbers == 0\n person_id = person.id\n errors.add(\"value\", \"Number '#{value}' can't be used for #{person.name}. Already used as #{year} #{number_issuer.name} #{discipline.name.downcase} number.\")\n person.errors.add(\"value\", \"Number '#{value}' can't be used for #{person.name}. Already used as #{year} #{number_issuer.name} #{discipline.name.downcase} number.\")\n if existing_numbers.size > 1\n logger.warn(\"Race number '#{value}' found #{existing_numbers} times for discipline #{discipline_id}, number issuer #{number_issuer_id}, year #{year}, person #{person_id}\")\n end\n false\n end\n end", "def missing_one_at_either_end\n [2,3].each { |i|\n return true if @counts[i]>0 && @counts[i+1]>0 && @counts[i+2]>0\n }\n return false\n end", "def passed_sex_offender_check?\n return false if sex_offender_check_result.nil?\n valid_length = Customer.current_customer.background_check_validity_length || 0\n return true if valid_length < 0\n return false if (sex_offender_check_run_at.nil? || sex_offender_check_run_at < valid_length.days.ago)\n sex_offender_check_result.include?(\"OK\") || sex_offender_check_result.include?(\"NO RECORD FOUND\")\n end", "def token_valid?\n @session_token and @toodle_token_death > Time.now\n end", "def overdue?\n !self.attempt_next_contact_by.nil? && self.attempt_next_contact_by < Time.current\n end", "def staff_initiated?\n self.from_phone == self.ride_zone.phone_number_normalized\n end", "def military_person?\n title38_status == 'V3' || title38_status == 'V6'\n end", "def patient_is_under_five?\n person = Person.find_by(person_id: @patient.patient_id)\n ((Time.zone.now - person.birthdate.to_time) / 1.year.seconds).floor < UNDER_FIVE_AGE_LIMIT\n end", "def check_age\n if @recorder.age >= @rec_show.req_age\n return true\n end\n false\n end", "def valid?\n return false if !@tracking_number.nil? && @tracking_number.to_s.length < 1\n true\n end", "def death_state_id\r\n return 1\r\n end", "def isDateDuplicated?(date)\n # binding.pry\n self.user_times.none?{ |day_time| day_time.clock_in.to_s.slice(8, 2) == date }\n # binding.pry \n end", "def direction_touching_number?\n return false unless @confirmed[:street_direction] && @confirmed[:street_number]\n\n @confirmed[:street_direction].min - 1 == @confirmed[:street_number].max\n end", "def new_born\n !alive && neighbours_living.count == 3\n end", "def valid_participant\r\n\t if not Participant.find_by(participantID: participantID)\r\n\t \terrors.add(:participantID, 'is not valid. Please enter a valid ID (8 characters)')\r\n\t end\r\n\tend", "def known_invalid_idref(mapkey, oldid)\n\treturn false;\n\t# \treturn ( ((mapkey==:version or mapkey==:fixfor) and oldid==21907 or oldid==21881 or oldid==21743) or\n\t# \t\t\t(mapkey==:version and (oldid==21240 or oldid==21743)) or \n\t# \t\t\t(mapkey==:issuestatus and (oldid==2 or oldid==-3)) or\n\t# \t\t\t(mapkey==:resolution and oldid==6)\n\t# \t )\nend", "def update_indicated?(marc_record, hyacinth_record)\n marc_005_last_modified = marc_record['005'].value\n hyc_005_last_modified = hyacinth_record['dynamic_field_data'].key?('marc_005_last_modified') ?\n hyacinth_record['dynamic_field_data']['marc_005_last_modified'].first['marc_005_last_modified_value'] : nil\n hyc_005_last_modified.nil? || marc_005_last_modified != hyc_005_last_modified\n end", "def timestamp?\n !!(self =~ /^Rel\\d\\d\\d\\d\\d\\d\\d\\d$/ ||\n self =~ /^\\w\\w\\w?_\\d\\d\\d\\d_\\d\\d_\\d\\d_\\d\\d_\\d\\d$/)\n end", "def probably_dead?\n self.date_of_death.present? ||\n (self.date_of_birth.present? &&\n Date.today.year - self.birth_date.year > 90)\n end", "def evocations?\n\n\t !evocations('n08112402').nil?\n\n\tend", "def recovered?\n date = self.arrival_date\n rec_date = self.recovery_date\n if rec_date == nil\n \"Not Recovered\"\n elsif date > rec_date\n \"Not Recovered\"\n else\n a = Date.parse(\"#{date}\")\n b = Date.parse(\"#{rec_date }\")\n c = b.mjd - a.mjd\n \"#{rec_date.month}/#{rec_date.day}/#{rec_date.year} | #{c} day\"\n end\n end", "def journal_magazine_periodical?\n marc_leader_06_match = record.leader.byteslice(6) == 'a'\n marc_leader_07_match = %w[b i s].include?(record.leader.byteslice(7))\n marc_008_21_match = record.fields('008').find do |field|\n !%w[d n w].include?(field.value.byteslice(21))\n end\n\n marc_006_match = record.fields('006').find do |field|\n field.value.byteslice(0) == 's' &&\n !%w[d n w].include?(field.value.byteslice(4))\n end\n\n return true if (marc_leader_06_match &&\n marc_leader_07_match &&\n marc_008_21_match) ||\n marc_006_match\n end", "def presence_of_hospital_no\n\t\tif hospital_no.blank?\n\t\t\terrors.add(:hospital_no, ActiveRecord::Error.new(\n\t\t\t\tself, :base, :blank, { \n\t\t\t\t\t:message => \"Hospital record number can't be blank.\" } ) )\n\t\tend\n\tend", "def id_valid?(id)\n return id.between?(1, LAST_ID)\n end", "def id_valid?(id)\n return id.between?(1, LAST_ID)\n end", "def isFCHiSeq(fcName)\n # If the name of the flowcell contains the string \"EAS034\" or \"EAS376\n # then it is GA2 flowcell, else it is HiSeq flowcell\n if !fcName.match(\"EAS034\") && !fcName.match(\"EAS376\")\n return true\n else\n return false\n end\n end", "def day_not_valid?\n return impossible_day_number? && wrong_day_number_in_month\n end", "def see_ball?\n \tball.notSeenLongTime() < 5\n end", "def fee_per_meeting_is_valid?\n return ((self.fee_per_meeting != nil) and (self.fee_per_meeting >= 0))\n end", "def missing?\n time.nil?\n end", "def stale?\n forecasts.empty? || (Time.now - data_file.mtime) > 14_400\n end", "def future_expense_checker (record)\n\t\tdate = record.date_paid\n \ttime = date.to_time\n \ttime.future?\n end", "def require_employee_number?\n !!(self.registered_download.require_employee_number?)\n end", "def has_been_mandated?\n !!accessors.find(:first, :conditions => [\"accesses.requestor_id = ? AND mandated IN (?)\", person.id, ['1'] + MANDATED_STATES])\n end", "def hall_of_famer?\n return false unless self.profile[\"levels_unlocked\"]\n Set.new(self.profile[\"levels_unlocked\"]).count == 65\n end", "def background_check_valid?\n if background_check_date.present?\n background_check_date >= 36.months.ago.midnight\n else\n false\n end\n end", "def valid_tournament_id\n \tall_tournaments = Tournament.all.to_a.map{|u| u.id}\n \treturn all_tournaments.include?(self.tournament.id) && self.tournament.end_date.nil?\n end", "def valid_tournament_id\n \tall_tournaments = Tournament.all.to_a.map{|u| u.id}\n \treturn all_tournaments.include?(self.tournament.id) && self.tournament.end_date.nil?\n end", "def validate_accession_number(accession_no,seq_type)\n is_valid_accession_no = false\n # https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?db=protein&id=AEE34859.1&api_key=e2eded7b94c28c0734a03b44d4a2d5a15308\n # check NCBI. to determine the accession_no is correct, grap the origin aa sequence and compare\n # documents about ncbi api\n # https://www.ncbi.nlm.nih.gov/books/NBK25500/#_chapter1_Downloading_Document_Summaries_\n # https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?&api_key=db1a6c70014467857721f83996c2c9d4a207&db=protein&id=AEE34859.1\n api_key = \"db1a6c70014467857721f83996c2c9d4a207\"\n ncbi_api = nil\n if seq_type == \"aa\"\n ncbi_api = \"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/esummary.fcgi?api_key=#{api_key}&db=protein&id=#{accession_no}\"\n elsif seq_type == \"nt\"\n ncbi_api = \"https://eutils.ncbi.nlm.nih.gov/entrez/eutils/epost.fcgi?api_key=#{api_key}&db=nuccore&id=#{accession_no}\"\n end\n\n ncbi_res = open(ncbi_api) # StringIO object\n if ncbi_res.status.include? \"200\"\n doc = Nokogiri::XML(ncbi_res.read)\n if doc.xpath('//ERROR').length == 0\n\n is_valid_accession_no = true\n\n end\n end\n\n return is_valid_accession_no\n\n end", "def previous_pregnancy_test_done?(today = Date.today)\n lab_encounter = EncounterType.find_by_name(\"LAB RESULTS\")\n pregnancy_test = ConceptName.find_by_name(\"Pregnancy test\")\n yes_concept = ConceptName.find_by_name(\"Yes\")\n\n lmp = self.lmp(today)\n\n checked_date = lmp.present?? lmp : (today.to_date - 9.months)\n\n last_test_visit = self.encounters.joins([:observations])\n .where([\"encounter.encounter_type = ? AND (obs.concept_id = ?) \n AND encounter.encounter_datetime > ?\", lab_encounter.id,\n pregnancy_test.concept_id,checked_date.to_date])\n .order([:encounter_datetime])\n .select(\"value_coded\")\n .last.value_coded rescue nil\n \n if last_test_visit == yes_concept.concept_id\n return true\n end\n\n return false\n\n end", "def efsm?() EFSM == @error_code; end", "def failed? participate\n return participate.continuous_check_in == 0 || participate.updated_at.to_date != Time.now.utc.to_date\nend", "def filing_number_history(patient)\n PatientIdentifier.unscoped.where(\n voided: true,\n patient: patient,\n type: [patient_identifier_type('Filing number'),\n patient_identifier_type('Archived filing number')]\n )\n end", "def mes_nao_efetivado(data)\n\t\tself.parts.each do |p|\n\t\t\tif((p.data.month <= data.month) && (p.data.year <= data.year) && (p.confirmacao == 0))\n\t\t\t\treturn true\n\t\t\tend\n\t\tend\n\t\treturn false\n\tend", "def seen_job_with_id?(job_id)\n last_job_id >= job_id\n end", "def free_time_frame?\n started_booking_time = Booking.where(start_time: start_time)\n\n if started_booking_time.present? && (started_booking_time.ids.first != id)\n errors.add(:start_time, 'Sorry, this hour is already booked')\n end\n end", "def has_wrong_number?\n status_code == '1'\n end", "def check_defaulter_period(defaulter_date, patient_id, program_id)\n states = adverse_outcomes\n previous_visit = fetch_previous_visit(defaulter_date, patient_id, program_id)['visit_date']\n result = ActiveRecord::Base.connection.select_one <<~SQL\n SELECT start_date, end_date FROM patient_state\n INNER JOIN patient_program ON patient_state.patient_program_id = patient_program.patient_program_id AND patient_program.voided = 0\n WHERE patient_program.patient_id = #{patient_id}\n AND patient_state.state IN (#{states.map { |state| state['program_workflow_state_id'] }.join(',')})\n AND patient_state.voided = 0\n AND start_date >= DATE('#{previous_visit}')\n AND start_date <= DATE('#{defaulter_date}')\n SQL\n return true if result.blank?\n\n start_date = result['start_date']\n # check if this record has an end date for better result\n end_date = result['end_date'].blank? ? fetch_next_state_start_date(start_date, patient_id) : result['end_date']\n\n return false if end_date.blank?\n\n !defaulter_date.to_date.between?(start_date.to_date, end_date.to_date)\n end", "def pre_claim?\n return false if filing_date.blank?\n\n filing_days_old = (Time.zone.today - filing_date).to_i.days\n\n # If the filing date is 365 days old or older then true (used for showing the claim)\n (filing_days_old <= Rails.configuration.x.returns.amendable_days)\n end", "def has_marc_holdings?\n # mfhd_id is a repeated field, once per holding.\n # we only care if it's present at all.\n return false unless key?(:mfhd_id)\n\n # We have a Holding -- return true\n true\n end", "def invalidPatientId\n@patients =Patient.where(\"patient_number =?\",@commands[1])\n\tif @patients.size == 0\n\t\treturn true\t\n\tend \nreturn false\nend", "def invalidPatientId\n@patients =Patient.where(\"patient_number =?\",@commands[1])\n\tif @patients.size == 0\n\t\treturn true\t\n\tend \nreturn false\nend", "def invalidPatientId\n@patients =Patient.where(\"patient_number =?\",@commands[1])\n\tif @patients.size == 0\n\t\treturn true\t\n\tend \nreturn false\nend", "def is_full_luhn_valid?\n get_check_digit == check_digit\n end", "def redeemed?\n self.redeemed_at?\n end", "def declined?(event)\n\t\tattended_events.declined.include?(event)\n\tend", "def invalidated?\n count = @props[\"invalid\"].to_i\n count != 0\n end", "def valid?\n return false if @last_update.nil?\n (@last_update + SecureRandom.random_number(9) + 1 <= Time.now.to_i)\n end", "def valid?\n return false if @last_update.nil?\n (@last_update + SecureRandom.random_number(9) + 1 <= Time.now.to_i)\n end", "def remaining?\n return true if max_times.zero?\n registrations.count < max_times\n end", "def old?(line)\n today = Date.today()\n return (today.year > line.year) && (today.month >= line.month) || ((today.year - line.year) > 1)\n end", "def remind?\n offset = HyperAlerts::Application.config.access_token_reminder_offset\n\n if reminded?\n return false\n end\n\n if infinite?\n return false\n end\n\n if expires_at > offset.from_now\n return false\n end\n\n if user.email.blank?\n return false\n end\n\n true\n end", "def pending_eps?\n pending = open_claims.any? { |claim| claim['base_end_product_code'] == '020' }\n save_metadata(offramp_reason: 'pending_ep') if pending\n pending\n end", "def new_material?\n codes[0..2] == %w[02 15 04]\n end", "def patient_should_proceed_after_diagnosis?\n procedure_type = concept 'Procedure type'\n x_ray = concept 'Xray'\n clinical = concept 'Clinical'\n ultrasound = concept 'Ultrasound'\n observation = Observation.joins(:encounter).where(\n 'person_id = ? AND concept_id = ? AND (value_coded = ? || value_coded = ? || value_coded = ?) AND encounter.encounter_type = ?',\n @patient.patient_id, procedure_type.concept_id, x_ray.concept_id, clinical.concept_id, ultrasound.concept_id, encounter_type(DIAGNOSIS).id\n ).order(obs_datetime: :desc).first\n\n begin\n time_diff = (Time.current - observation.obs_datetime)\n minutes = (time_diff / 60)\n (minutes >= 1 / 60)\n rescue StandardError\n false\n end\n end", "def check_elsewhere(field264c, field260c)\n date = field264c || field260c\n # Take the first four digits.\n match = /(\\d{4})/.match(date)\n match[1].to_i if match\n end", "def unique_sequence_number\n unless self.lifecycle.nil?\n if(lifecycle.lifecycle_phases.find_all_by_sequence_number(self.sequence_number).count > 0)\n errors.add(:sequence_number, \"must be unique for this lifecycle\")\n end\n end\n end" ]
[ "0.58972704", "0.56985015", "0.5395548", "0.526967", "0.51973104", "0.51459634", "0.5142374", "0.51226515", "0.51135284", "0.49679047", "0.49559268", "0.49558246", "0.4952661", "0.4949892", "0.49378726", "0.49257678", "0.49080813", "0.49079835", "0.48854214", "0.48752916", "0.4875086", "0.4862388", "0.48562017", "0.48485816", "0.48417515", "0.48369092", "0.4826646", "0.48098612", "0.4802605", "0.4802605", "0.47993058", "0.47874779", "0.47838792", "0.4774486", "0.47673276", "0.4755528", "0.47479713", "0.4741589", "0.47379252", "0.4730337", "0.47299796", "0.47278917", "0.47229192", "0.47209552", "0.47187385", "0.4712855", "0.47116995", "0.469732", "0.46909642", "0.46813077", "0.4677485", "0.467115", "0.46704486", "0.46700352", "0.46695668", "0.46651343", "0.46601385", "0.46601385", "0.46578234", "0.46527708", "0.46521333", "0.46518978", "0.46517426", "0.46455383", "0.46411583", "0.4638631", "0.4637065", "0.46354875", "0.4632063", "0.46245226", "0.46245226", "0.46194124", "0.4615953", "0.46136063", "0.46130663", "0.46107143", "0.46104422", "0.4608809", "0.46059018", "0.46058783", "0.4602852", "0.4601064", "0.45999148", "0.4598939", "0.4598939", "0.4598939", "0.45982096", "0.4597865", "0.45976266", "0.45974156", "0.45944005", "0.45944005", "0.45930552", "0.45921984", "0.45907027", "0.45868784", "0.4583618", "0.4579586", "0.4573124", "0.45719895" ]
0.5040314
9
Records the original rvm environment and sets up a new gemset.
def setup_rvm @@rvm_original_env ||= RVM.current.expanded_name @@env = RVM::Environment.current @@env.gemset_create(app_name) @@env.gemset_use!(app_name) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def reset_rvm\n @@env.use!(@@rvm_original_env)\n end", "def restore_env(env); end", "def gemset_initial\n rvm(:gemset, :initial).successful?\n end", "def env=(environment); end", "def env=(environment); end", "def finish\n super\n @_env[ENV_KEY] = self\n end", "def _env_change\n if @env_used\n @environments << @env\n @env = Bcpm::Tests::Environment.new\n @env_used = false\n end\n end", "def check_and_set_environment\n check_env\n set_env\n end", "def gemset_update\n rvm(@environment_name, :gemset, :update).successful?\n end", "def gemset_use(gemset, options = {})\n replace_env = options.delete(:replace_env)\n result = rvm(:gemset, :use, gemset, options)\n if result.successful?\n gemset_name = result[:rvm_gemset_name]\n @environment_name = self.class.environment_with_gemset(@environment_name, gemset_name)\n @expanded_name = nil\n self.class.reset_current!\n use_env_from_result! result if replace_env\n true\n end\n end", "def update_rvm_gemset( deps )\n\t\ttmp = Tempfile.new( 'gemset' )\n\t\tdeps.keys.each {|dep| deps[dep.name] = deps.delete(dep) }\n\n\t\tRVM_GEMSET.each_line do |line|\n\t\t\tif line =~ /^\\s*(#|$)/\n\t\t\t\ttmp.print( line )\n\t\t\telse\n\t\t\t\tgem, version = line.split( /\\s+/, 2 )\n\n\t\t\t\tif (( newer = deps.delete(gem) ))\n\t\t\t\t\ttmp.puts( gem + ' -v' + newer.to_s )\n\t\t\t\telse\n\t\t\t\t\ttmp.print( line )\n\t\t\t\tend\n\t\t\tend\n\t\tend\n\n\t\tdeps.each do |gem, newer|\n\t\t\tnext unless newer\n\t\t\ttmp.puts( gem + ' -v' + newer.to_s )\n\t\tend\n\n\t\ttmp.close\n\n\t\tFileUtils.cp( tmp.path, RVM_GEMSET, :verbose => true )\n\tend", "def setup_environment; end", "def source_rvm_environment\n rvm_path = config_value_for(:rvm_path, self.class.default_rvm_path, false)\n actual_config = defined_config.merge('rvm_path' => rvm_path)\n config = []\n actual_config.each_pair do |k, v|\n config << \"#{k}=#{escape_argument(v.to_s)}\"\n end\n run_silently \"export #{config.join(\" \")}\"\n run_silently :source, File.join(rvm_path, \"scripts\", \"rvm\")\n end", "def save_env; end", "def with_environment\n old_gem_home = ENV[\"GEM_HOME\"]\n old_gem_path = ENV[\"GEM_PATH\"]\n ENV[\"GEM_HOME\"] = @gem_home\n ENV[\"GEM_PATH\"] = @gem_home\n @logger.debug(\"Set GEM_* to: #{ENV[\"GEM_HOME\"]}\")\n\n # Clear paths so that it reads the new GEM_HOME setting\n Gem.paths = ENV\n\n # Clear the sources so that installation uses custom sources\n old_sources = Gem.sources\n Gem.sources = Gem.default_sources\n Gem.sources << \"http://gems.hashicorp.com\"\n\n # Use a silent UI so that we have no output\n Gem::DefaultUserInteraction.use_ui(Gem::SilentUI.new) do\n return yield\n end\n ensure\n # Restore the old GEM_* settings\n ENV[\"GEM_HOME\"] = old_gem_home\n ENV[\"GEM_PATH\"] = old_gem_path\n\n # Reset everything\n Gem.paths = ENV\n Gem.sources = old_sources.to_a\n end", "def restart_environment(argv={})\n @started = false\n start_environment(Merb::Config.to_hash.merge(argv))\n end", "def restart_environment(argv={})\n @started = false\n start_environment(Merb::Config.to_hash.merge(argv))\n end", "def reset_env\n clear_env\n set_env self.env_defaults\n end", "def setup\n\n setup_path\n save_application_details\n add_jvm_args\n rename_server_instance\n\n \"/bin/bash ./#{SETUP_ENV_SCRIPT}\"\n end", "def save\n\t\t\tsuper\n\t\t\t@@env = self\n\t\tend", "def environment\n Mash.new.tap do |environment|\n environment.update(new_resource.parent_ruby.ruby_environment) if new_resource.parent_ruby\n environment['BUNDLE_GEMFILE'] = new_resource.parent_bundle.gemfile_path if new_resource.parent_bundle\n environment.update(new_resource.environment) if new_resource.environment\n end\n end", "def set_state\n # Set environment variables for later services.\n new_resource.app_state_environment[:DJANGO_SETTINGS_MODULE] = new_resource.settings_module if new_resource.settings_module\n new_resource.app_state_environment[:DATABASE_URL] = new_resource.database[:URL] if new_resource.database[:URL]\n # Set the app module.\n new_resource.app_state[:python_wsgi_module] = new_resource.wsgi_module if new_resource.wsgi_module\n end", "def setup\n\n setup_path\n save_application_details\n add_jvm_args\n rename_server_instance\n\n \"/bin/sh ./#{SETUP_ENV_SCRIPT}\"\n end", "def gemset_pristine\n rvm(:gemset, :pristine).successful?\n end", "def recreateVM(vm)\n # Call the service controller to delete the VM and update the master\n paramfile = $WORKDIR + \"/envconfig.\" + @name\n execString = $SVCBIN + \" -c \" + paramfile + \" -v \" + vm.vmid + \" -x \" + @envid \n childpid=Kernel.fork\n if childpid == nil\n $stdout.reopen($ENVLOGFILE + \".#{@envid}\" ,'a+')\n $stderr.reopen($ENVLOGFILE + \".#{@envid}\",'a+')\n exec(execString)\n end\n jid = $jobManager.register(childpid, @envid, \"RECREATE\", @name, \"RUNNING\", 0)\n return jid \n end", "def setenv(softworkdir,project,chipIsModem,apconnection)\n\t#puts \"burp\"\n # Setup some environement variables.\n $PROJNAME = project\n $SOFT_WORKDIR = softworkdir\n $TOOLPOOL = $SOFT_WORKDIR + \"/toolpool\" \n $PLUGINS_WORKDIR = $TOOLPOOL + \"/plugins\"\n $SCRIPT_WORKDIR = $TOOLPOOL + \"/scripts\"\n $SCRIPT_GENDIR = $SCRIPT_WORKDIR + \"/ChipStd\"\n $SCRIPT_PROJDIR = $SCRIPT_WORKDIR + \"/\" + $PROJNAME.split[0]\n $COMMON_PLUGINS_WORKDIR = \"./rbbase/common/plugins\"\n\n if(chipIsModem.strip.casecmp(\"yes\") == 0)\n $CHIP_IS_MODEM = true\n else\n $CHIP_IS_MODEM = false\n end\n\n if(apconnection.strip.casecmp(\"yes\") == 0)\n $APCONNECTION = true\n else\n $APCONNECTION = false\n end\n\n # Add the path the working dir where the script under development are stored. \n $LOAD_PATH.unshift(\"./rbbase/\")\n $LOAD_PATH.unshift($TOOLPOOL)\n $LOAD_PATH.unshift($PLUGINS_WORKDIR)\n $LOAD_PATH.unshift($COMMON_PLUGINS_WORKDIR)\n $LOAD_PATH.unshift($SCRIPT_WORKDIR) \n $LOAD_PATH.unshift($SCRIPT_GENDIR) \n $LOAD_PATH.unshift($SCRIPT_PROJDIR) \n\t#$LOAD_PATH.unshift($SCRIPT_WORKDIR + \"/common\")\nend", "def gemset_copy(from, to)\n rvm(:gemset, :copy, from, to).successful?\n end", "def default_environment=(env); end", "def set_env()\n @triggers.each(&:set_env)\n end", "def _post_eval\n @environments << @env if @env_used\n @env = nil\n @options = nil\n end", "def sparkResetEnvironment()\n\tif ($cleanupCalls.size > 0)\n\t\tlogNormal(\"resetEnvironment(): Calling \" + $cleanupCalls.size.to_s + \" cleanup functions.\\n\")\n\t\tsparkInvokeCleanupCalls()\n\t\t$cleanupCalls.clear\n\telse\n\t\tlogNormal(\"resetEnvironment(): No cleanup functions to call.\\n\")\n\tend\n\tsparkResetScene()\nend", "def prompt_ruby_version\n if yes?(\"Are you using RVM?\")\n # rubocop:disable Metrics/LineLength\n if yes?(\"Would you like to create a RVM gemset, #{@app_name}, for this app?[y|yes] \")\n # rubocop:enable Metrics/LineLength\n template('rvmrc.tt','.rvmrc', {app_name: @app_name})\n else\n puts \"Using the default gemset\"\n run(\". ${rvm_path:-$HOME/.rvm}/environments/default\")\n end\n end\n end", "def restore_env(env)\n @src, @tree, @block_ial, @stack, @text_type = *env\n end", "def setup_clean_env\n # user may be running gem binary directly without bundler.\n if defined?(::Bundler)\n # a little revisionist history music...\n ::ENV.each do |key, value|\n if key.start_with?('GEM_') || key.start_with?('BUNDLER_')\n ::Bundler::ORIGINAL_ENV[key] = nil\n elsif Bundler::ORIGINAL_ENV[key].nil?\n ::Bundler::ORIGINAL_ENV[key] = value\n end\n end\n ::Bundler.with_clean_env do\n # now the ENV is clean and not missing any right-hand args so replace\n # the ORIGINAL_ENV.\n ::Bundler::ORIGINAL_ENV.replace(ENV)\n end\n end\n true\n end", "def mark_as_restored\n @restored = true\n end", "def setup\n # checkout to new branch\n initialize_revisions\n [@repo_dir, @tap_dir].each do |dir|\n Dir.chdir(dir.to_s) do\n shutup { `git checkout -b #{@new_branch}` }\n end\n end\n end", "def apply_environment!(hook_context, env); end", "def activate!(environment)\n environment ||= :master\n activated_environments << environment\n old_environment = self.environment\n @environment = environment\n old_environment\n end", "def dup_environment\n\n env = fetch_environment\n env = env.dup\n env.fei = @fei.dup\n env.fei.expression_name = EN_ENVIRONMENT\n @environment_id = env.fei\n\n env.store_itself\n end", "def original_env; end", "def environment=(env)\n setup(env)\n end", "def setup\r\n rake_original_setup\r\n @original_rake = Rake.application\r\n @rake = Rake::Application.new\r\n Rake.application = @rake\r\n end", "def prepare_for_deploy(services:, secrets:, local_environment:, why_run:)\n @local_env = local_environment\n end", "def gemset_create(*names)\n names = names.flatten\n rvm(:gemset, :create, *names).successful?\n end", "def undo_bundler\n clean_env = nil\n Bundler.with_clean_env do\n clean_env = ENV.to_hash\n end\n ENV.replace(clean_env)\n end", "def get_clean_env\n # blank out bundler and gem path modifications, will be re-setup by new call\n new_env = {}\n new_env['BUNDLER_ORIG_MANPATH'] = nil\n new_env['BUNDLER_ORIG_PATH'] = nil\n new_env['BUNDLER_VERSION'] = nil\n new_env['BUNDLE_BIN_PATH'] = nil\n new_env['RUBYLIB'] = nil\n new_env['RUBYOPT'] = nil\n\n # DLM: preserve GEM_HOME and GEM_PATH set by current bundle because we are not supporting bundle\n # requires to ruby gems will work, will fail if we require a native gem\n new_env['GEM_PATH'] = nil\n new_env['GEM_HOME'] = nil\n\n # DLM: for now, ignore current bundle in case it has binary dependencies in it\n # bundle_gemfile = ENV['BUNDLE_GEMFILE']\n # bundle_path = ENV['BUNDLE_PATH']\n # if bundle_gemfile.nil? || bundle_path.nil?\n new_env['BUNDLE_GEMFILE'] = nil\n new_env['BUNDLE_PATH'] = nil\n new_env['BUNDLE_WITHOUT'] = nil\n # else\n # new_env['BUNDLE_GEMFILE'] = bundle_gemfile\n # new_env['BUNDLE_PATH'] = bundle_path\n # end\n\n return new_env\n end", "def set_remote_env(env); end", "def gemset\n @gemset_wrapper ||= GemsetWrapper.new(self)\n end", "def setenv( vm, host )\n return unless host.key?('env')\n cmd=\"tee -a \\\"/etc/profile.d/setenv.sh\\\" > \\\"/dev/null\\\" <<ENDHERE\"\n host['env'].each do |key, val|\n cmd=\"#{cmd}\\nexport #{key}=\\\"#{val}\\\"\"\n end\n cmd=\"#{cmd}\\nENDHERE\"\n vm.provision \"shell\", inline: cmd, run: \"always\"\nend", "def install\r\n super\r\n automated_install {\r\n @local_gems.flush_gem_cache\r\n gem_name = @override_gem_name.nil? ? installed_as_name_for( self.gem_short_name ) : @override_gem_name\r\n installed_gem = @local_gems.find( gem_name )\r\n fails_to_load gem_name if installed_gem.nil?\r\n installed_gem.activate\r\n }\r\n end", "def reset!\n #$LOAD_STACK = []\n\n if manager = lock_load\n $LOAD_MANAGER = manager\n else\n #$LOAD_MANAGER.prime(*lookup_paths, :expound=>true)\n manager = Manager.new\n manager.prime(*lookup_paths, :expound=>true)\n $LOAD_MANAGER = manager\n end\n\n $LOAD_MANAGER << RubyLibrary.instance\n\n #if development?\n # find project root\n # if root\n # $LOAD_MANAGER.isolate_project(root)\n # end\n #end\n end", "def load_local_env\n load_env(KVMRC_LOCAL)\n end", "def push_RestoreEnv(env)\n top = @stack.last\n push(:RestoreEnv, env) unless (top and top[0].equal? :RestoreEnv)\n end", "def environment(environment); end", "def setup_env\n # use the correct ruby bin\n path = ENV[\"PATH\"].dup\n ruby_dir = RbConfig::CONFIG['bindir']\n if !path.include? ruby_dir then\n ENV[\"PATH\"] = \"#{ruby_dir}:#{path}\"\n end\n\n # stick ourselves in RUBYLIB to speedup exec time\n ENV[\"RUBYLIB\"] = File.expand_path(\"../../../..\", __FILE__)\n\n # load helper script\n ENV[\"RUBYOPT\"] = '-rbixby-client/script'\n end", "def rvm_run(cmd)\n run %{#{rvm_env} rvm #{cmd}}, :shell => \"bash\"\nend", "def test_Enviroment_007_SetEnv\r\n\r\n puts2(\"\")\r\n puts2(\"#######################\")\r\n puts2(\"Testcase: test_Enviroment_007_SetEnv\")\r\n puts2(\"#######################\")\r\n\r\n sEnvVarName = \"COMPUTERNAME\" # Is this one platform independent?\r\n sNewValue = \"MyNewName\"\r\n\r\n # Display the current value\r\n puts2(\"Current value of \" + sEnvVarName)\r\n printenv(sEnvVarName)\r\n\r\n puts2(\" Setting \" + sEnvVarName + \" to \" + sNewValue)\r\n\r\n # Set new value that will be in effect for duration of this Ruby session's test run\r\n setenv(sEnvVarName, sNewValue)\r\n\r\n # Display the current value\r\n puts2(\"Current value of \" + sEnvVarName)\r\n printenv(sEnvVarName)\r\n\r\n\r\n sNewEnvVarName = \"Ruby\"\r\n sNewSetting = \"Is Cool\"\r\n puts2(\" Setting a new Environment Variable \" + sNewEnvVarName + \" to a new setting \" + sNewSetting)\r\n\r\n # Set new value that will be in effect for duration of this Ruby session's test run\r\n setenv(sNewEnvVarName, sNewSetting)\r\n\r\n # Display the current value\r\n puts2(\"Current value of \" + sNewEnvVarName)\r\n printenv(sNewEnvVarName)\r\n\r\n end", "def reset_env(opts = T.unsafe(nil)); end", "def initialize_environment\n end", "def initialize_environment\n end", "def set_initial_path\n `echo $PATH`.split(':').each do |path|\n add_env_path path\n end\nend", "def register_flavored_package_set(package_set)\n package_sets << package_set\n end", "def with_application_environment\n backup = nil\n\n ::Bundler.ui.silence do\n if ::Bundler.root != config.source_path\n backup = ENV.to_hash\n ENV.replace(::Bundler.original_env)\n\n # reset bundler to load from the current app's source path\n ::Bundler.reset!\n end\n\n # ensure the bundler environment is loaded before enumeration\n ::Bundler.load\n\n yield\n end\n ensure\n if backup\n # restore bundler configuration\n ENV.replace(backup)\n ::Bundler.reset!\n end\n\n # reload the bundler environment after enumeration\n ::Bundler.load\n end", "def reset_cache\n envspecific_regexs(true)\n end", "def reinitialize_spec_set!\n Bundler.remove_instance_variable(:@locked_gems)\n Bundler.remove_instance_variable(:@definition)\n end", "def relaunch!\n requires :id\n body = [ \"FORCE\", {}]\n body[1][:sshKeyIds] = key_pairs.map {|kp| kp.id} unless key_pairs.empty?\n type = bare_metal? ? :hardware_server : :virtual_guest\n status = service.request(type, \"#{id}/reloadOperatingSystem\", :body => body, :http_method => :post).status\n wait_for { not ready? } # block until the relaunch has begun\n [200, 201].include?(status)\n end", "def bundle_repo(repo_dir=\"\", admin={}, gemset=\"\", ruby_env=\"\" )\n\n bundle = \"/usr/local/rvm/gems/#{gemset}/bin/bundle\"\n bash \"bundle_install\" do\n command \"rvm gemset #{bundle} install\"\n cwd \"#{repo_dir}\"\n user admin['username']\n group \"rvm\"\n end\n\n execute \"daemons_bundler\" do\n user admin['username']\n group admin['username']\n cwd repo_dir\n command \"rm -rf #{repo_dir}/.bundle && cd #{repo_dir} && bundle install\"\n environment(ruby_env)\n action :run\n end\n\nend", "def begin_load_revision\n load_revision_stack.push(true)\n end", "def store\n ROM.env\n end", "def service_options(resource)\n super\n resource.environment.update(new_resource.parent_python.python_environment) if new_resource.parent_python\n end", "def environment; end", "def environment=(env)\n @environment = env\n end", "def boot\n @labfile = TestLab::Labfile.load(labfile_path)\n @labfile.testlab = self\n\n Dir.chdir(@repo_dir)\n end", "def with_environment(env); end", "def env=(environment)\n @_env = ActiveSupport::EnvironmentInquirer.new(environment)\n end", "def prepare\n started_at = DateTime.now.to_s\n prepare_deploy\n prepare_common_installation\n puppet_installation\n create_prepare_checkpoint(started_at)\n end", "def post_provision_configure\n add_stack_to_resource\n link_orchestration_template\n assign_vms_owner\n apply_provisioning_tags\n end", "def reset_package_sets\n @package_sets.clear\n end", "def sync_gem_environments\n resync = []\n environments.each do |name|\n env = environment(name)\n if env.has_gems? \n resync << name\n env.sync\n env.save\n end\n end\n resync\n end", "def boot!\n adjust_load_path\n adjust_gem_path\n ENV['RACK_ENV'] = rack_env\n change_working_directory\n export_global_settings\n load_settings_from_init_rb\n set_relative_url_root\n run_boot_hooks\n self\n end", "def env\r\n original_env.merge(hacked_env)\r\n end", "def apply_environment_overrides\n @format = env(:format, @format)\n @autopath = env(:autopath, @autopath)\n @files = env(:files, @files)\n @match = env(:match, @match)\n @tags = env(:tags, @tags)\n @units = env(:units, @units)\n @requires = env(:requires, @requires)\n @loadpath = env(:loadpath, @loadpath)\n end", "def install(env); end", "def createPuppetMasterEnv(json_loaded)\n git_working_dir = json_loaded['environment_path']\n git_buildoop_branch = json_loaded['environment_branch']\n puppet_environment = json_loaded['environment_cluster']\n\n @outputHandler.msgOutput 'Patch to environments: ' + git_working_dir\n @outputHandler.msgOutput 'Based on Buildoop branch: ' + git_buildoop_branch\n\n # git staff\n g = Git.open(git_working_dir, :log => Logger.new(STDOUT))\n g.branches.remote\n g.branch(git_buildoop_branch).checkout\n\n if confirm_action? \"the /etc/puppet/environments/#{puppet_environment} will be erased,\"\n FileUtils.rm_rf(\"/etc/puppet/environments/#{puppet_environment}\")\n\n # copy environment to puppet location\n FileUtils.cp_r git_working_dir + \"/all\", \n '/etc/puppet/environments', :verbose => true\n FileUtils.cp_r git_working_dir + \"/cluster-name\", \n \"/etc/puppet/environments/#{puppet_environment}\", :verbose => true\n\n fillExtlookupCSV json_loaded\n end\n end", "def save()\n @env.sync(true)\n self\n end", "def test_usr2_restart_preserves_bundler_environment\n skip_unless_signal_exist? :USR2\n\n @tcp_port = UniquePort.call\n env = {\n # Intentionally set this to something we wish to keep intact on restarts\n \"BUNDLE_GEMFILE\" => \"Gemfile.bundle_env_preservation_test\",\n # Don't allow our (rake test's) original env to interfere with the child process\n \"BUNDLER_ORIG_BUNDLE_GEMFILE\" => nil\n }\n # Must use `bundle exec puma` here, because otherwise Bundler may not be defined, which is required to trigger the bug\n cmd = \"bundle exec puma -q -w 1 --prune-bundler -b tcp://#{HOST}:#{@tcp_port}\"\n Dir.chdir(File.expand_path(\"bundle_preservation_test\", __dir__)) do\n @server = IO.popen(env, cmd.split, \"r\")\n end\n wait_for_server_to_boot\n @pid = @server.pid\n connection = connect\n initial_reply = read_body(connection)\n assert_match(\"Gemfile.bundle_env_preservation_test\", initial_reply)\n restart_server connection\n new_reply = read_body(connection)\n assert_match(\"Gemfile.bundle_env_preservation_test\", new_reply)\n end", "def setup\n install_latest_ruby\n\n install_global_gems\n end", "def prepare\n if requires_snapshot?\n info \"Preparing vm #{name} ...\"\n restart { immutate }\n wait_for_boot\n pause\n snapshot\n end\n true\n end", "def env(signature, environment)\n if signature.is_a?(Array)\n signature.each { |s| env(s, environment) }\n return self\n end\n @environments[signature] = environment\n self\n end", "def freeze_vm()\n @log.debug \"Freezing vm for test series\"\n vmm_command(eb(@config['vmm']['saveteststate']))\n end", "def setup\n modified = false\n modified |= self.install_packages\n modified |= self.activate_service(modified)\n return modified\n end", "def use!(name)\n @parent.gemset_use(name, :replace_env => true)\n end", "def init_env type:\n # puts \" initializing env\" if debug\n # print \"(newenv) \" #if debug\n AtariWrapper.new gym.make(type), downsample: compr.downsample,\n skip_type: skip_type, preproc: preproc\n end", "def init_env\n @resource_descriptions = HashWithIndifferentAccess.new { |h, version| h[version] = {} }\n @controller_to_resource_id = {}\n @param_groups = {}\n\n # what versions does the controller belong in (specified by resource_description)?\n @controller_versions = Hash.new { |h, controller| h[controller] = [] }\n end", "def provision\n FileUtils.rm_f('.env')\n FileUtils.ln_s(\"#{compose_dir}/#{Ros.env}.env\", '.env')\n # return unless gem_version_check\n # TODO: make build its own rake task and method\n if options.build\n services.each_pair do |name, config|\n next if config&.enabled.eql? false\n compose(\"build #{name}\")\n end\n return\n end\n if options.initialize\n compose(\"up wait\")\n services.each do |name, config|\n next if config&.enabled.eql? false\n prefix = config.ros ? 'app:' : ''\n compose(\"run --rm #{name} rails #{prefix}ros:db:reset:seed\")\n end\n end\n compose_options = options.daemon ? '-d' : ''\n compose(\"up #{compose_options}\")\n if options.initialize\n %x(cat ros/services/iam/tmp/#{Settings.platform.environment.partition_name}/postman/222_222_222-Admin_2.json)\n end\n end", "def replace_ENV! # rubocop:disable Naming/MethodName\n old = $VERBOSE\n $VERBOSE = nil\n Object.const_set(:ENV, self)\n ensure\n $VERBOSE = old\n end", "def reset\n @instance = nil\n @local_env = nil\n end", "def reset\n @instance = nil\n @local_env = nil\n end", "def restore\n end", "def env; end" ]
[ "0.69092965", "0.62419206", "0.5963159", "0.59286314", "0.59286314", "0.57703185", "0.5767454", "0.5766548", "0.5700036", "0.5684107", "0.5649919", "0.56323075", "0.55625874", "0.5482174", "0.54086643", "0.5397399", "0.5397006", "0.53675944", "0.53661716", "0.5351091", "0.53496027", "0.5348934", "0.5327269", "0.52784795", "0.52575344", "0.5255951", "0.5183537", "0.51793706", "0.51734626", "0.51651037", "0.5148663", "0.5146467", "0.5143097", "0.5122999", "0.51031625", "0.50988305", "0.5073772", "0.5062856", "0.5054058", "0.5049721", "0.5037956", "0.50222075", "0.5003284", "0.5001292", "0.49925324", "0.49872214", "0.4986973", "0.49862137", "0.49700266", "0.49517146", "0.49489477", "0.49405795", "0.49066773", "0.48971286", "0.4887755", "0.4874217", "0.48652261", "0.48542374", "0.4848395", "0.4848395", "0.48433024", "0.48296326", "0.48168272", "0.48108464", "0.4805683", "0.47968808", "0.47932714", "0.47887334", "0.4779162", "0.47782138", "0.47764212", "0.47677618", "0.47584054", "0.47575694", "0.4752287", "0.4747921", "0.47468734", "0.47464743", "0.47462085", "0.47285864", "0.4725229", "0.47191095", "0.4717203", "0.47171673", "0.47129598", "0.4711514", "0.4692151", "0.46789992", "0.46754628", "0.46726876", "0.46716294", "0.46666422", "0.46632817", "0.46626985", "0.46609744", "0.46577835", "0.4655976", "0.4655976", "0.46493027", "0.46471077" ]
0.7845773
0
Reverts to the original rvm environment
def reset_rvm @@env.use!(@@rvm_original_env) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def restore_env(env); end", "def restore\n end", "def restore_env(env)\n @src, @tree, @block_ial, @stack, @text_type = *env\n end", "def restore; end", "def reset_env\n clear_env\n set_env self.env_defaults\n end", "def setup_rvm\n @@rvm_original_env ||= RVM.current.expanded_name\n\n @@env = RVM::Environment.current\n @@env.gemset_create(app_name)\n @@env.gemset_use!(app_name)\n end", "def reset\n send_to_vm('system_reset')\n end", "def reset_vm()\n @log.debug \"Reseting vm for next test\"\n vmm_command(eb(@config['vmm']['loadteststate']))\n # Give it a half a tic to reset...\n sleep 0.5\n end", "def reset\n @instance = nil\n @local_env = nil\n end", "def reset\n @instance = nil\n @local_env = nil\n end", "def restore\n RESTORE\n end", "def reboot_fusion_vm(options)\n reset_fusion_vm(options)\nend", "def reload!\n # Reload the configuration\n load_config!\n\n # Clear the VMs because this can now be diferent due to configuration\n @vms = nil\n end", "def recreateVM(vm)\n # Call the service controller to delete the VM and update the master\n paramfile = $WORKDIR + \"/envconfig.\" + @name\n execString = $SVCBIN + \" -c \" + paramfile + \" -v \" + vm.vmid + \" -x \" + @envid \n childpid=Kernel.fork\n if childpid == nil\n $stdout.reopen($ENVLOGFILE + \".#{@envid}\" ,'a+')\n $stderr.reopen($ENVLOGFILE + \".#{@envid}\",'a+')\n exec(execString)\n end\n jid = $jobManager.register(childpid, @envid, \"RECREATE\", @name, \"RUNNING\", 0)\n return jid \n end", "def reset_cache\n envspecific_regexs(true)\n end", "def reset_env(opts = T.unsafe(nil)); end", "def undo_bundler\n clean_env = nil\n Bundler.with_clean_env do\n clean_env = ENV.to_hash\n end\n ENV.replace(clean_env)\n end", "def reboot!(vm, options)\n if reboot? vm, options\n vm.action(:reload, options)\n end\n end", "def restore\r\n @status = @stack.shift if @stack.size > 0\r\n end", "def sparkResetEnvironment()\n\tif ($cleanupCalls.size > 0)\n\t\tlogNormal(\"resetEnvironment(): Calling \" + $cleanupCalls.size.to_s + \" cleanup functions.\\n\")\n\t\tsparkInvokeCleanupCalls()\n\t\t$cleanupCalls.clear\n\telse\n\t\tlogNormal(\"resetEnvironment(): No cleanup functions to call.\\n\")\n\tend\n\tsparkResetScene()\nend", "def restore(*args)\n argv = to_pointer([\"restore\"] + args)\n rrd_restore(args.size+1, argv) == 0\n ensure\n free_pointers\n end", "def restore(*args); end", "def restore_mode; end", "def restore_mode; end", "def reset\r\n interpreter_reset\r\n compiler_reset\r\n end", "def mark_as_restored\n @restored = true\n end", "def util_reset_arch\n util_set_arch @orig_arch\n end", "def util_reset_arch\n util_set_arch @orig_arch\n end", "def restore \n raise NotImplementedError.new\n end", "def reset\n info \"\\n\\n------------ RESET ------------\\n\"\n # ExecApp.killAll ## NOTE: do we want to kill of the started RC on reset ???\n resetState\n RMCommunicator.instance.reset\n end", "def restore(*args)\n call_engines_method(:restore, *args)\n end", "def original_env; end", "def restore!\n IO.console.cooked!\n end", "def reload(env, app)\n system \"ey ssh -e #{translate_env(env,app)} 'rm -rf /data/#{translate_app(env,app)}/current/tmp/cache/*'\" # clear out cache\n if env == 'production' # total hack to clear cache on app2\n system \"ssh deploy@ec2-50-18-83-188.us-west-1.compute.amazonaws.com 'rm -rf /data/#{translate_app(env,app)}/current/tmp/cache/*'\"\n end\n restart(env, app)\nend", "def relaunch!\n requires :id\n body = [ \"FORCE\", {}]\n body[1][:sshKeyIds] = key_pairs.map {|kp| kp.id} unless key_pairs.empty?\n type = bare_metal? ? :hardware_server : :virtual_guest\n status = service.request(type, \"#{id}/reloadOperatingSystem\", :body => body, :http_method => :post).status\n wait_for { not ready? } # block until the relaunch has begun\n [200, 201].include?(status)\n end", "def raw_reset\n raw_reboot_guest(:force => true)\n end", "def raw_reset\n raw_reboot_guest(:force => true)\n end", "def source_rvm_environment\n rvm_path = config_value_for(:rvm_path, self.class.default_rvm_path, false)\n actual_config = defined_config.merge('rvm_path' => rvm_path)\n config = []\n actual_config.each_pair do |k, v|\n config << \"#{k}=#{escape_argument(v.to_s)}\"\n end\n run_silently \"export #{config.join(\" \")}\"\n run_silently :source, File.join(rvm_path, \"scripts\", \"rvm\")\n end", "def restart_environment(argv={})\n @started = false\n start_environment(Merb::Config.to_hash.merge(argv))\n end", "def restart_environment(argv={})\n @started = false\n start_environment(Merb::Config.to_hash.merge(argv))\n end", "def reset\n API.finalize( @vm )\n commence\n @eof = false\n end", "def reset_env(opts = {})\n opts = {text_type: :raw_text, stack: []}.merge(opts)\n @src = opts[:src]\n @tree = opts[:tree]\n @block_ial = opts[:block_ial]\n @stack = opts[:stack]\n @text_type = opts[:text_type]\n end", "def reset\n $iptr = 0\n $program = []\n $labels = {}\n $binding = binding\nend", "def reset(env)\n env.each_pair do |key, value|\n ENV[key] = value\n end\n\n (ENV.keys - env.keys).each do |key|\n ENV.delete(key)\n end\n end", "def reload_from_rom\n @representation = nil\n clear_cache\n present\n self\n end", "def reset!\n #$LOAD_STACK = []\n\n if manager = lock_load\n $LOAD_MANAGER = manager\n else\n #$LOAD_MANAGER.prime(*lookup_paths, :expound=>true)\n manager = Manager.new\n manager.prime(*lookup_paths, :expound=>true)\n $LOAD_MANAGER = manager\n end\n\n $LOAD_MANAGER << RubyLibrary.instance\n\n #if development?\n # find project root\n # if root\n # $LOAD_MANAGER.isolate_project(root)\n # end\n #end\n end", "def restore\n {}\n end", "def restore_dir\n cd @dir\n end", "def revert_to!(version)\n revert version, :hard\n self\n end", "def resume\n @vm.resume\n end", "def cmd_restore argv\n setup argv\n filepath = @hash['filepath']\n clear_existing = to_boolean(@hash['boolean'])\n response = @api.restore(filepath, clear_existing)\n msg response\n return response\n end", "def interpreter_reset\r\n @data_stack = Array.new\r\n @ctrl_stack = Array.new\r\n @start_time = Time.now\r\n end", "def revert\n end", "def restore_mode\n system \"stty #{@state}\"\n end", "def restore_merge_state; end", "def restore_merge_state; end", "def reinstall\n uninstall and install\n end", "def reset\n if @stage == :running\n @should_reset = true\n end\n end", "def env=(environment); end", "def env=(environment); end", "def reset_to_defaults\n @config_stack = [ EnvironmentSource.new, DefaultSource.new ]\n reset_cache\n end", "def reset\n exit({})\n end", "def reset\n\t\tdo_send('ARST 2')\n\tend", "def _env_change\n if @env_used\n @environments << @env\n @env = Bcpm::Tests::Environment.new\n @env_used = false\n end\n end", "def reset_all\n clear_commands\n reset_colors\n @app_info = nil\n @app_exe = nil\n @verbose_parameters = true\n @@default_method = nil\n @@class_cache = {}\n end", "def rvm_run(cmd)\n run %{#{rvm_env} rvm #{cmd}}, :shell => \"bash\"\nend", "def reset(arguments, options)\n options[:persistence] ||= Persistence.new\n options[:persistence].clear\n end", "def reset!\n @storage = in_memory\n end", "def revert_database\n ActiveRecord::Base.establish_connection(default_connection)\n end", "def reset_irb\n say \"Began new irb session\"\n @session = try_eval(\"!INIT!IRB!\")\n end", "def reset ; end", "def reset_variables\n @variables = {}\n end", "def reload_environment\n CloudCrooner.instance_variables.each do |var|\n CloudCrooner.instance_variable_set(var, nil)\n end\n\n Post.instance_variable_set(:@compiled_content_dir, nil) if defined?(Post)\n end", "def reload\n restart\n end", "def restore_checkpoint\n @api.send(\"world.checkpoint.restore()\")\n end", "def reset\n\n end", "def reset(_object); end", "def restore!\n restore\n save!(validate: false)\n end", "def freeze_vm()\n @log.debug \"Freezing vm for test series\"\n vmm_command(eb(@config['vmm']['saveteststate']))\n end", "def reset\n self.explicit_arch = nil\n self.explicit_platform = nil\n self.actual_payload = nil\n end", "def restore_templates\n FileUtils.rm_rf @current_templates if File.exist? @current_templates\n\n if File.exist? @old_templates\n FileUtils.mv(\n @old_templates,\n @current_templates\n )\n end\n end", "def reset_app\n @app.reset if @app\n @app = nil\n end", "def reset\n initialize\n setup\n end", "def reset() end", "def reset\n getok 'RSET'\n end", "def reset!\n @storage = in_memory\n end", "def reset\n reset_config\n reset_driver\n end", "def restore(name)\n Session.instance.load name\n end", "def reset!; end", "def reset!; end", "def reset!; end", "def reset!; end", "def uninstall(env); end", "def revert_to(version)\n revert version\n self\n end", "def restore\n self.suspended = false\n save(:validate => false)\n end", "def rollback!\n restore_attributes\n end", "def reset\n \n end", "def Recreate(params, trace = [\"Recreate method called:#{__LINE__}\"])\n params.to_sym!\n LOG \"Recreating VM#{params[:vm]}\", 'Recreate'\n\n trace << \"Getting VM:#{__LINE__}\"\n vm = onblock(:vm, params[:vm])\n vm.info!\n trace << \"Checking access rights:#{__LINE__}\"\n onblock(:u, -1, @client) do | u |\n u.info!\n if u.id != vm.uid && !u.groups.include?(0) then\n raise StandardError.new(\"Not enough access to perform Recreate\")\n end\n end\n trace << \"Getting VM host:#{__LINE__}\"\n host, _ = vm.host\n trace << \"Recovering VM:#{__LINE__}\"\n vm.recover(4)\n\n if params[:passwd] then\n trace << \"Changing VM password#{__LINE__}\"\n vm.passwd params[:passwd]\n end\n\n if params[:deploy] then\n trace << \"Waiting for state PENDING to deploy VM:#{__LINE__}\"\n vm.wait_state(\"PENDING\", 120)\n trace << \"Deploying VM:#{__LINE__}\"\n vm.deploy(host.to_i)\n end\n\n return true, host.to_i\n rescue => e\n LOG_ERROR \"Error ocurred while Reinstall: #{e.message}\"\n raise e\n end", "def restore\n return self if restored?\n\n # copied from MiniTest::Mock stub()\n subject_class.__send__ :undef_method, @meth\n subject_class.__send__ :alias_method, @meth, new_meth_name\n subject_class.__send__ :undef_method, new_meth_name\n\n # remove self\n self.class.instances.delete instance_key\n\n # satisfy verify\n @count = -1\n\n self\n end", "def restart; end" ]
[ "0.7008531", "0.6195144", "0.60789096", "0.60209644", "0.5970747", "0.59668154", "0.59461004", "0.59411603", "0.58845127", "0.58845127", "0.58653486", "0.58198476", "0.5814897", "0.58031124", "0.57422304", "0.57039714", "0.5681587", "0.5634584", "0.562108", "0.56122756", "0.56100583", "0.55972576", "0.5552409", "0.5552409", "0.5538576", "0.55304945", "0.5526219", "0.5526219", "0.5486617", "0.5476541", "0.54675865", "0.54627585", "0.54385674", "0.54214376", "0.5381484", "0.53764427", "0.53764427", "0.53538775", "0.5350948", "0.53501534", "0.5337842", "0.53182757", "0.53068566", "0.52982175", "0.5295691", "0.5283067", "0.5279966", "0.5270499", "0.5266635", "0.52598685", "0.5258481", "0.52578086", "0.52526885", "0.5224742", "0.51902944", "0.51902944", "0.51859546", "0.51757646", "0.5167762", "0.5167762", "0.5148303", "0.5145092", "0.5142653", "0.51413697", "0.5138026", "0.5133081", "0.51274556", "0.5125098", "0.511577", "0.510824", "0.51060313", "0.5101995", "0.5101764", "0.5092902", "0.50753266", "0.5065176", "0.50619763", "0.5061397", "0.50518763", "0.5045656", "0.5043259", "0.5042806", "0.5035595", "0.50347084", "0.5033685", "0.50282747", "0.5025111", "0.50175977", "0.5013522", "0.5013522", "0.5013522", "0.5013522", "0.5013181", "0.5001179", "0.49994826", "0.4994679", "0.4989238", "0.4985011", "0.49849647", "0.49824828" ]
0.8179662
0
Returns the rbenv ruby version
def rbenv_ruby `rbenv version`.split(' ').first end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ruby_version\n if ruby = ENV['RUBY']\n File.basename(ruby)\n else\n RUBY_VERSION\n end\n end", "def most_recent_ruby_version\n node[:rbenv][:rubies].map do |version|\n Gem::Version.new(version)\n end.sort.map(&:to_s).last\nend", "def ruby_version\n\t\treturn RUBY_VERSION.split( /\\./, 3 ).map( &:to_i ).pack( 'n*' )\n\tend", "def ruby_version\n if ruby = ENV['RUBY_ROOT']\n File.basename(ruby)\n else\n RUBY_VERSION\n end\n end", "def ruby_version\n @ruby_version ||= begin\n version_ = parse(::RUBY_VERSION, :standard)\n if version_.release_type == :final\n version_ = version_.change({:patchlevel => ::RUBY_PATCHLEVEL},\n :patchlevel_required => true, :patchlevel_delim => '-p')\n end\n version_\n end\n end", "def python_version\n return `python --version 2>&1`.split(/([\\d\\.]+)/)[1]\n end", "def ruby_version\n RUBY_VERSION\n end", "def ruby_versions\n if jruby?\n [ \"JRuby #{JRUBY_VERSION}\", \"like Ruby #{RUBY_VERSION}\" ]\n else\n [ \"Ruby #{RUBY_VERSION}\" ]\n end\n end", "def ruby_version; '2.6.3' end", "def rvm_ruby\n @@env.expanded_name.match(/([\\w\\-\\.]+)/)[1]\n end", "def ruby_version\n RUBY_VERSION.gsub(/[^0-9]/,'').to_i\nend", "def version_from_ruby_version_file\n shell_return = run_shell(\"cat .ruby-version\")\n shell_return.nil? ? nil : shell_return.stdout\n end", "def rbenv_installed?\n @rbenv_installed ||= `which rbenv`.present?\n end", "def ruby_version\n @ruby_version ||= begin\n version = @options['ruby_version'] || RUBY_VERSION\n normalize_version version\n end\n end", "def ensure_rbenv_ruby(ruby_version)\n ensure_rbenv\n ensure_packages \"curl\", \"build-essential\", \"libxslt1-dev\", \"libxml2-dev\", \"libssl-dev\"\n\n dep \"rbenv ruby: #{ruby_version}\" do\n met? { `bash -lc 'which ruby'`.include?(\"rbenv\") && `rbenv versions`.include?(ruby_version) }\n meet do\n puts \"Compiling Ruby will take a few minutes.\"\n shell \"rbenv install #{ruby_version}\"\n shell \"rbenv rehash\"\n end\n end\n end", "def latest_mri_ruby\n \"ruby-3.2\"\n end", "def ruby\n Gem.ruby\n end", "def ruby_version\n default = %x{ rvm current}.strip\n items = %x{ rvm ls strings }.split.compact\n\n ruby = menu_with_default \"RVM Ruby version to use for deployment:\", items,default\n ruby = ask \"Enter alternative RVM Ruby string: \" if ruby =~ /Other/\n ruby\n end", "def python_binary\n @python_binary ||= begin\n `which python2`\n $?.success? ? \"python2\" : \"python\"\n end\n end", "def ruby_version\n lockfile_next_version = Bundler::LockfileParser.new(lockfile_path.read).ruby_version\n\n if lockfile_next_version\n lockfile_next_version.chomp.sub(\"(\", \"\").sub(\")\", \"\").sub(/(p-?\\d+)/, ' \\1').split.join(\"-\")\n else\n super\n end\n end", "def required_ruby_version\n spec.required_ruby_version || Gem::Requirement.default\n end", "def ruby\n \"ruby1.9.3 -S\"\n end", "def version\n Buildr.application.deprecated 'Use ENV_JAVA[\\'java.version\\'] instead.'\n Java.load\n ENV_JAVA['java.version']\n end", "def perl_version\n `perl --version 2>&1`.match(/\\(v([\\d\\.]+)\\)/)[1]\n end", "def ruby_version(v)\n @ruby_version = v\n end", "def required_ruby_version\n spec.required_ruby_version\n end", "def version\n case engine\n when 'ruby' then RUBY_VERSION\n when 'jruby' then JRUBY_VERSION\n when 'rbx' then Rubinius::VERSION\n else raise \"don't know how to obtain version for #{engine}\"\n end\n end", "def gemfile_ruby_patchlevel\n if definition.ruby_version.respond_to?(:patchlevel)\n definition.ruby_version.patchlevel\n end\n end", "def ruby_spec_name\n @ruby_spec_name ||= begin\n metadata = Bundler::Source::Metadata.new\n ruby_spec = metadata.specs.find { |s| s.name[/[R|r]uby\\0/] }\n # Default to Bundler > 2 in case the Bundler internals change\n ruby_spec ? ruby_spec.name : \"Ruby\\0\"\n end\n end", "def version\n [ \"lib/#{ name }.rb\", \"lib/#{ name }/version.rb\" ].each do |v|\n path = project_path( v )\n line = path.read[/^\\s*VERSION\\s*=\\s*.*/]\n if line then\n return line.match(/.*VERSION\\s*=\\s*['\"](.*)['\"]/)[1]\n end\n end\n end", "def version_file\n version_rb_file = File.dirname(Buildr.application.buildfile.to_s) + '/version.rb'\n return version_rb_file if File.exists?(version_rb_file)\n return Buildr.application.buildfile.to_s\n end", "def java_version\n return nil unless jruby?\n\n java.lang.System.get_property('java.version')\n end", "def getRubySignature\n lRubyReleaseInfo = nil\n if (defined?(RUBY_PATCHLEVEL))\n lRubyReleaseInfo = \"#{RUBY_RELEASE_DATE} patchlevel #{RUBY_PATCHLEVEL}\"\n else\n lRubyReleaseInfo = RUBY_RELEASE_DATE\n end\n\n return \"ruby #{RUBY_VERSION} (#{lRubyReleaseInfo}) [#{RUBY_PLATFORM}]\"\n end", "def kernel_version\n uname('-v')\n end", "def jruby_version\n @jruby_version ||= ::JRUBY_VERSION.split(\".\").map {|s| s.to_i}\n end", "def read_ruby_version vim\n script = %{require \"rbconfig\"; print File.join(RbConfig::CONFIG[\"bindir\"], RbConfig::CONFIG[\"ruby_install_name\"])}\n version = `#{vim} --nofork --cmd 'ruby #{script}' --cmd 'q' 2>&1 >/dev/null | grep -v 'Vim: Warning'`.strip\n version unless version.empty? or version.include?(\"command is not available\")\nend", "def read_ruby_version vim\n script = %{require \"rbconfig\"; print File.join(RbConfig::CONFIG[\"bindir\"], RbConfig::CONFIG[\"ruby_install_name\"])}\n version = `#{vim} --nofork --cmd 'ruby #{script}' --cmd 'q' 2>&1 >/dev/null | grep -v 'Vim: Warning'`.strip\n version unless version.empty? or version.include?(\"command is not available\")\nend", "def chef_version\n v = run_command('sudo chef-solo --version').stdout.split(':')\n v[0].strip == 'Chef' ? v[1].strip : ''\n end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def shell_ruby_platform\n `ruby -rrbconfig -e \"puts RbConfig::CONFIG['sitearchdir']\"`\n end", "def ruby_bin\n @ruby_bin ||= begin\n c = ::Config::CONFIG\n File.join(c['bindir'], c['ruby_install_name']) << c['EXEEXT']\n end\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 get_xcode_version\n result = `xcodebuild -version`\n first_line = result.split(\"\\n\")[0]\n version = first_line.split(' ')[1]\n version\nend", "def getterminalappversion()\r\n return getvalue(SVTags::TERMINAL_APP_VERSION)\r\n end", "def version_from_gem_lock_file\n shell_return = run_shell(\"grep -A 1 RUBY Gemfile.lock\")\n shell_return.nil? ? nil : shell_return.stdout.split(\"\\n\")[1].strip.split(\" \")[1]\n end", "def version\n content = File.read(File.join(@path, 'Gemfile.lock'))\n content.match(REGEX_VERSION)[1]\n rescue\n raise Pbtd::Error::FileNotFound, \"Your Gemfile.lock not found for this environment\"\n end", "def path; Gem.ruby; end", "def binary\n @binary ||= begin\n if brewed?\n # If the python is brewed we always prefer it!\n # Note, we don't support homebrew/versions/pythonXX.rb, though.\n Formula.factory(@name).opt_prefix/\"bin/python#{@min_version.major}\"\n else\n # Using the ORIGINAL_PATHS here because in superenv, the user\n # installed external Python is not visible otherwise.\n which(@name, ORIGINAL_PATHS.join(':'))\n end\n end\n end", "def version\n @xcode_version ||= lambda do\n execute_command(['-version']) do |stdout, _, _|\n version_string = stdout.read.chomp[VERSION_REGEX, 0]\n RunLoop::Version.new(version_string)\n end\n end.call\n end", "def current_version\n node['chef_packages']['chef']['version']\nend", "def current_version\n node['chef_packages']['chef']['version']\nend", "def platform_version\n osver[1]\n end", "def required_ruby_version=(req)\n @required_ruby_version = Gem::Requirement.create req\n end", "def fetch_linux_os_version\n `lsb_release -rs`.strip\nend", "def ruby_path\n File.join(%w(bindir RUBY_INSTALL_NAME).map{|k| RbConfig::CONFIG[k]})\n end", "def installed_version()\n version = '0.0.0'\n if ::File.exists?(node_exe)\n nodejs_cmd = Mixlib::ShellOut.new(\"\\\"#{node_exe}\\\" --version\")\n nodejs_cmd.run_command\n version = nodejs_cmd.stdout.chomp\n end\n Chef::Log.info(\"Found NodeJS installed version: #{version}\")\n version\n end", "def get_app_version\n if File.exists?(Rails.root.join('VERSION'))\n return File.read(Rails.root.join('VERSION')).strip\n elsif File.directory?(Rails.root.join('.git'))\n return `cd '#{Rails.root}'; git describe`.strip! rescue 'unknown'\n end\n\n 'unknown'\nend", "def debian_version\n IO.read('/etc/debian_version').strip.split('.')\n end", "def version_number\n self.name =~ /RHEL-([0-9]+)/\n return $1.to_i\n end", "def rbenv_aliases\n if `which rbenv` != ''\n `rbenv alias --list`\n else\n ''\n end\n end", "def get_node_version\n run_ssh_command('node --version')\n end", "def version\n exec('--version').match(/^Ledger (.*),/)[1]\n end", "def gem_version\n ::Gem::Version.new(VERSION::STRING)\n end", "def distro_ruby_versions\n case distribution_class\n when :ubuntu\n if is_distribution?(\"<= artful\")\n [\"2.3\"]\n elsif is_distribution?(\"<= eoan\")\n [\"2.5\"]\n elsif is_distribution?(\"<= impish\")\n [\"2.7\"]\n elsif is_distribution?(\"<= kinetic\")\n [\"3.0\"]\n else\n [\"3.1\"]\n end\n when :debian\n if is_distribution?(\"<= jessie\")\n [\"2.1\"]\n elsif is_distribution?(\"<= stretch\")\n [\"2.3\"]\n elsif is_distribution?(\"<= buster\")\n [\"2.5\"]\n elsif is_distribution?(\"<= bullseye\")\n [\"2.7\"]\n else\n [\"3.1\"]\n end\n else\n raise \"Unknown distribution class\"\n end\nend", "def current_bundle_version\n case lane_context[:PLATFORM_NAME]\n when :android\n get_gradle_version_name(gradle_path: lane_context[:GRADLE_FILE])\n when :ios\n get_info_plist_value(path: 'ios/AllAboutOlaf/Info.plist',\n key: 'CFBundleShortVersionString')\n else\n get_package_key(key: :version)\n end\nend", "def cli_version\n Utils.call_executable('-v')\n end", "def ruby20!\n require_ruby_version \"~> 2.0\"\n end", "def rubygems_version_string\n VERSION.gsub(/[-\\+]/,'.')\n end", "def ruby22!\n require_ruby_version \"~> 2.2\"\n end", "def platform\n (RUBY_PLATFORM == \"java\") ? 'java' : Gem::Platform::RUBY\n end", "def major_version\n '1.8'\n end", "def aliased_ruby(requested_version)\n ruby_aliases = rbenv_aliases\n\n aliased_versions = {}\n\n ruby_aliases.split(\"\\n\").each do |ruby_alias|\n split_pattern = /\\A(.+) => (.+)\\z/\n alias_name, aliased_version = ruby_alias.match(split_pattern)&.captures\n aliased_versions[alias_name] = aliased_version\n end\n\n find_aliased_ruby(requested_version, aliased_versions)\n end", "def chef_version\n # SPEC_BLOCK_CI is used to force non-locking behavior inside tests.\n @chef_version ||= ENV['CHEF_VERSION'] || if ENV['POISE_MASTER_BUILD']\n # We're going to install the latest nightly via Omnitruck later on.\n nil\n elsif ENV['SPEC_BLOCK_CI'] != 'true'\n # If there isn't a specific override, lock TK to use the same version of Chef as the Gemfile.\n require 'chef/version'\n Chef::VERSION.to_s\n end\n end", "def initialize_defaults\n prefix = RBCONFIG['prefix']\n\n rubypath = File.join(RBCONFIG['bindir'], RBCONFIG['ruby_install_name'] + RBCONFIG['EXEEXT'])\n\n major = RBCONFIG['MAJOR'].to_i\n minor = RBCONFIG['MINOR'].to_i\n teeny = RBCONFIG['TEENY'].to_i\n version = \"#{major}.#{minor}\"\n\n # ruby ver. >= 1.4.4?\n newpath_p = ((major >= 2) or\n ((major == 1) and\n ((minor >= 5) or\n ((minor == 4) and (teeny >= 4)))))\n\n if RBCONFIG['rubylibdir']\n # V > 1.6.3\n libruby = \"#{prefix}/lib/ruby\"\n librubyver = RBCONFIG['rubylibdir']\n librubyverarch = RBCONFIG['archdir']\n siteruby = RBCONFIG['sitedir']\n siterubyver = RBCONFIG['sitelibdir']\n siterubyverarch = RBCONFIG['sitearchdir']\n elsif newpath_p\n # 1.4.4 <= V <= 1.6.3\n libruby = \"#{prefix}/lib/ruby\"\n librubyver = \"#{prefix}/lib/ruby/#{version}\"\n librubyverarch = \"#{prefix}/lib/ruby/#{version}/#{c['arch']}\"\n siteruby = RBCONFIG['sitedir']\n siterubyver = \"$siteruby/#{version}\"\n siterubyverarch = \"$siterubyver/#{RBCONFIG['arch']}\"\n else\n # V < 1.4.4\n libruby = \"#{prefix}/lib/ruby\"\n librubyver = \"#{prefix}/lib/ruby/#{version}\"\n librubyverarch = \"#{prefix}/lib/ruby/#{version}/#{c['arch']}\"\n siteruby = \"#{prefix}/lib/ruby/#{version}/site_ruby\"\n siterubyver = siteruby\n siterubyverarch = \"$siterubyver/#{RBCONFIG['arch']}\"\n end\n\n if arg = RBCONFIG['configure_args'].split.detect {|arg| /--with-make-prog=/ =~ arg }\n makeprog = arg.sub(/'/, '').split(/=/, 2)[1]\n else\n makeprog = 'make'\n end\n\n parameterize = lambda do |path|\n val = RBCONFIG[path]\n raise \"Unknown path -- #{path}\" if val.nil?\n val.sub(/\\A#{Regexp.quote(prefix)}/, '$prefix')\n end\n\n self.prefix = prefix\n self.bindir = parameterize['bindir']\n self.libdir = parameterize['libdir']\n self.datadir = parameterize['datadir']\n self.mandir = parameterize['mandir']\n self.docdir = File.dirname(parameterize['docdir']) # b/c of trailing $(PACKAGE)\n self.sysconfdir = parameterize['sysconfdir']\n self.localstatedir = parameterize['localstatedir']\n self.libruby = libruby\n self.librubyver = librubyver\n self.librubyverarch = librubyverarch\n self.siteruby = siteruby\n self.siterubyver = siterubyver\n self.siterubyverarch = siterubyverarch\n self.rbdir = '$siterubyver'\n self.sodir = '$siterubyverarch'\n self.rubypath = rubypath\n self.rubyprog = rubypath\n self.makeprog = makeprog\n self.extconfopt = ''\n self.shebang = 'ruby'\n self.without_ext = 'no'\n self.without_doc = 'yes'\n self.doctemplate = 'html'\n self.testrunner = 'auto'\n self.installdirs = 'site'\n end", "def python_binary\n ::File.join('', 'usr', 'bin', system_package_name)\n end", "def yosemite_or_newer?\n Gem::Version.new(`sw_vers -productVersion`) >= Gem::Version.new('10.10')\nend", "def ruby21!\n require_ruby_version \"~> 2.1\"\n end", "def ruby?\n exist? 'Gemfile'\n end", "def version_to_install\n return config[:bootstrap_version] if config[:bootstrap_version]\n\n if config[:channel] == \"stable\"\n Chef::VERSION.split(\".\").first\n else\n \"latest\"\n end\n end", "def version\n @version ||= exec('SHOW server_version')[0]['server_version'].split[0]\n end", "def puppet_gem_version\n Gem::Version.create(puppet_version.split(' ').first.strip.gsub('-', '.'))\n end", "def platform_and_version\n return \"debian-#{node['platform_version'].to_i}\" if node['platform'] == 'debian'\n return \"ubuntu-#{node['platform_version']}\" if node['platform'] == 'ubuntu'\n end", "def osver\n return `uname -r`.chomp\n end", "def gem_version\n Gem::Version.new VERSION\n end", "def ruby_platform\n RUBY_PLATFORM\n end", "def getRubyVersion(fn)\n if File.file?(fn)\n puts \".ruby-version: #{File.open(fn).gets.chop}. Version actually running is in upper right of this window on gray background. \\n[Can't tell if ruby is selected by #{fn} or TM Preferences. . Ruby version not being selected by ruby-version]\"\n else\n puts \"fn: #{fn} isn't in this folder. Need to change the script to go until finds one.\"\n end\nend", "def default_ruby_system_packages\n case node['platform']\n when 'ubuntu'\n pkgs = %w[ openssl libreadline6 libreadline6-dev\n zlib1g zlib1g-dev libssl-dev libyaml-dev libsqlite3-dev\n sqlite3 libxml2-dev libxslt-dev autoconf libc6-dev\n ncurses-dev automake libtool bison ssl-cert ]\n case node['platform_version']\n when '10.04' then %w[ ruby ruby-dev libopenssl-ruby1.8 ] + pkgs\n when '12.04', '12.10' then %w[ ruby1.9.1 ruby1.9.1-dev ] + pkgs\n else pkgs\n end\n end\nend", "def current_version\n version_number rev\n end", "def version\n '2.0.7.7' # Version number <major-update>.<minor-update>.<patch-update>.<commit-count>\n end", "def current_deployed_version\n 5\n end", "def version\n output = @filer.invoke(\"system-get-version\")\n if(output.results_errno() != 0)\n r = output.results_reason()\n raise \"Failed : \\n\" + r\n else \n output.child_get_string(\"version\")\n end\n end", "def version\n str = if detect_product(\"CriOs\")\n crios.version\n else\n chrome.version\n end\n\n Version.new(str)\n end", "def system_version\n @system_version ||= File.read(Rails.root.join(\"VERSION\")).strip\n end", "def environment_info\n info = \"[Ruby: #{RUBY_VERSION}]\"\n info << \" [#{configuration.framework}]\" if configuration.framework\n info << \" [Env: #{configuration.environment_name}]\" if configuration.environment_name\n end", "def ruby_version(gemfile, ruby_version_file, specified_ruby_version)\n ruby, ruby_source = if gemfile && gemfile.ruby_version\n [gemfile.ruby_version, :gemfile]\n elsif !specified_ruby_version.to_s.empty?\n [specified_ruby_version, :vexor_yml]\n elsif ruby_version_file && ruby_version_file.ruby_version\n [ruby_version_file.ruby_version, :ruby_version]\n else\n [DEFAULT_RUBY_VERSION, nil]\n end\n use_and_log_ruby(ruby, ruby_source)\n end" ]
[ "0.71018237", "0.7021712", "0.6862039", "0.677662", "0.67422354", "0.66946185", "0.65791935", "0.6559915", "0.6503853", "0.64653397", "0.64008373", "0.64001", "0.63920224", "0.6369104", "0.62895656", "0.62581515", "0.62406", "0.6203518", "0.618088", "0.60488933", "0.6047772", "0.5973022", "0.5964222", "0.5949097", "0.5918476", "0.589056", "0.5881601", "0.5864132", "0.58320856", "0.57815087", "0.5777546", "0.5765431", "0.5730586", "0.5729687", "0.5674589", "0.5663696", "0.5663696", "0.56536067", "0.56444055", "0.56444055", "0.56444055", "0.56444055", "0.56444055", "0.56444055", "0.56404597", "0.5623769", "0.55759513", "0.555976", "0.5545702", "0.5529277", "0.5521893", "0.55027896", "0.5498729", "0.54955816", "0.5489622", "0.5489622", "0.5445849", "0.5436798", "0.5432399", "0.5410359", "0.540542", "0.5401947", "0.5391675", "0.538277", "0.5377565", "0.5373289", "0.5372469", "0.5346922", "0.53369075", "0.5334083", "0.5322275", "0.5320444", "0.5320003", "0.5309468", "0.53093123", "0.5288881", "0.5287181", "0.52727354", "0.52707297", "0.5270531", "0.5270437", "0.5265661", "0.5260225", "0.5251243", "0.5248368", "0.52432686", "0.5226752", "0.5221709", "0.52191365", "0.5209271", "0.5207991", "0.5207636", "0.5204408", "0.52022016", "0.52016616", "0.51942116", "0.5191366", "0.5180105", "0.5178566", "0.5175443" ]
0.89887893
0
Returns the RVM ruby version
def rvm_ruby @@env.expanded_name.match(/([\w\-\.]+)/)[1] end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def ruby_version\n default = %x{ rvm current}.strip\n items = %x{ rvm ls strings }.split.compact\n\n ruby = menu_with_default \"RVM Ruby version to use for deployment:\", items,default\n ruby = ask \"Enter alternative RVM Ruby string: \" if ruby =~ /Other/\n ruby\n end", "def ruby_version\n if ruby = ENV['RUBY']\n File.basename(ruby)\n else\n RUBY_VERSION\n end\n end", "def ruby_version\n\t\treturn RUBY_VERSION.split( /\\./, 3 ).map( &:to_i ).pack( 'n*' )\n\tend", "def perl_version\n `perl --version 2>&1`.match(/\\(v([\\d\\.]+)\\)/)[1]\n end", "def ruby_version\n @ruby_version ||= begin\n version = @options['ruby_version'] || RUBY_VERSION\n normalize_version version\n end\n end", "def ruby_version\n RUBY_VERSION\n end", "def version_from_ruby_version_file\n shell_return = run_shell(\"cat .ruby-version\")\n shell_return.nil? ? nil : shell_return.stdout\n end", "def ruby_version\n if ruby = ENV['RUBY_ROOT']\n File.basename(ruby)\n else\n RUBY_VERSION\n end\n end", "def read_ruby_version vim\n script = %{require \"rbconfig\"; print File.join(RbConfig::CONFIG[\"bindir\"], RbConfig::CONFIG[\"ruby_install_name\"])}\n version = `#{vim} --nofork --cmd 'ruby #{script}' --cmd 'q' 2>&1 >/dev/null | grep -v 'Vim: Warning'`.strip\n version unless version.empty? or version.include?(\"command is not available\")\nend", "def read_ruby_version vim\n script = %{require \"rbconfig\"; print File.join(RbConfig::CONFIG[\"bindir\"], RbConfig::CONFIG[\"ruby_install_name\"])}\n version = `#{vim} --nofork --cmd 'ruby #{script}' --cmd 'q' 2>&1 >/dev/null | grep -v 'Vim: Warning'`.strip\n version unless version.empty? or version.include?(\"command is not available\")\nend", "def determine_rvm_ruby_if_not_given\n if node['rvm_passenger']['rvm_ruby'].nil?\n rvm_ruby = node['rvm']['default_ruby']\n rvm_ruby += \"@passenger\" unless rvm_ruby == \"system\"\n\n node.set['rvm_passenger']['rvm_ruby'] = rvm_ruby\n Chef::Log.debug(%{Setting node['rvm_passenger']['rvm_ruby'] = } +\n %{\"#{node['rvm_passenger']['rvm_ruby']}\"})\n end\n end", "def ruby_version\n @ruby_version ||= begin\n version_ = parse(::RUBY_VERSION, :standard)\n if version_.release_type == :final\n version_ = version_.change({:patchlevel => ::RUBY_PATCHLEVEL},\n :patchlevel_required => true, :patchlevel_delim => '-p')\n end\n version_\n end\n end", "def python_version\n return `python --version 2>&1`.split(/([\\d\\.]+)/)[1]\n end", "def rbenv_ruby\n `rbenv version`.split(' ').first\n end", "def ruby_version\n RUBY_VERSION.gsub(/[^0-9]/,'').to_i\nend", "def version\n case engine\n when 'ruby' then RUBY_VERSION\n when 'jruby' then JRUBY_VERSION\n when 'rbx' then Rubinius::VERSION\n else raise \"don't know how to obtain version for #{engine}\"\n end\n end", "def ruby\n Gem.ruby\n end", "def ruby_version(v)\n @ruby_version = v\n end", "def get_virtualbox_version\n\tbegin\n\t\tif windows?\n\t\t\tver = `\"%ProgramFiles%\\\\Oracle\\\\VirtualBox\\\\VBoxManage\" -v 2>NULL`\n\t\telse\n\t\t\tver = `VBoxManage -v 2>/dev/null`\n\t\tend\n\trescue\n\t\tver = ''\n\tend\n\tver.gsub(/r.*/m, '')\nend", "def ruby\n \"ruby1.9.3 -S\"\n end", "def latest_mri_ruby\n \"ruby-3.2\"\n end", "def maglev_using_rvm\n ENV['rvm_path'] != \"\" && (/^maglev/ =~ ENV['rvm_ruby_string']) == 0\nend", "def maglev_using_rvm\n ENV['rvm_path'] != \"\" && (/^maglev/ =~ ENV['rvm_ruby_string']) == 0\nend", "def java_version\n return nil unless jruby?\n\n java.lang.System.get_property('java.version')\n end", "def ruby_version; '2.6.3' end", "def version\n Buildr.application.deprecated 'Use ENV_JAVA[\\'java.version\\'] instead.'\n Java.load\n ENV_JAVA['java.version']\n end", "def vbox_version\n command=\"#{@vboxcmd} --version\"\n shell_results=shell_exec(\"#{command}\",{:mute => true})\n version=shell_results.stdout.strip.split(/[^0-9\\.]/)[0]\n return version\n end", "def prompt_ruby_version\n if yes?(\"Are you using RVM?\")\n # rubocop:disable Metrics/LineLength\n if yes?(\"Would you like to create a RVM gemset, #{@app_name}, for this app?[y|yes] \")\n # rubocop:enable Metrics/LineLength\n template('rvmrc.tt','.rvmrc', {app_name: @app_name})\n else\n puts \"Using the default gemset\"\n run(\". ${rvm_path:-$HOME/.rvm}/environments/default\")\n end\n end\n end", "def get_node_version\n run_ssh_command('node --version')\n end", "def rvm?\n\t\t\tFile.exists?(RvmPow::RVM_BINARY)\n\t\tend", "def get_virtualbox_version\n begin\n if windows?\n ver = `\"%ProgramFiles%\\\\Oracle\\\\VirtualBox\\\\VBoxManage\" -v 2>NULL`\n else\n ver = `VBoxManage -v 2>/dev/null`\n end\n rescue\n ver = ''\n end\n ver.gsub(/r.*/m, '')\nend", "def virtualbox_version\n cmd = windows? ?\n '\"%ProgramFiles%\\\\Oracle\\\\VirtualBox\\\\VBoxManage\" -v 2>NUL' :\n 'VBoxManage -v 2>/dev/null'\n `#{cmd}`[/[\\d\\.]+/] rescue nil\nend", "def ruby_versions\n if jruby?\n [ \"JRuby #{JRUBY_VERSION}\", \"like Ruby #{RUBY_VERSION}\" ]\n else\n [ \"Ruby #{RUBY_VERSION}\" ]\n end\n end", "def kernel_version\n uname('-v')\n end", "def virtualbox_version()\n vboxmanage = Vagrant::Util::Which.which(\"VBoxManage\") || Vagrant::Util::Which.which(\"VBoxManage.exe\")\n if vboxmanage != nil\n s = Vagrant::Util::Subprocess.execute(vboxmanage, '--version')\n s = s.stdout.strip!\n s = s.split('_').first\n return s\n else\n return nil\n end\nend", "def virtualbox_version()\n vboxmanage = Vagrant::Util::Which.which(\"VBoxManage\") || Vagrant::Util::Which.which(\"VBoxManage.exe\")\n if vboxmanage != nil\n s = Vagrant::Util::Subprocess.execute(vboxmanage, '--version')\n s = s.stdout.strip!\n s = s.split('_').first\n return s\n else\n return nil\n end\nend", "def current_version\n node['chef_packages']['chef']['version']\nend", "def current_version\n node['chef_packages']['chef']['version']\nend", "def most_recent_ruby_version\n node[:rbenv][:rubies].map do |version|\n Gem::Version.new(version)\n end.sort.map(&:to_s).last\nend", "def ruby_installed?(ruby)\n cmd_if %{rvm list strings | grep -q \"#{ruby}\" >/dev/null}, true\nend", "def chef_version\n v = run_command('sudo chef-solo --version').stdout.split(':')\n v[0].strip == 'Chef' ? v[1].strip : ''\n end", "def get_puppet_version\n version = nil\n installed = self.is_in_path?('puppet')\n\n if installed\n raw = self.run('puppet --version')\n version = raw.match(/([\\d\\.]*)\\s/) ? $1 : nil\n else\n version = nil\n end\n\n version\n end", "def rvm_installed?\n cmd_test %{-s \"/usr/local/lib/rvm\"}\nend", "def osver\n return `uname -r`.chomp\n end", "def ruby_version\n lockfile_next_version = Bundler::LockfileParser.new(lockfile_path.read).ruby_version\n\n if lockfile_next_version\n lockfile_next_version.chomp.sub(\"(\", \"\").sub(\")\", \"\").sub(/(p-?\\d+)/, ' \\1').split.join(\"-\")\n else\n super\n end\n end", "def getterminalappversion()\r\n return getvalue(SVTags::TERMINAL_APP_VERSION)\r\n end", "def rpm_version(name)\n if (self.centos? && !self.centos7?) || self.fedora? || self.redhat8? || self.oracle8? || self.redhat9?\n # returns epoch.version\n v = Chef::Provider::Package::Dnf::PythonHelper.instance.\n package_query(:whatinstalled, name).version\n unless v.nil?\n v.split(':')[1]\n end\n elsif self.centos7? &&\n (FB::Version.new(Chef::VERSION) > FB::Version.new('14'))\n # returns epoch.version.arch\n v = Chef::Provider::Package::Yum::PythonHelper.instance.\n package_query(:whatinstalled, name).version\n unless v.nil?\n v.split(':')[1]\n end\n else\n # return version\n Chef::Provider::Package::Yum::YumCache.instance.\n installed_version(name)\n end\n end", "def version\n output = @filer.invoke(\"system-get-version\")\n if(output.results_errno() != 0)\n r = output.results_reason()\n raise \"Failed : \\n\" + r\n else \n output.child_get_string(\"version\")\n end\n end", "def required_ruby_version\n spec.required_ruby_version || Gem::Requirement.default\n end", "def rvm_installed?\n @rvm_installed ||= `which rvm`.present?\n end", "def system_version\n @system_version ||= File.read(Rails.root.join(\"VERSION\")).strip\n end", "def version\n h = call(CMD_VERSION)\n return h[:result]\n end", "def path_to_bin_rvm(options={})\n result = File.join(rvm_bin_path, \"rvm\")\n result << \" #{options[:with_ruby]} do\" if options[:with_ruby]\n result\n end", "def chef_version\n # SPEC_BLOCK_CI is used to force non-locking behavior inside tests.\n @chef_version ||= ENV['CHEF_VERSION'] || if ENV['POISE_MASTER_BUILD']\n # We're going to install the latest nightly via Omnitruck later on.\n nil\n elsif ENV['SPEC_BLOCK_CI'] != 'true'\n # If there isn't a specific override, lock TK to use the same version of Chef as the Gemfile.\n require 'chef/version'\n Chef::VERSION.to_s\n end\n end", "def required_ruby_version\n spec.required_ruby_version\n end", "def version\n echo_rosh_command\n\n @version ||= adapter.current_version\n end", "def version\n @version ||= exec('SHOW server_version')[0]['server_version'].split[0]\n end", "def puppet_version\n return @@puppet_version unless @@puppet_version.nil?\n\n begin\n @@puppet_version = Librarian::Posix.run!(%W{puppet --version}).strip\n rescue Errno::ENOENT, Librarian::Posix::CommandFailure => error\n msg = \"Unable to load puppet. Please install it using native packages for your platform (eg .deb, .rpm, .dmg, etc).\"\n msg += \"\\npuppet --version returned #{error.status}\" if error.respond_to? :status\n msg += \"\\n#{error.message}\" unless error.message.nil?\n $stderr.puts msg\n exit 1\n end\n return @@puppet_version\n end", "def Check_OS_Version()\n\tos_version = `ver`\n\treturn os_version\nend", "def installed_version()\n version = '0.0.0'\n if ::File.exists?(node_exe)\n nodejs_cmd = Mixlib::ShellOut.new(\"\\\"#{node_exe}\\\" --version\")\n nodejs_cmd.run_command\n version = nodejs_cmd.stdout.chomp\n end\n Chef::Log.info(\"Found NodeJS installed version: #{version}\")\n version\n end", "def platform_version_for_package\n if platform == 'rhel'\n platform_version[/([\\d]+)\\..+/, 1]\n else\n platform_version\n end\n end", "def jruby_version\n @jruby_version ||= ::JRUBY_VERSION.split(\".\").map {|s| s.to_i}\n end", "def ruby_spec_name\n @ruby_spec_name ||= begin\n metadata = Bundler::Source::Metadata.new\n ruby_spec = metadata.specs.find { |s| s.name[/[R|r]uby\\0/] }\n # Default to Bundler > 2 in case the Bundler internals change\n ruby_spec ? ruby_spec.name : \"Ruby\\0\"\n end\n end", "def version\n cmd(COMMANDS[:version], 2)\n end", "def version\n @xcode_version ||= lambda do\n execute_command(['-version']) do |stdout, _, _|\n version_string = stdout.read.chomp[VERSION_REGEX, 0]\n RunLoop::Version.new(version_string)\n end\n end.call\n end", "def platform_version\n osver[1]\n end", "def os_minimum_version\n return @os_minimum_version\n end", "def os_minimum_version\n return @os_minimum_version\n end", "def installed_version\n capture(\"#{chef_solo} -v || true\") =~ /Chef: (\\d+\\.\\d+\\.\\d+)/ ? $1 : nil\n end", "def version_number\n self.name =~ /RHEL-([0-9]+)/\n return $1.to_i\n end", "def version\n str = if detect_product(\"CriOs\")\n crios.version\n else\n chrome.version\n end\n\n Version.new(str)\n end", "def get_rbvm(arg = nil, existing = nil)\n if arg.nil?\n rbvm = new(ENV['rbvm_ruby_specification'])\n else \n rbvm = new(arg, existing)\n if !rbvm.valid?\n if ENV['rbvm_ruby_specification']\n ruby_str = ENV['rbvm_ruby_specification'].split(env.gemset_separator)[0]\n else\n ruby_str = new('default').ruby_string\n end\n rbvm = new(\"#{ruby_str}#{env.gemset_separator}#{arg}\", existing)\n end\n end\n return rbvm\n end", "def ruby_version=(value)\n normalize_version(value).tap do |version|\n @ruby_version = @options['ruby_version'] = version\n @ruby_parser = parser_for_version version\n end\n end", "def puppet_gem_version\n Gem::Version.create(puppet_version.split(' ').first.strip.gsub('-', '.'))\n end", "def linux_version\n case ENV['MACHTYPE']\n when \"s390x-suse-linux\"\n :sles_zlnx\n when /^i[356]86/\n if File.exist? \"/etc/fedora-release\"\n :linux_ia32_cell\n else\n :linux_ia32\n end\n else\n if File.exist? \"/etc/rhel-release\"\n :rhel\n elsif File.exist? \"/etc/redhat-release\"\n `awk '/release 5/||/release 4.9/{v=5};/release 4/{v=4}; END {print \"rhel\" v}' /etc/redhad-release`.to_sym\n elsif File.exist? \"/etc/SuSE-release\"\n `awk '$1==\"VERSION\" { v=$3}; END { print \"sles\" v}' /etc/SuSE-release`.to_sym\n elsif File.exist? \"/etc/yellowdog-release\"\n :yhpc\n else\n :rhel\n end\n end\nend", "def yosemite_or_newer?\n Gem::Version.new(`sw_vers -productVersion`) >= Gem::Version.new('10.10')\nend", "def fetch_linux_os_version\n `lsb_release -rs`.strip\nend", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def gem_version; end", "def operating_system_version\n return @operating_system_version\n end", "def operating_system_version\n return @operating_system_version\n end", "def runtime_version\n \n #create a new buffer which will hold the runtime's version\n version_buffer = FFI::MemoryPointer.new(VersionMaxLength) \n\n #get the system's version\n GetVersion(version_buffer)\n\n #and return the retrieved version\n version_buffer.read_string\n\n end", "def getRubyVersion(fn)\n if File.file?(fn)\n puts \".ruby-version: #{File.open(fn).gets.chop}. Version actually running is in upper right of this window on gray background. \\n[Can't tell if ruby is selected by #{fn} or TM Preferences. . Ruby version not being selected by ruby-version]\"\n else\n puts \"fn: #{fn} isn't in this folder. Need to change the script to go until finds one.\"\n end\nend", "def old_version?\n case @node['platform']\n when 'ubuntu'\n Chef::VersionConstraint.new(\"< 11.0\").include?(@node['platform_version'])\n when 'debian'\n Chef::VersionConstraint.new(\"< 7.0\").include?(@node['platform_version'])\n end\n end", "def monit_version\n @monit_version ||= begin\n cmd = shell_out([monit_binary, '-V'])\n if !cmd.error? && /version ([0-9.]+)$/ =~ cmd.stdout\n Gem::Version.create($1)\n else\n nil\n end\n end\n end", "def java_version\n ver_str = `java -version 2>&1 | grep \"java version\"`\n Chef::Log.info \"Java version string: #{ver_str}\"\n # Strip the 'java version \"..\"' from the string\n (!ver_str.nil? && !ver_str.empty?) ? ver_str.gsub(/[java version *,\",\\n]/, '') : `Chef::Log.error \"Java version is empty. Cannot Proceed further...\"`\n end", "def shell_ruby_platform\n `ruby -rrbconfig -e \"puts RbConfig::CONFIG['sitearchdir']\"`\n end", "def version\n execute_string(\"-version\")\n end", "def version\n version_property ? version_property.ruby_value : nil\n end", "def cli_version\n Utils.call_executable('-v')\n end", "def ruby_implementation\n case RUBY_ENGINE\n when /java/\n 'jruby'\n when /ruby/\n # I'm actually not sure what rubinius or maglev or other implementions would return. I don't use rubies, other than mri or jruby.\n 'mri'\n else\n nil\n end\nend", "def gemfile_ruby_patchlevel\n if definition.ruby_version.respond_to?(:patchlevel)\n definition.ruby_version.patchlevel\n end\n end", "def getRubySignature\n lRubyReleaseInfo = nil\n if (defined?(RUBY_PATCHLEVEL))\n lRubyReleaseInfo = \"#{RUBY_RELEASE_DATE} patchlevel #{RUBY_PATCHLEVEL}\"\n else\n lRubyReleaseInfo = RUBY_RELEASE_DATE\n end\n\n return \"ruby #{RUBY_VERSION} (#{lRubyReleaseInfo}) [#{RUBY_PLATFORM}]\"\n end", "def get_current_version(package)\n command = \"apt-cache policy #{package} | grep --color=never 'Installed'\"\n raw = `#{command}`.strip\n return nil if raw == ''\n\n version = raw.gsub('Installed: ', '')\n return nil if version == '(none)'\n\n version\n end", "def platform_version\n return @platform_version\n end", "def osx_version\n @osx_version ||= `sw_vers | grep ProductVersion | cut -f 2 -d ':' | awk ' { print $1; } '`.strip rescue ''\n end" ]
[ "0.79461366", "0.6698439", "0.6692845", "0.6652912", "0.66254026", "0.66031736", "0.6598809", "0.655525", "0.64827526", "0.64827526", "0.63912076", "0.6375008", "0.63747865", "0.6343658", "0.632626", "0.6312146", "0.62389517", "0.6225651", "0.6220597", "0.62051994", "0.6195858", "0.6168397", "0.6168397", "0.61522746", "0.61204636", "0.6108243", "0.6046088", "0.6039954", "0.60398", "0.601832", "0.599887", "0.5996743", "0.59437174", "0.58969206", "0.5896063", "0.5896063", "0.58656466", "0.58656466", "0.58396155", "0.5836137", "0.58306974", "0.5805282", "0.58031315", "0.5780061", "0.57673866", "0.5724642", "0.5707415", "0.56677127", "0.5665295", "0.56483996", "0.5643481", "0.5626741", "0.5620635", "0.5602815", "0.56010777", "0.5589841", "0.5567321", "0.5565858", "0.5549979", "0.55397755", "0.5537298", "0.55177534", "0.5484441", "0.5460811", "0.54494643", "0.544098", "0.5429336", "0.5429336", "0.54060185", "0.53905404", "0.53843033", "0.53840554", "0.5362643", "0.53516996", "0.5348966", "0.5346873", "0.5328572", "0.53252065", "0.53252065", "0.53252065", "0.53252065", "0.53252065", "0.53252065", "0.5313306", "0.5313306", "0.53113055", "0.52949464", "0.52899116", "0.52826965", "0.5278584", "0.52753913", "0.5271695", "0.52693266", "0.5244898", "0.5243567", "0.52191454", "0.521706", "0.52148616", "0.5208805", "0.52039564" ]
0.755152
1
Returns true if rbenv is installed.
def rbenv_installed? @rbenv_installed ||= `which rbenv`.present? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def has_virtualenv_installed(python)\n `#{python} -m virtualenv --help 2>&1`\n if (0 != $?.to_i)\n false\n else\n true\n end\n end", "def ruby?\n exist? 'Gemfile'\n end", "def python?\n exist? 'requirements.txt'\n end", "def installed?\n !IO.popen(\"which #{self}\"){|i| i.read}.empty?\n end", "def installed?\n MacOS.dev_tools_path == Pathname.new(\"/usr/bin\")\n end", "def should_do_python_install?\n return (osx? and (not (File.exists?(python_directory))))\n end", "def env_exists?(ruby_string)\n return true if system_ruby?(ruby_string)\n\n rubie = select_ruby(ruby_string)\n gemset = select_gemset(ruby_string)\n\n if gemset\n gemset_exists?(:ruby => rubie, :gemset => gemset)\n else\n ruby_installed?(rubie)\n end\n end", "def environment?\n dir?('.bundle') || dir?('.virtualenv') || dir?('node_modules')\n end", "def have_brew?\n have_command? :brew\n end", "def installed?\n ::File.exist?(PATH)\n end", "def executable_installed?\n @cli.system_call 'which gcloud'\n $?.success?\n end", "def proselint_installed?\n `which proselint`.strip.empty? == false\n end", "def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end", "def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end", "def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end", "def installed?\n File.exists?(@path)\n end", "def cookbooks_repo_installed?\n cmd_test %{-d \"#{cookbooks_path}\"}\nend", "def is_dependencies_installed?\n is_pkgs = @ssh.do_ssh_cmd('which puppet && which git')\n if is_pkgs[:exit_code] != 0\n abort 'Please install git and puppet on the targeted node'\n end\n true\n end", "def gemfile_exists? \n File.exists? \"Gemfile\"\nend", "def gemfile_exists? \n File.exists? \"Gemfile\"\nend", "def installed?\n File.exist?(ktlint_path)\n end", "def installed?\n false\n end", "def installed?\n revision && install_path.exist?\n end", "def ruby_installed?(ruby)\n cmd_if %{rvm list strings | grep -q \"#{ruby}\" >/dev/null}, true\nend", "def jruby?\n RbConfig::CONFIG['ruby_install_name'] == 'jruby'\n end", "def check_pythons_for_virtenv\n @candidate_pythons.each{ |py|\n if has_virtualenv_installed(py)\n @command = py\n return true\n end\n }\n return false\n end", "def installed?\n File.exist?(swiftlint_path)\n end", "def installed?(command)\n MakeMakefile.find_executable(command)\n end", "def rbx?\n RbConfig::CONFIG['ruby_install_name'] == 'rbx'\n end", "def rvm_installed?\n @rvm_installed ||= `which rvm`.present?\n end", "def dot_installed?\n assert_usr_bin_env_exists\n system \"#{USR_BIN_ENV} which dot > /dev/null\"\n end", "def bundler?\n @bundler ||= File.exist?(\"#{ Dir.pwd }/Gemfile\")\n end", "def git_installed?\n\tbegin\n\t `git config > /dev/null 2>&1`\n\trescue\n\t false\n\tend\n end", "def setup_project_python_environment\n if not has_valid_virtualenv?\n return false\n end\n if should_do_requirements_install\n action \"Installing user defined python dependencies\" do\n unless install_user_python_dependencies()\n return false\n end\n note_install(\"pythonenv\")\n end\n end\n if should_install_python_dependencies?\n unless install_python_dependencies()\n return false\n end\n end\n return true\n end", "def rbenv_ruby\n `rbenv version`.split(' ').first\n end", "def rvm_installed?\n cmd_test %{-s \"/usr/local/lib/rvm\"}\nend", "def install?\n return false unless allowed_host?\n return false unless packages_installed?\n true\n end", "def ri_installed?\n File.exist? @ri_dir\n end", "def ri_installed?\n File.exist? @ri_dir\n end", "def exist?\n ruby_gems_fetcher.started?\n end", "def installed?\n (dir = installed_prefix).directory? && dir.children.length > 0\n end", "def should_do_requirements_install\n if has_python_requirements\n if not install_date('pythonenv')\n # We've never done an install from requirements.txt before\n return true\n else\n return (requirements_edit_date > install_date('pythonenv'))\n end\n else\n return false\n end\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 installed?\n self.class.installed?(@repo)\n end", "def installed?(utility)\n return false if execute_as_root(\"which #{utility}\").nil?\n true\n end", "def ri_installed?\n File.exist?(File.join(@doc_dir, \"ri\"))\n end", "def chef_installed?\n cmd_if %{rvm use #{ruby} >/dev/null && gem list --no-versions | grep -q \"^chef$\" >/dev/null}, true\nend", "def ihs_plg_installed?\n get_version = node['ihs']['plugin']['install_dir'] + '/bin/versionInfo.sh'\n\n begin\n !/^PLG\\s+installed$/.match(shell_out(get_version).stdout).to_s.empty?\n rescue Errno::ENOENT => e\n Chef::Log.info \"File not found: #{get_version}, error: #{e}\"\n return false\n end\n end", "def bundled?\n $BUNDLE || ENV.key?(\"BUNDLE\")\n end", "def app_available?(app)\n `which #{app}`.strip == \"\" ? false : true\n end", "def installed?\n path.exist? || path.symlink?\n end", "def unicorn_installed?\n result = `which unicorn`.gsub(\"\\n\", \"\")\n \n puts \"unicorn-binary not found\" if result.empty?\n \n result.empty? ? false : true\n end", "def ruby?\n RUBY_ENGINE == 'jruby'\n end", "def check_or_install\n if osx?\n # We currently only install python for osx\n install_or_update_osx\n else\n # Otherwise we check that the system supplied python will be sufficient\n check_system_python\n end\n end", "def aptitude?\n File.executable? '/usr/bin/apt-get'\n end", "def installed?(cmd)\n !Garcon::FileHelper.which(cmd).nil?\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 jruby?\n defined?( RUBY_ENGINE ) and RUBY_ENGINE == 'jruby'\nend", "def setup_ruby_environment\n return false unless ruby?\n working_dir do\n cmd 'bundle', 'install', '--path', '.bundle', '--deployment'\n end\n end", "def config_repo_installed?\n cmd_test %{-d \"#{config_path}\"}\nend", "def what_is_installed?\n which_os = os.green\n package_manager = ( has_installer? ? 'Yes'.green : 'No'.red.blink )\n exe_installed = ( pianobar? ? 'Yes'.green : 'No'.red.blink )\n ctl_file = ( ctl? ? 'Yes'.green : 'No'.red.blink )\n has_notifier = ( notify? ? 'Yes'.green : 'No'.red.blink )\n ok = ( has_installer? ? 'Yes'.green : 'No'.red.blink )\n\n puts get_template 'what_is_installed', binding\n\n has_installer?\n end", "def backup_minister_installed?\n software_installed?(APP_NAME)\n end", "def setup_python_environment\n return false unless python?\n working_dir do\n cmd 'virtualenv', '.virtualenv'\n cmd './.virtualenv/bin/pip', '-r', 'requirements.txt'\n end\n end", "def yum?\n File.executable? '/usr/bin/yum'\n end", "def installed?\n File.exists?(database_configuration_file)\n end", "def installed?\n !!@installed\n end", "def berkshelf_enabled?(env)\n env[:machine].config.berkshelf.enabled == true\n end", "def php?\n ::FileTest.exist?('/usr/bin/php')\n end", "def php?\n ::FileTest.exist?('/usr/bin/php')\n end", "def kacl_cli_installed?\n `which kacl-cli`.strip.empty? == false\n end", "def rdoc_installed?\n File.exist? @rdoc_dir\n end", "def rdoc_installed?\n File.exist? @rdoc_dir\n end", "def installed?\n !installed_version.nil?\n end", "def git_installed?\n\t`git config > /dev/null 2>&1`\n end", "def git_installed?\n\t`git config > /dev/null 2>&1`\n end", "def redis_installed?\n result = `which redis-server`.gsub(\"\\n\", \"\")\n\n puts \"redis-server-binary not found\" if result.empty?\n\n result.empty? ? false : true\n end", "def puppet_lib?\n File.exists?(puppet_lib)\n end", "def installed?\n return prefix.children.length > 0\n rescue\n return false\n end", "def installed?(name, req = Gem::Requirement.default)\n Gem::Specification.any? { |s| s.name =~ name and req =~ s.version }\n end", "def jruby?\n @jruby ||= defined?(JRUBY_VERSION)\n end", "def installed?(gem_name)\n !run('list', '|', 'grep', \"' #{gem_name} '\").empty?\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 installed?(_name = nil, _version = nil)\n return false if info.nil?\n info[:installed]\n end", "def jruby?\n defined?(JRUBY_VERSION)\n end", "def node?\n exist? 'package.json'\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 ensure_rbenv_ruby(ruby_version)\n ensure_rbenv\n ensure_packages \"curl\", \"build-essential\", \"libxslt1-dev\", \"libxml2-dev\", \"libssl-dev\"\n\n dep \"rbenv ruby: #{ruby_version}\" do\n met? { `bash -lc 'which ruby'`.include?(\"rbenv\") && `rbenv versions`.include?(ruby_version) }\n meet do\n puts \"Compiling Ruby will take a few minutes.\"\n shell \"rbenv install #{ruby_version}\"\n shell \"rbenv rehash\"\n end\n end\n end", "def rails_app?\n File.exist?(\"bin/rails\")\n end", "def installed? site = nil\n site_list = (site) ? [site] : platform.site_names\n site_list.each do |s|\n site_path = platform.sites_path + s\n next unless site_path.exist?\n return true if Drush.installed?(site_path, name, relative_path)\n end\n return false\n end", "def as_framework?\n (self.installed? and File.exists? prefix+\"Frameworks/Python.framework\") or build_framework?\n end", "def check_install?\n @default_options[ :check_install ]\n end", "def coffeescript_available?\n defined?(CoffeeScript) || require('coffee-script')\n true\n rescue LoadError\n false\n end", "def valid?\n gemfile? && gemfile_lock? && gem?(\"thin\") &&\n gem?(\"rake\") && config_ru?\n end", "def node_modules?\n !!name.match(/node_modules\\//)\n end", "def jruby?\n RUBY_ENGINE == \"jruby\"\nend", "def application?\n gem_dir\n end", "def application?\n gem_dir\n end", "def has_package?(name)\n packages.has_key?(name) || os_package_resolver.include?(name)\n end", "def has_ssh?\n discover_ssh_executable.present?\n end", "def check_if_bundle_needed\n if `bundle exec #{rspec_command} -v` == `#{rspec_command} -v`\n @bundle = \"\"\n else\n @bundle = \"bundle exec \"\n end\n end" ]
[ "0.77486736", "0.72765374", "0.6919784", "0.67822814", "0.651632", "0.648404", "0.6482359", "0.64690065", "0.6451853", "0.64186656", "0.6410398", "0.63503563", "0.6338802", "0.6338802", "0.6338802", "0.6336043", "0.630004", "0.6287065", "0.6255579", "0.6255579", "0.62461686", "0.6185789", "0.6135452", "0.6135211", "0.61335385", "0.6120117", "0.61177003", "0.6113815", "0.6107073", "0.60911757", "0.60831493", "0.6080973", "0.6056945", "0.6038205", "0.60330427", "0.60269445", "0.602238", "0.6014753", "0.6014753", "0.5958611", "0.59547067", "0.5950093", "0.59346485", "0.59115535", "0.58726966", "0.58335096", "0.58212805", "0.5820681", "0.5814506", "0.579922", "0.57897556", "0.57729954", "0.577299", "0.5768591", "0.57605934", "0.57594097", "0.5757907", "0.5742031", "0.5735718", "0.57138294", "0.5707251", "0.57067364", "0.57055956", "0.57055837", "0.570186", "0.56946003", "0.56930864", "0.56891173", "0.56891173", "0.56840456", "0.56740737", "0.56740737", "0.5670856", "0.56505895", "0.56505895", "0.5630744", "0.5618204", "0.56167006", "0.55988246", "0.5587548", "0.55799", "0.5563891", "0.55563104", "0.5553057", "0.55496055", "0.55472535", "0.55400455", "0.5526733", "0.55258083", "0.5517805", "0.5510941", "0.5502217", "0.5488526", "0.54863584", "0.5483608", "0.54814214", "0.54814214", "0.54687023", "0.54679334", "0.5459348" ]
0.88057137
0
Returns true if RVM is installed.
def rvm_installed? @rvm_installed ||= `which rvm`.present? end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def rvm_installed?\n cmd_test %{-s \"/usr/local/lib/rvm\"}\nend", "def rvm?\n\t\t\tFile.exists?(RvmPow::RVM_BINARY)\n\t\tend", "def ruby_installed?(ruby)\n cmd_if %{rvm list strings | grep -q \"#{ruby}\" >/dev/null}, true\nend", "def installed?\n !IO.popen(\"which #{self}\"){|i| i.read}.empty?\n end", "def chef_installed?\n cmd_if %{rvm use #{ruby} >/dev/null && gem list --no-versions | grep -q \"^chef$\" >/dev/null}, true\nend", "def installed?(utility)\n return false if execute_as_root(\"which #{utility}\").nil?\n true\n end", "def proselint_installed?\n `which proselint`.strip.empty? == false\n end", "def has_virtualenv_installed(python)\n `#{python} -m virtualenv --help 2>&1`\n if (0 != $?.to_i)\n false\n else\n true\n end\n end", "def installed?\n File.exist?(ktlint_path)\n end", "def aptitude?\n File.executable? '/usr/bin/apt-get'\n end", "def installed?\n revision && install_path.exist?\n end", "def installed?(command)\n MakeMakefile.find_executable(command)\n end", "def installed?(cmd)\n !Garcon::FileHelper.which(cmd).nil?\n end", "def installed?\n MacOS.dev_tools_path == Pathname.new(\"/usr/bin\")\n end", "def systemctl?\n systemctl.present?\n end", "def systemctl?\n systemctl.present?\n end", "def installed?(package)\n run_command(\"yum list installed #{package}\")[:value].success?\n end", "def installed?\n false\n end", "def redis_installed?\n result = `which redis-server`.gsub(\"\\n\", \"\")\n\n puts \"redis-server-binary not found\" if result.empty?\n\n result.empty? ? false : true\n end", "def installed?\n ::File.exist?(PATH)\n end", "def installed?\n !!@installed\n end", "def installed?\n !installed_version.nil?\n end", "def maglev_using_rvm\n ENV['rvm_path'] != \"\" && (/^maglev/ =~ ENV['rvm_ruby_string']) == 0\nend", "def maglev_using_rvm\n ENV['rvm_path'] != \"\" && (/^maglev/ =~ ENV['rvm_ruby_string']) == 0\nend", "def should_install_vagrant?\n vagrant_v_output = run_command('vagrant -v')[:output]\n installed_version = vagrant_v_output.match(/^Vagrant ([0-9.]+)\\s*$/)[1]\n SemVersion.new(VAGRANT_VERSION) > SemVersion.new(installed_version)\n rescue Errno::ENOENT\n true\n end", "def installed?\n self.class.installed?(@repo)\n end", "def installed?\n File.exists?(@path)\n end", "def dot_installed?\n assert_usr_bin_env_exists\n system \"#{USR_BIN_ENV} which dot > /dev/null\"\n end", "def installed?\n File.exist?(\"/etc/munin/plugins/#{name}\")\n end", "def install?\n return false unless allowed_host?\n return false unless packages_installed?\n true\n end", "def executable_installed?\n @cli.system_call 'which gcloud'\n $?.success?\n end", "def lkrg_installed?\n cmd_exec('test -d /proc/sys/lkrg && echo true').to_s.strip.include? 'true'\n rescue\n raise 'Could not determine LKRG status'\n end", "def x11_installed?\n Pathname.new('/usr/bin/X').exist?\n end", "def vip_installed?\n ssh.directory_exists?(vip_path)\n end", "def installed?(_name = nil, _version = nil)\n return false if info.nil?\n info[:installed]\n end", "def yum?\n File.executable? '/usr/bin/yum'\n end", "def installed?\n (dir = installed_prefix).directory? && dir.children.length > 0\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 backup_minister_installed?\n software_installed?(APP_NAME)\n end", "def what_is_installed?\n which_os = os.green\n package_manager = ( has_installer? ? 'Yes'.green : 'No'.red.blink )\n exe_installed = ( pianobar? ? 'Yes'.green : 'No'.red.blink )\n ctl_file = ( ctl? ? 'Yes'.green : 'No'.red.blink )\n has_notifier = ( notify? ? 'Yes'.green : 'No'.red.blink )\n ok = ( has_installer? ? 'Yes'.green : 'No'.red.blink )\n\n puts get_template 'what_is_installed', binding\n\n has_installer?\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 rpm_installed?(name)\n system_command(\"rpm\", args: [\"-q\", \"--qf\", \"%{NAME}-%{VERSION}\", name]).success?\nend", "def ri_installed?\n File.exist? @ri_dir\n end", "def ri_installed?\n File.exist? @ri_dir\n end", "def check_pythons_for_virtenv\n @candidate_pythons.each{ |py|\n if has_virtualenv_installed(py)\n @command = py\n return true\n end\n }\n return false\n end", "def mdspell_installed?\n `which mdspell`.strip.empty? == false\n end", "def unicorn_installed?\n result = `which unicorn`.gsub(\"\\n\", \"\")\n \n puts \"unicorn-binary not found\" if result.empty?\n \n result.empty? ? false : true\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 check_install?\n @default_options[ :check_install ]\n end", "def install_rvm\n %x{which rvm}\n unless $?.success?\n LOGGER.info \"\\nInstalling RVM\".blue\n autolibs = OSX ? 'homebrew' : 'packages'\n system %Q{curl -L https://get.rvm.io | bash -s stable --autolibs=#{autolibs} --ruby --with-gems=\"rails\"}\n system 'rvm autolibs homebrew' if OSX\n end\nend", "def check_or_install\n if osx?\n # We currently only install python for osx\n install_or_update_osx\n else\n # Otherwise we check that the system supplied python will be sufficient\n check_system_python\n end\n end", "def check_snmp\n\t\tprint_status(\"Checking if SNMP is Installed\")\n\t\tkey = \"HKLM\\\\System\\\\CurrentControlSet\\\\Services\"\n\t\tif registry_enumkeys(key).include?(\"SNMP\")\n\t\t\tprint_status(\"\\tSNMP is installed!\")\n\t\t\treturn true\n\t\telse\n\t\t\tprint_error(\"\\tSNMP is not installed on the target host\")\n\t\t\treturn false\n\t\tend\n\tend", "def is_dependencies_installed?\n is_pkgs = @ssh.do_ssh_cmd('which puppet && which git')\n if is_pkgs[:exit_code] != 0\n abort 'Please install git and puppet on the targeted node'\n end\n true\n end", "def ihs_plg_installed?\n get_version = node['ihs']['plugin']['install_dir'] + '/bin/versionInfo.sh'\n\n begin\n !/^PLG\\s+installed$/.match(shell_out(get_version).stdout).to_s.empty?\n rescue Errno::ENOENT => e\n Chef::Log.info \"File not found: #{get_version}, error: #{e}\"\n return false\n end\n end", "def installed?\n path.exist? || path.symlink?\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 pax_installed?\n cmd_exec('/bin/grep -q \"PaX:\" /proc/self/status && echo true').to_s.strip.include? 'true'\n rescue\n raise 'Could not determine PaX status'\n end", "def kacl_cli_installed?\n `which kacl-cli`.strip.empty? == false\n end", "def rakeAppAndRvm\n\t\t\t(rakeApp? && rvm?)\n\t\tend", "def gemset_initial\n rvm(:gemset, :initial).successful?\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 installed?\n raise NotImplementedError\n end", "def launchctl?\n launchctl.present?\n end", "def launchctl?\n launchctl.present?\n end", "def pkg_installed?(pkg)\n cmd_if %{dpkg-query --showformat='${Essential}\\n' --show '#{pkg}' > /dev/null 2>&1}\nend", "def installed?\n File.exist?(swiftlint_path)\n end", "def RunSCRSwitchTest_CheckWhetherInstalled(package_name)\n test_result = nil\n ret = true\n one_rpm_installed = nil\n\n one_rpm_installed = Builtins.sformat(\n \"%1 %2 %3\",\n @test_chroot_binary,\n @chroot_path,\n Builtins.sformat(@test_one_rpm, package_name)\n )\n\n test = Convert.convert(\n SCR.Execute(path(\".target.bash_output\"), one_rpm_installed),\n :from => \"any\",\n :to => \"map <string, any>\"\n )\n test_result = Ops.get_integer(test, \"exit\", -1) == 0\n ret = false if test_result != true\n\n ReportTest(\n # Test progress\n Builtins.sformat(\n _(\"Checking whether RPM package %1 is installed...\"),\n package_name\n ),\n test_result\n )\n Builtins.y2milestone(\"Debug: %1\", test)\n\n ret\n end", "def gemset_update\n rvm(@environment_name, :gemset, :update).successful?\n end", "def installed?\n secrets = @stage.get('secrets').map(&:name)\n secrets.any? { |s| s.match(/\\Ash\\.helm\\.release\\.v\\d+\\.#{Regexp.escape(name)}\\./) }\n end", "def appium_available?\n `appium -v`\n true\n rescue Errno::ENOENT\n false\n end", "def cookbooks_repo_installed?\n cmd_test %{-d \"#{cookbooks_path}\"}\nend", "def rbenv_installed?\n @rbenv_installed ||= `which rbenv`.present?\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 booted?\n IO.popen([\"systemctl\", \"is-system-running\"], &:read).chomp != \"offline\"\n end", "def installed?\n return prefix.children.length > 0\n rescue\n return false\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 gem_installed?(gem_name)\n list = `gem list #{gem_name}`\n list.split(\"\\n\").any? { |line| line.include?(gem_name) }\nend", "def knotx_installed?\n # Currently deployed JAR checksum verification\n if ::File.exist?(new_resource.install_path)\n\n new_checksum = new_resource.checksum\n current_checksum = md5sum(new_resource.install_path)\n # If checksum doesn't match deployment is required\n return true if new_checksum == current_checksum\n end\n\n # TODO: Implement additional checks for log_dir, base_dir etc.\n\n false\n end", "def env_exists?(ruby_string)\n return true if system_ruby?(ruby_string)\n\n rubie = select_ruby(ruby_string)\n gemset = select_gemset(ruby_string)\n\n if gemset\n gemset_exists?(:ruby => rubie, :gemset => gemset)\n else\n ruby_installed?(rubie)\n end\n end", "def app_available?(app)\n `which #{app}`.strip == \"\" ? false : true\n end", "def available?\n !!version\n end", "def already_installed?(path, package)\n installed_packages(path).include?(package)\n end", "def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end", "def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end", "def bundler_installed?\n\t`(gem spec bundler -v > /dev/null 2>&1)`\n end", "def gemset_empty\n run(\"echo 'yes' | rvm\", :gemset, :empty).successful?\n end", "def has_rpm(package)\n @commands << \"rpm -qa | grep #{package}\"\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 tmux_available?\n system \"which tmux >/dev/null 2>&1\"\nend", "def gemset_pristine\n rvm(:gemset, :pristine).successful?\n end", "def ruby?\n exist? 'Gemfile'\n end", "def installed?(gem_name)\n !run('list', '|', 'grep', \"' #{gem_name} '\").empty?\n end", "def has_package?(name)\n packages.has_key?(name) || os_package_resolver.include?(name)\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 should_do_python_install?\n return (osx? and (not (File.exists?(python_directory))))\n end", "def yama_installed?\n ptrace_scope = cmd_exec('cat /proc/sys/kernel/yama/ptrace_scope').to_s.strip\n return true if ptrace_scope =~ /\\A\\d\\z/\n false\n rescue\n raise 'Could not determine Yama status'\n end", "def check_parallels_is_installed(options)\n options['status'] = \"no\"\n app_dir = \"/Applications/Parallels Desktop.app\"\n if File.directory?(app_dir)\n options['status'] = \"yes\"\n if !File.symlink?(\"/Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/prlsdkapi.pth\")\n if !File.exist?(\"/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prlsdkapi.pth\")\n install_brew_pkg(options,\"parallels-virtualization-sdk\")\n else\n command = \"ln -s /Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/site-packages/prlsdkapi.pth /Library/Developer/CommandLineTools/Library/Frameworks/Python3.framework/Versions/3.9/lib/python3.9/site-packages/prlsdkapi.pth\"\n message = \"Information:\\tSymlinking Parallels SDK Library\"\n execute_command(options,message,command)\n end\n end\n end\n return options['status']\nend", "def check_vbox_is_installed()\n app_dir = \"/Applications/VirtualBox.app\"\n if !File.directory?(app_dir)\n puts \"Warning:\\tVirtualbox not installed\"\n exit\n end\nend", "def gem_installed?(gem_name)\n found_gem = false\n begin\n found_gem = Gem::Specification.find_by_name(gem_name)\n rescue Gem::LoadError\n return false \n else\n return true \n end\nend" ]
[ "0.83704555", "0.78068435", "0.73033595", "0.72069067", "0.7049136", "0.6857459", "0.6763749", "0.66081756", "0.6594433", "0.6593279", "0.6572746", "0.6558013", "0.6551827", "0.65492225", "0.65381473", "0.65381473", "0.6535947", "0.64989525", "0.6495354", "0.64644104", "0.6455162", "0.6453348", "0.64413065", "0.64413065", "0.64379984", "0.64375484", "0.64052653", "0.63727456", "0.63578707", "0.63566756", "0.63309044", "0.6309635", "0.6300404", "0.624813", "0.624791", "0.6232207", "0.6232182", "0.62236184", "0.62060404", "0.6193451", "0.619094", "0.6135165", "0.61265177", "0.61265177", "0.6078923", "0.607855", "0.60719174", "0.6071752", "0.6071752", "0.60599834", "0.60415417", "0.60276", "0.6021606", "0.6018908", "0.60104114", "0.59780675", "0.5967143", "0.59640944", "0.5953973", "0.59408444", "0.5932057", "0.59273905", "0.59208393", "0.59075093", "0.59075093", "0.5898942", "0.5896762", "0.5876522", "0.58647394", "0.58385265", "0.58372325", "0.58277917", "0.5810301", "0.5801673", "0.5794111", "0.57863575", "0.57770455", "0.57529515", "0.5752698", "0.5745371", "0.5737792", "0.5735679", "0.57090545", "0.5696302", "0.5696302", "0.5696302", "0.5696213", "0.5691019", "0.56902194", "0.56857723", "0.56803256", "0.56788653", "0.5677499", "0.56671095", "0.56613266", "0.56527674", "0.5631967", "0.5625393", "0.5623152", "0.5622616" ]
0.86571807
0
GET /chase_vehicles GET /chase_vehicles.json
def index @chase_vehicles = ChaseVehicle.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def vehicles\n @vehicles ||= begin\n _, json = get_json(\"/vehicles\")\n json.map { |data| Vehicle.new(self, data) }\n end\n end", "def show\n render json: @vehicle\n end", "def vehicle\n fetch('final_space.vehicles')\n end", "def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end", "def vehicles_all\n @work_order_vehicles = WorkOrderVehicle.by_id\n render json: serialized_work_order_vehicles(@work_order_vehicles)\n end", "def index\n @load_vehicle = LoadVehicle.all\n respond_to do |format|\n format.json { render json: @load_vehicle }\n end\n end", "def index\n @vehicles = Vehicle.all\n end", "def index\n @vehicles = Vehicle.all\n if @vehicles.present?\n \trender json: { vehicles: @vehicles, status: :ok }\n else\n render json: { :status => \"204\", :message => \"There is not vehicles\" }, status: :no_content\n end\n end", "def show\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n end", "def get_models_for_make_id\n render json: vehicle_service.get_models_for_make_id(params[:make_id])\n end", "def index\n if params[:vehicle]\n @vehicles = Vehicle.find_by_ticker(params[:vehicle])\n else\n @vehicles = Vehicle.all\n end\n end", "def vehicles; end", "def index\n @vehicles = current_user.vehicles\n end", "def index\n if params[:vehicle_id]\n @vehicle = Vehicle.find(params[:vehicle_id])\n @vehicle_features = @vehicle.features\n end\n @feature = Feature.new\n @features = Feature.all\n @all_features = Feature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n end\n end", "def get_models_for_make_id_year\n render json: vehicle_service.get_models_for_make_id_year(params[:make_id], params[:make_year])\n end", "def set_chase_vehicle\n @chase_vehicle = ChaseVehicle.find(params[:id])\n end", "def set_chase_vehicle\n @chase_vehicle = ChaseVehicle.find(params[:id])\n end", "def show\n vehicle=Vehicle.where(uid: params[:id]).first\n render :json => {\"vehicle\"=>vehicle }\n end", "def index\n #@space_vehicles = SpaceVehicle.all\n @space_vehicles = current_user.space_vehicles\n\n @being_shared_vehicles = current_user.shared_vehicles_by_others\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @space_vehicles }\n end\n end", "def index\n @vehicle_infos = VehicleInfo.all\n end", "def index\n @vehicle_realtimes = VehicleRealtime.all\n \n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtimes.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end", "def vehicles \n \"vehicles\" \n end", "def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end", "def show\n @vehicle = Vehicle.find(params[:id])\n\n end", "def index\n @references_vehicle_drivers = ReferencesVehicleDriver.all\n end", "def index\n @stolen_vehicles = StolenVehicle.all\n end", "def index\n add_breadcrumb \"all\", nil, \"glyphicon-list\"\n\n #@vehicles = Vehicle.all\n @vehicles = current_user.account.vehicles || []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end", "def vehicle\n vehicles.first\n end", "def get_part_by_car\n @cars = PartsController::PartService.get_part_by_car(params[:param]);\n respond_to do |format|\n format.json { render json: @cars }\n end \n end", "def show\n @cars = Car.sort_by(dealership_id: params[:id])\n render json: { cars: @cars }\n \n end", "def index\n @vehicle_costs = VehicleCost.all\n end", "def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end", "def create\n @chase_vehicle = ChaseVehicle.new(chase_vehicle_params)\n\n respond_to do |format|\n if @chase_vehicle.save\n format.html { redirect_to :back, notice: 'Chase vehicle was successfully created.' }\n format.json { render action: 'show', status: :created, location: @chase_vehicle }\n else\n format.html { render action: 'new' }\n format.json { render json: @chase_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @chase_vehicle = ChaseVehicle.new(chase_vehicle_params)\n\n respond_to do |format|\n if @chase_vehicle.save\n format.html { redirect_to :back, notice: 'Chase vehicle was successfully created.' }\n format.json { render action: 'show', status: :created, location: @chase_vehicle }\n else\n format.html { render action: 'new' }\n format.json { render json: @chase_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def vehicles\n vehicles = []\n user_vehicles = self.user_vehicles.all.eager_load(:vehicle)\n user_vehicles.each do |uv|\n vehicles.push(uv.vehicle)\n end\n\n return vehicles\n end", "def get_carriers\n @transporter = Transporter.find(params[:id])\n\n render json: @transporter.carriers\n end", "def show\n add_breadcrumb \"all\", nil, \"glyphicon-screenshot\"\n\n @vehicle = Vehicle.find(params[:id])\n #if current_user.vehicles.contain?(@vehicle)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n #end\n end", "def new\n @vehicle = Vehicle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtime.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end", "def index\n @cars = Car.all\n render json: @cars\n end", "def index\n @cars = Car.all\n\n render json: @cars\n end", "def show\n @cars = Car.where(dealership_id: params[:id])\n render json: { dealership: @dealership, cars: @cars }\n \n end", "def create\n @vehicle = Vehicle.new(vehicle_params)\n if @vehicle.save\n render json: { status: 'Vehicle created successfully', vehicle: @vehicle }, status: :created\n else\n render json: { errors: @vehicle.errors.full_messages }, status: :bad_request\n end\n end", "def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend", "def index\n @vehicle_prices = VehiclePrice.all\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle_type }\n end\n end", "def index\n @vehicles = @current_user.vehicles\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vehicles }\n end\n end", "def index\n @trucks = Truck.all\n\n render json: @trucks\n end", "def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vehicles }\n end\n end", "def index\n if params[:customer_id]\n begin\n @vehicles = Customer.find_by_id(params[:customer_id]).vehicles.paginate(:page => params[:page])\n rescue ActiveRecord::RecordNotFound\n render_404\n end\n end\n\n # search for a vehicle by vin\n if params[:search]\n @vehicles = Vehicle.search(params[:search]).paginate(:page => params[:page])\n if only_one_non_zero?(@vehicles)\n redirect_to @vehicles.first\n end\n end\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:vehicle_id])\n end", "def get(req)\n results = search(dealership(req), term(req))\n data = results['hits']\n count = data['total']\n documents = data['hits']\n req.session['back_uri'] = \"/admin/#{dealership(req).slug}/search?q=#{term(req)}\"\n @vehicles = documents.map do |doc|\n vehicle_dao.get(BSON::ObjectId.from_string(doc['_id']))\n end\n render 'admin/search_results.erb'\n end", "def index\n travels = Travel.where(:travel_category_id => @travel_category)\n # if weapon = params[:weapon]\n # travels = travels.where(name: weapon)\n # end\n\n respond_to do |format|\n #format.html { render :new }\n format.json { render json: travels, status: 200 }\n format.xml { render xml: travels, status: 200 }\n end\n\n # render json: travels, status: 200\n end", "def index\n @vechicles = Vechicle.all\n end", "def index\n @vehicles = Vehicle.search(params[:search]).where(\"name like ?\", \"%#{params[:q]}%\").paginate(:page => params[:page], :per_page => 10, :order => :id)\n \n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vehicles }\n format.json { render :json => @vehicles.map(&:attributes) }\n format.js\n end\n end", "def index\n\t @search = Vehicle.search do\n\t\t\tfulltext params[:search]\n\t\t end\n\t\t@vehicles = @search.results\n\tend", "def court_sports\n render json: @venue.supported_sports_options\n end", "def show\n @media_vehicle = MediaVehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @media_vehicle }\n end\n end", "def new\n add_breadcrumb \"add\", nil, \"glyphicon-plus-sign\"\n\n @vehicle = Vehicle.new\n @years = VehicleYear.all\n @makes = []\n @models = []\n @trims = []\n @types = []\n @doors = []\n @sizes = []\n\n @select_years = VehicleYear.all\n @select_makes = VehicleMake.all\n @select_models = VehicleModel.all\n @select_trims = VehicleTrim.all\n @select_types = VehicleType.all\n @select_doors = VehicleDoor.all\n @select_sizes = VehicleSize.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle }\n end\n end", "def index\n @curriculum_vitaes = findable_curriculum_vitaes.all\n respond_to do |format|\n format.html {}\n format.json { render json: @curriculum_vitaes }\n end\n end", "def index\n @vehicle_informations = VehicleInformation.all\n end", "def vehicle_index\n @models = vehicle_models\n # session[:vehicle_models] = @models\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def index\n authenticate_request!\n @cars = Car.all\n\n render json: @cars\n end", "def create\n @vehicle = get_vehicle_from_params\n\n respond_to do |format|\n if @vehicle.save!\n @vehicle.accounts << current_user.account\n format.html { redirect_to root_path, notice: 'Vehicle was successfully created.' }\n format.json { render @vehicle.id}#json: @vehicle, status: :created, location: @vehicle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @admin_vehicles = City.find(session[:current_city_id]).utility.vehicles.where(vehicle_type: Vehicle.vehicle_types[params[:vehicle_type]]).page(params[:page]).per(10)\n end", "def chase_vehicle_params\n params.require(:chase_vehicle).permit(:description, :identifier, \n :mission_id, :chase_server_id )\n end", "def update_vehicles\n @vehicles = Customer.find_by(customer_id: params[:customer_id].to_i).vehicles\n respond_to do |format|\n format.html { render(:text => \"not implemented\") }\n format.js\n end\n end", "def index\n @verticals = Vertical.all()\n render json: @verticals\n end", "def index\n @vicarages = Vicarage.all\n end", "def index\n @vehicle_submodels = VehicleSubmodel.all\n end", "def vehicle_params\n params.require(:vehicle).permit(:code, :name, :historic, :speed, :user_id)\n end", "def chase_vehicle_params\n params.require(:chase_vehicle).permit(:description, :ident, \n :mission_id, :chase_server_id )\n end", "def index\n @delivery_trucks = DeliveryTruck.where(user_id: current_user)\n @vehicles = Vehicle.all\n end", "def index\n @vehicletypes = Vehicletype.paginate(page: params[:page])\n end", "def get_part_by_car_category\n @cars = PartsController::PartService.get_part_by_car_category(params[:paran_car], params[:paran_category]);\n respond_to do |format|\n format.json { render json: @cars }\n end \n end", "def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @client_releases = ClientRelease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_releases }\n end\n end", "def vitals\n raise UserNotAuthenticated unless access_token\n\n get('records/vitals')\n end", "def index\n @vehicles = Vehicle.available\n .not_from_current_user(current_user)\n .eager_load(images_attachments: :blob)\n end", "def show\n render json: @car\n end", "def index\n @verbs = Verb.all\n\n render json: @verbs\n end", "def index\n @election = Election.find(params[:election_id])\n @races = @election.races\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @races }\n end\n end", "def create_vehicles vehicle\n self.create_vehicle(:four_wheeler => vehicle[:four_wheeler],:two_wheeler => vehicle[:two_wheeler],:none => vehicle[:none])\n end", "def vehicle()\n sql = \"SELECT * FROM vehicles INNER JOIN rentals ON rentals.vehicle_id\n = vehicles.id WHERE rentals.id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)[0]\n return Vehicle.new(result)\n end", "def index\n @vacancies = Vacancy.all_vacancies# current_user.vacancies #\n render json: @vacancies\n end", "def index\n @vets = Vet.all\n end" ]
[ "0.69964904", "0.69512826", "0.6920142", "0.6902806", "0.6787383", "0.67636365", "0.6747108", "0.66985935", "0.6606108", "0.6438546", "0.6360747", "0.6341063", "0.6323488", "0.63189006", "0.6306929", "0.62902707", "0.62902707", "0.6276853", "0.6272245", "0.6238601", "0.6214477", "0.6178697", "0.6177638", "0.61720216", "0.61212146", "0.61190873", "0.61052907", "0.6102442", "0.6018295", "0.59991556", "0.5987576", "0.5978129", "0.5957767", "0.5957767", "0.5953171", "0.5933272", "0.591777", "0.5917256", "0.5874682", "0.58745444", "0.5863187", "0.5858191", "0.585316", "0.5853087", "0.58321834", "0.58301544", "0.582728", "0.5816927", "0.5812545", "0.5803304", "0.5790639", "0.5774925", "0.5773527", "0.5766", "0.5761311", "0.57493556", "0.5711717", "0.5709417", "0.5705052", "0.5699099", "0.56960654", "0.5695463", "0.5683358", "0.5683358", "0.5683358", "0.5683358", "0.5683358", "0.5683358", "0.5683358", "0.5683358", "0.5683358", "0.5683358", "0.5683358", "0.5683244", "0.5678576", "0.56762475", "0.5671589", "0.56592244", "0.5651456", "0.5647665", "0.5630098", "0.56273264", "0.5621562", "0.561199", "0.561177", "0.5603227", "0.5598911", "0.5598911", "0.5598911", "0.5595347", "0.5585049", "0.5579774", "0.5579223", "0.55708486", "0.55663615", "0.555564", "0.55511165", "0.55479795", "0.55475616" ]
0.7339431
1
GET /chase_vehicles/1 GET /chase_vehicles/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def show\n render json: @vehicle\n end", "def show\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n end", "def index\n @chase_vehicles = ChaseVehicle.all\n end", "def index\n @chase_vehicles = ChaseVehicle.all\n end", "def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end", "def vehicle\n fetch('final_space.vehicles')\n end", "def index\n @load_vehicle = LoadVehicle.all\n respond_to do |format|\n format.json { render json: @load_vehicle }\n end\n end", "def show\n vehicle=Vehicle.where(uid: params[:id]).first\n render :json => {\"vehicle\"=>vehicle }\n end", "def show\n @vehicle = Vehicle.find(params[:id])\n\n end", "def vehicle\n vehicles.first\n end", "def index\n @vehicles = Vehicle.all\n end", "def index\n @vehicles = Vehicle.all\n if @vehicles.present?\n \trender json: { vehicles: @vehicles, status: :ok }\n else\n render json: { :status => \"204\", :message => \"There is not vehicles\" }, status: :no_content\n end\n end", "def get_models_for_make_id\n render json: vehicle_service.get_models_for_make_id(params[:make_id])\n end", "def index\n if params[:vehicle_id]\n @vehicle = Vehicle.find(params[:vehicle_id])\n @vehicle_features = @vehicle.features\n end\n @feature = Feature.new\n @features = Feature.all\n @all_features = Feature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n end\n end", "def set_chase_vehicle\n @chase_vehicle = ChaseVehicle.find(params[:id])\n end", "def set_chase_vehicle\n @chase_vehicle = ChaseVehicle.find(params[:id])\n end", "def get_models_for_make_id_year\n render json: vehicle_service.get_models_for_make_id_year(params[:make_id], params[:make_year])\n end", "def vehicles\n @vehicles ||= begin\n _, json = get_json(\"/vehicles\")\n json.map { |data| Vehicle.new(self, data) }\n end\n end", "def new\n @vehicle = Vehicle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle }\n end\n end", "def index\n if params[:vehicle]\n @vehicles = Vehicle.find_by_ticker(params[:vehicle])\n else\n @vehicles = Vehicle.all\n end\n end", "def vehicles_all\n @work_order_vehicles = WorkOrderVehicle.by_id\n render json: serialized_work_order_vehicles(@work_order_vehicles)\n end", "def index\n @vehicle_infos = VehicleInfo.all\n end", "def index\n @vehicle_types = VehicleType.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicle_types }\n end\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle_type }\n end\n end", "def index\n @vehicles = current_user.vehicles\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:vehicle_id])\n end", "def index\n @vehicle_realtimes = VehicleRealtime.all\n \n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtimes.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end", "def get_part_by_car\n @cars = PartsController::PartService.get_part_by_car(params[:param]);\n respond_to do |format|\n format.json { render json: @cars }\n end \n end", "def show\n @media_vehicle = MediaVehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @media_vehicle }\n end\n end", "def index\n #@space_vehicles = SpaceVehicle.all\n @space_vehicles = current_user.space_vehicles\n\n @being_shared_vehicles = current_user.shared_vehicles_by_others\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @space_vehicles }\n end\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def vehicles \n \"vehicles\" \n end", "def create\n @chase_vehicle = ChaseVehicle.new(chase_vehicle_params)\n\n respond_to do |format|\n if @chase_vehicle.save\n format.html { redirect_to :back, notice: 'Chase vehicle was successfully created.' }\n format.json { render action: 'show', status: :created, location: @chase_vehicle }\n else\n format.html { render action: 'new' }\n format.json { render json: @chase_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @chase_vehicle = ChaseVehicle.new(chase_vehicle_params)\n\n respond_to do |format|\n if @chase_vehicle.save\n format.html { redirect_to :back, notice: 'Chase vehicle was successfully created.' }\n format.json { render action: 'show', status: :created, location: @chase_vehicle }\n else\n format.html { render action: 'new' }\n format.json { render json: @chase_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n add_breadcrumb \"all\", nil, \"glyphicon-screenshot\"\n\n @vehicle = Vehicle.find(params[:id])\n #if current_user.vehicles.contain?(@vehicle)\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vehicle }\n end\n #end\n end", "def index\n add_breadcrumb \"all\", nil, \"glyphicon-list\"\n\n #@vehicles = Vehicle.all\n @vehicles = current_user.account.vehicles || []\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end", "def show\n respond_to do |format|\n format.html\n format.json { render :json => @vehicle_realtime.to_json(:include => [:vehicle_trip, :vehicle_route, :vehicle_stop]) }\n end\n end", "def get\n appid = ENV['TRIMET_APP_ID']\n response = Unirest.get( \"http://developer.trimet.org/ws/v2/vehicles?appid=#{appid}\" )\n response.body\nend", "def vehicles; end", "def create\n @vehicle = Vehicle.new(vehicle_params)\n if @vehicle.save\n render json: { status: 'Vehicle created successfully', vehicle: @vehicle }, status: :created\n else\n render json: { errors: @vehicle.errors.full_messages }, status: :bad_request\n end\n end", "def index\n @vehicle_costs = VehicleCost.all\n end", "def show\n begin\n @vehicle = Vehicle.find_by_id(params[:id])\n rescue ActiveRecord::RecordNotFound\n render_404\n end\n end", "def show\n @cars = Car.sort_by(dealership_id: params[:id])\n render json: { cars: @cars }\n \n end", "def index\n @cartridges = Cartridge.all\n\n respond_to do |format|\n format.html\n format.json { render json: @cartridges }\n end\n end", "def index\n @references_vehicle_drivers = ReferencesVehicleDriver.all\n end", "def index\n @stolen_vehicles = StolenVehicle.all\n end", "def show\n @cars = Car.where(dealership_id: params[:id])\n render json: { dealership: @dealership, cars: @cars }\n \n end", "def new\n add_breadcrumb \"add\", nil, \"glyphicon-plus-sign\"\n\n @vehicle = Vehicle.new\n @years = VehicleYear.all\n @makes = []\n @models = []\n @trims = []\n @types = []\n @doors = []\n @sizes = []\n\n @select_years = VehicleYear.all\n @select_makes = VehicleMake.all\n @select_models = VehicleModel.all\n @select_trims = VehicleTrim.all\n @select_types = VehicleType.all\n @select_doors = VehicleDoor.all\n @select_sizes = VehicleSize.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle }\n end\n end", "def new\n @vehicle_class = VehicleClass.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle_class }\n end\n end", "def show\n @vehicle = Vehicle.find_by_id(params[:id])\n\n respond_to do |format|\n if @vehicle.present?\n format.html do\n if params[:lotredfrm].present?\n redirect_to edit_vehicle_url(@vehicle, lotredfrm: params[:lotredfrm])\n else\n redirect_to edit_vehicle_url(@vehicle) # The 'show' template is also the 'edit' template in this case.\n end\n end\n format.json { render json: { model_object: @vehicle.as_json(include_yard: 'yes', include_documents: \"yes\",\n include_seller_light: \"yes\", service_orders_compact: \"yes\") } }\n else\n format.html { redirect_to vehicles_url }\n format.json { render json: { errors: [ \"Vehicle #{params[:id]} not found.\" ] } }\n end\n end\n end", "def vehicle()\n sql = \"SELECT * FROM vehicles INNER JOIN rentals ON rentals.vehicle_id\n = vehicles.id WHERE rentals.id = $1\"\n values = [@id]\n result = SqlRunner.run(sql, values)[0]\n return Vehicle.new(result)\n end", "def show\n @virus_characteristic = VirusCharacteristic.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @virus_characteristic }\n end\n end", "def index\n @vehicles = Vehicle.all\n\n id = Vehicle.pluck(:api_id) # integer array\n\n \n end", "def set_vehicle\n\t\t\t@vehicle = Vehicle.find(params[:id])\n\t\tend", "def create\n @vehicle = get_vehicle_from_params\n\n respond_to do |format|\n if @vehicle.save!\n @vehicle.accounts << current_user.account\n format.html { redirect_to root_path, notice: 'Vehicle was successfully created.' }\n format.json { render @vehicle.id}#json: @vehicle, status: :created, location: @vehicle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def show\n @vehicle = Vehicle.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vehicle }\n end\n end", "def show\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vehicle }\n end\n end", "def show\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @vehicle }\n end\n end", "def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end", "def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end", "def show\n @verse = Verse.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @verse }\n end\n end", "def index\n @cars = Car.all\n render json: @cars\n end", "def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vehicles }\n end\n end", "def index\n @cars = Car.all\n\n render json: @cars\n end", "def index\n @vehicles = @current_user.vehicles\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @vehicles }\n end\n end", "def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def get(req)\n results = search(dealership(req), term(req))\n data = results['hits']\n count = data['total']\n documents = data['hits']\n req.session['back_uri'] = \"/admin/#{dealership(req).slug}/search?q=#{term(req)}\"\n @vehicles = documents.map do |doc|\n vehicle_dao.get(BSON::ObjectId.from_string(doc['_id']))\n end\n render 'admin/search_results.erb'\n end", "def index\n @trucks = Truck.all\n\n render json: @trucks\n end", "def index\n @vehicle_informations = VehicleInformation.all\n end", "def index\n if params[:customer_id]\n begin\n @vehicles = Customer.find_by_id(params[:customer_id]).vehicles.paginate(:page => params[:page])\n rescue ActiveRecord::RecordNotFound\n render_404\n end\n end\n\n # search for a vehicle by vin\n if params[:search]\n @vehicles = Vehicle.search(params[:search]).paginate(:page => params[:page])\n if only_one_non_zero?(@vehicles)\n redirect_to @vehicles.first\n end\n end\n end", "def get_carriers\n @transporter = Transporter.find(params[:id])\n\n render json: @transporter.carriers\n end", "def set_vehicle_info\n @vehicle_info = VehicleInfo.find(params[:id])\n end", "def index\n @vehicle_prices = VehiclePrice.all\n end", "def show\n @vegetable = Vegetable.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vegetable }\n end\n end", "def show\n render json: @car\n end", "def index\n travels = Travel.where(:travel_category_id => @travel_category)\n # if weapon = params[:weapon]\n # travels = travels.where(name: weapon)\n # end\n\n respond_to do |format|\n #format.html { render :new }\n format.json { render json: travels, status: 200 }\n format.xml { render xml: travels, status: 200 }\n end\n\n # render json: travels, status: 200\n end", "def show\n @sub_vehicle = SubVehicle.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @sub_vehicle }\n end\n end", "def set_vehicle\n @vehicle ||= Vehicle.find_by_id(params[:id])\n end", "def get(req)\n @pagination_data = {\n current: page(req),\n pages: page_nums(req, vehicle_count(req)),\n uri: \"/admin/#{dealership(req).slug}/vehicle/manage?page=\",\n }\n @vehicles = vehicle_dao.list(dealership(req), page(req), PER_PAGE)\n req.session['back_uri'] = \"/admin/#{@dealership.slug}/vehicle/manage\"\n render 'admin/vehicle/manage.erb'\n end", "def show\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @vet }\n end\n end", "def index\n @client_releases = ClientRelease.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_releases }\n end\n end", "def create\n\t\t@vehicle = Vehicle.new(vehicle_params)\n\n\t\trespond_to do |format|\n\t\t\tif @vehicle.save\n\t\t\t\tcreate_audit __method__, 'vehicle', @vehicle.id\n\t\t\t\tformat.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @vehicle }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\tformat.json { render json: @vehicle.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def show\n render json: @truck\n end", "def vehicle_index\n @models = vehicle_models\n # session[:vehicle_models] = @models\n end", "def create\n @vehicle = current_user.vehicles.new(vehicle_params)\n\n respond_to do |format|\n binding.pry\n if @vehicle.save\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def get_part_by_car_category\n @cars = PartsController::PartService.get_part_by_car_category(params[:paran_car], params[:paran_category]);\n respond_to do |format|\n format.json { render json: @cars }\n end \n end", "def index\n @curriculum_vitaes = findable_curriculum_vitaes.all\n respond_to do |format|\n format.html {}\n format.json { render json: @curriculum_vitaes }\n end\n end", "def index\n @vehicle_type = VehicleType.new\n @vehicle_types = VehicleType.all\n end", "def show\n authenticate_request!\n @car = Car.find(params[:id])\n render json: @car, status: 200\n end" ]
[ "0.7163817", "0.710176", "0.7094259", "0.7094259", "0.69484675", "0.69316834", "0.6834217", "0.68270093", "0.6688323", "0.6676003", "0.66755193", "0.667411", "0.6647563", "0.6512315", "0.6512098", "0.6512098", "0.64661384", "0.6446154", "0.63971066", "0.6362867", "0.6317246", "0.6285877", "0.6250508", "0.62437564", "0.6233363", "0.62166214", "0.62129205", "0.62102795", "0.6178253", "0.6146098", "0.61283624", "0.61283624", "0.61283624", "0.61283624", "0.61283624", "0.61283624", "0.61283624", "0.61283624", "0.61283624", "0.61283624", "0.61283624", "0.610959", "0.6107841", "0.6107841", "0.6078324", "0.6077309", "0.6076408", "0.60719633", "0.6062871", "0.60503167", "0.6036271", "0.60314006", "0.6007626", "0.5991039", "0.59720886", "0.5963421", "0.5957909", "0.593958", "0.5922186", "0.5920209", "0.590731", "0.5904033", "0.5899094", "0.58853716", "0.58794737", "0.58626556", "0.5858114", "0.5858114", "0.5857179", "0.5857179", "0.5857179", "0.5856512", "0.58504784", "0.5844619", "0.58365506", "0.58312213", "0.58312213", "0.58312213", "0.58252466", "0.58180416", "0.58142984", "0.5812361", "0.5805515", "0.5798804", "0.5791518", "0.57775915", "0.57719445", "0.57707596", "0.57644725", "0.5736824", "0.5727503", "0.5723573", "0.5722106", "0.5715113", "0.57100165", "0.57052666", "0.57036144", "0.57004553", "0.5687923", "0.56869185", "0.56865567" ]
0.0
-1
POST /chase_vehicles POST /chase_vehicles.json
def create @chase_vehicle = ChaseVehicle.new(chase_vehicle_params) respond_to do |format| if @chase_vehicle.save format.html { redirect_to :back, notice: 'Chase vehicle was successfully created.' } format.json { render action: 'show', status: :created, location: @chase_vehicle } else format.html { render action: 'new' } format.json { render json: @chase_vehicle.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def create\n @vehicle = Vehicle.new(vehicle_params)\n if @vehicle.save\n render json: { status: 'Vehicle created successfully', vehicle: @vehicle }, status: :created\n else\n render json: { errors: @vehicle.errors.full_messages }, status: :bad_request\n end\n end", "def create_vehicles vehicle\n self.create_vehicle(:four_wheeler => vehicle[:four_wheeler],:two_wheeler => vehicle[:two_wheeler],:none => vehicle[:none])\n end", "def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle = get_vehicle_from_params\n\n respond_to do |format|\n if @vehicle.save!\n @vehicle.accounts << current_user.account\n format.html { redirect_to root_path, notice: 'Vehicle was successfully created.' }\n format.json { render @vehicle.id}#json: @vehicle, status: :created, location: @vehicle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def chase_vehicle_params\n params.require(:chase_vehicle).permit(:description, :identifier, \n :mission_id, :chase_server_id )\n end", "def create\n @vehicle = current_user.vehicles.new(vehicle_params)\n\n respond_to do |format|\n binding.pry\n if @vehicle.save\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\t\t@vehicle = Vehicle.new(vehicle_params)\n\n\t\trespond_to do |format|\n\t\t\tif @vehicle.save\n\t\t\t\tcreate_audit __method__, 'vehicle', @vehicle.id\n\t\t\t\tformat.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n\t\t\t\tformat.json { render action: 'show', status: :created, location: @vehicle }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'new' }\n\t\t\t\tformat.json { render json: @vehicle.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def chase_vehicle_params\n params.require(:chase_vehicle).permit(:description, :ident, \n :mission_id, :chase_server_id )\n end", "def create\n @vehicle = current_user.vehicles.new(vehicle_params)\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'El vehículo ha sido creado exitosamente.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle=Vehicle.find_or_create_by(vehicle_params)\n end", "def vehicle_params\n params.require(:vehicle).permit(:code, :name, :historic, :speed, :user_id)\n end", "def create\n if vehicle_params[:actual_vehicle] === \"true\"\n @vehicles = Vehicle.where(user_id: vehicle_params[:user_id])\n if !@vehicles.nil?\n @vehicles.each do |v|\n v.update(actual_vehicle: \"false\")\n end\n end\n end\n @vehicle = Vehicle.new(vehicle_params)\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to \"/vehicles\", notice: 'El vehículo fue añadido!' }\n format.json { render :index, status: :created, location: @vehicle }\n else\n format.html { render :index}\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def vehicle_params\n params.require(:vehicle).permit(:name, \n :model_year, \n :make, \n :model, \n :trim_level, \n :body_style, \n :engine_type, \n :milage, \n :vin, \n :notes,\n :image, \n :bought_date, \n :bought_milage, \n :bought_price)\n end", "def vehicle_params\n params.require(:vehicle).permit(:api_id, :api_vehicle_company_id, :number, :status, :ifta, :vin, :make, :model, :year, :license_plate_state, :license_plate_number, :metric_units, :fuel_type, :prevent_auto_odometer_entry, :edl_device_id, :edl_identifier, :edl_model, :api_driver_id, :driver_first_name, :driver_last_name, :driver_username, :driver_email, :driver_internal_id, :driver_status, :driver_role)\n end", "def vehicle_params\n params.require(:vehicle).permit(:plate, :brand, :model, :string, :doors, :kind, :user_id, :actual_vehicle)\n end", "def vehicle_params\n params.require(:vehicle).permit(:year, :mileage, :price)\n end", "def create\n @stolen_vehicle = StolenVehicle.new(stolen_vehicle_params)\n\n respond_to do |format|\n if @stolen_vehicle.save\n format.html { redirect_to @stolen_vehicle, notice: 'Stolen vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @stolen_vehicle }\n else\n format.html { render :new }\n format.json { render json: @stolen_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def vehicle_params\n params.require(:vehicle).permit(:vehicle_model_id, :year, :odometer,\n :license_plate, :engine_number, :drive,\n :chasis_number, :transmission, :engine_type,\n :passenger_capacity, :air_conditioning,\n :airbags_quantity, :door_quantity,\n :steering, :body_type, :comment, :status,\n images: [])\n end", "def vehicle_params\n params.require(:vehicle).permit!\n end", "def create\n @vehicle = @current_user.vehicles.build params[:vehicle]\n\n respond_to do |format|\n if @vehicle.save\n flash[:success] = \"#{@vehicle.name} was successfully created.\"\n format.html { redirect_to(user_vehicle_path(@current_user, @vehicle)) }\n format.xml { render :xml => @vehicle, :status => :created, :location => @vehicle }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def vehicle_params\n params.require(:vehicle).permit(:year, :mileage, :price, :vehiclemodel_id)\n end", "def create\n @vehicle = Vehicle.new(params[:vehicle])\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to(@vehicle, :notice => 'Vehicle was successfully created.') }\n format.xml { render :xml => @vehicle, :status => :created, :location => @vehicle }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle = Vehicle.new(allowed_params)\n if @vehicle.save\n flash[:notice] = \"New Vehicle Created\"\n redirect_to @vehicle\n else\n flash[:error] = @vehicle.errors.full_messages.to_sentence\n redirect_to Vehicle.find_by_vin @vehicle.vin\n end\n end", "def create\n @vehicle = Vehicle.new(params[:vehicle])\n if @vehicle.save\n flash[:notice] = \"New Vehicle Created\"\n redirect_to @vehicle\n else\n flash[:error] = @vehicle.errors.full_messages.to_sentence \n redirect_to new_vehicle_path\n end\n end", "def vehicle_params\n params.require(:vehicle).permit(:name, :number, :category, :member_id)\n end", "def vehicle_params\n params.require(:vehicle).permit(:license_plate, :color, :year)\n end", "def create\n @vehicle = @fleet.vehicles.create(params[:vehicle])\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to( [@vehicle.fleet, @vehicle], :notice => 'Vehicle was successfully created.') }\n format.xml { render :xml => @vehicle, :status => :created, :location => @vehicle }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def create\n @load_vehicle = LoadVehicle.new(load_vehicle_params)\n\n respond_to do |format|\n if @load_vehicle.save\n format.html { redirect_to @load_vehicle, notice: 'LoadVehicle was successfully created.' }\n format.json { render action: 'show', status: :created, location: @load_vehicle }\n else\n format.html { render action: 'new' }\n format.json { render json: @load_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def vehicle_param\n params.require(:vehicle).permit(:license, :colour, :make, :model, :year)\n end", "def create_vehicle\n if @work_order_vehicle.present?\n render json: :conflict, status: :conflict\n else\n @work_order_vehicle = WorkOrderVehicle.new\n @work_order_vehicle.assign_attributes(@json['data'])\n if !@json['data']['created_by']\n @work_order_vehicle.created_by = current_user.id if !current_user.nil?\n end\n if @work_order_vehicle.save\n render json: serialized_work_order_vehicle(@work_order_vehicle), status: :created\n else\n render json: format_errors(@work_order_vehicle), status: :unprocessable_entity\n end\n end\n end", "def index\n @chase_vehicles = ChaseVehicle.all\n end", "def index\n @chase_vehicles = ChaseVehicle.all\n end", "def set_chase_vehicle\n @chase_vehicle = ChaseVehicle.find(params[:id])\n end", "def set_chase_vehicle\n @chase_vehicle = ChaseVehicle.find(params[:id])\n end", "def create\n @user_vehicle = UserVehicle.new(user_vehicle_params)\n\t\t@user_vehicle.user = current_user\n respond_to do |format|\n if @user_vehicle.save\n format.html { redirect_to @user_vehicle, notice: 'User vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @user_vehicle }\n else\n format.html { render :new }\n format.json { render json: @user_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @admin_vehicle = City.find(session[:current_city_id]).utility.vehicles.new(admin_vehicle_params)\n @vehicle_type = params[:vehicle][:vehicle_type]\n italian_type = {parking:'Parcheggi', bike:'Bici', taxi:'Taxi'}\n respond_to do |format|\n if @admin_vehicle.save\n format.html { redirect_to session['previous_url'] || admin_vehicles_url(vehicle_type: @admin_vehicle.vehicle_type), notice: \"#{italian_type[@vehicle_type.to_sym]} è stato creato con successo.\" }\n format.json { render :show, status: :created, location: @admin_vehicle }\n else\n format.html { render :new }\n format.json { render json: @admin_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def vehicle_params\n params.require(:vehicle).permit(:patente, :vehicle_type_id, :description, :phone)\n end", "def create\n @vehicle = Vehicle.new()\n\n \n # Populate the basic information from the form\n @vehicle.make = params[:vehicle][:make]\n @vehicle.model = params[:vehicle][:model]\n @vehicle.miles = params[:vehicle][:miles]\n @vehicle.colour = params[:vehicle][:colour]\n @vehicle.image = params[:vehicle][:image]\n @vehicle.owners = params[:vehicle][:owners]\n @vehicle.reg = params[:vehicle][:reg]\n @vehicle.price = params[:vehicle][:price]\n @vehicle.description = params[:vehicle][:description]\n \n myCar = BasicModelCar.new(@vehicle.make, @vehicle.model, @vehicle.miles, @vehicle.colour, @vehicle.image, @vehicle.owners, @vehicle.reg, @vehicle.price, @vehicle.description)\n crashLogger = CrashLogger.instance\n # Add some additional features to our new car\n # the statements could be written inline: params[:newcar][:fireExt].to_s.length > 0 ? myCar = FireExtinguisher.new(myCar) : null\n if params[:vehicle][:NCT].to_s.length > 0 then\n myCar = NCT.new(myCar)\n end\n if params[:vehicle][:Taxed].to_s.length > 0 then\n myCar = Taxed.new(myCar)\n end\n if params[:vehicle][:ExtendedWarranty].to_s.length > 0 then\n myCar = ExtendedWarranty.new(myCar)\n end\n if params[:vehicle][:Crashed].to_s.length > 0 then\n crashLogger.logCrash(@vehicle.reg.to_s)\n end\n \n ##Populate the cost and description information\n @vehicle.price = myCar.getPrice\n @vehicle.description = myCar.getDescription\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render json: @vehicle, status: :created, location: @vehicle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n\n @vehicel = @user.vehicels.create(vehicel_params)\n respond_to do |format|\n if @vehicel.save\n format.html { redirect_to user_vehicels_path(@user, @vehicel) }\n format.json { render :show, status: :created, location: @vehicel }\n else\n format.html { render :new }\n format.json { render json: @vehicel.errors, status: :unprocessable_entity }\n end\n end\n end", "def createVehicle _args\n \"createVehicle _args;\" \n end", "def create\n @vehicle_model = @vehicle_brand.vehicle_models.build(vehicle_model_params)\n\n respond_to do |format|\n if @vehicle_model.save\n format.html { redirect_to @vehicle_brand, notice: 'Vehicle model was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vehicle_model }\n else\n format.html { render action: 'new' }\n format.json { render json: @vehicle_model.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle = Vehicle.new(vehicle_params)\n new_stock = StockQuote::Stock.quote(@vehicle.ticker)\n @vehicle.name = new_stock.name\n @vehicle.last_price= new_stock.last_trade_price_only\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle }\n else\n format.html { render :new }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle = Vehicle.new(vehicle_params)\n if @vehicle.save\n assign_vehicle_to_user\n redirect_to @vehicle, notice: 'Vehicle was successfully created.'\n else\n render :new\n end\n end", "def vehicle_params\n params.require(:vehicle).permit(:veh_reg_no, :category, :name, :desc, :photo, :daily_rate, :color => [], :features => [])\n end", "def create\n #@space_vehicle = SpaceVehicle.new(params[:space_vehicle])\n @space_vehicle = current_user.space_vehicles.new(params[:space_vehicle])\n\n respond_to do |format|\n if @space_vehicle.save\n format.html { redirect_to @space_vehicle, notice: 'Space vehicle was successfully created.' }\n format.json { render json: @space_vehicle, status: :created, location: @space_vehicle }\n else\n format.html { render action: \"new\" }\n format.json { render json: @space_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def vehicle_params\n params.require(:vehicle).permit( :numberPlate, :driverID_id, :model, :brand, :isFull, :packagesCat1, :packagesCat2, :packagesCat3)\n end", "def vehicle_params\n params.require(:vehicle).permit(:vehicle_make, :vehicle_number, :user_id, :start_point_attributes => [:name, :address, :vehicle_id, :latitude, :longitude, :gmaps],\n :end_point_attributes => [:name, :address, :latitude, :longitude, :vehicle_data_id], :vehicle_data_attributes => [:registration_data, :purchase_date_and_year, :owner_name, :owner_address, :vehicle_detail, :vehicle_id, :vehicle_document_photos_attributes => [:name, :photo, :vehicle_data_id]])\n end", "def new\n @vehicle = Vehicle.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle }\n end\n end", "def update_vehicles vehicle\n if self.vehicle.nil?\n self.create_vehicles vehicle\n else\n self.vehicle.update!(:four_wheeler => vehicle[:four_wheeler],:two_wheeler => vehicle[:two_wheeler],:none => vehicle[:none])\n end\n end", "def create\n @sub_vehicle = SubVehicle.new(params[:sub_vehicle])\n\n respond_to do |format|\n if @sub_vehicle.save\n format.html { redirect_to(@sub_vehicle, :notice => 'Sub vehicle was successfully created.') }\n format.xml { render :xml => @sub_vehicle, :status => :created, :location => @sub_vehicle }\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @sub_vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def vehicle_params\n params.require(:vehicle).permit(:license, :colour, :make, :model, :year, :user_id)\n end", "def create\n @vehicle_submodel = VehicleSubmodel.new(vehicle_submodel_params)\n\n respond_to do |format|\n if @vehicle_submodel.save\n format.html { redirect_to @vehicle_submodel, notice: 'Vehicle submodel was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle_submodel }\n else\n format.html { render :new }\n format.json { render json: @vehicle_submodel.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle_info = VehicleInfo.new(vehicle_info_params)\n\n respond_to do |format|\n if @vehicle_info.save\n format.html { redirect_to @vehicle_info, notice: 'Vehicle info was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle_info }\n else\n format.html { render :new }\n format.json { render json: @vehicle_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def vehicle_params\n\t\t\tparams.require(:vehicle).permit(:make, :model, :year, :plate, :state, :color, :owner, :siezure_report_id, :subject_id)\n\t\tend", "def vehicles; end", "def vehicle_params\n params.require(:vehicle).permit(:user_id, :model, :year, :vin, :id)\n end", "def create\n @vehicletype = Vehicletype.new(vehicletype_params)\n\n respond_to do |format|\n if @vehicletype.save\n format.html { redirect_to @vehicletype, notice: 'Vehicletype was successfully created.' }\n format.json { render action: 'show', status: :created, location: @vehicletype }\n else\n format.html { render action: 'new' }\n format.json { render json: @vehicletype.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle = Vehicle.new(params[:vehicle])\n\n respond_to do |format|\n if @vehicle.save\n format.html { redirect_to(new_process_register_url, :notice => 'Vehicle was successfully created.') }\n format.xml { render :xml => @vehicle, :status => :created, :location => @vehicle }\n format.js\n else\n format.html { render :action => \"new\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n format.js\n end\n end\n end", "def vehicle_params\n params.fetch(:vehicle, {}).permit(:driver_name, :driver_phone_num, :vehicle_num, :license_num, :address_line1, :address_line2, :city, :state, :pincode,:identity_proof,:identity_num)\n end", "def create\n @bike = Bike.new(bike_params)\n @bike.compare_vehicles = params[:bike][:compare_vehicles]\n\n if @bike.save\n audit(@bike, current_user)\n render json: @bike, status: :created #serializer: Web::V1::BikeSerializer\n else\n render json: @bike.errors, status: :unprocessable_entity\n end\n end", "def create\n @vehicle_army = VehicleArmy.new(vehicle_army_params)\n\n respond_to do |format|\n if @vehicle_army.save\n format.html { redirect_to @vehicle_army, notice: (t 'vehicle_armies.title')+(t 'actions.created')}\n format.json { render action: 'show', status: :created, location: @vehicle_army }\n else\n format.html { render action: 'new' }\n format.json { render json: @vehicle_army.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle_realtime = VehicleRealtime.new(vehicle_realtime_params)\n\n respond_to do |format|\n if @vehicle_realtime.save\n format.html { redirect_to @vehicle_realtime, notice: 'Vehicle realtime was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle_realtime }\n else\n format.html { render :new }\n format.json { render json: @vehicle_realtime.errors, status: :unprocessable_entity }\n end\n end\n end", "def create\n @vehicle_price = VehiclePrice.new(vehicle_price_params)\n\n respond_to do |format|\n if @vehicle_price.save\n format.html { redirect_to @vehicle_price, notice: 'Vehicle price was successfully created.' }\n format.json { render :show, status: :created, location: @vehicle_price }\n else\n format.html { render :new }\n format.json { render json: @vehicle_price.errors, status: :unprocessable_entity }\n end\n end\n end", "def vehicles\n @vehicles ||= begin\n _, json = get_json(\"/vehicles\")\n json.map { |data| Vehicle.new(self, data) }\n end\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:vehicle_id])\n end", "def new\n add_breadcrumb \"add\", nil, \"glyphicon-plus-sign\"\n\n @vehicle = Vehicle.new\n @years = VehicleYear.all\n @makes = []\n @models = []\n @trims = []\n @types = []\n @doors = []\n @sizes = []\n\n @select_years = VehicleYear.all\n @select_makes = VehicleMake.all\n @select_models = VehicleModel.all\n @select_trims = VehicleTrim.all\n @select_types = VehicleType.all\n @select_doors = VehicleDoor.all\n @select_sizes = VehicleSize.all\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @vehicle }\n end\n end", "def show\n render json: @vehicle\n end", "def createVehicle _obj, _args\n \"_obj createVehicle _args;\" \n end", "def vehicle_params\n # params.require(:vehicle).permit(:ticker, :name, :currency, :last_price)\n params.require(:vehicle).permit(:ticker)\n end", "def vehicle_params\n params.require(:vehicle).permit(:brand, :model, :lowest_price, :highest_price, :image_url, :tag_list)\n end", "def create\n @vehicle_class = VehicleClass.new(params[:vehicle_class])\n\n respond_to do |format|\n if @vehicle_class.save\n format.html { redirect_to @vehicle_class, notice: 'Vehicle class was successfully created.' }\n format.json { render json: @vehicle_class, status: :created, location: @vehicle_class }\n else\n format.html { render action: \"new\" }\n format.json { render json: @vehicle_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @vehicles = Vehicle.all\n if @vehicles.present?\n \trender json: { vehicles: @vehicles, status: :ok }\n else\n render json: { :status => \"204\", :message => \"There is not vehicles\" }, status: :no_content\n end\n end", "def vehicle_params\n params.require(:vehicle).permit(:nickname, :year, :make, :model)\n # , :odometer, :image)\n # , :trim\n #anything that comes from the actual form\n end", "def create\n @check_vehicle_status = CheckVehicleStatus.new(check_vehicle_status_params)\n\n respond_to do |format|\n if @check_vehicle_status.save\n format.html { redirect_to @check_vehicle_status, notice: 'Check vehicle status was successfully created.' }\n format.json { render :show, status: :created, location: @check_vehicle_status }\n else\n format.html { render :new }\n format.json { render json: @check_vehicle_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @vehicles = Vehicle.all\n end", "def index\n @vehicles = Vehicle.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @vehicles }\n end\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def vehicle\n fetch('final_space.vehicles')\n end", "def update\n if @vehicle.update(vehicle_params)\n render json: { status: 'Vehicle was successfully updated', vehicle: @vehicle }, status: :ok\n else\n render json: { errors: @vehicle.errors.full_messages }, status: :bad_request\n end\n end", "def create\n @vehicle_card = VehicleCard.new(vehicle_card_params)\n\n respond_to do |format|\n if @vehicle_card.save\n format.html { redirect_to @vehicle_card, notice: (t 'vehicle_cards.title')+(t 'actions.created') }\n format.json { render action: 'show', status: :created, location: @vehicle_card }\n else\n format.html { render action: 'new' }\n format.json { render json: @vehicle_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def vechicle_params\n params.require(:vechicle).permit(:user_id, :type_vehicle_id, :model)\n end", "def index\n if params[:vehicle_id]\n @vehicle = Vehicle.find(params[:vehicle_id])\n @vehicle_features = @vehicle.features\n end\n @feature = Feature.new\n @features = Feature.all\n @all_features = Feature.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @features }\n end\n end", "def post(path, json, params = {})\n if path.include?('covid19')\n request = Net::HTTP::Post.new(path, @headers)\n else\n request = Net::HTTP::Post.new('/v2' + path, @headers)\n end\n request.add_field('Content-Type', 'application/json')\n request.body = json\n params.each do |k, v|\n request[k] = v\n end\n send_request(request)\n end", "def create\n @lease = Lease.new(params[:lease])\n\n respond_to do |format|\n if @lease.save\n car = Car.where(:registration => @lease.registration).first\n car.update_attributes(:longtermassigned => true)\n format.html { redirect_to cars_url, :notice => 'Lease was successfully created.' }\n format.json { render :json => @lease, :status => :created, :location => @lease }\n else\n format.html { render :action => \"new\" }\n format.json { render :json => @lease.errors, :status => :unprocessable_entity }\n end\n end\n end", "def vehicles_all\n @work_order_vehicles = WorkOrderVehicle.by_id\n render json: serialized_work_order_vehicles(@work_order_vehicles)\n end", "def new\n @carrier = Carrier.new\n @carrier.vehicles.build\n end", "def create\n @driver = Driver.new(driver_params)\n @driver.user_id = current_user.id\n\n url = \"https://dvlasearch.appspot.com/DvlaSearch?apikey=#{Rails.application.credentials.dvla[:dvla_api_key]}&licencePlate=#{@driver.registration_number}\"\n uri = URI(url)\n response = Net::HTTP.get(uri)\n @hash = JSON.parse(response)\n\n if @hash.key?(\"make\")\n @driver.car_info = @hash[\"colour\"] + \" \" + @hash[\"make\"] + \" \" + @hash[\"model\"]\n else\n @driver.car_info = \"Registration number not linked to vehicle!!!\"\n end\n\n @driver.registration_number.upcase!\n\n respond_to do |format|\n if @driver.save\n format.html { redirect_to @driver, notice: 'Car information registered successfully!' }\n format.json { render :show, status: :created, location: @driver }\n else\n format.html { render :new }\n format.json { render json: @driver.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.726066", "0.72551686", "0.694362", "0.694362", "0.694362", "0.6789401", "0.669196", "0.6687901", "0.6627009", "0.6571046", "0.6530366", "0.6498463", "0.6489297", "0.644983", "0.64340776", "0.6402104", "0.6339483", "0.62834346", "0.6263557", "0.6261981", "0.62587154", "0.6248276", "0.62435997", "0.62137455", "0.62135375", "0.6193599", "0.6190476", "0.6188396", "0.6159449", "0.61414444", "0.613775", "0.6137505", "0.612655", "0.612655", "0.61142623", "0.61142623", "0.6099112", "0.6079724", "0.607502", "0.6074358", "0.6069815", "0.6063172", "0.6063021", "0.6060668", "0.6056409", "0.6024741", "0.601528", "0.60038984", "0.60021424", "0.5991984", "0.5983223", "0.59787184", "0.5974613", "0.59740317", "0.5962549", "0.59624296", "0.59480107", "0.5943292", "0.5940854", "0.59206617", "0.59122187", "0.5904711", "0.58930826", "0.5890201", "0.58889425", "0.5879873", "0.5871696", "0.5862642", "0.586023", "0.58423495", "0.58200204", "0.5804379", "0.5759902", "0.5723048", "0.57171196", "0.5676882", "0.56761163", "0.5667182", "0.56569123", "0.56569123", "0.56569123", "0.56569123", "0.56569123", "0.56569123", "0.56569123", "0.56569123", "0.56569123", "0.56569123", "0.56569123", "0.56449753", "0.56161535", "0.5603112", "0.559615", "0.5593858", "0.5581649", "0.5574571", "0.5570152", "0.5569167", "0.55637705" ]
0.7026579
3
PATCH/PUT /chase_vehicles/1 PATCH/PUT /chase_vehicles/1.json
def update respond_to do |format| if @chase_vehicle.set(chase_vehicle_params) format.html { redirect_to :back, notice: 'Chase vehicle was successfully updated.' } format.json { head :no_content } else format.html { render action: 'edit' } format.json { render json: @chase_vehicle.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n put_request\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @vehicle.update(vehicle_params)\n render json: { status: 'Vehicle was successfully updated', vehicle: @vehicle }, status: :ok\n else\n render json: { errors: @vehicle.errors.full_messages }, status: :bad_request\n end\n end", "def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\trespond_to do |format|\n\t\t\tif @vehicle.update(vehicle_params)\n\t\t\t\tcreate_audit __method__, 'vehicle', @vehicle.id\n\t\t\t\tformat.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n\t\t\t\tformat.json { head :no_content }\n\t\t\telse\n\t\t\t\tformat.html { render action: 'edit' }\n\t\t\t\tformat.json { render json: @vehicle.errors, status: :unprocessable_entity }\n\t\t\tend\n\t\tend\n\tend", "def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehcile }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_vehicles vehicle\n if self.vehicle.nil?\n self.create_vehicles vehicle\n else\n self.vehicle.update!(:four_wheeler => vehicle[:four_wheeler],:two_wheeler => vehicle[:two_wheeler],:none => vehicle[:none])\n end\n end", "def update\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to @vehicle, notice: 'El vehículo ha sido actualizado exitosamente.' }\n format.json { render :show, status: :ok, location: @vehicle }\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle_model.update(vehicle_model_params)\n format.html { redirect_to @vehicle_brand, notice: 'Vehicle model was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_model.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @load_vehicle.update(load_vehicle_params)\n format.html { redirect_to @load_vehicle, notice: 'LoadVehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @load_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to(@vehicle, :notice => 'Vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @vehicle = Vehicle.find(params[:id])\n\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to(@vehicle, :notice => 'Vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @stolen_vehicle.update(stolen_vehicle_params)\n format.html { redirect_to @stolen_vehicle, notice: 'Stolen vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @stolen_vehicle }\n else\n format.html { render :edit }\n format.json { render json: @stolen_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vehicle = Vehicle.find(params[:id])\n respond_to do |format|\n if @vehicle.update_attributes(params[:vehicle])\n format.html { redirect_to([@vehicle.fleet,@vehicle], :notice => 'Vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle_submodel.update(vehicle_submodel_params)\n format.html { redirect_to @vehicle_submodel, notice: 'Vehicle submodel was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_submodel }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_submodel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n if vehicle_params[:actual_vehicle] === \"true\"\n @vehicles = Vehicle.where(user_id: vehicle_params[:user_id])\n\n if !@vehicles.nil?\n @vehicles.each do |v|\n v.update(actual_vehicle: \"false\")\n end\n end\n end\n respond_to do |format|\n if @vehicle.update(vehicle_params)\n format.html { redirect_to vehicles_url, notice: 'Los datos del vehículo fueron modificados' }\n format.json { render :index, status: :ok, location: @vehicle, notice: 'Los datos del vehículo fueron modificados'}\n else\n format.html { render :edit }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_vehicles\n @vehicles = Customer.find_by(customer_id: params[:customer_id].to_i).vehicles\n respond_to do |format|\n format.html { render(:text => \"not implemented\") }\n format.js\n end\n end", "def update\n if @vehicle.update(vehicle_params)\n redirect_to @vehicle, notice: 'Vehicle was successfully updated.'\n else\n render :edit\n end\n end", "def update\n vehicle = Vehicle.find_by(license_number: permit_params[:vehicle_attributes][:license_number])\n \n respond_to do |format|\n if @vehiclepermit.update(permit_params)\n @vehiclepermit.update(vehicle: vehicle)\n format.html { redirect_to @vehiclepermit, notice: 'Permit was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehiclepermit }\n else\n format.html { render :edit }\n format.json { render json: @vehiclepermit.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle_info.update(vehicle_info_params)\n format.html { redirect_to @vehicle_info, notice: 'Vehicle info was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_info }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n if @vehicle_model.update_attributes(params[:vehicle_model])\n flash[:notice] = 'VehicleModel was successfully updated.'\n render :partial => 'show', :object => @vehicle_model\n else\n render :partial => 'edit', :object => @vehicle_model, :status => 409\n end\n end", "def update\n @sub_vehicle = SubVehicle.find(params[:id])\n\n respond_to do |format|\n if @sub_vehicle.update_attributes(params[:sub_vehicle])\n format.html { redirect_to(@sub_vehicle, :notice => 'Sub vehicle was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @sub_vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @user_vehicle.update(user_vehicle_params)\n format.html { redirect_to @user_vehicle, notice: 'User vehicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @user_vehicle }\n else\n format.html { render :edit }\n format.json { render json: @user_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicletype.update(vehicletype_params)\n format.html { redirect_to @vehicletype, notice: 'Vehicletype was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicletype.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle_army.update(vehicle_army_params)\n format.html { redirect_to @vehicle_army, notice: (t 'vehicle_armies.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_army.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle_information.update(vehicle_information_params)\n format.html { redirect_to @vehicle_information, notice: 'Vehicle information was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_information }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_information.errors, status: :unprocessable_entity }\n end\n end\n end", "def update!(params)\n res = @client.put(path, nil, params, \"Content-Type\" => \"application/json\")\n @attributes = res.json if res.status == 201\n res\n end", "def update\n respond_to do |format|\n if @vehicle_realtime.update(vehicle_realtime_params)\n format.html { redirect_to @vehicle_realtime, notice: 'Vehicle realtime was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_realtime }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_realtime.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle_card.update(vehicle_card_params)\n format.html { redirect_to @vehicle_card, notice: (t 'vehicle_cards.title')+(t 'actions.updated') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_card.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle_boat_part.update(vehicle_boat_part_params)\n format.html { redirect_to @vehicle_boat_part, notice: 'Vehicle boat part was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_boat_part }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_boat_part.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if (params[:commit] == 'Cancel')\n @vehicle.reload\n flash[:info] = \"Editing of #{@vehicle.name} was cancelled.\"\n format.html { redirect_to(user_vehicle_path(@current_user, @vehicle)) }\n format.xml { head :ok }\n elsif @vehicle.update_attributes(params[:vehicle])\n first_fill_up = @vehicle.fill_ups.sort{ |a,b| a.odometer <=> b.odometer}[0] unless @vehicle.fill_ups.size == 0\n first_fill_up.save unless first_fill_up.nil?\n flash[:success] = \"#{@vehicle.name} was successfully updated.\"\n format.html { redirect_to(user_vehicle_path(@current_user, @vehicle)) }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_tenant_circle(args = {}) \n put(\"/tenantcircles.json/#{args[:circleId]}\", args)\nend", "def update\n respond_to do |format|\n if @car_specific_spec.update(car_specific_spec_params)\n format.html { redirect_to @car_specific_spec, notice: 'Car specific spec was successfully updated.' }\n format.json { render :show, status: :ok, location: @car_specific_spec }\n else\n format.html { render :edit }\n format.json { render json: @car_specific_spec.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vehicle = Vehicle.find(id_from_params)\n #if (@vehicle.vehicle_type.casecmp(\"Pickup\") == 0) || (@vehicle.vehicle_type.casecmp(\"SUV\") == 0) || (@vehicle.vehicle_type.casecmp(\"Crossover\") == 0) || (@vehicle.vehicle_type.casecmp(\"CUV\") == 0) || (@vehicle.vehicle_type.casecmp(\"Van\") == 0) || (@vehicle.vehicle_type.casecmp(\"Minivan\") == 0)\n #@vehicle.size = \"Large\"\n #elsif(@vehicle.vehicle_type.casecmp(\"Convertible\") == 0) || (@vehicle.vehicle_type.casecmp(\"Coupe\") == 0) || (@vehicle.vehicle_type.casecmp(\"Sedan\") == 0) || (@vehicle.vehicle_type.casecmp(\"Wagon\") == 0) || (@vehicle.vehicle_type.casecmp(\"Hatchback\") == 0)\n #@vehicle.size = \"Small\"\n #end\n\n respond_to do |format|\n if @vehicle.update_attributes(params_update_vehicle)\n format.html { redirect_to root_path, notice: 'Vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @feature = Feature.find(params[:id])\n if params[:vehicle_id]\n @method = Vehicle.find(params[:vehicle_id]).toggle_feature(@feature)\n end\n\n respond_to do |format|\n if @feature.update_attributes(feature_params)\n format.json { head :no_content }\n format.js\n else\n format.html { render action: \"edit\" }\n format.json { render json: @feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @media_vehicle = MediaVehicle.find(params[:id])\n\n respond_to do |format|\n if @media_vehicle.update_attributes(params[:media_vehicle])\n format.html { redirect_to @media_vehicle, notice: 'Media vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @media_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle_service_record.update(vehicle_service_record_params)\n format.html { redirect_to @vehicle_service_record.vehicle, notice: 'Vehicle Service Record was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_service_record }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_service_record.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle_price.update(vehicle_price_params)\n format.html { redirect_to @vehicle_price, notice: 'Vehicle price was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_price }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_price.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n @vehicle = Vehicle.find(params[:id])\n\n end", "def update_vehicle_with_http_info(body, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VehicleApi.update_vehicle ...\"\n end\n # verify the required parameter 'body' is set\n if @api_client.config.client_side_validation && body.nil?\n fail ArgumentError, \"Missing the required parameter 'body' when calling VehicleApi.update_vehicle\"\n end\n # resource path\n local_var_path = \"/vehicle\"\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/xml', 'application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/json', 'application/xml'])\n\n # form parameters\n form_params = {}\n\n # http body (model)\n post_body = @api_client.object_to_http_body(body)\n auth_names = ['vehiclegarage_auth']\n data, status_code, headers = @api_client.call_api(:PUT, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VehicleApi#update_vehicle\\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 @admin_vehicle.update(admin_vehicle_params)\n format.html { redirect_to session['previous_url'] || admin_vehicles_url(vehicle_type: @admin_vehicle.vehicle_type), notice: \"#{@italian_type[@vehicle_type.to_sym]} è stato aggiornato con successo.\" }\n format.json { render :show, status: :ok, location: @admin_vehicle }\n else\n format.html { render :edit }\n format.json { render json: @admin_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render json: Company.update(params[\"id\"], params[\"company\"])\n end", "def update\n @vehicle_class = VehicleClass.find(params[:id])\n\n respond_to do |format|\n if @vehicle_class.update_attributes(params[:vehicle_class])\n format.html { redirect_to @vehicle_class, notice: 'Vehicle class was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vehicle_class.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @check_vehicle_status.update(check_vehicle_status_params)\n format.html { redirect_to @check_vehicle_status, notice: 'Check vehicle status was successfully updated.' }\n format.json { render :show, status: :ok, location: @check_vehicle_status }\n else\n format.html { render :edit }\n format.json { render json: @check_vehicle_status.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle_manufacturer.update(vehicle_manufacturer_params)\n format.html { redirect_to @vehicle_manufacturer, notice: 'Vehicle manufacturer was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_manufacturer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t@vehicle_categories = VehicleCategory.all\n\t@vehicle_category = VehicleCategory.find(params[:id])\n respond_to do |format|\n if @vehicle_category.update(vehicle_category_params)\n format.html { redirect_to @vehicle_category, notice: 'Vehicle category was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_category.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @bike = Bike.find(params[:id])\n @bike.compare_vehicles = params[:bike][:compare_vehicles]\n\n if @bike.update(bike_params)\n audit(@bike, current_user)\n render json: @bike, status: :ok #serializer: Web::V1::BikeSerializer\n else\n render json: @bike.errors, status: :unprocessable_entity\n end\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:vehicle_id])\n end", "def update\n respond_to do |format|\n if @vehicle_cost.update(vehicle_cost_params)\n format.html { redirect_to @vehicle_cost, notice: 'Vehicle cost was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_cost }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_cost.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # { clinic: {id: references, \"license_id\"=>nil, \"name\"=>string } }\n \n if @clinic.update_attributes(params[:clinic].except(:api_license_id))\n head :no_content\n else\n render json: clinic.errors.full_messages, status: :unprocessable_entity\n end\n end", "def update\n @vacancy = Vacancy.find(params[:id])\n\n respond_to do |format|\n if @vacancy.update_attributes(params[:vacancy])\n format.html { redirect_to @vacancy, notice: 'Vacancy was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle_reservation.update(vehicle_reservation_params)\n format.html { redirect_to @vehicle_reservation, notice: 'Reserva atualizada com sucesso.' }\n format.json { render :show, status: :ok, location: @vehicle_reservation }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_reservation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vehicle_fine.update(vehicle_fine_params)\n format.html { redirect_to @vehicle_fine, notice: 'Vehicle fine was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicle_fine }\n else\n format.html { render :edit }\n format.json { render json: @vehicle_fine.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @company_vacancy.update(company_vacancy_params)\n format.html { redirect_to @company_vacancy, notice: 'Company vacancy was successfully updated.' }\n format.json { render :show, status: :ok, location: @company_vacancy }\n else\n format.html { render :edit }\n format.json { render json: @company_vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @sims_biga_vehicle_person.update(sims_biga_vehicle_person_params)\n format.html { redirect_to @sims_biga_vehicle_person, notice: t('flash.notice.updated.') }\n format.json { render :show, status: :ok, location: @sims_biga_vehicle_person }\n else\n format.html { render :edit }\n format.json { render json: @sims_biga_vehicle_person.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vacancy.update(vacancy_params)\n update_skills\n format.html { redirect_to @vacancy, notice: 'Vacancy was successfully updated.' }\n format.json { render :show, status: :ok, location: @vacancy }\n else\n format.html { render :edit }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def vehicle_params\n params.require(:vehicle).permit(:api_id, :api_vehicle_company_id, :number, :status, :ifta, :vin, :make, :model, :year, :license_plate_state, :license_plate_number, :metric_units, :fuel_type, :prevent_auto_odometer_entry, :edl_device_id, :edl_identifier, :edl_model, :api_driver_id, :driver_first_name, :driver_last_name, :driver_username, :driver_email, :driver_internal_id, :driver_status, :driver_role)\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def set_vehicle\n @vehicle = Vehicle.find(params[:id])\n end", "def update\n respond_to do |format|\n if @vehicle_type.update(vehicle_type_params)\n images\n\n format.html { redirect_to @vehicle_type, notice: 'Vehicle type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n if @product_option_vehicle_model.update_attributes(params[:product_option_vehicle_model])\n flash[:notice] = 'ProductOptionVehicleModel was successfully updated.'\n render :partial => 'show', :object => @product_option_vehicle_model\n else\n render :partial => 'edit', :object => @product_option_vehicle_model, :status => 409\n end\n end", "def update\n respond_to do |format|\n if @vechicle.update(vechicle_params)\n format.html { redirect_to @vechicle, notice: 'Vechicle was successfully updated.' }\n format.json { render :show, status: :ok, location: @vechicle }\n else\n format.html { render :edit }\n format.json { render json: @vechicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n travel = Travel.find(params[:id])\n if travel.update(travel_params)\n render json: travel, status: 200\n else\n render json: travel.errors, status: 422\n end\n end", "def patch\n headers = {\"If-Match\" => @version}\n response = @context.request :patch, \"#{@path}/#{@id}\", @data.to_json, headers\n @version += 1\n response\n # 'X-HTTP-Method-Override' => 'PATCH'\n end", "def update\n @vet = Vet.find(params[:id])\n\n respond_to do |format|\n if @vet.update_attributes(params[:vet])\n format.html { redirect_to @vet, notice: 'Vet was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @vet.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @car_feature.update(car_feature_params)\n format.html { redirect_to @car_feature, notice: 'Car feature was successfully updated.' }\n format.json { render :show, status: :ok, location: @car_feature }\n else\n format.html { render :edit }\n format.json { render json: @car_feature.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @car = Car.find(params[:id])\n\n if @car.update(car_params)\n head :no_content\n else\n render json: @car.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @references_vehicle_driver.update(references_vehicle_driver_params)\n format.html { redirect_to @references_vehicle_driver, notice: 'References vehicle driver was successfully updated.' }\n format.json { render :show, status: :ok, location: @references_vehicle_driver }\n else\n format.html { render :edit }\n format.json { render json: @references_vehicle_driver.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vehicle_historic = VehicleHistoric.find(params[:id])\n @vehicle_historic.status = \"aberto\"\n\n respond_to do |format|\n if @vehicle_historic.update_attributes(params[:vehicle_historic])\n format.html { redirect_to(@vehicle_historic, :notice => 'Vehicle historic was successfully updated.') }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @vehicle_historic.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @cars_part.update(cars_part_params)\n format.html { redirect_to @cars_part, notice: 'Cars part was successfully updated.' }\n format.json { render :show, status: :ok, location: @cars_part }\n else\n format.html { render :edit }\n format.json { render json: @cars_part.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @agency = Agency.find(params[:id])\n\n if @agency.update(agency_params)\n #head :no_content\n render json: @agency, status: :accepted, location: @agency #sera? status accepted? \n else\n render json: @agency.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @particular_vacancy_request.update(particular_vacancy_request_params)\n format.html { redirect_to @particular_vacancy_request, notice: 'Particular vacancy request was successfully updated.' }\n format.json { render :show, status: :ok, location: @particular_vacancy_request }\n else\n format.html { render :edit }\n format.json { render json: @particular_vacancy_request.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #@space_vehicle = SpaceVehicle.find(params[:id])\n @space_vehicle = current_user.space_vehicles.find_by_id(params[:id])\n vehicle = SpaceVehicle.find_by_id(params[:id]) \n @space_vehicle ||= vehicle if current_user.has_share_access?(vehicle) \n\n respond_to do |format|\n if @space_vehicle.update_attributes(params[:space_vehicle])\n format.html { redirect_to @space_vehicle, notice: 'Space vehicle was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @space_vehicle.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @customer = params[:customer]\n begin \n @vehicle = Vehicle.find_by_id(params[:id])\n if @vehicle.update_attributes(params[:vehicle])\n flash[:notice] = \"Vehicle updated\"\n redirect_to @vehicle\n else\n flash[:error] = @vehicle.errors.full_messages.to_sentence if @vehicle.errors\n redirect_to edit_vehicle_path\n end\n rescue ActiveRecord::RecordNotFound\n render_404\n end\n end", "def update\n respond_to do |format|\n if @vacancy.update(vacancy_params)\n format.html { redirect_to @vacancy, notice: 'Vacancy was successfully updated.' }\n format.json { render :show, status: :ok, location: @vacancy }\n else\n format.html { render :edit }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @vacancy.update(vacancy_params)\n format.html { redirect_to @vacancy, notice: 'Vacancy was successfully updated.' }\n format.json { render :show, status: :ok, location: @vacancy }\n else\n format.html { render :edit }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_vehicle(id, params)\n fleet[id] = RoutificApi::Vehicle.new(id, params)\n end", "def update\n respond_to do |format|\n if @agency.update_attributes(params[:agency])\n format.html { redirect_to @agency, notice: 'Agency was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @agency.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if @person.seat\n render json: {errors: 'Cannot update a seated person'}, status: 422\n else\n @person.update person_params\n render json: @person\n end\n end", "def update\n respond_to do |format|\n if @vacancy.update(vacancy_params)\n format.html { redirect_to @vacancy, notice: \"Vacancy was successfully updated.\" }\n format.json { render :show, status: :ok, location: @vacancy }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @vacancy.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @plate = Plate.find(params[:id])\n\n if @plate.update(params[:plate])\n head :no_content\n else\n render json: @plate.errors, status: :unprocessable_entity\n end\n end", "def update\n @vehicle_fine_types = VehicleFineType.all\n @vehicle_fine_type = VehicleFineType.find(params[:id])\n respond_to do |format|\n if @vehicle_fine_type.update(vehicle_fine_type_params)\n format.html { redirect_to @vehicle_fine_type, notice: 'Vehicle fine type was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vehicle_fine_type.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @vehicel = @user.vehicels.find(params[:id])\n respond_to do |format|\n if @vehicel.update(vehicel_params)\n format.html { redirect_to user_vehicels_path(@user), notice: 'Vehicel was successfully updated.' }\n format.json { render :show, status: :ok, location: @vehicel }\n else\n format.html { render :edit }\n format.json { render json: @vehicel.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authenticate_request!\n\n @car = Car.find(params[:id])\n\n if @car.update(car_params)\n head :no_content\n else\n render json: @car.errors, status: :unprocessable_entity\n end\n end", "def update_vehicle_with_form_with_http_info(vehicle_id, opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug \"Calling API: VehicleApi.update_vehicle_with_form ...\"\n end\n # verify the required parameter 'vehicle_id' is set\n if @api_client.config.client_side_validation && vehicle_id.nil?\n fail ArgumentError, \"Missing the required parameter 'vehicle_id' when calling VehicleApi.update_vehicle_with_form\"\n end\n # resource path\n local_var_path = \"/vehicle/{vehicleId}\".sub('{' + 'vehicleId' + '}', vehicle_id.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/xml', 'application/json'])\n # HTTP header 'Content-Type'\n header_params['Content-Type'] = @api_client.select_header_content_type(['application/x-www-form-urlencoded'])\n\n # form parameters\n form_params = {}\n form_params[\"name\"] = opts[:'name'] if !opts[:'name'].nil?\n form_params[\"vehicletype\"] = opts[:'vehicletype'] if !opts[:'vehicletype'].nil?\n\n # http body (model)\n post_body = nil\n auth_names = ['vehiclegarage_auth']\n data, status_code, headers = @api_client.call_api(:POST, local_var_path,\n :header_params => header_params,\n :query_params => query_params,\n :form_params => form_params,\n :body => post_body,\n :auth_names => auth_names)\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: VehicleApi#update_vehicle_with_form\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def set_vehicle\n\t\t\t@vehicle = Vehicle.find(params[:id])\n\t\tend", "def update\n respond_to do |format|\n if @travel_vendor.update(travel_vendor_params)\n format.html { redirect_to @travel_vendor, notice: 'Travel vendor was successfully updated.' }\n format.json { render :show, status: :ok, location: @travel_vendor }\n else\n format.html { render :edit }\n format.json { render json: @travel_vendor.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7265345", "0.71993643", "0.7122561", "0.7122561", "0.7082296", "0.69862705", "0.69862705", "0.69862705", "0.69370764", "0.67699367", "0.6696247", "0.6612618", "0.6588545", "0.656046", "0.656046", "0.6551436", "0.6547223", "0.6524608", "0.65235007", "0.65010476", "0.6479677", "0.6471352", "0.64712864", "0.64492553", "0.6442307", "0.6440808", "0.6403014", "0.64008516", "0.634984", "0.6313761", "0.62821776", "0.6211544", "0.61992383", "0.6184285", "0.6175827", "0.61653984", "0.6156348", "0.6153729", "0.6142625", "0.61418694", "0.6139293", "0.613891", "0.6128455", "0.6118789", "0.61149925", "0.6111607", "0.6110948", "0.6090627", "0.60848737", "0.60807484", "0.6076013", "0.60439336", "0.60355407", "0.6026576", "0.60062593", "0.59921944", "0.59912807", "0.59911644", "0.5988741", "0.598218", "0.59787947", "0.59787947", "0.59787947", "0.59787947", "0.59787947", "0.59787947", "0.59787947", "0.59787947", "0.59787947", "0.59787947", "0.59787947", "0.59664196", "0.59583807", "0.5949058", "0.59463346", "0.5943325", "0.5925169", "0.5922563", "0.59185076", "0.59171194", "0.5879658", "0.58758473", "0.5873316", "0.5868663", "0.5864626", "0.5857479", "0.58542854", "0.58542854", "0.5846913", "0.5844969", "0.58414257", "0.5839249", "0.5829465", "0.5825068", "0.58203715", "0.5814422", "0.5814252", "0.58018565", "0.5800136" ]
0.71813715
3
DELETE /chase_vehicles/1 DELETE /chase_vehicles/1.json
def destroy @chase_vehicle.destroy respond_to do |format| format.html { redirect_to :back } format.json { head :no_content } end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to root_path }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to vehicles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to vehicles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n\t\tcreate_audit __method__, 'vehicle', @vehicle.id\n\t\t@vehicle.destroy\n\t\trespond_to do |format|\n\t\t\tformat.html { redirect_to vehicles_url }\n\t\t\tformat.json { head :no_content }\n\t\tend\n\tend", "def destroy\n @vehicle.destroy\n render json: { status: 'Vehicle was successfully destroyed' }, status: :ok\n end", "def destroy\n vehicle = Vehicle.where(uid: params[:id]).first\n # vehicle.locations.destroy_all\n vehicle.destroy\n render nothing: true, :status =>204\n end", "def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @load_vehicle.destroy\n respond_to do |format|\n format.html { redirect_to load_vehicle_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehcile.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def deleteVehicle _args\n \"deleteVehicle _args;\" \n end", "def destroy\n @vehicle_model.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_models_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle.destroy\n respond_to do |format|\n format.html { redirect_to vehicles_url, notice: 'El vehículo seleccionado fue eliminado' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @vehicle = Vehicle.find(params[:id])\n @vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to(fleet_vehicles_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @sub_vehicle = SubVehicle.find(params[:id])\n @sub_vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to(sub_vehicles_url) }\n format.xml { head :ok }\n end\n end", "def delete_aos_version(args = {}) \n delete(\"/aosversions.json/#{args[:aosVersionId]}\", args)\nend", "def destroy\n @vehicletype.destroy\n respond_to do |format|\n format.html { redirect_to vehicletypes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_army.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_armies_url, notice: (t 'vehicle_armies.title')+(t 'actions.removed') }\n format.json { head :no_content }\n end\n end", "def destroy\n @stolen_vehicle.destroy\n respond_to do |format|\n format.html { redirect_to stolen_vehicles_url, notice: 'Stolen vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_model.destroy\n\n render :nothing => true\n end", "def destroy\n @vehicle_type.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_types_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 destroy\n @vehicle_realtime.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_realtimes_url, notice: 'Vehicle realtime was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @media_vehicle = MediaVehicle.find(params[:id])\n @media_vehicle.destroy\n\n respond_to do |format|\n format.html { redirect_to media_vehicles_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehiclepermit.destroy\n respond_to do |format|\n format.html { redirect_to permits_url, notice: 'Permit was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_info.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_infos_url, notice: 'Vehicle info was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n render json: Company.delete(params[\"id\"])\n end", "def destroy\n @vehicle_submodel.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_submodels_url, notice: 'Vehicle submodel was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @sims_biga_vehicle_person.destroy\n respond_to do |format|\n format.html { redirect_to sims_biga_vehicle_people_url, notice: t('flash.notice.destroied.') }\n format.json { head :no_content }\n end\n end", "def destroy\n @droparea = Droparea.find(params[:id])\n @droparea.destroy\n @vehicle = Vehicle.find(1)\n\n respond_to do |format|\n format.html { redirect_to edit_post_url(@vehicle) }\n format.json { head :no_content }\n end\n end", "def destroy\n # @vehicle is retrieved in before_filter acquire_vehicle\n @vehicle.destroy\n\n if @vehicle.destroyed?\n logger.info(\"deleted Vehicle #{@vehicle.id}.\")\n respond_to do |format|\n format.html { redirect_to vehicles_path }\n format.json { render json: { success: true, vehicle: @vehicle } }\n end\n else\n logger.error(\"Cannot delete Vehicle #{@vehicle.id}.\")\n flash.now[:alert] = I18n.t(\"controllers.vehicle.flash_message.can_not_delete\")\n respond_to do |format|\n format.html { render :show }\n format.json { render json: { success: false, \n vehicle: @vehicle,\n msg: (@vehicle.errors.present? ?\n @vehicle.errors.full_messages :\n I18n.t(\"controllers.vehicle.flash_message.can_not_delete\")) } }\n end\n end\n end", "def destroy\n @user_vehicle.destroy\n respond_to do |format|\n format.html { redirect_to user_vehicles_url, notice: 'User vehicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(\"/#{id}\")\n end", "def destroy\n @admin_vehicle.destroy\n respond_to do |format|\n format.html { redirect_to session['previous_url'] || admin_vehicles_url, notice: \"#{italian_type[@vehicle_type.to_sym]} cancellata con successo!.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_historic = VehicleHistoric.find(params[:id])\n @vehicle_historic.destroy\n\n respond_to do |format|\n format.html { redirect_to(vehicle_historics_url) }\n format.xml { head :ok }\n end\n end", "def destroy\n @visit = Visit.find(params[:id])\n @visit.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @check_vehicle_status.destroy\n respond_to do |format|\n format.html { redirect_to check_vehicle_statuses_url, notice: 'Check vehicle status was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n if @vehicle.destroy\n redirect_to vehicles_url, notice: 'Vehicle was successfully destroyed.'\n end\n end", "def destroy\n @vehicle_cost.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_costs_url, notice: 'Vehicle cost was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def call(event)\n es = Lynr::Elasticsearch.new\n response = es.client.delete({\n index: 'vehicles',\n type: vehicle(event).class.name,\n id: vehicle_id(event),\n })\n require 'pry-debugger'\n binding.pry\n success\n rescue StandardError => e\n failure\n end", "def destroy\n @vehicle_class = VehicleClass.find(params[:id])\n @vehicle_class.destroy\n\n respond_to do |format|\n format.html { redirect_to vehicle_classes_url }\n format.json { head :ok }\n end\n end", "def destroy\n @vehicle_card.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_cards_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 @vechicle.destroy\n respond_to do |format|\n format.html { redirect_to vechicles_url, notice: 'Vechicle was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_end_of_life.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_end_of_lives_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @maintenance_item.destroy\n respond_to do |format|\n format.html { redirect_to controller: \"maintenance_records\", action: \"edit\", id: Vehicle.find_by(id: params[:vid]).maintenance_record.id, vid: params[:vid], notice: 'Maintenance item was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_boat_part.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_boat_parts_url, notice: 'Vehicle boat part was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicule_perso = VehiculePerso.find(params[:id])\n @vehicule_perso.destroy\n\n respond_to do |format|\n format.html { redirect_to vehicule_persos_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicel = @user.vehicels.find(params[:id])\n @vehicel.destroy\n respond_to do |format|\n format.html { redirect_to user_vehicels_path(@user) }\n format.json { head :no_content }\n end\n end", "def destroy\n @references_vehicle_driver.destroy\n respond_to do |format|\n format.html { redirect_to references_vehicle_drivers_url, notice: 'References vehicle driver was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client_asset = ClientAsset.find(params[:id])\n client_name = @client_asset.client_name\n @client_asset.deleted = true\n @client_asset.deleted_at = Time.now\n @client_asset.save\n #@client_asset.destroy\n\n respond_to do |format|\n format.html { redirect_to client_assets_url, notice: \"#{client_name}'s asset was successfully deleted.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacancy = Vacancy.find(params[:id])\n @vacancy.destroy\n\n respond_to do |format|\n format.html { redirect_to vacancies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n begin\n Vehicle.find_by_id(params[:id]).destroy\n flash[:notice] = \"Vehicle deleted successfully\"\n redirect_to action: :index\n rescue \n render_404\n end\n end", "def delete(path)\n RestClient.delete request_base+path\n end", "def destroy\n @subway.destroy\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :no_content }\n end\n end", "def delete(vmname)\n uri = @uri + \"/#{vmname}?api-version=#{api_version}\"\n uri\n end", "def destroy\n begin\n Vehicle.find_by_id(params[:id]).destroy\n flash[:notice] = \"Vehicle deleted successfully\"\n redirect_to action: :index\n rescue ActiveRecord::RecordNotFound\n render_404\n end\n end", "def destroy\n @lease = Lease.find(params[:id])\n\n car = Car.where(:registration => @lease.registration).first\n car.update_attributes(:longtermassigned => false)\n \n @lease.destroy\n\n respond_to do |format|\n format.html { redirect_to cars_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @trein_consul_comercial.destroy\n respond_to do |format|\n format.html { redirect_to trein_consul_comercials_url }\n format.json { head :no_content }\n end\n end", "def delete(path, params)\n parse_response @client[path].delete(:params => params)\n end", "def destroy\n @ride_driver.destroy\n respond_to do |format|\n format.html { redirect_to @root }\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 @vet = Vet.find(params[:id])\n @vet.destroy\n\n respond_to do |format|\n format.html { redirect_to vets_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vocalium = Vocalium.find(params[:id])\n @vocalium.destroy\n\n respond_to do |format|\n format.html { redirect_to vocalia_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @ruby.destroy\n respond_to do |format|\n format.html { redirect_to rubies_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vice.destroy\n respond_to do |format|\n format.html { redirect_to vices_url, notice: 'Vice was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle.destroy\n flash[:success] = \"#{@vehicle.name} was removed\"\n respond_to do |format|\n format.html { redirect_to(user_vehicles_path(@current_user)) }\n format.xml { head :ok }\n end\n end", "def destroy\n @travel_vendor.destroy\n respond_to do |format|\n format.html { redirect_to travel_vendors_url, notice: 'Travel vendor was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @client = Client.find(params[:id])\n \n if @client.deleted_at.blank?\n @client.destroy\n else\n @client.revive\n end\n \n respond_to do |format|\n format.html { redirect_to :back }\n format.json { head :ok }\n end\n end", "def destroy\n id = params[:id]\n @physical_rack = PhysicalRack.any_of({_id: id}, {name: id.gsub('-', '.')}).first\n @physical_rack.destroy\n\n respond_to do |format|\n format.html { redirect_to physical_racks_url }\n format.json { head :ok }\n end\n end", "def destroy\n @depot_fuel.destroy\n respond_to do |format|\n format.html { redirect_to depot_fuels_url }\n format.json { head :no_content }\n end\n end", "def delete path\n make_request(path, \"delete\", {})\n end", "def destroy\n @vehicle_reservation.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_reservations_url, notice: 'Reserva excluída com sucesso.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_price.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_prices_url, notice: 'Vehicle price was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @cartridge.destroy\n respond_to do |format|\n format.html { redirect_to cartridges_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @railway = Railway.find(params[:id])\n @railway.destroy\n\n respond_to do |format|\n format.html { redirect_to railways_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vitabus.destroy\n respond_to do |format|\n format.html { redirect_to vitabus_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vibe.destroy\n respond_to do |format|\n format.html { redirect_to vibes_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehicle_fine.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_fines_url, notice: 'Vehicle fine was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n # find ALL servings associated with this purchase and delete them\n all_servings = Serving.where(purchase_id: @purchase.id)\n puts \"all servings associated with this purchase: #{all_servings}\"\n all_servings.destroy_all\n puts \"deleted servings\"\n @purchase.destroy\n puts \"deleted purchase\"\n render json: {status: 204, purchase: @purchase}\n end", "def destroy\n @client_release = ClientRelease.find(params[:id])\n @client_release.destroy\n\n respond_to do |format|\n format.html { redirect_to client_releases_url }\n format.json { head :ok }\n end\n end", "def destroy\n @cage.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @subway = Subway.find(params[:id])\n @subway.destroy\n\n respond_to do |format|\n format.html { redirect_to subways_url }\n format.json { head :ok }\n end\n end", "def destroy\n @opttruck.destroy\n respond_to do |format|\n format.html { redirect_to opttrucks_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vacancy.destroy\n respond_to do |format|\n format.html { redirect_to vacancies_url, notice: 'Вакансия удалена.' }\n format.json { head :no_content }\n end\n end", "def delete\n client.delete(url)\n @deleted = true\nend", "def destroy\n @agent = @business.agents.find(params[:id])\n @agent.destroy\n\n respond_to do |format|\n format.html { redirect_to business_agents_url(@business) }\n format.json { head :no_content }\n end\n end", "def destroy\n @agency.destroy\n respond_to do |format|\n format.html { redirect_to agencies_url, notice: \"Agency was successfully destroyed.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @plate.destroy\n respond_to do |format|\n format.html { redirect_to client_budget_mobile_url(@client, @budget, @mobile), notice: \"Chapa deletada com sucesso.\" }\n format.json { head :no_content }\n end\n end", "def destroy\n @wait = Wait.find(params[:id])\n @wait.destroy\n\n respond_to do |format|\n format.json { head :no_content }\n end\n end", "def destroy\n @agency.update_attribute(:status, 'N')\n respond_to do |format|\n format.html { redirect_to agencies_url, notice: 'Agency was successfully deleted.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @vegetable = Vegetable.find(params[:id])\n @vegetable.destroy\n\n respond_to do |format|\n format.html { redirect_to vegetables_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @vehiculo.destroy\n respond_to do |format|\n format.html { redirect_to vehiculos_url, notice: 'Vehiculo was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @maintenance.destroy\n respond_to do |format|\n format.html { redirect_to vehicle_maintenances_path(@vehicle), notice: 'Maintenance was successfully destroyed.' }\n format.json { head :no_content }\n end\n end", "def destroy\n @contacter = Contacter.find(params[:id])\n @contacter.destroy\n\n respond_to do |format|\n format.html { redirect_to contacters_url }\n format.json { head :no_content }\n end\n end" ]
[ "0.75328815", "0.7520184", "0.7520184", "0.73870677", "0.7347832", "0.7293985", "0.72215956", "0.72215956", "0.72215956", "0.72215956", "0.7196833", "0.7184534", "0.71619755", "0.71357685", "0.7115856", "0.70986724", "0.70986724", "0.70474255", "0.702127", "0.7010943", "0.6998676", "0.69753116", "0.693343", "0.69293916", "0.6928753", "0.6924488", "0.69227064", "0.6880558", "0.68361723", "0.6827173", "0.6820304", "0.6781822", "0.6778002", "0.6774746", "0.6771653", "0.6752634", "0.6745921", "0.6745216", "0.6729101", "0.67284584", "0.67217875", "0.66942924", "0.6684715", "0.6682744", "0.6682171", "0.6680609", "0.6674801", "0.6672952", "0.66725427", "0.66658074", "0.6663266", "0.66577137", "0.665196", "0.6650375", "0.66439486", "0.663979", "0.6636969", "0.6627255", "0.66272515", "0.6626643", "0.6610332", "0.6605094", "0.65916854", "0.6591068", "0.658568", "0.6578282", "0.6576215", "0.65748006", "0.6574278", "0.6573827", "0.65730464", "0.6569653", "0.65610904", "0.6557839", "0.65560764", "0.6551832", "0.654947", "0.6543972", "0.6529558", "0.6528345", "0.6527155", "0.652691", "0.6525368", "0.65235174", "0.6520383", "0.6518847", "0.651801", "0.6516574", "0.6514215", "0.65055823", "0.65027374", "0.65012187", "0.6499862", "0.64973277", "0.64971423", "0.6495995", "0.6491809", "0.6490688", "0.6488123" ]
0.76296186
1
Use callbacks to share common setup or constraints between actions.
def set_chase_vehicle @chase_vehicle = ChaseVehicle.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 chase_vehicle_params params.require(:chase_vehicle).permit(:description, :ident, :mission_id, :chase_server_id ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
this function is used to get the node from feature files.
def get_target(host) case host when 'server' node = $server when 'ceos-minion' node = $ceos_minion when 'ssh-minion' node = $ssh_minion when 'sle-minion' node = $minion when 'sle-client' node = $client when 'sle-migrated-minion' node = $client else raise 'Invalid target.' end node end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def feature\n child_node.feature\n end", "def feature\n child_node.feature\n end", "def get_node(fqn)\n node = @nodes.get_node(fqn)\n node if context?(node)\n end", "def get_node(node)\n\t\t\t@nodes[node]\n\t\tend", "def node\n @context.node\n end", "def file_node(path)\n file_info(path).first[0..19]\n end", "def node\n attributes['node']\n end", "def node\n attributes['node']\n end", "def node\n @node\n end", "def node\n @node\n end", "def cucumber_features_node\n # XPath is case-sensitive so I'm using the translate function as\n # described in a blog post titled \"Performing a Case In-sensitive\n # search in an XML Document\" by Harish Ranganathan\n # http://geekswithblogs.net/ranganh/archive/2005/09/12/53520.aspx\n #\n # There may be functions in XPath version 2 that provide a better way\n # to do case-insensitive search but as of this writing REXML only\n # implements XPath 1.0.\n #\n # Because the search is for a specific string, only those characters\n # need translated to lower case.\n REXML::XPath.first(@mmdoc, '//node[translate(attribute::TEXT, \"CUMBERFATS\", \"cumberfats\")=\"cucumber features:\"]')\n end", "def getNodeFeatureData\n\t render json: Network.getFeatureData(params)\n\tend", "def node\n return @node\n end", "def get_name_feature_from_file(content)\n parser = Gherkin::Parser.new\n gherkin_document = parser.parse(content)\n gherkin_document[:feature][:name]\nend", "def node\n Chef.run_context.node\n end", "def read_feature_by_path(feature_file_name)\n file = File.open(feature_file_name)\n file_data = file.read\n file_data\nend", "def node(node_name)\n nodes(node_name).first\nend", "def node\n run_context.node\n end", "def get_node(fqn)\n @database.all_nodes.find { |node| node.fqn == fqn }\n end", "def node\n run_context.node\n end", "def node\n run_context.node\n end", "def feature\n return @feature\n end", "def get_feature(current)\n fid = self.fields.delete('features.fid')\n if fid.blank?\n old_pid = self.fields.delete('features.old_pid')\n if old_pid.blank?\n puts \"Either a \\\"features.fid\\\" or a \\\"features.old_pid\\\" must be present in line #{current}!\"\n return false\n end\n\n feature = Feature.find_by_old_pid(old_pid)\n if feature.nil?\n puts \"Feature with old pid #{old_pid} was not found.\"\n return false\n end\n else\n feature = Feature.get_by_fid(fid)\n if feature.nil?\n puts \"Feature with THL ID #{fid} was not found.\"\n return false\n end\n end\n self.feature = Feature.find(feature.id)\n return true\n end", "def get_sax_feature(feature)\n \n end", "def node\n datasource.document.xpath(xpath).first\n end", "def provider\n @node.provider\n end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def node; end", "def get_feature(current)\n fid = self.fields.delete('features.fid')\n if fid.blank?\n old_pid = self.fields.delete('features.old_pid')\n if old_pid.blank?\n self.say \"Either a \\\"features.fid\\\" or a \\\"features.old_pid\\\" must be present in line #{current}!\"\n return false\n end\n\n feature = Feature.find_by(old_pid: old_pid)\n if feature.nil?\n self.say \"Feature with old pid #{old_pid} was not found.\"\n return false\n end\n else\n feature = Feature.get_by_fid(fid)\n if feature.nil?\n self.say \"Feature with THL ID #{fid} was not found.\"\n return false\n end\n end\n self.feature = Feature.find(feature.id)\n return true\n end", "def feature(name)\n features[name]\n end", "def find_node(nd_name)\n chef_nodes.find{|nd| nd.name == nd_name }\n end", "def find_feature\n @feature = Feature.get_by_fid(params[:feature_id]) # Feature.find(params[:feature_id])\n end", "def features_path\n @features_path || 'features'\n end", "def get_node_from_file(filepath)\n head_nodes_file = File.open(filepath,\"r:UTF-16LE:UTF-8\"){ |file| file.readlines }\n lines_array = []\n head_nodes_file.each do | line, i |\n lines_array << line\n end\n \n # if /(\\\\)(.*)(\\\\)(.*)$/.match(head_nodes_file[0]) == nil\n # node_type = \"head\"\n # else\n # node_type = \"child\"\n # end\n \n ## get relevant nodes based on what type it is\n head_nodes_file[0] == nil ? node = nil : node = /(Name: )(.*)/.match(head_nodes_file[0])[2].strip()\n \n ## get file name and reference number from line 2\n head_nodes_file[2] == nil ? references = nil : references = /(§ )(\\d)/.match(head_nodes_file[2])[2].to_i\n \n ## Get all references from in 3 line blocks\n ref_array = []\n \n \n ### get the segment times from each reference\n if references != nil\n references.times do |i|\n # ref = i+1\n seg_line = 6+(i*4)\n # puts head_nodes_file[seg_line]\n # puts /(\\[)(\\d+:\\d+.\\d)/.match(head_nodes_file[seg_line])[2])\n # puts seg_line\n start_time = /(\\[)(\\d+:\\d+.\\d)/.match(head_nodes_file[seg_line])[2]\n end_time = /(\\d+:\\d+.\\d)(\\])/.match(head_nodes_file[seg_line])[1]\n ref_array << {\"start_time\": start_time, \"end_time\": end_time}\n end\n else\n ref_array = nil\n end\n \n return {\"filename\": /^(.+)\\/([^\\/]+)$/.match(filepath)[2], \"node\": node, \"segments\": ref_array}\n \n end", "def draw_node(anIO, aFeatureFile, anIndex)\n basename = File.basename(aFeatureFile.filepath, '.feature')\n its_feature = aFeatureFile.feature\n if its_feature.anonymous?\n id_suffix = ''\n else\n id_suffix = \" -- #{its_feature.identifier}\"\n end\n anIO.puts %Q( node_#{anIndex} [label = \"#{basename}#{id_suffix}\"];)\n end", "def get_node_data()\n return @node_data\n end", "def get_features_info\n get_uri = @controller.get_node_operational_uri(self)\n response = @controller.rest_agent.get_request(get_uri)\n check_response_for_success(response) do |body|\n if body.has_key?('node') && body['node'].is_a?(Array) &&\n body['node'][0].has_key?('flow-node-inventory:switch-features')\n properties = body['node'][0]['flow-node-inventory:switch-features']\n feature_info = {'max_tables' => properties['max_tables'],\n 'max_buffers' => properties['max_buffers']}\n capabilities = []\n properties['capabilities'].each do |capability|\n capabilities << capability.gsub('flow-node-inventory:flow-feature-capability-', '')\n end\n feature_info['capabilities'] = capabilities\n NetconfResponse.new(NetconfResponseStatus::OK, feature_info)\n else\n NetconfResponse.new(NetconfResponseStatus::DATA_NOT_FOUND)\n end\n end\n end", "def ref_node_for_class\n Neo4j.ref_node\n end", "def node\n @node ||= args.dig(:node)\n end", "def get_sax_feature(feature)\n return @features[feature]\n end", "def get_node\n # @@neo = Neography::Rest.new\n begin\n # qur = \"MATCH (n {object_id: \"+self.id.to_s+\", object_type: \\'\"+self.class.to_s+\"\\' }) RETURN n LIMIT 1\"\n # response = @@neo.execute_query(qur)\n # node_id = response[\"data\"].flatten.first[\"metadata\"][\"id\"]\n node_id = self.get_node_id\n node = (node_id ? Neography::Node.load(node_id, @@neo) : nil)\n return node\n rescue Exception\n return nil\n end\n end", "def get_node(state, name)\n machines = state[:machines]\n if (machines.include?(name))\n chef_server = Cheffish::CheffishServerAPI.new(Cheffish.enclosing_chef_server)\n nodes = chef_server.get(\"/nodes\")\n node_url = nodes[name]\n chef_server.get(node_url)\n else\n nil\n end\n end", "def node(klass = nil)\n return @context[:node] if !klass\n @context[:node].get(klass)\n end", "def nodes\n get_chef_files_absolute_paths nodes_path\n end", "def node\n retract[:node]\n end", "def read_features(p_features_path = @features_path, p_parent_node = nil)\n # don't read features if some error happened before\n if @exit_status == 0\n feature_node = nil\n begin\n if p_features_path.end_with?(\"/\")\n features_path = p_features_path\n else\n features_path = p_features_path + \"/\"\n end\n features = Dir.entries(features_path)\n rescue Exception\n @log.error(\"can't access >>#{features_path}<< as feature dir\")\n @exit_status = 66\n return\n end\n @log.info \"start reading features from dir #{features_path}\"\n feature_count = 0\n scenario_count = 0\n features.each do |feature_file|\n #ignore files starting with .\n if feature_file =~ /^[^\\.]/\n #look for features in only in .feature files\n if feature_file =~ /\\.feature$/\n feature = File.read(\"#{features_path}#{feature_file}\")\n feature.scan(/^\\s*(Feature|Ability|Business Need):\\s*(\\S.*)$/) do |feature_type, feature_name|\n feature_node = @mindmap.add_node(feature_name, \"feature\", p_parent_node)\n feature_count += 1\n end\n feature.scan(/^\\s*(Scenario|Scenario Outline):\\s*(\\S.*)$/) do |scenario_type, scenario_name|\n case scenario_type\n when \"Scenario Outline\" then @mindmap.add_node(scenario_name, \"scenario_outline\", feature_node)\n when \"Scenario\" then @mindmap.add_node(scenario_name, \"scenario\", feature_node)\n end\n scenario_count += 1\n end\n end\n # look for subdirs\n if File.directory?(\"#{features_path}#{feature_file}\")\n # ignore step_definitions and support folders because those are used for code\n if feature_file != \"step_definitions\" && feature_file != \"support\"\n subdir_node = @mindmap.add_node(feature_file, \"subdir\", p_parent_node)\n read_features(\"#{features_path}#{feature_file}\", subdir_node)\n end\n end\n end\n end\n @log.info \"found #{feature_count} feature(s) and #{scenario_count} scenarios in dir #{features_path}\"\n end\n end", "def test_get_node_single_position_no_features\n node = @container.get_node('1',7,0)\n assert_equal([6,10,0,0,nil], [node.start, node.stop, node.count, node.flag, node.sum])\n assert_equal([], node.feature_byte_offsets)\n end", "def getNode(name)#name is the int for the vertice\n\t\t@graph.select {|nodes| nodes.node == name }[0] \n\tend", "def for_node; end", "def file_node\n @file_node ||= file_log.lookup_id(@file_id) if @file_id ||= nil\n @file_node ||= changeset.file_node(@path) unless @file_id\n @file_node ||= NULL_ID\n end", "def feature\n @property[:feature]\n end", "def extract_feature(doc)\n raise \"extract_feature was passed an empty doc!\" if doc.nil?\n pid = (doc/'/feature')[0].attributes['id']\n puts \"extract_feature() -> pid = #{pid}\"\n description = (doc/'/feature/fdesc').inner_html\n feature = Feature.find_or_create_by_pid(pid)\n\n #if(description)\n feature.description = description.strip\n #end\n\n raise \"Feature not saved!\" unless feature.save\n return feature\n end", "def my_node(allow_caching = true)\n graph = SourceClass.class_graph(allow_caching)\n graph.get_node(@uri_s) || OntologyGraph::ClassNode.new(@uri_s)\n end", "def value_of_node(node_name)\n value_of_nodes(node_name).first\nend", "def get_node(id)\n @nodes[id.to_i]\n end", "def node\n scope.node\n end", "def file\n file_id = @attributes[\"file\"]\n file_node = NodeCache.find(file_id)\n file_node ? file_node.name : nil\n end", "def ast\n feature(get_result) unless @feature\n @feature\n end", "def node_type() ; info[:node_type] ; end", "def node_type() ; info[:node_type] ; end", "def get_node(key); end", "def get_layers_from_tlef(tlef_fn)\n if tlef_fn.match(/\\.tf/)\n new_tf_object = TF_File.new(tlef_fn)\n new_tf_object.tf_parse()\n return new_tf_object.layers()\n else\n #must be tlef file\n new_tlef_object = TLEF_File.new(tlef_fn)\n new_tlef_object.tlef_parse()\n return new_tf_object.layers()\n end\n\nend", "def get_node(id)\n get_object('node', id)\n end", "def loaded_features; end", "def target_api\n @node\n end", "def get_feature(feature_name)\n case feature_name\n when Feature\n feature = feature_name\n when String\n feature = Feature.find_by_name(feature_name)\n when Integer\n feature = Feature.find_by_id(feature_name)\n else\n raise \"Feature with name '#{feature.name}' doesn't exist\" unless feature\n end\n return feature\n end", "def node\n items_node[:node]\n end", "def node_ids() ; ext_info[:nodes] ; end", "def first\n @features.first\n end", "def lookup_node(request_path)\n\t\t\tname = request_path.last\n\t\t\tname_xnode = name.to_s + XNODE_EXTENSION\n\n\t\t\tnode_path = File.join(@root, request_path.dirname.components, name_xnode)\n\n\t\t\tif File.exist? node_path\n\t\t\t\treturn Node.new(self, request_path.dirname + name, request_path, node_path)\n\t\t\tend\n\n\t\t\treturn nil\n\t\tend", "def entity_node(node_id=nil)\n node = nil\n if node_id\n node = get_node(node_id)\n else\n begin\n node = Neography::Node.find(\"actionables_nodes_index\", \"class#id\", \"#{self.class.name}##{self.id}\")\n rescue\n end\n unless node\n node = get_node(self.entity_node_id)\n end\n end\n return node\n end", "def node(name)\n nodes[name]\n end", "def get_required_features(features)\n end", "def node_type; end", "def node_type; end", "def find_forum_topic\n @forum_topic = @node.content\n end" ]
[ "0.71671754", "0.71671754", "0.6584795", "0.6537017", "0.6433615", "0.64158225", "0.6399734", "0.6399734", "0.6351271", "0.6351271", "0.6320524", "0.6295444", "0.62834597", "0.6276243", "0.62040997", "0.6200791", "0.6170005", "0.61695874", "0.61650485", "0.6151035", "0.6151035", "0.61304724", "0.6081196", "0.60246444", "0.60126686", "0.59909827", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.59781545", "0.5975207", "0.59630376", "0.58751106", "0.5845876", "0.5837651", "0.5828839", "0.5823123", "0.5791873", "0.57851934", "0.57734877", "0.57709813", "0.5741736", "0.57352984", "0.5717814", "0.5697271", "0.5697074", "0.5695838", "0.56876427", "0.56869847", "0.5671729", "0.56478184", "0.56462574", "0.56303775", "0.5607306", "0.5604948", "0.55866766", "0.5577762", "0.55767655", "0.5566383", "0.5559629", "0.55517447", "0.55517447", "0.55441153", "0.55362207", "0.5529218", "0.5529162", "0.5527382", "0.55272055", "0.5525356", "0.5520301", "0.55130345", "0.5503061", "0.5483985", "0.5483638", "0.5482222", "0.54822063", "0.54822063", "0.54739785" ]
0.0
-1
Strong params for FormTemplate
def form_template_params params.permit(:name, questions: [:text, :type_id]) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def template_params\n params.require(:template).permit(:name, :body, :active_flg)\n end", "def post_template_params\n params.require(:post_template).permit(:new_thing, :other_thing, :another_thing)\n end", "def my_template_params\n params.require(:my_template).permit(:name, :desc)\n end", "def template_params\n params.require(:template).permit(:name, :description, :template_type, :accounting_plan, :accounting_plan_id)\n end", "def template_params\n params.require(:template).permit(:title, :desc, :creator, :templateVersion, :fields, :aprovable, :acknowledgeable, :defaultemail, :parent)\n end", "def template_params\n params.fetch(:template, {}).permit([:title, :data])\n end", "def template_params\n params.require(:template).permit(:name)\n end", "def form_template_params\n params.require(:form_template).permit(:round_id)\n end", "def template_detail_params\n params.fetch(:template_detail, {}).permit(:task_description, :template_id, :stage_id)\n end", "def form_params\n params.fetch(:form, {}).permit(:key, :name)\n end", "def template_parameter_params\n params.require(:template_parameter).permit(:name, :value, :atom_id, :param_type)\n end", "def form_params\n params.require(:form).permit(:name, :alias, :type, :active, :structure_id, :user_id)\n end", "def template_params\n params.require(:template).permit(:name, :bgUrl, :accentColor, :headerColor, :linkColor, :unvisitedLinkColor, :darkClassColor)\n end", "def service_template_params\n params.require(:service_template).permit(:name, :icon, :group_id, :user_id, :raw_config, :desc, :readme)\n end", "def validate_params\n template_param.merge(options)\n end", "def validate_params\n template_param.merge(options)\n end", "def template_params\n params.require(:template).permit(:subject, :body, :merchant_id, :created_by, :last_updated_by)\n end", "def cf_template_params\n params.require(:cf_template).permit(:infrastructure_id, :name, :detail, :value, :format, :params)\n end", "def emailtemplate_params\n params[:email_template].permit!\n end", "def content_form_params\n params.require(form_param_key).permit!\n end", "def template_params\n params.require(:template).permit(:name, :path, elements: [:key, :type, :content])\n end", "def template_params\n params.require(:template).permit(:name, :content)\n end", "def template_params\n params.require(:template).permit(:title, :subject, :receiver, :content)\n end", "def template_params\n params.require(:email_template).permit(:body, :subject, :action_url, :body_text)\n end", "def template_params\n params.require(:template).permit(:name, :action)\n end", "def template_params\n params.require(:template).permit(:selected,:theme_color,:template_no,:name, :variant_display_type, :is_allowed_custom_theme)\n #params[:template]\n end", "def template_form_field_params\n params.require(:template_form_field).permit(:sorails, :generate, :scaffold, :TemplateFormField, :sorails, :generate, :scaffold, :TemplateFormField, :sorails, :generate, :scaffold, :TemplateFormField, :sorails, :generate, :scaffold, :TemplateFormField, :soraeger, :y_position, :default_text, :default_is_visible, :generate, :scaffold, :TemplateFormField, :sorails, :generate, :scafforinrails, :generate, :scaffold, :TemplateFormField, :sorails, :generate, :scaffold, :TemplateFormField, :sorails, :generate, :scaffold, :idatePattern, :generate, :scaffold, :TemplateFormField, :sorails, :generate, :scaffold, :TemplateFormField, :sorails, :generate, :scaffold, :TemplateFormField, :sorails, :generate, :scaffold, :TemplateFormField, :soreldGroup, :group_name, :generate, :scaffold, :TemplateFormField, :sorails, :generate, :scaffold, :TemplateFormField, :soraiatum, :sorails, :generate, :scaffold, :TemplateFormField, :sorails, :generate, :scaffold, :TemplateFormField, :sorails, :generate, :scaffold, :TemplateFormField, :sorails, :generate, :scaffoleferences, :x_position, :y_position, :default_text, :default_is_visible, :instructions, :text_to_replace, :width, :height, :show_designations, :prepopulate_field, :is_all_caps)\n end", "def book_template_params\n params.require(:book_template).permit(:title, :book_qt)\n end", "def form_params\n params.require(:wrapper).permit(:name,:description,:form_wrapper,:field_wrapper,:form_selector,:field_selector,:title_selector)\n end", "def checklist_template_params\n params.require(:checklist_template).permit(ChecklistTemplate.safe_attributes)\n end", "def policy_template_params\n params.require(:policy_template).permit(:name, :is_active, :body)\n end", "def etemplate_params\n params.require(:etemplate).permit(:template_id, :template_name)\n end", "def meal_template_params\n params.require(:meal_template).permit(:name)\n end", "def email_template_params\n params.require(:email_template).permit(:title, :subject, :body)\n end", "def registration_params\n hash = params.permit(:object_type, :admin_policy, :metadata_source, :rights,\n :collection, :other_id, tag: [])\n hash[:source_id] = params.require(:source_id)\n hash[:label] = params.require(:label)\n hash\n end", "def attr_template_params\n params[:attr_template]\n end", "def template_params\n params.require(:template).permit(:name, elements: [:type, :ordinal])\n end", "def template_params\n params.require(:template).permit(:content)\n end", "def script_template_params\n params.require(:script_template).permit(:name)\n end", "def form_fields\n params\n end", "def call_template_params\n params.require(:call_template).permit(:name, :desc, :flocation, :mode)\n end", "def company_template_params\n params.require(:company_template).permit(:company_id, :name)\n end", "def form_params\n params.require(:form).permit(:name, :user_id, :search, :description, :parent_id,\n :status, :version_independent_id, :control_number)\n end", "def email_template_params\n params.require(:email_template).permit(:name, :body, :org_id)\n end", "def survey_template_params\n params.require(:survey_template).permit(:name, :description, :organization_id)\n end", "def <%= singular_name %>_params\n params.require(:<%= singular_name %>).permit(<%= attributes_allowed %>)\n end", "def template_params\n params.require(:template).permit(:name, :template_type, :template_sub_type, \n { uploaded_file_attributes: [:assets, :id] }, { thumbnail_image_attributes: [:assets, :id] } )\n end", "def generic_params\n params.require(:generic).permit(:genericName, :desc)\n end", "def docu_template_params\n params.require(:docu_template).permit(:recipients, :self_sign, :users, :document, :title)\n end", "def tbl_form_field_helper_params\n params.require(:tbl_form_field_helper).permit(:FormID, :FieldID)\n end", "def track_template_params\n params.require(:track_template).permit(:name, :order, :course_id, :description)\n end", "def template_params\n params.require(:template).permit(:identifier, :title, :help, :publisher, :variables, :payload, :memory, :count, :last_execute_at, :created_at, :updated_at, :method, :content,:uri, :cache, :checked, :headers, :delimiter, :host, :port, :database, :username, :password, :query, :selectors, :server, :to, :cc, :bcc, :subject, :message)\n end", "def template_library_params\n params[:template_library].permit(:title)\n end", "def forminfo_params\n params.require(:forminfo).permit(:introduces_by, :member_submited_form_date, :f_place, :form_details, :old_member, :member_id)\n end", "def get_params\r\n #params.require(:widget).permit(:name)\r\n params.require(:widget).permit!\r\n end", "def template_params\n params.permit(\n :certificate_serial,\n :identity,\n { template_contents_attributes: [:id, :template_id, :locale, :title, :content] }\n )\n end", "def custom_pet_template_params\n params.require(:custom_pet_template).permit(:name, :image, :uploader, :recipient, :author, :rights)\n end", "def task_template_params\n params.require(:task_template).permit(:title, :created_by, :location)\n end", "def invitation_template_params\n params.require(:invitation_template).permit(:subject, :body)\n end", "def ing_form; end", "def custom_form_params\n params.require(:custom_form).permit!\n end", "def description_template_params\n params.require(:description_template).permit(:title, :description)\n end", "def survey_template_params\n params.require(:survey_template).permit(:name, :status, :survey_type)\n end", "def doc_template_params\n params.require(:doc_template).permit(:title, :description)\n end", "def question_template_params\n params.require(:question_template).permit(:context_id, :name, :points_awarded)\n end", "def lcb_template_params\n params.require(:lcb_template).permit(:code, :name, :type, :content, :owner_id, :create_uid, :write_uid, :id)\n end", "def form_params\n params.require(:ntd_form).permit(NtdForm.allowable_params)\n end", "def template_params\n params.require(:template).permit(:file, :description, :name, :html_content)\n end", "def form_params\n params.require(:culvert).permit(Culvert.new.allowable_params)\n end", "def dynamic_params\n #params.require(:dynamic).permit(:name, :descricao)\n params.require(:dynamic).permit(:name, :descricao, :user_id,:color,:final,:numerodenotas,:votation,:votationnumber, boards_attributes: [ :name, :descricao ],participants_attributes: [ :email ], notes_attributes: [ :text ])\n end", "def template_params\n @template_params ||= TemplateParamsController.new config\n end", "def questionnaire_template_params\n params.require(:questionnaire_template).permit(:name, :qt_type_id, :instructions, :comments)\n end", "def email_template_params\n params.require(:email_template).permit(:email_type, :subject, :body)\n end", "def template_cate_params\n params.require(:templates_cate).permit(:title, :description)\n end", "def form_params\n params.require(:form).permit(:name, :package_id, :document_id, :signed, :link)\n end", "def event_template_params\n params.require(:event_template).permit(:summary, :length, :location, :color, :avaliability)\n end", "def pit_form_params\n params.require(:pit_form).permit(:name)\n end", "def medical_item_template_params\n params.require(:medical_item_template).permit(*MedicalItemTemplate.create_params)\n end", "def form_params\n params.fetch(:form, {})\n end", "def configure_sign_up_params_ted\n\n params.permit(:consorciot, :sucursalbt, :siglas, :vendedor, :contacto)\n #ppediente de completar, de lo contrario la asigacion la haremos com params directo del borwser al modelo...? (like session[:id_cliente] y session[:tipo_cliente]) ...+/*\n end", "def student_params(*args) #is the helper method \n\n\t\tparams.require(:student).permit(*args)\n\t\t#uses .require and .permit methods as stronger params to prevent hacks through inspect element right click edit html \n\t\t#require restricts, permit allows, and *args is for the custom arguments\n\tend", "def template_photo_params\n params[:template_photo].permit(:name, :description, :title ,:photolink ,:url_image_1,:remove_url_image_1, :item_id)\n end", "def mailtemplate_params\n params.require(:mailtemplate).permit(:name, :content)\n end", "def template_params\n params.require(:cms_template).permit(:title, :section_id, :layout_id, :path,\n :content_type, :tag_list, :system_name, :liquid_enabled, :handler, :draft).tap do |params|\n\n section_id = params.delete(:section_id).presence\n layout_id = params.delete(:layout_id).presence\n\n params[:section] = current_account.sections.find(section_id) if section_id\n # We need to handle the case when the layout_id is purposely nil\n params[:layout] = layout_id && current_account.layouts.find(layout_id)\n end\n end", "def show_template_params\n params.require(:show_template).permit(:name, :dow, :showtime, :calltime, :group_id, skill_ids: [])\n end", "def form_params\n params[:form]\n end", "def cv_template_params\n params.require(:cv_template).permit(:content, :for)\n end", "def strong_params_keys\n [key]\n end", "def form_comp_params\n params.require(:form_comp).permit(:content)\n end", "def question_template_params\n params.require(:question_template).permit(:prompt, :response_type, :response_required)\n end", "def salary_component_template_params\n params.require(:salary_component_template).permit(:manual_template_code, :salary_template_id, :salary_component_id, :is_deducted, :parent_salary_component_id, :percentage, :to_be_paid)\n end", "def tssk_params\n params.require(:tssk).permit(:title, :detail)\n end", "def workout_template_params\n # params.require(:workout_template).permit(:title, :isTemplate, :boolean, :exerciseCount, :user_id,:id)\n params .permit(:title, :isTemplate, :boolean, :exerciseCount, :user_id,:id)\n end", "def induction_template_params\n params.require(:induction_template).permit(:template_no, :description, :activity, :day, :duration, :employee_id)\n end", "def form_params\n params.require(:highway_structure).permit(HighwayStructure.new.allowable_params)\n end", "def form_params\n params.require(:form).permit(:nombre, :apellidos, :cedula, :email, :telefono, :institucion, :unidad, :cargo, :profesion, :user_id)\n end", "def strong_params\n params.require(:installer_new_app).permit(\n :repository_id,\n :label, :container_name, :host_name, :domain_name, :http_protocol,\n :icon_url, :license_label, :license_sourceurl,\n :memory, :required_memory, :recommended_memory, :license_accept,\n service_connections_attributes: [\n :publisher_namespace, :type_path,\n :create_type, :existing_service, :orphan_service ],\n environment_variables_attributes: [\n :mandatory, :immutable,\n :ask_at_build_time, :build_time_only,\n field_attributes: [\n :value, :method_name, :as,\n :label, :title,\n :horizontal, :compact,\n :left, :width, :right,\n :collection,\n :placeholder, :comment, :tooltip, :hint,\n :validate_regex, :validate_invalid_message,\n :depends_on_field, :depends_on_regex,\n :required, :read_only ] ] )\n end", "def plain_text_input_params\n params.fetch(:plain_text_input, {})\n end", "def form_params\n params.require(:form).permit(:name, :description)\n end", "def form_params\n params.require(:form).permit(:twilio_keyword, :hidden)\n end" ]
[ "0.68342626", "0.6702268", "0.669496", "0.66166705", "0.66152966", "0.6610921", "0.6606364", "0.6596509", "0.6568322", "0.6566678", "0.65468246", "0.6542152", "0.651745", "0.64934045", "0.6482077", "0.6482077", "0.64466614", "0.64424986", "0.6394971", "0.63904494", "0.63895947", "0.6386799", "0.6374928", "0.6372774", "0.6359196", "0.63210994", "0.631768", "0.6315974", "0.630385", "0.6298454", "0.6291895", "0.62855726", "0.6276977", "0.6272832", "0.6260815", "0.62431824", "0.6237148", "0.6232246", "0.6229463", "0.6221753", "0.62186974", "0.62126046", "0.62069714", "0.6178522", "0.6168902", "0.61659473", "0.6155577", "0.61537987", "0.6143131", "0.6142423", "0.6135834", "0.6125653", "0.6120314", "0.6117469", "0.6113592", "0.60882723", "0.6087654", "0.6084637", "0.608052", "0.6069777", "0.6049877", "0.6048847", "0.60462105", "0.60436213", "0.60407144", "0.6036885", "0.6035783", "0.60230815", "0.60089785", "0.59949714", "0.59864146", "0.5983577", "0.59612125", "0.5961204", "0.59607637", "0.596037", "0.59588885", "0.5956805", "0.5937682", "0.59264445", "0.5924847", "0.59134704", "0.5913458", "0.5913195", "0.5912827", "0.59121346", "0.5902431", "0.5901813", "0.59014136", "0.5892025", "0.5889096", "0.5888224", "0.58852756", "0.5884647", "0.5877136", "0.58709", "0.5870581", "0.5865236", "0.5864815", "0.58620924" ]
0.64548045
16
p my_min_1(list) O(n^2) Phase 2 my_min
def my_min_2(list) min = list.first list.each {|num| min = num if min > num } min end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def my_min_2(list)\r\n min = 0 # O(1)\r\n \r\n list.each do |ele| # O(n) \r\n if ele < min # O(1)\r\n min = ele # O(1)\r\n end\r\n end\r\n min # O(1) \r\nend", "def my_better_min(list)\n min = list[0] #1\n\n list.each_with_index do |ele_1, i| #n\n if ele_1 < min # 1 *n\n min = ele_1 #1 *n\n end\n end\n\n min #1\n # (i...list.length).each do |j|\n # if list[i] list[j]\nend", "def my_min(list)\n\n # phase 1\n # min = list.first\n # list.each_with_index do |ele_1, i_1|\n # list.each_with_index do |ele_2, i_2|\n # if i_2 != i_1\n # if min > ele_2\n # min = ele_2\n # end\n # end\n # end\n # end\n # min\n\n # phase 2\n min = list.first\n list[1..-1].each do |ele|\n if min > ele\n min = ele\n end\n end\n min\nend", "def my_min_phase_2(list)\n min = list[0]\n (1...list.length).each do |i|\n min = list[i] if list[i] < min\n end\n min\nend", "def my_min(list) \n\n list.each_with_index do |ele, i| #O(n)\n compare_arr = list[0...i] + list[i+1..-1] # O(2n) \n return ele if compare_arr.all? { |ele2| ele < ele2 } #O(n)\n end\n\n #time complexity = O(n^2) + O(2n)\n\nend", "def my_min(list)\n\n min = nil\n\n list.each do |ele|\n min ||= ele\n list.each do |ele2|\n if ele2 < min\n min = ele2\n end\n end\n end\n\n min\nend", "def my_min(list)\r\n list.inject { |min,ele| min < ele ? min : ele }\r\n \r\n # Time : O(n)\r\n # Space : O(1)\r\nend", "def my_min_ii(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min(list)\n min = 0\n list.each do |ele|\n list.each do |ele2|\n min = ele if ele < ele2 && ele < min\n end\n end\n min\nend", "def my_min_fast(list)\n smallest = list.first\n\n list[1..-1].each { |n| smallest = n if n < smallest }\n smallest\nend", "def my_min_better(list)\n min = list.first\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min2(list)\n min = list[0]\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min2(list)\n result = list.first\n list.each do |el|\n result = el if el < result\n end\n result\n\nend", "def my_min_2(list) # n\n min_value = list.first\n i = 0\n while i < list.length\n min_value = list[i] if list[i] < min_value\n i += 1\n end\n min_value\nend", "def my_min(list)\n list.each do |el|\n equal_or_smaller = []\n list.each do |el2|\n equal_or_smaller << el2 if el2 < el\n end\n return el if equal_or_smaller.empty?\n end\nend", "def my_min2(list)\n min = 0\n list.each do |el|\n min = el if el < min\n end\n min\nend", "def my_min_2(list)\n min = list.first\n list.each do |num|\n if num < min \n min = num\n end\n end\n min\nend", "def my_min(list)\n min = list[0]\n (1...list.length).each do |i| \n min = list[i] if list[i] < min \n end\n min\nend", "def phase_1_min(list)\n smallest = 0\n list.each_with_index do |num1, indx1|\n list.each_with_index do |num2, indx2|\n next if indx1 == indx2\n smallest = num1 if num1 < num2 && num1 < smallest\n end\n end\n smallest\nend", "def my_min(list)\r\n smallest = 0\r\n \r\n list.each_with_index do |ele1, idx1|\r\n list.each_with_index do |ele2, idx2|\r\n if idx2 > idx1 \r\n if ele1 < smallest\r\n smallest = ele1\r\n end\r\n if ele2 < smallest\r\n smallest = ele2\r\n end\r\n end\r\n end\r\n end\r\n\r\n smallest\r\nend", "def my_min(list)\n min = list.first \n\n list.each do |el|\n if el < min \n min = el \n end\n end\n min\nend", "def my_min(list)\n min = list[0]\n (0...list.length).each do |i| \n min = list[i] if list[i] < min\n end\n min\nend", "def my_min(list)\n i = 0\n min = list[0]\n while i < list.length - 1\n if list[i + 1] < min\n min = list[i + 1]\n end\n i += 1\n end\n min\nend", "def my_min(list)\n list.each do |el|\n smallest = true\n list.each do |second_el|\n if second_el < el\n smallest = false\n end\n end\n if smallest == true\n return el\n end\n end\nend", "def my_min_2(list)\n min = nil\n\n list.each do |num|\n min = num if min.nil? || num < min\n end\n\n min\nend", "def my_min(list)\r\n smaller_ele = []\r\n list.each do |ele1|\r\n list.each do |ele2|\r\n smaller_ele << [ele1,ele2].min \r\n end\r\n end\r\n return smaller_ele.min\r\nend", "def my_min(list)\n min = list[0]\n\n list.each do |ele| \n case min <=> ele\n when 1\n min = ele\n when 0\n next\n when -1\n min = min \n end\n end\n\n min\nend", "def my_min_2(list)\n smallest = 0\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min_2(arr) #O(N)\n min_num = arr.first\n \n arr.each { |num| min_num = num if num < min_num }\n \n min_num\n end", "def my_min(list)\n smallest = list.first\n list.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min(list)\r\n smallest = list.first\r\n list.each do |ele|\r\n smallest = ele if ele < smallest\r\n end\r\n return smallest\r\nend", "def my_min(array)\n min_val = array.first\n array.each_with_index do |el1, idx1| # O(n)\n array.each_with_index do |el2, idx2| # O(n)\n if idx1 < idx2 # O(1)\n if el1 < el2# O(1)\n if el1 < min_val# O(1)\n min_val = el1# O(1)\n end\n else\n if el2 < min_val# O(1)\n min_val = el2# O(1)\n end\n end\n end\n end\n end\n min_val\n end", "def my_min_2(nums) # O(n)\n smallest = 0\n nums.each do |num|\n smallest = num if num < smallest\n end\n smallest\nend", "def my_min_2(arr)\n\n smallest_value = arr[0] # O(1)\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n smallest_value = ele1 if ele1 <= smallest_value #O(1)\n end\n\n smallest_value #O(1)\n\nend", "def my_min(arr) #O(n2)\n min = arr.first\n arr.each_with_index do |el_1 , i|\n (i+1...arr.length).each do |el_2|\n if arr[el_2] < el_1 && arr[el_1] < min \n min = arr[el_2]\n end \n end \n end \n min \n end", "def my_min(arr) # Find\n min = arr[0]\n\n arr.each do |el| # Go through array once O(n)\n min = el if el < min # update min while going through if found min\n end\n min\nend", "def my_min2(list)\n smallest_number = list.first\n list.each do |num|\n smallest_number = num if num <= smallest_number\n end\n smallest_number\nend", "def my_min2(array)\n min = array.first\n array.each do |el|\n min = [el, min].min\n end\n min\nend", "def my_min_2(array)#O(n)\n array.inject do |acc, ele|#O(n)\n if acc < ele\n acc\n else\n ele\n end\n end\nend", "def my_min_linear(list)\n smallest_number = list.first\n \n list.each do |num|\n smallest_number = num if num < smallest_number\n end\n\n smallest_number\nend", "def min(list)\n list.min\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 my_min_v2(arr) # O(n)\n num = arr[0]\n arr.each { |int| num = int if int < num }\n num\nend", "def faster_my_min(arr) # O(n)\n min = arr[0]\n arr.each do |ele|\n min = ele if ele < min\n end\n min\nend", "def my_min2(int_list)\n min = 0\n\n int_list.each do |int|\n min = int if int < min\n end\n\n min\nend", "def better_min(array)\n min_val = array.first\n\n array.each do |el| #O(n)\n if el < min_val\n min_val = el\n end\n end\n min_val\n end", "def min(list)\n tiny = list[0]\n list.each do |n|\n if n < tiny\n tiny = n\n end\n end\n puts tiny\nend", "def my_min1(int_list)\n int_list.each do |int1|\n return int1 if int_list.all? { |int2| int2 >= int1 }\n end\nend", "def my_min2(arr)\n min = arr.first\n arr.each { |el| min = el if el < min }\n min\nend", "def my_second_min(list)\n smallest = list[0]\n list.each do |el|\n next if el == smallest\n if el < smallest\n smallest = el\n end\n end\n return smallest\nend", "def my_min(arry)\n mini = arry.first\n arry.each do |ele|\n if ele < mini\n mini = ele\n end\n end\n mini\nend", "def my_min1(arr)\n arr.each do |el1| #O(n)\n if arr.all? {|el2| el1 <= el2 } #O(n + 1)\n return el1\n end\n end \nend", "def my_min2(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min_v2(array)\n minimum = array.first\n\n array[1..-1].each do |element|\n minimum = element if minimum > element\n end\n\n minimum\nend", "def my_min2(arr)\n min = arr.first \n arr.each {|ele| min = ele if ele < min }\n min\nend", "def my_min2(arr)\n minimum = arr.first\n arr.each do |num|\n minimum = num if num < minimum\n end\n minimum\nend", "def my_min2(array)\n minimum = array.first\n array.each_index do |idx|\n if array[idx] < minimum\n minimum = array[idx]\n end\n end\n minimum\nend", "def my_min(arr)\n\n smallest_value = arr[0]\n\n arr.each do |ele1| # [ 0, 3, 5, 4, -5, 10, 1, 90 ] O(n)\n # smallest_value = ele1 if ele1 < smallest_value\n if arr.all?{|ele2| ele1 <= ele2 } #O(n)\n smallest_value = ele1\n end\n end\n\n smallest_value\n\nend", "def better_my_min(array)\n array.inject do |acc, ele|\n if acc <= ele\n acc\n else\n ele\n end\n end\n end", "def my_min2(array)\n min = array.first\n array.each {|item| min = item if item <= min}\n return min\nend", "def my_min_improved(arr)\n min = arr[0]\n\n arr.each do |el|\n min = el if el < min\n end\n\n return min\nend", "def better_my_min\n min = self.first\n self.each do |el|\n min = el if el < min\n end\n min\n end", "def my_min(list)\n smallest_num = nil\n list.each do |num|\n if smallest_num == nil || smallest_num > num\n smallest_num = num\n end\n end\n smallest_num\nend", "def my_min2(array)\n lowest_num = array.first\n array.each do |el1|\n next if lowest_num == el1\n if el1 < lowest_num\n lowest_num = el1\n end\n end\n lowest_num\nend", "def min(*x, &block)\n return x.first if x.size == 1\n return min2(x[0], x[1], &block) if x.size == 2\n a = x.first\n (1...x.size).each { |b| \n a = min2(a,x[b], &block) }\n a\n end", "def my_min(arr) #linear\n arr.reduce do |smallest, num|\n if smallest < num\n smallest\n else\n smallest = num\n end\n end\nend", "def my_min_2(array)\n array.sort!\n array.first\nend", "def my_min2(array)\n array.inject { |acc, ele| acc < ele ? acc : ele}\nend", "def my_min2(arr)\n minimum = arr[0]\n arr[1..-1].each do |el|\n minimum = el if el < minimum\n end\n minimum\nend", "def my_min_fast(arr)\n smallest = arr[0]\n arr.each do |ele|\n if ele < smallest\n smallest = ele\n end\n end\n return smallest\nend", "def find_min(*nums)\n nums.reduce do | acc, current_value |\n if acc > current_value\n current_value\n else\n acc\n end\n end\nend", "def my_min2(arr)\n smallest = arr[0]\n arr[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def linear_my_min(arr)\n # arr.inject do |min, ele|\n # min > ele \n # end\n # arr.first \n\n min = arr.first \n\n arr.each do |ele|\n min = ele if ele < min \n end\n min \n\nend", "def my_min(list)\n minimum_num = [] \n list.each do |num1| \n minimum_num = num1 if list.all? {|ele| ele >= num1}\n end\n minimum_num\nend", "def better_my_min(array)\n smallest = array[0]\n array[1..-1].each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def check_list_linear(array)\n min = array.first\n array.each do |num|\n min = num if num < min\n end\n min\n end", "def my_min_iterative(array)\n minimum = nil\n\n array.each { |element| minimum = element if minimum.nil? || element < minimum }\n\n minimum\nend", "def my_min_once(arr)\n min = arr.first \n\n (0...arr.count).each do |i|\n min = arr[i] if arr[i] < min \n end\n\n min \nend", "def my_min(arr)\n min = arr[0]\n (0...arr.size).each do |i1|\n (i1 + 1...arr.size).each do |i2|\n min = arr[i2] if arr[i2] < min\n end\n end\n min\nend", "def good_my_min(arr)\n smallest = arr.first\n arr.each do |el|\n smallest = el if el < smallest\n end\n smallest\nend", "def my_min2(arr)\r\n min = arr[0]\r\n arr.each { |num| min = num if num < min }\r\n min\r\nend", "def my_min(array) # O(n) - Linear\n counter = array[0]\n\n (1...array.length).each do |i|\n if counter > array[i]\n counter = array[i]\n end\n end\n counter\nend", "def my_min(arr)\n min = arr.first\n (0...arr.length).each do |idx1|\n (idx1...arr.length).each do |idx2|\n if (idx2 != idx1) && (arr[idx1] < arr[idx2]) && (arr[idx1] < min)\n min = arr[idx1]\n end\n\n end\n end\n min\n\nend", "def my_min2(arr)\n smallest = arr.first\n\n arr.each do |i|\n smallest = i if smallest > i\n end\n\n smallest\nend", "def my_min(arr)\n min = arr.first\n\n arr.each do |el|\n min = el if el < min\n end\n\n min\nend", "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 my_min(arr)\n l = arr.length - 1 # constant\n # min = 0 # is this more efficient than swapping? \n (0...l).each do |i| # n times1\n if arr[i] < arr[i+1] # 1\n arr[i], arr[i+1] = arr[i+1], arr[i] # 1\n end\n end\n\n arr.last # 1\nend", "def my_min_n2(arr)\n smallest_number = true\n arr.each do |first_el|\n smallest_number = true\n arr.each do |second_el|\n smallest_number = false if second_el < first_el\n end\n return first_el if smallest_number\n end\nend", "def my_min(arr)\n output = arr.first\n \n (1...arr.length).each do |i|\n (i+1...arr.length).each do |j|\n output = arr[j] if arr[j] < output\n end\n end\n \n output\nend", "def reduce key, list\n res = []\n loop do\n min = list.reject(&:empty?).min # find array starting with smallest element\n break if min.nil? # break if none found\n res << min.shift # pull out the first element and append it to result\n end\n res\n end", "def solution(a)\n min_val = 10_000\n min_pos = 0\n \n sums = [0]\n for i in (0..a.count - 1) \n sums << sums.last + a[i] \n end\n for p in (0..a.count - 2)\n for q in (p + 1..[p + 2, a.count - 1].min)\n s = (sums[q + 1] - sums[p]).to_f / (q - p + 1)\n if s < min_val\n min_val = s\n min_pos = p\n end\n end\n end\n min_pos\nend", "def my_min_n2(arr)\n arr.each_with_index do |comp_el, idx|\n im_the_smallest = true\n (idx + 1).upto(arr.length - 1) do |j|\n im_the_smallest = false if comp_el > arr[j]\n end\n return comp_el if im_the_smallest == true\n end\nend", "def min_item\n list.min do |a, b|\n return -1 if a[0].null_item?\n return 1 if b[0].null_item?\n a[1] <=> b[1]\n end\n end", "def simple_loop(list)\n smallest = list.first\n \n (1...list.length).each do |idx|\n smallest = list[idx] if list[idx] < smallest\n end\n \n smallest\nend", "def best_my_min(arr)\n smallest = arr.shift\n arr.each do |el|\n smallest = el unless el > smallest\n end\n smallest\nend", "def my_min_linear(array)\n min = array[0]\n\n array.each do |num|\n min = num if num < min\n end\n min\nend", "def my_min(array)\n min = array.first\n array.each {|el| min = el if min > el}\n min\nend", "def my_min_2(arr)\n least = arr[0]\n\n arr.each do |i|\n arr.each do |y|\n if i < y && i < least\n least = i\n end\n end\n end\n\n least\n\n\nend", "def my_min(arr)\n min = arr.first\n\n arr.each_with_index do |ele1, i| \n arr.each_with_index do |ele2, j|\n next if i == j \n min = ele2 if ele2 < min \n end\n end\n\n min\nend", "def min() end" ]
[ "0.8553666", "0.8295935", "0.82740265", "0.80466914", "0.8041372", "0.8035147", "0.8021097", "0.79902905", "0.79746145", "0.79696107", "0.79601043", "0.7930271", "0.7920284", "0.789237", "0.78777903", "0.7854581", "0.7834821", "0.7813584", "0.77767473", "0.776412", "0.7757376", "0.77465487", "0.7739404", "0.77292776", "0.77135205", "0.77113724", "0.7662526", "0.7658102", "0.7657868", "0.76333606", "0.7625366", "0.7537311", "0.75159717", "0.7500902", "0.74200827", "0.74170905", "0.74100304", "0.73966736", "0.7389821", "0.73754627", "0.7356541", "0.73432356", "0.73325366", "0.7302434", "0.7266531", "0.7259997", "0.7253696", "0.72481817", "0.7209311", "0.71763945", "0.7137295", "0.71283805", "0.7127533", "0.7126376", "0.7120356", "0.71188277", "0.71165943", "0.71149313", "0.71146756", "0.71116304", "0.7074373", "0.7068144", "0.7062104", "0.7060388", "0.70489836", "0.70402116", "0.7027838", "0.7025325", "0.70176035", "0.7012168", "0.6982453", "0.697267", "0.6964943", "0.6964813", "0.69628435", "0.6951216", "0.6948767", "0.6940873", "0.6915216", "0.69122016", "0.69023144", "0.6875456", "0.6863781", "0.68610364", "0.68580127", "0.68459654", "0.68353814", "0.6835006", "0.68249357", "0.6803918", "0.68033624", "0.6802346", "0.6790369", "0.6787556", "0.67853206", "0.67772794", "0.6766587", "0.674952", "0.67414755", "0.67343634" ]
0.775831
20
O(n) p my_min_2(list) Largest_contiguous sum Phase 1
def largest_contiguous_subsum(list) subs = [] (0...list.length).each do |i| (i...list.length).each do |j| subs << list[i..j] end end subs.map {|el| el.sum}.max end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def largest_contiguous_subsum_1(list) \n subs = [] #O(1)\n (0...list.length).each do |start_num| #O(n)\n (start_num...list.length).each do |end_num| #O(n)\n subs << list[start_num..end_num] #O(n)\n end\n end\n subs_sum = [] #O(1)\n subs.each do |sub| #O(n**2)\n sub_sum = 0 #O(1)\n sub.each {|s| sub_sum += s} #O(n)\n subs_sum << sub_sum #O(1)\n end\n subs_sum.inject do |acc,el| #O(n)\n if acc > el #O(1)\n acc #O(1)\n else\n el #O(1)\n end\n end\n end", "def largest_contiguous_subsum_1(list)\n subs = []\n (0...list.length).each do |idx| #O(n)\n (idx...list.length).each do |idx_2| #O(n)\n subs << list[idx..idx_2] #O(n)\n end\n end\n max = list.first\n subs.each do |subarr|\n if subarr.sum > max\n max = subarr.sum\n end\n end\n max\nend", "def largest_contiguous_subsum1(list)\n greatest_sum = -1.0/0.0\n (0...list.length).each do |i|\n (i...list.length).each do |j|\n greatest_sum = list[i..j].sum if greatest_sum < list[i..j].sum\n end\n end\n greatest_sum\nend", "def largest_contiguous_subsum2(list)\n result = list.first\n sum = list.first\n\n list.each_with_index do |n, i|\n next if i == 0\n\n sum = 0 if sum < 0\n\n sum += n\n\n result = sum if sum > result\n end\n\n result\nend", "def largest_contiguous_subsum1(list)\n sums = []\n\n list.each_with_index do |el1, i1|\n list.each_with_index do |el2, i2|\n if i1 == i2\n sums << el1\n else\n sums << el1 + el2\n end\n end\n end\n\n result = sums.first\n\n sums.each do |sum|\n result = sum if sum > result\n end\n\n result\nend", "def largest_contiguous_subsum(list)\n new_arr = []\n\n (0...list.length).each do |idx1| #O(n)\n (0...list.length).each do |idx2| #O(n)\n if idx2 >= idx1 #O(1)\n new_arr << list[idx1..idx2].sum #O(1)\n end \n end \n \n end \n \n return new_arr.max #O(n)\nend", "def largest_contiguous_subsum1(list)\n arr = []\n (0...list.length).each do |i|\n (i...list.length).each { |j| arr << list[i..j] }\n end\n largest_sum = arr.first.sum\n arr.each do |sub_arr|\n largest_sum = sub_arr.sum if sub_arr.sum > largest_sum\n end\n largest_sum\nend", "def largest_contiguous_subsum_2(list)\n largest_sum = 0\n current_sum = 0\n\n list.each do |el|\n largest_sum = current_sum \n current_sum += el \n if current_sum < el \n current_sum = el \n end \n largest_sum = current_sum if largest_sum < current_sum\n end\n\n largest_sum\nend", "def largest_contiguous_subsum_2(list)\n current_sum = 0\n largest_sum = 0\n (0...list.length).each do |idx|\n current_sum += list[idx]\n largest_sum = current_sum if current_sum > largest_sum\n current_sum = 0 if current_sum < 0\n end\n largest_sum\nend", "def largest_contiguous_subsum(list)\n # debugger\n results = [] # O(1)\n\n list.each_with_index do |el1, idx1| # O(n)\n list.each_with_index do |el2, idx2| # O(n) => O(n^2)\n next if idx2 < idx1 # O(1)\n results << list[idx1..idx2] # O(1)\n end\n end\n\n results.map! { |subsum| subsum.reduce(:+) } # O(n^2)\n results.max # O(1)\nend", "def largest_contiguous_subsum1(list)\n subs = []\n (0...list.length).each do |i|\n (i...list.length).each do |j|\n subs << list[i..j]\n end\n end\n\n subs.map(&:sum).max\nend", "def largest_contiguous_subsum(list)\r\n sub_arr = []\r\n list.each_with_index do |ele1,idx1|\r\n list.each_with_index do |ele2,idx2|\r\n sub_arr<< list[idx1..idx2] if idx2>=idx1\r\n end\r\n end\r\n p sub_arr.size\r\n sub_arr.map{ |sub| sub.sum}.max\r\n #(O(n^2 + m)\r\nend", "def largest_contiguous_subsum_one(list)\n sub_arr = []\n sum = 0\n list.each_with_index do |ele, i|\n (i...list.length).each do |i2|\n sub_arr << list[i..i2]\n end\n end\n sub_arr.each do |arr|\n if arr.sum > sum\n sum = arr.sum\n end\n end\n sum\nend", "def largest_contiguous_subsum1(list)\n p Time.now\n sub_arrays = []\n list.each_index do |i|\n list.each_index do |j|\n next if j < i\n sub_arrays << list[i..j]\n end\n end\n sub_arrays.map{|numbers| numbers.inject(:+)}.max\n p Time.now\nend", "def largest_contiguous_subsum2(list)\n # O(N) ==> Time\n # O(1) ==> Space\n largest = list.first\n curr = list.first\n\n len = list.length\n (1...len).each do |i|\n curr = 0 if curr < 0 \n curr += list[i]\n largest = curr if curr > largest\n end\n largest\nend", "def largest_contiguous_subsum(list)\n # l = list.length # 1\n # result = [] # 1\n # hash = Hash.new(0) # 1\n\n # (0...l).each do |i1| # n\n # (0...l).each do |i2| # n\n # result << list[i1..i2] if i2 >= i1 # 1\n # end\n # end\n\n # result.each do |sub_arr| # n\n # hash[sub_arr] = sub_arr.sum # 1\n # end\n\n # sorted_by_val = hash.sort_by { |k, v| v } # n, \n # sorted_by_val[-1][1] # \nend", "def largest_contiguous_sub_sum1(list)\n max = list[0]\n (0...list.length).each do |i|\n (i...list.length).each do |j| \n sub_sum = list[i..j].sum \n max = sub if sub >= max \n end\n end\n max\nend", "def largest_contiguous_subsum_2(list)\n largest_sum = list.first\n current_sum = 0\n list.each do |ele| \n current_sum += ele\n if current_sum > largest_sum\n largest_sum = current_sum\n end\n current_sum = 0 if current_sum < 0 \n end\n largest_sum\nend", "def largest_contiguous_subsum(list)\n curr_sum = list[0]\n max_sum = list[0]\n (1...list.length).each do |idx|\n # debugger\n curr_sum += list[idx]\n if curr_sum < list[idx] \n curr_sum = list[idx]\n end\n if curr_sum > max_sum\n max_sum = curr_sum\n end\n end\n max_sum\nend", "def largest_contiguous_subsum(list)\n current_max = list[0]\n current_sum = list[0]\n\n (1...list.size).each do |i|\n current_sum += list[i]\n if current_sum > current_max\n current_max = current_sum\n end\n\n if current_sum < 0 \n current_sum = 0\n end\n \n end\n\n current_max\nend", "def largest_contiguous_subsum(list) # O(n^2)\n array = []\n list.each_with_index do |ele1, i1| # O(n^2)\n (i1...list.length).each do |i2|\n array << list[i1..i2]\n end\n end\n\n max_sum = array.first.sum\n array[1..-1].each do |subarr| # O(n^2)\n sum = subarr.sum\n if sum > max_sum\n max_sum = sum\n end\n end\n\n max_sum\n\nend", "def largest_contiguous_subsum(list)\n max_sum = list[0]\n\ttemp_sum = list[0]\n\tdebugger\n #0(n) #note: only n^2 if nested\n \n return list.max if list.all? { |ele| ele < 0 } \n #need to add O(1) return case\n # Write a new function using O(n) time with O(1) memory. Keep a running tally of the largest sum.\n\n list_2 = list.drop(1)\n list_2.each do |ele|\n\t\ttemp_sum = [ele, temp_sum + ele].max #O(1) operation, should refactor \n #temp_sum = ele = 4, temp_sum = 1+3, [4, 8].max\n # [3, -7]\n #[3, 5 + 3] = > 3, 8 = > 8 max = 5\n #[-7, 8 - 7] => 1, 1 = > 1 max = 8\n max_sum = temp_sum if temp_sum > max_sum\n\tend\n\t\n\tmax_sum\nend", "def largest_contiguous_subsum(list)\n helper_arr = [list.first]\n (1...list.length).each do |idx|\n if helper_arr[-1] + list[idx] > list[idx]\n helper_arr << helper_arr[-1] + list[idx]\n else\n helper_arr << list[idx]\n end\n end\n helper_arr.max\nend", "def largest_contiguous_subsum(list) # O(n^2)\n subs_sums = []\n\n list.each_index do |i|\n list.each_index do |j|\n next if j < i\n subs_sums << list[i..j]\n end\n end\n\n highest_array_sum = nil\n subs_sums.each do |array|\n array_sum = array.reduce(:+)\n if highest_array_sum == nil || array_sum > highest_array_sum\n highest_array_sum = array_sum\n end\n end\n\n highest_array_sum\nend", "def largest_contiguous_subsum_v2(list)\n largest_sum = list.first\n sum = list.first # but the first element can be a negative number\n\n (1...list.length).each do |i|\n # a negative number + a postive number always less than pos number on its own\n sum = 0 if sum < 0 # if we add to a negative sum, then result is less than pos number on its own\n sum += list[i]\n largest_sum = sum if largest_sum < sum\n end\n\n largest_sum\nend", "def largest_contiguous_subsum(list)\n max_sum = list.first\n current_sum = list.first\n \n (1...list.length).each do |i| \n current_sum = 0 if current_sum < 0 \n current_sum += list[i]\n max_sum = current_sum if current_sum > max_sum\n end\n max_sum\nend", "def efficient_contiguous_subsum(list)\n current_sum = list[0] #0\n largest_sum = list[0] #5\n # debugger\n (1...list.length).each do |i| \n if current_sum + list[i] > 0 \n current_sum += list[i] \n largest_sum = current_sum if current_sum > largest_sum\n else \n current_sum = 0\n end \n end \n largest_sum\nend", "def largest_contiguous_subsum2(int_list)\n largest_sum = int_list.first\n curr_sum = int_list.first\n\n (1...int_list.length).each do |idx|\n curr_sum = (int_list[idx] > curr_sum + int_list[idx]) ? int_list[idx] : curr_sum + int_list[idx]\n largest_sum = curr_sum if curr_sum > largest_sum\n end\n\n largest_sum\nend", "def largest_contiguous_subsum2(list)\n sum = 0 # keeps track of current sum\n largest_sum = list.first # evaluates to the largest sum\n list.each do |ele|\n sum += ele \n largest_sum = sum if sum > largest_sum\n sum = 0 if sum < 0\n end\n largest_sum\nend", "def better_largest_contiguous_subsum(list)\n total_sum = list.first\n current_sum = list.first\n\n list.each_index do |idx| \n current_sum = [list[idx], current_sum + list[idx]].max\n total_sum = [total_sum, current_sum].max\n end\n\n return total_sum\nend", "def largest_contiguous_subsum_2(list)# [2, 3, -6, 7, -6, 7]\n largest_num = list[0]#2 O(1)\n running_sum = list[0]#2 - 5 after entering loop. O(1)\n\n (1...list.length).each do |i| #O(n) \n running_sum = 0 if running_sum < 0 #O(1)\n running_sum += list[i] #O(1)\n largest_num = running_sum if running_sum > largest_num #O(1)\n end\n return largest_num #O(1)\nend", "def largest_contiguous_subsum(list) \n subs = []\n\n (0...list.length).each do |i|\n (i...list.length).each do |j|\n sub = list[i..j]\n subs << sub\n end\n end\n \n max = nil\n\n subs.each do |sub|\n sum = sub.sum \n if max == nil || sum > max\n max = sum\n end\n end\n max\nend", "def largest_contiguous_subsum_1(list)\r\n subarrays = [] #1\r\n list.each_with_index do |ele1, i| #n\r\n list[i...list.length].each_with_index do |ele2,i2| #(n-1)\r\n subarrays << list[i..i2+i] #k \r\n end\r\n end # n^2\r\n subarrays.map { |subarray| subarray.sum}.max # n^x\r\nend", "def largest_contiguous_subsum2(array)\n # return [list[0]] if list.count == 1\n #\n # start_num = list.shift\n # large_sum = start_num\n #\n # other_list = list.dup\n #\n # idx = 0\n # while idx < list.count\n # sum = list[0..idx].inject(:+)\n # if large_sum < start_num + sum\n # large_sum = start_num + sum\n # end\n # idx += 1\n # end\n #\n # [large_sum] + largest_contiguous_subsum2(other_list)\n\n largest = nil\n current = 0\n\n array.each do |el|\n current += el\n if largest.nil? || current > largest\n largest = current\n end\n current = 0 if current < 0\n end\n\n largest\n\nend", "def largest_contiguous_subsum(list)\n prev_max = -9999999999999\n new_max = 0\n list.each do |ele|\n new_max += ele\n prev_max = new_max if prev_max <= new_max\n new_max = 0 if new_max < 0 # Reset\n end\n prev_max\nend", "def largest_contiguous_subsum2(list)\n largest_sum = list[0]\n current_sum = 0\n# list = [2, 3, -6, 7, -6, 7]\n list.each do |number|\n current_sum += number\n if current_sum > largest_sum\n largest_sum = current_sum\n elsif current_sum < 0\n current_sum = 0\n end\n end\n largest_sum\nend", "def largest_contiguous_subsum(list)\n largest_sum = 0\n current_sum = list[0]\n (1...list.length).each do |i|\n current_sum = 0 if current_sum < 0 #we need to reset current sum if we hit a negative number\n current_sum += list[i]\n largest_sum = current_sum if current_sum > largest_sum\n end\n largest_sum\nend", "def largest_contiguous_subsum_fast(list)\n start = Time.now\n max_sum = list[0]\n cur_sum = list[0]\n list[1..-1].each do |el|\n if el >= cur_sum && cur_sum < 0\n cur_sum = el\n else\n cur_sum += el\n end\n max_sum = cur_sum if cur_sum > max_sum\n end\n finish = Time.now\n puts \"Runtime: #{finish - start}\"\n return max_sum\nend", "def largest_contiguous_subsum(list)\r\n \r\n largest = -1*Float::INFINITY\r\n current_sum = 0\r\n\r\n list.each do |num|\r\n if (current_sum += num ) < 0\r\n current_sum = 0\r\n if largest < num\r\n largest = num\r\n end\r\n else\r\n largest = current_sum if largest < current_sum\r\n end\r\n end\r\n largest\r\n # last_idx = 0\r\n # list.each_with_index do |e, i|\r\n # if current_sum < 0 || (current_sum += e) > largest\r\n # last_idx = i \r\n # largest = current_sum > 0 ? current_sum : e\r\n # end\r\n # end\r\n # p largest\r\n # p last_idx\r\n # largest = -1*Float::INFINITY\r\n # current_sum = 0\r\n\r\n # last_idx.downto(0).each do |i|\r\n # if current_sum < 0 || (current_sum += list[i]) > largest\r\n # largest = current_sum > 0 ? current_sum : list[i]\r\n # end\r\n # end\r\n\r\n # largest\r\nend", "def largest_contiguous_subsum(list)\n subs = []\n list.each_with_index do |ele1, idx1|\n (idx1..list.length-1).each do |idx2|\n subs.push(list[idx1..idx2])\n end\n end\n subs_sum = subs.map{|sub_arr| sub_arr.sum}\n subs_sum.flatten.max\nend", "def largest_contiguous_subsum(list)\n new_arr = []\n (0...list.length - 1).each do |i|\n (i...list.length).each do |j|\n new_arr << list[i..j]\n end\n end\n new_arr.map { |sub_arr| sub_arr.sum }.max\nend", "def better_largest_contiguous_subsum(list)\n current_largest_sum = 0\n current_sum = 0\n return list.max if list.all? {|ele| ele < 0}\n\n (0...list.length).each do |i |\n # debugger\n #add current element to current sum\n current_sum += list[i]\n\n #if current sum is less than 0 ignore it and reset to move on to next number\n if ( current_sum < 0 ) \n current_sum = 0\n end \n # if current sum is greater than our current largest sum, we want to keep it\n if current_sum > current_largest_sum\n current_largest_sum = current_sum\n end\n end\n current_largest_sum\nend", "def largest_contiguous_subsum_n(list2)\n large = 0\n \n list2.inject do |sum, n|\n if (sum + n) > sum\n sum += n \n large = sum if sum > large\n sum\n else\n sum = 0\n end\n end\n\n large\nend", "def largest_contiguous_subsum_two(list)\n largest_sum = list[0]\n current_sum = 0\n # list.inject {|acc, ele| acc + ele}\n list.each do |ele|\n current_sum = [ele, current_sum + ele].max\n largest_sum = [largest_sum, current_sum].max\n end\n largest_sum\nend", "def largest_contiguous_subsum(list)\n sub_arr = []\n \n (0...list.length).each do |idx|\n (idx...list.length).each do |jdx|\n sub_arr << list[idx..jdx]\n end\n end\n\n sub_arr.map! {|ele| ele.sum}.max\nend", "def largest_contiguous_subsum(list)\n # O(N*M) ==> Time\n # O(N*M) ==> Space\n sub_arrs = sub_arrays_of(list) # O(N^3)\n sums = []\n sub_arrs.each do |sub_arr| ## O(N*M)\n sums << sub_arr.sum\n end\n # Get the max of the sums array\n sums.max # O(N)\nend", "def largest_contiguous_subsum(list)\r\n max_val = 0 #8\r\n current_sum = 0 #8\r\n list.each do |num|\r\n current_sum = [0, current_sum + num].max\r\n max_val = [max_val, current_sum].max\r\n end\r\n return max_val\r\nend", "def largest_contiguous_subsum(list)\n answer=[]\n list.each_with_index do |ele,index|\n list.each_with_index do |ele2,index2|\n if index2 >= index \n answer.push(list[index..index2])\n end\n end\n end\n answer.map {|array| array.sum}.max\nend", "def phase_2_largest_contiguous_sum(arr)\n\n return [[]] if arr.empty?\n subs = arr.take(arr.count-1).phase_2_largest_contiguous_sum\n subs.concat(subs.map {|sub| sub + [last]})\n\n largest_sum = subs.first.sum \n\n subs.each do |sub|\n current_sum = sub.sum \n if current_sum > largest_sum\n largest_sum = current_sum\n end\n end\n\n largest_sum\n\nend", "def largest_contiguous_subsum(list)\n max_sum = 0\n i = 0\n while i < list.size\n curr_sum = list[0..i].take(i).sum #take from front\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-1].take(i).sum #take from front\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[0..i].drop(i).sum #drop from back\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-1].drop(i).sum #drop from back\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-i].take(i).sum #take from front\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-i].drop(i).sum #drop from back\n max_sum = curr_sum if curr_sum > max_sum\n\n i += 1\n end\n max_sum\nend", "def largest_contiguous_subsum(list)\n arr = []\n list.length.times do |id|\n arr << [list[id]]\n id2 = id + 1\n while id2 < list.length\n arr << list[id..id2]\n id2 += 1\n end\n end\n sum_arr = arr.map{ |el| el.reduce(:+)}\n arr[sum_arr.find_index{|el| el == sum_arr.max}]\nend", "def largest_contiguous_subsum(list)\n subsets = []\n (0...list.length).each do |idx1|\n (idx1...list.length).each do |idx2|\n subsets << list[idx1..idx2]\n end\n end\n\n #orignial [1,2,3]\n\n #[1]\n #[1,2]\n #[1,2,3]\n #[2]\n #[2,3]\n #[3]\n\n\n largest = subsets[0].sum\n subsets.each do |subset|\n largest = subset.sum if subset.sum > largest\n end\n\n largest\nend", "def largest_contiguous_subsum(list)\n max = nil\n subarrays = []\n\n list.each_with_index do |el1, idx1|\n (idx1...list.length).each do |idx2|\n subarrays << list[idx1..idx2]\n end\n end\n\n sums = []\n subarrays.each do |array|\n sums << array.inject(:+)\n end\n\n sums.max\nend", "def largest_contiguous_subsum(arr) #BigO of O(n)\n max = 0 \n current_sum = 0\n arr.each_with_index do |el,idx|\n if current_sum + el >= el \n current_sum += el \n else \n current_sum = el \n end \n max = current_sum if current_sum > max \n end \n max\nend", "def largest_contiguous_subsum1(int_list)\n sub_arrays = []\n\n (0...int_list.length).each do |idx1|\n (idx1...int_list.length).each do |idx2|\n sub_arrays << int_list[idx1..idx2]\n end\n end\n\n sub_arrays.each_with_index do |arr, idx|\n sum_arr = arr.sum\n sub_arrays[idx] = sum_arr\n end\n\n sub_arrays.max\nend", "def largest_contiguous_subsum(list)\n length = 1\n sub_arrays = []\n until length == list.length\n sub_arrays += list.each_cons(length).to_a\n length += 1\n end\n sub_arrays.map! { |el| el.reduce(:+) }.max\n\n # sub_arrays = []\n #\n # list.each_with_index do |ele, idx1|\n # list.each_with_index do |ele2, idx2|\n # sub_arrays << list[idx1..idx2] unless list[idx1..idx2].length < 1\n # end\n # end\n # sub_arrays.map! { |el| el.reduce(:+) }.max\n\nend", "def largest_contiguous_subsum_v2(arr) # O(n)\n\n largest_sum = arr[0]\n current_sum = arr[0]\n \n (1...arr.length).each do |i|\n if current_sum < 0\n if current_sum < arr[i]\n current_sum = arr[i]\n end\n else\n current_sum += arr[i]\n end\n if current_sum > largest_sum\n largest_sum = current_sum\n end\n end\n largest_sum\nend", "def largest_contiguous_sum2(array)\n sum = array.first\n max_sum = array.first\n array.each_with_index do |el,idx|\n next if idx == 0\n\n if el > sum && sum < 0\n sum = el\n else\n sum += el\n end\n\n if sum < max_sum\n sum = el\n else\n max_sum = sum\n end\n end\n max_sum\nend", "def largest_contiguous_subsum(list)\n all_subarrays = Array.new \n i = 0 \n j = 0\n\n while j < list.length \n while i < list.length \n all_subarrays << list[j..i]\n i += 1 \n end \n j += 1 \n i = j \n end\n\n sums = Array.new\n\n all_subarrays.each do |arr|\n sum = 0\n\n arr.each { |n| sum += n }\n\n sums << sum\n end\n\n sums.max\nend", "def largest_contiguous_subsum1(array)\n sub_array = []\n\n array.each_index do |i|\n array.each_index do |j|\n next if i > j\n sub_array << array[i..j]\n end\n end\n sum = sub_array.first.inject(:+)\n sub_array.each do |el|\n sum = el.inject(:+) if el.inject(:+) > sum\n end\n sum\nend", "def largest_contiguous_subsum(arr) # n^2\n subs = []\n (0...arr.length).each do |start_i|\n (start_i...arr.length).each do |end_i|\n subs << arr[start_i..end_i]\n end\n end\n\n subs.map { |sub| sub.inject(:+) }.max\nend", "def largest_contiguous_subsum2(list)\n\n largest = list.first\n current = list.first\n\n list[1..-1].each do |num|\n if current < num && current < 0 #dealing with a condition of negative nums and want to restart\n current = num\n elsif num < 0 && current > largest #about to begin negative nums, compare current and largest\n largest = current\n current += num\n else\n current += num\n end\n end\n\n return current if largest < current\n largest\nend", "def largest_contiguous_subsum_v1(arr)\n subs = [] # ( +2 )\n\n (0...arr.length).each do |idx1| # ( n )\n (idx1..arr.length - 1).each do |idx2| # ( n )\n subs << arr[idx1..idx2].sum # ( n * ( 1 + ))\n end\n end\n\n subs.max # ( n )\nend", "def largest_contiguous_subsum(arr)\n\n\nend", "def largest_contigous_subsum_ii(list)\n current_sum = list.first\n max = list.first\n (1..-1).each do |i|\n current_sum += list[i]\n current_sum = 0 if current_sum < 0\n max = current_sum if max < current_sum\n end\n current_sum\nend", "def largest_contiguous_sub_sum2(arr)\n #one varable tracks largest sum\n #one variable tracks current sum\n #O(n) + O(1)\n # list = [2, 3, -6, 7, -6, 7]\n\n # largest_sum= arr.first\n\n # i = 0\n # arr_end = true\n\n # while arr_end\n # current_sum = arr[i]\n # if arr[i+1] == nil\n # arr_end = false\n # puts \"This is current sum: #{current_sum}\"\n # else\n # if current_sum > largest_sum\n # current_sum += arr[i+1]\n # largest_sum = current_sum\n # end\n # end\n # if i < arr.length\n # arr_end = true\n # i += 1\n # end\n # end\n # largest_sum\n \n\n\n # arr.each_with_index do |ele, idx|\n # if ele > largest_sum\n # largest_sum = ele\n # end\n\n # i = idx\n # sum = ele\n # while i < arr.length - 1\n # if sum <= sum + arr[i+1]\n # largest_sum = sum + arr[i+1]\n # end\n # sum = sum + arr[i+1]\n # i+=1\n # end\n # end\n # largest_sum\n\nend", "def largest_contiguous_subsum_n_2(arr)\n subs = []\n arr.each_with_index do |el1, i|\n arr.each_with_index do |el2, j|\n if j > i \n subs << arr[i..j]\n end\n end\n end\n subs\n x = subs.max_by {|arr| arr.sum}\n x.sum\nend", "def largest_contiguous_subsum(nums)\n running_sum = 0\n max = nums.first || 0\n\n nums.each do |n|\n running_sum += n\n max = running_sum if max < running_sum\n running_sum = 0 if running_sum < 0\n end\n max\nend", "def largest_contiguous_subsum_slow(arr)\n res = arr.first\n (0...arr.length - 1).each do |i|\n (i+1...arr.length).each do |j|\n tmp_sum = arr[i..j].reduce(:+)\n res = tmp_sum if tmp_sum > res\n end\n end\n return res\nend", "def best_largest_contiguous_subsum(arr)\n return arr.max if arr.max < 0\n largest = 0\n current = 0\n\n\n (0..(arr.length-1)).each do |idx1|\n if current + arr[idx1] < 0\n current = arr[idx1]\n else\n current += arr[idx1]\n end\n\n largest = current if current > largest\n end\n largest\nend", "def largest_contiguous_subsum2(array)\n #all negative numbers\n if array.none? {|el| el > 0 }\n max = array.first\n array.each do |el1|\n next if max == el1\n if el1 > max\n max = el1\n end\n end\n max\n end\n\n current_sum = 0\n max_sum = 0\n\n array.each do |num|\n current_sum += num\n max_sum = current_sum if current_sum > max_sum\n if current_sum < 0\n current_sum = 0\n next\n current_sum += num\n max_sum = current_sum if current_sum > max_sum\n end\n\n end\n max_sum\n\nend", "def largest_contiguous_subsum_2(arr)\n sum = 0\n max = 0\n arr.each do |num|\n sum += num\n if sum > 0\n max = sum if sum > max\n else\n sum = 0\n end\n end\n max\nend", "def largest_contiguous_subsum(arr)\n max = 0\n\n (0...arr.count).each do |i|\n sum = arr[i]\n (i + 1...arr.count).each do |j|\n sum += arr[j]\n max = sum if max < sum \n end \n end \n\n max\nend", "def largest_contiguous_subsum2(arr)\n max = arr[0]\n current = arr[0]\n arr.drop(1).each do |num|\n current += num\n max = current if current > max\n current = 0 if current < 0\n end\n max\nend", "def largest_contiguous_subsum(arr)\n subs = []\n l = arr.length\n (0...l).each do |i|\n (0...l).each do |j| \n subs << arr[i..j] if arr[i..j].length > 0 # n*n *( n) == n^3 + n\n end\n end\n subs.map(&:sum).max\nend", "def largest_contiguous_subsum(array)\r\n max = array.first \r\n current_sum = 0\r\n array.each do |ele|\r\n current_sum += ele\r\n max = current_sum if current_sum > max\r\n current_sum = 0 if current_sum < 0\r\n end\r\n max\r\nend", "def largest_contiguous_subsum(array)\n current_sum = array.first\n largest_sum = array.first\n array.each do |num|\n current_sum += num\n if largest_sum < current_sum\n largest_sum = current_sum\n end\n end\n largest_sum\nend", "def largest_contiguous_subsum2(array)\r\n largest = array[0]\r\n current_sum = array[0]\r\n\r\n (1...array.length).each do |i|\r\n current_sum = 0 if current_sum < 0\r\n num = array[i]\r\n current_sum += num\r\n if current_sum > largest\r\n largest = current_sum\r\n end\r\n end\r\n\r\n largest\r\nend", "def largest_con_subsum_2(list)\n largest = list.first\n contiguous_sum = list.first\n\n i = 1\n \n while i < list.length\n current = list[i]\n contiguous_sum += current\n if contiguous_sum > largest\n largest = contiguous_sum \n elsif current > largest\n largest = current\n \n end\n contiguous_sum = 0 if contiguous_sum < 0\n i += 1 \n \n end\n return largest\nend", "def largest_contiguous_sub_sum3(arr)\n\n largest_sum = arr.first\n current_sum = arr.first\n\n (1...arr.length).each do |index|\n current_num = arr[index]\n prev_num = arr[index-1]\n\n if largest_sum < current_num\n largest_sum = current_num\n end\n\n current_sum = current_sum + current_num\n prev_sum = prev_num + current_num\n\n if prev_sum > current_sum\n current_sum = prev_sum\n end\n\n if largest_sum < current_sum\n largest_sum = current_sum\n end\n end\n largest_sum\nend", "def largest_contiguous_subsum(array)\n sums_list = []\n sums = []\n\n idx1 = 0\n\n while idx1 < array.length #O(n)\n idx2 = idx1 #O(1)\n while idx2 < array.length #O(n)\n sums_list << array[idx1..idx2] #O(n)\n idx2 += 1\n end\n idx1 += 1\n end\n\n sums_list.each do |list| #O(n)\n sums << list.reduce {|sum, num| sum + num} #O(n)\n end\n sums.max\nend", "def largest_contiguous_subsum_1(arr)\n res = []\n i = 0\n while i < arr.length\n j = i\n while j < arr.length\n res << arr[i..j].reduce(:+)\n j += 1\n end\n i += 1\n end\n res.max\nend", "def largest_contiguous_subsum_2(arr)\n (1...arr.length).each do |i|\n if arr[i] + arr[i - 1] > 0\n arr[i] = arr[i] + arr[i - 1]\n elsif arr[i] < 0 && arr[i-1] < 0\n arr[i] = [arr[i-1], arr[i]].max\n else\n arr[i] = 0\n end\n end\n\n arr.max\nend", "def largest_contiguous_subsum(arr)\n sum = arr.first\n\n (0...(arr.length - 1)).each do |idx1|\n (idx1..(arr.length - 1)).each do |idx2|\n if idx1 == idx2\n ss = arr[idx1]\n else\n ss = arr[idx1..idx2].reduce(:+)\n end\n sum = ss if ss > sum\n end\n end\n sum\nend", "def largest_contiguous_subsum(arry)\n bigone = arry.first || 0\n actual_sum = 0\n\n arry.each do |number|\n actual_sum += number\n if actual_sum > bigone\n bigone = actual_sum \n end\n if actual_sum < 0\n actual_sum = 0 \n end\n end\n return bigone\nend", "def largest_contiguous_subsum_fast(arr)\n global_max = arr.first\n prev_max = arr.first\n\n arr.drop(1).each do |el|\n curr_max = (prev_max + el > el) ? (prev_max + el) : el\n prev_max = curr_max\n global_max = curr_max if curr_max > global_max\n end\n global_max\nend", "def largest_contiguous_subsum2(array)\n largest_sum = array.first\n current_sum = array.first\n\n (1..array.length-1).each do |i|\n current_sum = 0 if current_sum < 0\n current_sum += array[i]\n largest_sum = current_sum if current_sum > largest_sum\n end\n largest_sum\n \nend", "def largest_contiguous_sub_sum(arr)\n subarrs = [] #O(1)\n\n (0...arr.length).each do |idx| #O(n)\n (idx...arr.length).each do |jdx| #O(n/2)\n subarrs << arr[idx..jdx] #O(n)\n end\n end \n\n subarrs.map! do |array| #O(n)\n array.reduce(:+) #O(n)\n end \n\n subarrs.max #O(n)\nend", "def largest_contiguous_sum(array)\n subsets = []\n subarr = []\n\n\n array.each_index do |i|\n array.each_index do |j|\n next if j < i\n subsets << array[i..j] unless subsets.include? array[i..j]\n end\n end\n sum = 0\n subsets.each do |sarr|\n next if sarr.empty?\n sum = [sarr.inject(:+), sum].max\n end\n sum\nend", "def sub_sum(list)\n sub_arr = []\n (0...list.length).each do |i| #O(n)\n (i...list.length).each do |j| #O(n)\n sub_arr << list[i..j] if i <= j\n end\n end\n largest_continuous_sub_sum1(sub_arr)\nend", "def largest_contiguous_subsum_once(arr)\n largest_subsum = 0\n current = 0\n\n arr.each do |elm|\n current += elm\n if largest_subsum < current\n largest_subsum = current\n elsif current < 0\n current = 0 \n end \n end \n\n # (0...arr.count).each do |i|\n # current_subsum = (largest_subsum + arr[i])\n # if current_subsum > largest_subsum \n # largest_subsum = current_subsum \n # elsif current_subsum < 0 \n # largest_subsum = 0 \n # end\n # end \n\n largest_subsum \nend", "def largest_contiguous_subsum_good(arr) \n last_max = arr.first\n current_max = 0\n arr.each do |num|\n temp_sum = current_max + num\n if temp_sum < 0\n last_max = current_max if temp_sum > last_max\n else\n if temp_sum > last_max\n last_max = temp_sum\n end\n end\n if num > temp_sum\n current_max = num\n else\n current_max = temp_sum\n end\n end\n last_max\nend", "def largest_contiguous_sub_sum1(arr)\n subarrays = []\n arr.each_with_index do |num1, i|\n arr.each_with_index do |num2, j|\n subarrays << arr[i..j] if i <= j\n end\n end\n\n subarrays.map! do |subarray|\n subarray.sum\n end\n\n subarrays.sort[-1]\nend", "def largest_contiguous_subsum(arr)\n i = 0\n subs = []\n while i < arr.length\n j = i\n\n while j < arr.length\n subs << arr[i..j]\n\n j += 1\n end\n\n i += 1\n end\n\n\n return (subs.max {|a, b| a.sum <=> b.sum}).sum\n\nend", "def largest_contiguous_subsum(array)\n previous_sum = 0\n current_sum = 0\n array.each_with_index do |el, i|\n\n current_sum = previous_sum + el\n if previous_sum < 0\n if el < previous_sum\n current_sum = previous_sum\n else\n current_sum = el\n end\n end\n\n previous_sum = current_sum\n end\n\n current_sum\nend", "def largest_contiguous_subsum(array)\n arr = []\n (0...array.length).each do |i|\n (i + 1...array.length).each do |j|\n arr << array[i] + array[j] \n end\n end\n arr.max\n \nend", "def largest_contiguous_subsum(arr)\n \n curr_sum = arr.first\n largest_sum = arr.first\n (1...arr.length).each do |i| \n if curr_sum < 0\n curr_sum = 0 #reset\n end\n\n curr_sum += arr[i] \n \n if curr_sum > largest_sum \n largest_sum = curr_sum\n end\n end\n largest_sum\nend", "def largest_cont_subsum_fast(list)\n # for constant size to be true, you cant create any variables\n # whose memory size depends on the size of the input\n curr_sum = list[0]\n largest_sum = list[0]\n\n # we know there are n^2 potential, so if we ever check all of them\n # it must be n^2\n\n # there must be a way to find the max without checking every subarray\n list[1..-1].each do |ele|\n # debugger\n if curr_sum > largest_sum\n largest_sum = curr_sum\n end\n\n if curr_sum < 0\n curr_sum = 0\n end\n\n curr_sum += ele\n\n end\n\n # debugger\n return [largest_sum, curr_sum].max\n\nend", "def largest_contiguous_subsum(arr)\n max = arr.first\n arr.each_index do |idx1|\n (idx1+1..arr.length).each do |idx2|\n sub_arr = arr[idx1...idx2]\n sum = sub_arr.reduce(:+)\n max = sum if max < sum \n end\n\n end\n max\nend", "def largest_contiguous_subsum(arr)\n current_sum = arr.first \n max_sum = arr.first \n (0...arr.length-1).each do |i|\n if current_sum < 0 \n current_sum = [current_sum, arr[i+1]].max\n max_sum = current_sum\n else \n current_sum += arr[i+1]\n max_sum = [current_sum, max_sum].max\n end \n end \n max_sum\nend" ]
[ "0.8553727", "0.84786344", "0.842758", "0.8403052", "0.8398605", "0.8373972", "0.8370883", "0.83707887", "0.8357327", "0.83568573", "0.8342328", "0.834114", "0.83287495", "0.8326551", "0.8312691", "0.8295603", "0.82616144", "0.82543004", "0.82452", "0.8230645", "0.8229102", "0.820381", "0.81868863", "0.8180858", "0.81771505", "0.81764585", "0.8173381", "0.8173288", "0.81727016", "0.8168058", "0.81587017", "0.81498694", "0.81479114", "0.81453747", "0.81322026", "0.810788", "0.81077373", "0.8102291", "0.8077813", "0.8055504", "0.80543005", "0.8039687", "0.80340374", "0.8030093", "0.8009997", "0.79972744", "0.79637927", "0.79517245", "0.7923427", "0.7905904", "0.78804624", "0.7859596", "0.78463507", "0.78255606", "0.7818618", "0.78106034", "0.7807359", "0.78025454", "0.77805954", "0.7771114", "0.77601033", "0.7756755", "0.7743657", "0.77273935", "0.7724657", "0.7717761", "0.7702084", "0.77003294", "0.76850027", "0.7672444", "0.76618445", "0.7656263", "0.7637516", "0.76351357", "0.7632259", "0.7624153", "0.7619874", "0.76034623", "0.7602764", "0.7602508", "0.76010966", "0.75935596", "0.7590441", "0.7587029", "0.7584357", "0.7570682", "0.75659037", "0.7564958", "0.75604355", "0.7559345", "0.7553955", "0.7553185", "0.75523335", "0.7551349", "0.7537309", "0.7531816", "0.7529287", "0.75249404", "0.7517859", "0.7511134" ]
0.8153781
31
n^3 + n^2 => O(n^3) list = [5, 3, 7] p largest_contiguous_subsum(list) => 8 list = [5, 1, 3] p largest_contiguous_subsum(list) => 1 (from [1]) list = [2, 3, 6, 7, 6, 7] p largest_contiguous_subsum(list) => 8 (from [7, 6, 7]) Phase 2
def largest_contiguous_subsum_2(list) largest_sum = 0 current_sum = 0 list.each do |el| largest_sum = current_sum current_sum += el if current_sum < el current_sum = el end largest_sum = current_sum if largest_sum < current_sum end largest_sum end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def largest_contiguous_subsum(list)\n new_arr = []\n\n (0...list.length).each do |idx1| #O(n)\n (0...list.length).each do |idx2| #O(n)\n if idx2 >= idx1 #O(1)\n new_arr << list[idx1..idx2].sum #O(1)\n end \n end \n \n end \n \n return new_arr.max #O(n)\nend", "def largest_contiguous_subsum_1(list) \n subs = [] #O(1)\n (0...list.length).each do |start_num| #O(n)\n (start_num...list.length).each do |end_num| #O(n)\n subs << list[start_num..end_num] #O(n)\n end\n end\n subs_sum = [] #O(1)\n subs.each do |sub| #O(n**2)\n sub_sum = 0 #O(1)\n sub.each {|s| sub_sum += s} #O(n)\n subs_sum << sub_sum #O(1)\n end\n subs_sum.inject do |acc,el| #O(n)\n if acc > el #O(1)\n acc #O(1)\n else\n el #O(1)\n end\n end\n end", "def largest_contiguous_subsum(list) # O(n^2)\n array = []\n list.each_with_index do |ele1, i1| # O(n^2)\n (i1...list.length).each do |i2|\n array << list[i1..i2]\n end\n end\n\n max_sum = array.first.sum\n array[1..-1].each do |subarr| # O(n^2)\n sum = subarr.sum\n if sum > max_sum\n max_sum = sum\n end\n end\n\n max_sum\n\nend", "def largest_contiguous_subsum(list)\r\n sub_arr = []\r\n list.each_with_index do |ele1,idx1|\r\n list.each_with_index do |ele2,idx2|\r\n sub_arr<< list[idx1..idx2] if idx2>=idx1\r\n end\r\n end\r\n p sub_arr.size\r\n sub_arr.map{ |sub| sub.sum}.max\r\n #(O(n^2 + m)\r\nend", "def largest_contiguous_subsum_1(list)\n subs = []\n (0...list.length).each do |idx| #O(n)\n (idx...list.length).each do |idx_2| #O(n)\n subs << list[idx..idx_2] #O(n)\n end\n end\n max = list.first\n subs.each do |subarr|\n if subarr.sum > max\n max = subarr.sum\n end\n end\n max\nend", "def largest_contiguous_subsum(list)\n # debugger\n results = [] # O(1)\n\n list.each_with_index do |el1, idx1| # O(n)\n list.each_with_index do |el2, idx2| # O(n) => O(n^2)\n next if idx2 < idx1 # O(1)\n results << list[idx1..idx2] # O(1)\n end\n end\n\n results.map! { |subsum| subsum.reduce(:+) } # O(n^2)\n results.max # O(1)\nend", "def largest_contiguous_subsum1(list)\n arr = []\n (0...list.length).each do |i|\n (i...list.length).each { |j| arr << list[i..j] }\n end\n largest_sum = arr.first.sum\n arr.each do |sub_arr|\n largest_sum = sub_arr.sum if sub_arr.sum > largest_sum\n end\n largest_sum\nend", "def largest_contiguous_subsum(list)\n # l = list.length # 1\n # result = [] # 1\n # hash = Hash.new(0) # 1\n\n # (0...l).each do |i1| # n\n # (0...l).each do |i2| # n\n # result << list[i1..i2] if i2 >= i1 # 1\n # end\n # end\n\n # result.each do |sub_arr| # n\n # hash[sub_arr] = sub_arr.sum # 1\n # end\n\n # sorted_by_val = hash.sort_by { |k, v| v } # n, \n # sorted_by_val[-1][1] # \nend", "def largest_contiguous_subsum_2(list)\n current_sum = 0\n largest_sum = 0\n (0...list.length).each do |idx|\n current_sum += list[idx]\n largest_sum = current_sum if current_sum > largest_sum\n current_sum = 0 if current_sum < 0\n end\n largest_sum\nend", "def largest_contiguous_subsum(list)\n curr_sum = list[0]\n max_sum = list[0]\n (1...list.length).each do |idx|\n # debugger\n curr_sum += list[idx]\n if curr_sum < list[idx] \n curr_sum = list[idx]\n end\n if curr_sum > max_sum\n max_sum = curr_sum\n end\n end\n max_sum\nend", "def largest_contiguous_subsum(list) # O(n^2)\n subs_sums = []\n\n list.each_index do |i|\n list.each_index do |j|\n next if j < i\n subs_sums << list[i..j]\n end\n end\n\n highest_array_sum = nil\n subs_sums.each do |array|\n array_sum = array.reduce(:+)\n if highest_array_sum == nil || array_sum > highest_array_sum\n highest_array_sum = array_sum\n end\n end\n\n highest_array_sum\nend", "def largest_contiguous_subsum_one(list)\n sub_arr = []\n sum = 0\n list.each_with_index do |ele, i|\n (i...list.length).each do |i2|\n sub_arr << list[i..i2]\n end\n end\n sub_arr.each do |arr|\n if arr.sum > sum\n sum = arr.sum\n end\n end\n sum\nend", "def largest_contiguous_subsum_1(list)\r\n subarrays = [] #1\r\n list.each_with_index do |ele1, i| #n\r\n list[i...list.length].each_with_index do |ele2,i2| #(n-1)\r\n subarrays << list[i..i2+i] #k \r\n end\r\n end # n^2\r\n subarrays.map { |subarray| subarray.sum}.max # n^x\r\nend", "def largest_contiguous_subsum_2(list)# [2, 3, -6, 7, -6, 7]\n largest_num = list[0]#2 O(1)\n running_sum = list[0]#2 - 5 after entering loop. O(1)\n\n (1...list.length).each do |i| #O(n) \n running_sum = 0 if running_sum < 0 #O(1)\n running_sum += list[i] #O(1)\n largest_num = running_sum if running_sum > largest_num #O(1)\n end\n return largest_num #O(1)\nend", "def largest_contiguous_subsum(list)\n new_arr = []\n (0...list.length - 1).each do |i|\n (i...list.length).each do |j|\n new_arr << list[i..j]\n end\n end\n new_arr.map { |sub_arr| sub_arr.sum }.max\nend", "def largest_contiguous_subsum(list)\n max_sum = 0\n i = 0\n while i < list.size\n curr_sum = list[0..i].take(i).sum #take from front\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-1].take(i).sum #take from front\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[0..i].drop(i).sum #drop from back\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-1].drop(i).sum #drop from back\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-i].take(i).sum #take from front\n max_sum = curr_sum if curr_sum > max_sum\n\n curr_sum = list[i..-i].drop(i).sum #drop from back\n max_sum = curr_sum if curr_sum > max_sum\n\n i += 1\n end\n max_sum\nend", "def largest_contiguous_subsum(list)\n subs = [] \n (0...list.length).each do |i|\n (i...list.length).each do |j|\n subs << list[i..j]\n end\n end\n\n subs.map {|el| el.sum}.max\nend", "def largest_contiguous_subsum(list)\n subs = []\n list.each_with_index do |ele1, idx1|\n (idx1..list.length-1).each do |idx2|\n subs.push(list[idx1..idx2])\n end\n end\n subs_sum = subs.map{|sub_arr| sub_arr.sum}\n subs_sum.flatten.max\nend", "def largest_contiguous_subsum2(int_list)\n largest_sum = int_list.first\n curr_sum = int_list.first\n\n (1...int_list.length).each do |idx|\n curr_sum = (int_list[idx] > curr_sum + int_list[idx]) ? int_list[idx] : curr_sum + int_list[idx]\n largest_sum = curr_sum if curr_sum > largest_sum\n end\n\n largest_sum\nend", "def largest_contiguous_subsum(list)\n arr = []\n list.length.times do |id|\n arr << [list[id]]\n id2 = id + 1\n while id2 < list.length\n arr << list[id..id2]\n id2 += 1\n end\n end\n sum_arr = arr.map{ |el| el.reduce(:+)}\n arr[sum_arr.find_index{|el| el == sum_arr.max}]\nend", "def largest_contiguous_subsum(list)\n helper_arr = [list.first]\n (1...list.length).each do |idx|\n if helper_arr[-1] + list[idx] > list[idx]\n helper_arr << helper_arr[-1] + list[idx]\n else\n helper_arr << list[idx]\n end\n end\n helper_arr.max\nend", "def largest_contiguous_subsum2(list)\n # O(N) ==> Time\n # O(1) ==> Space\n largest = list.first\n curr = list.first\n\n len = list.length\n (1...len).each do |i|\n curr = 0 if curr < 0 \n curr += list[i]\n largest = curr if curr > largest\n end\n largest\nend", "def largest_contiguous_subsum(list)\n # O(N*M) ==> Time\n # O(N*M) ==> Space\n sub_arrs = sub_arrays_of(list) # O(N^3)\n sums = []\n sub_arrs.each do |sub_arr| ## O(N*M)\n sums << sub_arr.sum\n end\n # Get the max of the sums array\n sums.max # O(N)\nend", "def largest_contiguous_subsum2(array)\n # return [list[0]] if list.count == 1\n #\n # start_num = list.shift\n # large_sum = start_num\n #\n # other_list = list.dup\n #\n # idx = 0\n # while idx < list.count\n # sum = list[0..idx].inject(:+)\n # if large_sum < start_num + sum\n # large_sum = start_num + sum\n # end\n # idx += 1\n # end\n #\n # [large_sum] + largest_contiguous_subsum2(other_list)\n\n largest = nil\n current = 0\n\n array.each do |el|\n current += el\n if largest.nil? || current > largest\n largest = current\n end\n current = 0 if current < 0\n end\n\n largest\n\nend", "def largest_contiguous_subsum(list)\n sub_arr = []\n \n (0...list.length).each do |idx|\n (idx...list.length).each do |jdx|\n sub_arr << list[idx..jdx]\n end\n end\n\n sub_arr.map! {|ele| ele.sum}.max\nend", "def largest_contiguous_subsum2(list)\n result = list.first\n sum = list.first\n\n list.each_with_index do |n, i|\n next if i == 0\n\n sum = 0 if sum < 0\n\n sum += n\n\n result = sum if sum > result\n end\n\n result\nend", "def largest_contiguous_subsum1(list)\n sums = []\n\n list.each_with_index do |el1, i1|\n list.each_with_index do |el2, i2|\n if i1 == i2\n sums << el1\n else\n sums << el1 + el2\n end\n end\n end\n\n result = sums.first\n\n sums.each do |sum|\n result = sum if sum > result\n end\n\n result\nend", "def largest_contiguous_subsum1(list)\n subs = []\n (0...list.length).each do |i|\n (i...list.length).each do |j|\n subs << list[i..j]\n end\n end\n\n subs.map(&:sum).max\nend", "def largest_contiguous_subsum1(list)\n greatest_sum = -1.0/0.0\n (0...list.length).each do |i|\n (i...list.length).each do |j|\n greatest_sum = list[i..j].sum if greatest_sum < list[i..j].sum\n end\n end\n greatest_sum\nend", "def largest_contiguous_subsum(arr) # n^2\n subs = []\n (0...arr.length).each do |start_i|\n (start_i...arr.length).each do |end_i|\n subs << arr[start_i..end_i]\n end\n end\n\n subs.map { |sub| sub.inject(:+) }.max\nend", "def largest_contiguous_subsum1(list)\n p Time.now\n sub_arrays = []\n list.each_index do |i|\n list.each_index do |j|\n next if j < i\n sub_arrays << list[i..j]\n end\n end\n sub_arrays.map{|numbers| numbers.inject(:+)}.max\n p Time.now\nend", "def largest_contiguous_subsum(list)\n max_sum = list.first\n current_sum = list.first\n \n (1...list.length).each do |i| \n current_sum = 0 if current_sum < 0 \n current_sum += list[i]\n max_sum = current_sum if current_sum > max_sum\n end\n max_sum\nend", "def largest_contiguous_subsum(list)\n largest_sum = 0\n current_sum = list[0]\n (1...list.length).each do |i|\n current_sum = 0 if current_sum < 0 #we need to reset current sum if we hit a negative number\n current_sum += list[i]\n largest_sum = current_sum if current_sum > largest_sum\n end\n largest_sum\nend", "def largest_contiguous_subsum(array)\n sums_list = []\n sums = []\n\n idx1 = 0\n\n while idx1 < array.length #O(n)\n idx2 = idx1 #O(1)\n while idx2 < array.length #O(n)\n sums_list << array[idx1..idx2] #O(n)\n idx2 += 1\n end\n idx1 += 1\n end\n\n sums_list.each do |list| #O(n)\n sums << list.reduce {|sum, num| sum + num} #O(n)\n end\n sums.max\nend", "def largest_contiguous_subsum(list)\n max = nil\n subarrays = []\n\n list.each_with_index do |el1, idx1|\n (idx1...list.length).each do |idx2|\n subarrays << list[idx1..idx2]\n end\n end\n\n sums = []\n subarrays.each do |array|\n sums << array.inject(:+)\n end\n\n sums.max\nend", "def largest_contiguous_subsum(list)\n answer=[]\n list.each_with_index do |ele,index|\n list.each_with_index do |ele2,index2|\n if index2 >= index \n answer.push(list[index..index2])\n end\n end\n end\n answer.map {|array| array.sum}.max\nend", "def largest_contiguous_subsum(arr) #BigO of O(n)\n max = 0 \n current_sum = 0\n arr.each_with_index do |el,idx|\n if current_sum + el >= el \n current_sum += el \n else \n current_sum = el \n end \n max = current_sum if current_sum > max \n end \n max\nend", "def largest_contiguous_subsum(list)\n max_sum = list[0]\n\ttemp_sum = list[0]\n\tdebugger\n #0(n) #note: only n^2 if nested\n \n return list.max if list.all? { |ele| ele < 0 } \n #need to add O(1) return case\n # Write a new function using O(n) time with O(1) memory. Keep a running tally of the largest sum.\n\n list_2 = list.drop(1)\n list_2.each do |ele|\n\t\ttemp_sum = [ele, temp_sum + ele].max #O(1) operation, should refactor \n #temp_sum = ele = 4, temp_sum = 1+3, [4, 8].max\n # [3, -7]\n #[3, 5 + 3] = > 3, 8 = > 8 max = 5\n #[-7, 8 - 7] => 1, 1 = > 1 max = 8\n max_sum = temp_sum if temp_sum > max_sum\n\tend\n\t\n\tmax_sum\nend", "def largest_contiguous_subsum(arr)\n sum = arr.first\n\n (0...(arr.length - 1)).each do |idx1|\n (idx1..(arr.length - 1)).each do |idx2|\n if idx1 == idx2\n ss = arr[idx1]\n else\n ss = arr[idx1..idx2].reduce(:+)\n end\n sum = ss if ss > sum\n end\n end\n sum\nend", "def efficient_contiguous_subsum(list)\n current_sum = list[0] #0\n largest_sum = list[0] #5\n # debugger\n (1...list.length).each do |i| \n if current_sum + list[i] > 0 \n current_sum += list[i] \n largest_sum = current_sum if current_sum > largest_sum\n else \n current_sum = 0\n end \n end \n largest_sum\nend", "def largest_contiguous_subsum(list)\n subsets = []\n (0...list.length).each do |idx1|\n (idx1...list.length).each do |idx2|\n subsets << list[idx1..idx2]\n end\n end\n\n #orignial [1,2,3]\n\n #[1]\n #[1,2]\n #[1,2,3]\n #[2]\n #[2,3]\n #[3]\n\n\n largest = subsets[0].sum\n subsets.each do |subset|\n largest = subset.sum if subset.sum > largest\n end\n\n largest\nend", "def largest_contiguous_subsum(list)\n current_max = list[0]\n current_sum = list[0]\n\n (1...list.size).each do |i|\n current_sum += list[i]\n if current_sum > current_max\n current_max = current_sum\n end\n\n if current_sum < 0 \n current_sum = 0\n end\n \n end\n\n current_max\nend", "def largest_contiguous_subsum(list)\n prev_max = -9999999999999\n new_max = 0\n list.each do |ele|\n new_max += ele\n prev_max = new_max if prev_max <= new_max\n new_max = 0 if new_max < 0 # Reset\n end\n prev_max\nend", "def better_largest_contiguous_subsum(list)\n total_sum = list.first\n current_sum = list.first\n\n list.each_index do |idx| \n current_sum = [list[idx], current_sum + list[idx]].max\n total_sum = [total_sum, current_sum].max\n end\n\n return total_sum\nend", "def largest_contiguous_sub_sum1(list)\n max = list[0]\n (0...list.length).each do |i|\n (i...list.length).each do |j| \n sub_sum = list[i..j].sum \n max = sub if sub >= max \n end\n end\n max\nend", "def largest_contiguous_subsum_v1(arr)\n subs = [] # ( +2 )\n\n (0...arr.length).each do |idx1| # ( n )\n (idx1..arr.length - 1).each do |idx2| # ( n )\n subs << arr[idx1..idx2].sum # ( n * ( 1 + ))\n end\n end\n\n subs.max # ( n )\nend", "def largest_contiguous_subsum_2(list)\n largest_sum = list.first\n current_sum = 0\n list.each do |ele| \n current_sum += ele\n if current_sum > largest_sum\n largest_sum = current_sum\n end\n current_sum = 0 if current_sum < 0 \n end\n largest_sum\nend", "def largest_contiguous_subsum(list)\n length = 1\n sub_arrays = []\n until length == list.length\n sub_arrays += list.each_cons(length).to_a\n length += 1\n end\n sub_arrays.map! { |el| el.reduce(:+) }.max\n\n # sub_arrays = []\n #\n # list.each_with_index do |ele, idx1|\n # list.each_with_index do |ele2, idx2|\n # sub_arrays << list[idx1..idx2] unless list[idx1..idx2].length < 1\n # end\n # end\n # sub_arrays.map! { |el| el.reduce(:+) }.max\n\nend", "def largest_contiguous_subsum_fast(list)\n start = Time.now\n max_sum = list[0]\n cur_sum = list[0]\n list[1..-1].each do |el|\n if el >= cur_sum && cur_sum < 0\n cur_sum = el\n else\n cur_sum += el\n end\n max_sum = cur_sum if cur_sum > max_sum\n end\n finish = Time.now\n puts \"Runtime: #{finish - start}\"\n return max_sum\nend", "def largest_contiguous_subsum(list)\r\n \r\n largest = -1*Float::INFINITY\r\n current_sum = 0\r\n\r\n list.each do |num|\r\n if (current_sum += num ) < 0\r\n current_sum = 0\r\n if largest < num\r\n largest = num\r\n end\r\n else\r\n largest = current_sum if largest < current_sum\r\n end\r\n end\r\n largest\r\n # last_idx = 0\r\n # list.each_with_index do |e, i|\r\n # if current_sum < 0 || (current_sum += e) > largest\r\n # last_idx = i \r\n # largest = current_sum > 0 ? current_sum : e\r\n # end\r\n # end\r\n # p largest\r\n # p last_idx\r\n # largest = -1*Float::INFINITY\r\n # current_sum = 0\r\n\r\n # last_idx.downto(0).each do |i|\r\n # if current_sum < 0 || (current_sum += list[i]) > largest\r\n # largest = current_sum > 0 ? current_sum : list[i]\r\n # end\r\n # end\r\n\r\n # largest\r\nend", "def largest_contiguous_subsum_v2(arr) # O(n)\n\n largest_sum = arr[0]\n current_sum = arr[0]\n \n (1...arr.length).each do |i|\n if current_sum < 0\n if current_sum < arr[i]\n current_sum = arr[i]\n end\n else\n current_sum += arr[i]\n end\n if current_sum > largest_sum\n largest_sum = current_sum\n end\n end\n largest_sum\nend", "def largest_contiguous_subsum(list)\n all_subarrays = Array.new \n i = 0 \n j = 0\n\n while j < list.length \n while i < list.length \n all_subarrays << list[j..i]\n i += 1 \n end \n j += 1 \n i = j \n end\n\n sums = Array.new\n\n all_subarrays.each do |arr|\n sum = 0\n\n arr.each { |n| sum += n }\n\n sums << sum\n end\n\n sums.max\nend", "def largest_contiguous_subsum(list) \n subs = []\n\n (0...list.length).each do |i|\n (i...list.length).each do |j|\n sub = list[i..j]\n subs << sub\n end\n end\n \n max = nil\n\n subs.each do |sub|\n sum = sub.sum \n if max == nil || sum > max\n max = sum\n end\n end\n max\nend", "def largest_contiguous_subsum2(list)\n sum = 0 # keeps track of current sum\n largest_sum = list.first # evaluates to the largest sum\n list.each do |ele|\n sum += ele \n largest_sum = sum if sum > largest_sum\n sum = 0 if sum < 0\n end\n largest_sum\nend", "def largest_contiguous_subsum(list)\r\n max_val = 0 #8\r\n current_sum = 0 #8\r\n list.each do |num|\r\n current_sum = [0, current_sum + num].max\r\n max_val = [max_val, current_sum].max\r\n end\r\n return max_val\r\nend", "def largest_contiguous_subsum_slow(arr)\n res = arr.first\n (0...arr.length - 1).each do |i|\n (i+1...arr.length).each do |j|\n tmp_sum = arr[i..j].reduce(:+)\n res = tmp_sum if tmp_sum > res\n end\n end\n return res\nend", "def largest_contiguous_subsum(arr)\r\n all_sub_arrays = [] # space : O(n^2)\r\n\r\n (0...arr.length).each do |i|\r\n (i...arr.length).each do |i2|\r\n all_sub_arrays << arr[i..i2] # slice makes n^3\r\n end\r\n end\r\n\r\n all_sub_arrays.map { |sub_arr| sub_arr.sum }.max # O(n^2)\r\nend", "def largest_contiguous_subsum1(array)\n sub_array = []\n\n array.each_index do |i|\n array.each_index do |j|\n next if i > j\n sub_array << array[i..j]\n end\n end\n sum = sub_array.first.inject(:+)\n sub_array.each do |el|\n sum = el.inject(:+) if el.inject(:+) > sum\n end\n sum\nend", "def largest_contiguous_sub_sum(arr)\n subarrs = [] #O(1)\n\n (0...arr.length).each do |idx| #O(n)\n (idx...arr.length).each do |jdx| #O(n/2)\n subarrs << arr[idx..jdx] #O(n)\n end\n end \n\n subarrs.map! do |array| #O(n)\n array.reduce(:+) #O(n)\n end \n\n subarrs.max #O(n)\nend", "def largest_contiguous_subsum(arr)\n sums = []\n\n (0...arr.length).each do |idx1|\n (idx1+1...arr.length).each do |idx2|\n sums << arr[idx1..idx2].sum\n end\n end\n\n sums.max\nend", "def largest_contiguous_subsum_v2(list)\n largest_sum = list.first\n sum = list.first # but the first element can be a negative number\n\n (1...list.length).each do |i|\n # a negative number + a postive number always less than pos number on its own\n sum = 0 if sum < 0 # if we add to a negative sum, then result is less than pos number on its own\n sum += list[i]\n largest_sum = sum if largest_sum < sum\n end\n\n largest_sum\nend", "def largest_contiguous_subsum(arr)\n result = []\n\n arr.each_with_index do |el1, idx1|\n i = idx1\n while i < arr.length\n result << arr[idx1..i]\n i += 1\n end\n end\n\n largest_sum = result.first.inject(:+)\n result.each do |sub_arr|\n curr_sum = sub_arr.inject(:+)\n largest_sum = curr_sum if curr_sum > largest_sum\n end\n largest_sum\nend", "def largest_contiguous_subsum(nums)\n running_sum = 0\n max = nums.first || 0\n\n nums.each do |n|\n running_sum += n\n max = running_sum if max < running_sum\n running_sum = 0 if running_sum < 0\n end\n max\nend", "def largest_contiguous_subsum(arr)\n\n\nend", "def largest_contiguous_subsum_n_2(arr)\n subs = []\n arr.each_with_index do |el1, i|\n arr.each_with_index do |el2, j|\n if j > i \n subs << arr[i..j]\n end\n end\n end\n subs\n x = subs.max_by {|arr| arr.sum}\n x.sum\nend", "def largest_contiguous_subsum2(list)\n largest_sum = list[0]\n current_sum = 0\n# list = [2, 3, -6, 7, -6, 7]\n list.each do |number|\n current_sum += number\n if current_sum > largest_sum\n largest_sum = current_sum\n elsif current_sum < 0\n current_sum = 0\n end\n end\n largest_sum\nend", "def largest_contiguous_subsum1(int_list)\n sub_arrays = []\n\n (0...int_list.length).each do |idx1|\n (idx1...int_list.length).each do |idx2|\n sub_arrays << int_list[idx1..idx2]\n end\n end\n\n sub_arrays.each_with_index do |arr, idx|\n sum_arr = arr.sum\n sub_arrays[idx] = sum_arr\n end\n\n sub_arrays.max\nend", "def largest_contiguous_subsum_1(arr)\n res = []\n i = 0\n while i < arr.length\n j = i\n while j < arr.length\n res << arr[i..j].reduce(:+)\n j += 1\n end\n i += 1\n end\n res.max\nend", "def largest_contiguous_subsum(arr)\n subs = []\n l = arr.length\n (0...l).each do |i|\n (0...l).each do |j| \n subs << arr[i..j] if arr[i..j].length > 0 # n*n *( n) == n^3 + n\n end\n end\n subs.map(&:sum).max\nend", "def largest_contiguous_subsum_n(list2)\n large = 0\n \n list2.inject do |sum, n|\n if (sum + n) > sum\n sum += n \n large = sum if sum > large\n sum\n else\n sum = 0\n end\n end\n\n large\nend", "def largest_contiguous_subsum(arr)\n max_sum = arr.first\n\n (0...arr.length).each do |start|\n (start...arr.length).each do |ending|\n sum = arr[start..ending].sum\n max_sum = sum if sum > max_sum\n end\n end\n\n max_sum\nend", "def largest_contiguous_subsum_two(list)\n largest_sum = list[0]\n current_sum = 0\n # list.inject {|acc, ele| acc + ele}\n list.each do |ele|\n current_sum = [ele, current_sum + ele].max\n largest_sum = [largest_sum, current_sum].max\n end\n largest_sum\nend", "def largest_contiguous_subsum(arr)\n max = 0\n\n (0...arr.count).each do |i|\n sum = arr[i]\n (i + 1...arr.count).each do |j|\n sum += arr[j]\n max = sum if max < sum \n end \n end \n\n max\nend", "def largest_contiguous_subsum(arr)\n max = arr.first\n arr.each_index do |idx1|\n (idx1+1..arr.length).each do |idx2|\n sub_arr = arr[idx1...idx2]\n sum = sub_arr.reduce(:+)\n max = sum if max < sum \n end\n\n end\n max\nend", "def largest_contiguous_subsum(array)\n previous_sum = 0\n current_sum = 0\n array.each_with_index do |el, i|\n\n current_sum = previous_sum + el\n if previous_sum < 0\n if el < previous_sum\n current_sum = previous_sum\n else\n current_sum = el\n end\n end\n\n previous_sum = current_sum\n end\n\n current_sum\nend", "def largest_contiguous_subsum_1(arr)\n largest = []\n (0...arr.length).each do |i|\n (i...arr.length).each do |j|\n largest << arr[i..j]\n end\n end\n sums = largest.map do |sub_array|\n sub_array.sum\n end\n sums.max\nend", "def better_largest_contiguous_subsum(list)\n current_largest_sum = 0\n current_sum = 0\n return list.max if list.all? {|ele| ele < 0}\n\n (0...list.length).each do |i |\n # debugger\n #add current element to current sum\n current_sum += list[i]\n\n #if current sum is less than 0 ignore it and reset to move on to next number\n if ( current_sum < 0 ) \n current_sum = 0\n end \n # if current sum is greater than our current largest sum, we want to keep it\n if current_sum > current_largest_sum\n current_largest_sum = current_sum\n end\n end\n current_largest_sum\nend", "def largest_contiguous_subsum(arr)\n answer = []\n arr.each_with_index do |ele1,idx1|\n arr.each_with_index do |ele2,idx2|\n answer << arr[idx1..idx2].sum \n end\n end\n answer.sort[-1]\nend", "def largest_contiguous_subsum(array)\n current_sum = array.first\n largest_sum = array.first\n array.each do |num|\n current_sum += num\n if largest_sum < current_sum\n largest_sum = current_sum\n end\n end\n largest_sum\nend", "def largest_contiguous_subsum(arr)\n i = 0\n subs = []\n while i < arr.length\n j = i\n\n while j < arr.length\n subs << arr[i..j]\n\n j += 1\n end\n\n i += 1\n end\n\n\n return (subs.max {|a, b| a.sum <=> b.sum}).sum\n\nend", "def largest_contiguous_subsum(arry)\n sums = 0\n size = arry.length\n\n (0..size - 1).each do | i|\n sub = []\n (i + 1..size).each do |j|\n sub = arry[i..j]\n if sub.sum > sums\n sums = sub.sum \n end\n end\n end\n sums\nend", "def largest_contiguous_subsum(arr)\n current_sum = arr.first \n max_sum = arr.first \n (0...arr.length-1).each do |i|\n if current_sum < 0 \n current_sum = [current_sum, arr[i+1]].max\n max_sum = current_sum\n else \n current_sum += arr[i+1]\n max_sum = [current_sum, max_sum].max\n end \n end \n max_sum\nend", "def largest_contiguous_subsum(array)\n arr = []\n (0...array.length).each do |i|\n (i + 1...array.length).each do |j|\n arr << array[i] + array[j] \n end\n end\n arr.max\n \nend", "def largest_contiguous_subsum(array)\n sub_arrs = []\n array.each_index do |ind1|\n array[ind1..-1].each_index do |ind2|\n sub_arrs.push(array[ind1..ind2+ind1])\n end\n end\n max_sum = sub_arrs.first.sum\n sub_arrs.each {|sub| max_sum = sub.sum if sub.sum >= max_sum }\n return max_sum\nend", "def largest_contiguous_subsum(arr)\r\n # sub_arr = []\r\n # (0...arr.length).each do |idx|\r\n # (idx...arr.length).each do |idx_2| \r\n # sub_arr << arr[idx..idx_2]\r\n # end\r\n # end\r\n # p sub_arr.length \r\n # sub_arr.map {|sub| sub.sum }.max\r\n max = arr.first #8\r\n curr = arr.first #8\r\n arr.drop(1).each do |ele| \r\n curr = 0 if curr < 0\r\n curr += ele\r\n max = curr if curr > max\r\n end\r\n max\r\nend", "def largest_contiguous_subsum_2(arr)\n sum = 0\n max = 0\n arr.each do |num|\n sum += num\n if sum > 0\n max = sum if sum > max\n else\n sum = 0\n end\n end\n max\nend", "def largest_contiguous_subsum_fast(arr)\n global_max = arr.first\n prev_max = arr.first\n\n arr.drop(1).each do |el|\n curr_max = (prev_max + el > el) ? (prev_max + el) : el\n prev_max = curr_max\n global_max = curr_max if curr_max > global_max\n end\n global_max\nend", "def largest_contiguous_sub_sum3(arr)\n\n largest_sum = arr.first\n current_sum = arr.first\n\n (1...arr.length).each do |index|\n current_num = arr[index]\n prev_num = arr[index-1]\n\n if largest_sum < current_num\n largest_sum = current_num\n end\n\n current_sum = current_sum + current_num\n prev_sum = prev_num + current_num\n\n if prev_sum > current_sum\n current_sum = prev_sum\n end\n\n if largest_sum < current_sum\n largest_sum = current_sum\n end\n end\n largest_sum\nend", "def largest_contiguous_subsum(arr)\n \n curr_sum = arr.first\n largest_sum = arr.first\n (1...arr.length).each do |i| \n if curr_sum < 0\n curr_sum = 0 #reset\n end\n\n curr_sum += arr[i] \n \n if curr_sum > largest_sum \n largest_sum = curr_sum\n end\n end\n largest_sum\nend", "def largest_contiguous_subsum(arr)\n subsets = [] \n\n (0...arr.length).each do |i| \n (i...arr.length).each do |j| \n subsets << arr[i..j]\n end \n end \n \n subsets.map {|sub| sub.sum}.max \nend", "def largest_contiguous_subsum(arr)\n max = arr[0]\n current = 0\n (0...arr.length).each do |i|\n current += arr[i]\n max = current if current > max\n current = 0 if current < 0\n end\n max\nend", "def best_largest_contiguous_subsum(arr)\n return arr.max if arr.max < 0\n largest = 0\n current = 0\n\n\n (0..(arr.length-1)).each do |idx1|\n if current + arr[idx1] < 0\n current = arr[idx1]\n else\n current += arr[idx1]\n end\n\n largest = current if current > largest\n end\n largest\nend", "def largest_contiguous_subsum(arr)\n sum = 0\n arr_indices = []\n running_sums = []\n arr.each_with_index do |num,idx|\n sum += num \n arr_indices << idx \n running_sums << sum\n end \n running_sums.max\n\nend", "def largest_contiguous_subsum(arr)\n global_sum = arr.first\n # p \"global = #{global_sum}\"\n i = 0\n pot = 0\n while i < arr.length\n pot += arr[i]\n global_sum = pot if global_sum < pot\n pot = 0 if pot < 0\n i += 1\n end\n global_sum\nend", "def largest_contiguous_sum(array)\n subsets = []\n subarr = []\n\n\n array.each_index do |i|\n array.each_index do |j|\n next if j < i\n subsets << array[i..j] unless subsets.include? array[i..j]\n end\n end\n sum = 0\n subsets.each do |sarr|\n next if sarr.empty?\n sum = [sarr.inject(:+), sum].max\n end\n sum\nend", "def largest_contiguous_subsum_2(arr)\n (1...arr.length).each do |i|\n if arr[i] + arr[i - 1] > 0\n arr[i] = arr[i] + arr[i - 1]\n elsif arr[i] < 0 && arr[i-1] < 0\n arr[i] = [arr[i-1], arr[i]].max\n else\n arr[i] = 0\n end\n end\n\n arr.max\nend", "def largest_contiguous_sub_sum1(arr)\n subarrays = []\n arr.each_with_index do |num1, i|\n arr.each_with_index do |num2, j|\n subarrays << arr[i..j] if i <= j\n end\n end\n\n subarrays.map! do |subarray|\n subarray.sum\n end\n\n subarrays.sort[-1]\nend", "def largest_con_subsum_2(list)\n largest = list.first\n contiguous_sum = list.first\n\n i = 1\n \n while i < list.length\n current = list[i]\n contiguous_sum += current\n if contiguous_sum > largest\n largest = contiguous_sum \n elsif current > largest\n largest = current\n \n end\n contiguous_sum = 0 if contiguous_sum < 0\n i += 1 \n \n end\n return largest\nend", "def largest_contiguous_subsum2(arr)\n max = arr[0]\n current = arr[0]\n arr.drop(1).each do |num|\n current += num\n max = current if current > max\n current = 0 if current < 0\n end\n max\nend", "def largest_contiguous_subsum(array)\n new_arr = []\n (0...array.length).each do |idx1|\n sum = [array[idx1]]\n new_arr << sum\n (idx1+1...array.length).each do |idx2|\n sum += [array[idx2]]\n new_arr << sum\n end\n end\n\n sums = []\n new_arr.each do |pair|\n sums << pair.sum\n end\n\n sums.max\nend" ]
[ "0.9279769", "0.92475915", "0.91537136", "0.91229916", "0.9107171", "0.9104064", "0.9073092", "0.9022264", "0.9003899", "0.8973464", "0.89464563", "0.8937978", "0.89025164", "0.89018273", "0.8894797", "0.88861483", "0.88847995", "0.88820446", "0.88765436", "0.88742787", "0.8870281", "0.88661397", "0.88643926", "0.8855745", "0.8844029", "0.88402486", "0.88364655", "0.8835374", "0.88164514", "0.880136", "0.8777996", "0.877736", "0.87738544", "0.87609893", "0.8759311", "0.87551355", "0.8746975", "0.8730025", "0.8721655", "0.87190706", "0.8716778", "0.8714459", "0.8713239", "0.87119913", "0.8711541", "0.87075686", "0.8704286", "0.8702983", "0.86943734", "0.869354", "0.8690076", "0.86836904", "0.866907", "0.86235577", "0.8616037", "0.8613305", "0.8604763", "0.8596796", "0.8594608", "0.85905445", "0.8587192", "0.85852647", "0.85626316", "0.85592556", "0.8555506", "0.8552049", "0.8544015", "0.85422873", "0.85415643", "0.85320854", "0.8530435", "0.85227895", "0.85074794", "0.8505366", "0.8503099", "0.84897125", "0.8489322", "0.8485301", "0.8476116", "0.8465915", "0.84357613", "0.84314954", "0.8411707", "0.8410534", "0.8409769", "0.8408633", "0.83991474", "0.8395194", "0.8393228", "0.8377207", "0.8363903", "0.83602744", "0.8348053", "0.83463776", "0.8338046", "0.83360237", "0.8335767", "0.8313043", "0.8301243", "0.8300514" ]
0.88750684
19
Add a tag with the given key and data value to all collections matching the query condition. If append is true, this method will append the value to any existing data (if not already present), rather than overwriting it. The optional block gets passed Arrayuniq to determine whether a piece of data is already present in the tag. Newer versions of data will overwrite older ones.
def add_tag(key, value, condition, token, append=false, only_granules=true, &block) query = tag_condition_to_query(condition) # https://bugs.earthdata.nasa.gov/browse/CMR-2855 will fix the need for some of this logic # https://bugs.earthdata.nasa.gov/browse/CMR-2609 as well if value.present? || only_granules query_params = {include_tags: key, include_has_granules: true} response = json_query_collections(condition, token, query_params) return response unless response.success? && response.body['feed']['entry'].present? entries = response.body['feed']['entry'] entries = entries.select {|entry| entry['has_granules']} if only_granules assoc_data = nil if append data = Array.wrap(value) assoc_data = entries.map do |entry| tags = entry['tags'] data = Array.wrap(tags[key]['data']) + data if tags && tags[key] # Ensure no duplicate values and that newer values overwrite older ones data = data.reverse.uniq(&block).reverse {'concept-id' => entry['id'], 'data' => data} end elsif value.present? assoc_data = entries.map { |entry| {'concept-id' => entry['id'], 'data' => value} } else assoc_data = entries.map { |entry| {'concept-id' => entry['id']} } end if assoc_data.present? response = post("/search/tags/#{key}/associations", assoc_data.to_json, token_header(token)) end else response = post("/search/tags/#{key}/associations/by_query", query.to_json, token_header(token)) end response end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def append_with(name)\n prepare do\n document[field] = [] unless document[field]\n docs = document.send(field).concat(value.__array__)\n execute(name)\n docs\n end\n end", "def append(key, value); end", "def append(key, value); end", "def append!(key, value); end", "def append!(key, value); end", "def append(value, hash, array)\n key = array[1]\n hash[value[:key]] = { flags: value[:flags], exptime: value[:exptime], value: hash[key][:value] + value[:value], cas_unique: value[:cas_unique] }\n value[:reply] != 'false' ? (self.result = \"\\r\\nSTORED\") : (self.result = '')\n end", "def append(key, value)\n perform(:append, key, value.to_s)\n end", "def add_to_db input, key = nil, opts = {}\n #TODO: Handle repeating a already selected key (raise an error or return nil?)\n # input.each { |i| add_to_db(i) } if input.is_a? Array\n\t\tkey ||= opts[:key]\n\t\tthe_key = case\n\t\t\twhen key.nil? then assign_key(input)\n\t\t\twhen key.is_a?(Database::Reference::Variable) then key.value\n\t\t\telse\n\t\t\t\tkey\n\t\t\tend\n\t\tif db.has_key?(the_key)\n\t\t\treturn the_key if db[the_key] == input\n\t\t\tcase opts[:if_in_use]\n\t\t\t\t#Append to the set after adding to this db\n\t\t\t\twhen :append\t\t\t\tthen add_to_db(input,key); db[the_key].add(input)\n\t\t\t\twhen :overwrite then db[the_key] = input\n\t\t\t\twhen :destroy_entry then destroy_entry(db[the_key]); db[the_key] = input\n\t\t\t\twhen :destroy_input then input.destroy_self(); return nil\n\t\t\t\twhen nil\t then raise \"Attempted to overwrite an already existing key\"\n\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t\t ## TODO: Create an error class for this\n\t\t\tend\n\t\telse\n\t\t\tdb[the_key] = input\n\t\tend\n\t\tinput.set_key(the_key,self) if input.is_data?\n\t\treturn the_key\n end", "def append_uniq!(weekly, key, element)\n weekly[key] = (weekly[key] << element).flatten.uniq\n end", "def append(key, value)\n send_command([:append, key, value])\n end", "def append(new_data)\n end", "def append!\n self.operation = :append\n end", "def add_tag(tag)\n\n (h.fields['__tags__'] ||= []) << tag\n end", "def append_attribute(key_, value_)\n attribute(key_, value_, :append)\n end", "def deep_merge!(other_hash, append: :auto, &block)\n\t\t\t\treturn self unless other_hash\n\t\t\t\tother_hash.each_pair do |k,v|\n\t\t\t\t\ttv = self[k]\n\t\t\t\t\tcase\n\t\t\t\t\twhen tv.is_a?(Hash) && v.is_a?(Hash)\n\t\t\t\t\t\tself[k] = tv.deep_merge(v, &block)\n\t\t\t\t\twhen tv.is_a?(Array) && v.is_a?(Array)\n\t\t\t\t\t\tif append==:auto and v.length > 0 && v.first.nil? then\n\t\t\t\t\t\t\t#hack: if the array begins with nil, we append the new\n\t\t\t\t\t\t\t#value rather than overwrite it\n\t\t\t\t\t\t\tv.shift\n\t\t\t\t\t\t\tself[k] += v\n\t\t\t\t\t\telsif append && append != :auto\n\t\t\t\t\t\t\tself[k] += v\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tself[k] = block && tv ? block.call(k, tv, v) : v\n\t\t\t\t\t\tend\n\t\t\t\t\twhen tv.nil? && v.is_a?(Array)\n\t\t\t\t\t\t#here we still need to remove nil (see above)\n\t\t\t\t\t\tif append==:auto and v.length > 0 && v.first.nil? then\n\t\t\t\t\t\t\tv.shift\n\t\t\t\t\t\t\tself[k]=v\n\t\t\t\t\t\telse\n\t\t\t\t\t\t\tself[k] = block && tv ? block.call(k, tv, v) : v\n\t\t\t\t\t\tend\n\t\t\t\t\telse\n\t\t\t\t\t\tself[k] = block && tv ? block.call(k, tv, v) : v\n\t\t\t\t\tend\n\t\t\t\tend\n\t\t\t\tself\n\t\t\tend", "def append_to_association(association_map, key, datum_to_append, opts = {})\n if opts[:coord] # we will be interacting with the associations of a part of a collection if coord is specified\n association_map.putrc(opts[:coord][0], opts[:coord][1], key, []) if association_map.getrc(opts[:coord][0], opts[:coord][1], key).nil?\n association_map.getrc(opts[:coord][0], opts[:coord][1], key) << datum_to_append\n else\n association_map.put(key, []) if association_map.get(key).nil?\n association_map.get(key) << datum_to_append\n end\n end", "def append(aName,aDataArray,aValue,reply)\n i = searchKey(aName,aDataArray[1])\n if i != '' then\n beforeValue = serv_data[i].values[0].values[0][0]\n nowValue = beforeValue + aValue.chop\n updateKey(aName,aDataArray,nowValue,i)\n returnStorage(reply,true)\n else\n returnStorage(reply,false)\n end\n end", "def add_tags(*tags)\n @hash_tags.concat(tags.flatten)\n end", "def with_tag_data( newhash={} )\n\t\traise LocalJumpError, \"no block given\" unless block_given?\n\t\t# self.log.debug \"Overriding tag state with: %p\" % [ newhash ]\n\n\t\tbegin\n\t\t\t@tag_data.push( @tag_data.last.merge(newhash) )\n\t\t\tyield( self )\n\t\tensure\n\t\t\t@tag_data.pop\n\t\tend\n\tend", "def append value\n add_idx = empty? ? 0 : last_key + 1\n self[add_idx] = value\n end", "def add_to_set(adds)\n prepare_atomic_operation do |ops|\n process_atomic_operations(adds) do |field, value|\n existing = send(field) || attributes[field]\n if existing.nil?\n attributes[field] = []\n # Read the value out of attributes:\n # https://jira.mongodb.org/browse/MONGOID-4874\n existing = attributes[field]\n end\n values = [ value ].flatten(1)\n values.each do |val|\n existing.push(val) unless existing.include?(val)\n end\n ops[atomic_attribute_name(field)] = { \"$each\" => values }\n end\n { \"$addToSet\" => ops }\n end\n end", "def append(key, length, data)\n end", "def handle_key_append(key, value, cfg_dir, list_keys, path_keys, cfg)\n this_value = handle_key(key, value, cfg_dir, list_keys, path_keys, cfg)\n cfg[key] = [] unless cfg.has_key?(key)\n\n begin\n cfg[key].concat(this_value).uniq!\n rescue NoMethodError\n end\n end", "def uniq(&block)\n append(Unique.new(&block))\n end", "def add_attr attr_name\n return false if (attrs.nil? || attrs.include?(attr_name))\n attrs << attr_name\n items.each do |item| \n item[:data] << nil\n item[:ori_data] << nil if item.has_key?(:ori_data)\n end\n true\n end", "def update_tag_keyword(keyword,tags_set=[],args={})\n @tag_keyword[keyword] += tags_set\n @tag_blck[:keyword][keyword] += new_tags_set if args[:mode] && args[:mode] == :blck\n end", "def find_or_add(item)\n self << item unless include?(item) || include_from_query?(item)\n item\n end", "def append(key, value)\n node_for(key).append(key, value)\n end", "def add_qs k,v,p={}; alter_qs :add, k,v,p; end", "def <<(hash={})\n merge! hash\n end", "def active_serialize_add *attrs, named: nil, to: nil, group: nil\n active_serialize_map attrs[0] => named if named\n return _active_serialize[:groups][group] = attrs.map(&:to_sym) if group\n _active_serialize[to || :add].concat attrs.map(&:to_sym)\n end", "def add_or_merge_value(name, value)\n @attrs ||= {}\n\n unless @attrs[name]\n @attrs[name] = value\n else\n old_value = @attrs[name]\n\n collection = (old_value + value).flatten\n group = collection.group_by { |h| h[:id] || h['id'] }\n\n @attrs[name] = group.map { |_k, v| v.reduce(:merge) }\n end\n end", "def append(item)\n items << item unless items.include?(item)\n end", "def << hdata\n hdata.each{ |name,value| @querystring << \"#{name}=#{value}\" }\n end", "def <<(hash={})\r\n merge! hash\r\n end", "def add_keyword\n @item.keywords = @bib.keyword.map(&:content).join(\", \") if @bib.keyword.any?\n end", "def <<(key)\n key_to_hashes(key).each { |hash| filter.set!(hash) }\n self\n end", "def append(cql, *bind_vars)\n @cql << cql\n @bind_vars.concat(bind_vars)\n self\n end", "def add?(key)\n hashes = key_to_hashes(key).reject { |hash| filter.set?(hash) }\n hashes.each { |hash| filter.set!(hash) }\n hashes.any?\n end", "def addExtraURITag(key,value) \n\t\tself._querytext.push([key,value])\t\n\tend", "def append(model, data)\n data.group_by { |row| row[:record_id] }.each do |record_id, changes|\n @records << Record.new(model, record_id, changes.map { |c| c.slice(:column_name, :value, :changed_at)})\n end\n @length = nil\n self\n end", "def append_comment_tag_hash_array(hash)\n @comment_tag_hash_array << hash\n end", "def append(path, data)\n append_all(path, [data])\n end", "def add_tags(new_tags)\n case new_tags\n when Array # Called with an array\n # Call recursively for each entry\n new_tags.each do |tag_hash|\n add_tags(tag_hash)\n end\n when Hash # Called with a hash\n #check if it is weird {'k' => 'key', 'v' => 'value'} syntax\n if (new_tags.size == 2 && new_tags.keys.include?('k') && new_tags.keys.include?('v'))\n # call recursively with values from k and v keys.\n add_tags({new_tags['k'] => new_tags['v']})\n else\n # OK, this seems to be a proper ruby hash with a single entry\n new_tags.each do |k,v|\n self.tags[k] = v\n end\n end\n end\n self # return self so calls can be chained\n end", "def group_append(*columns, &block)\n columns = @opts[:group] + columns if @opts[:group]\n group(*columns, &block)\n end", "def do_merge(env, key, value)\n\n if value.is_a?(Hash)\n env.attributes[key].merge(value)\n else\n if env.attributes[key].blank?\n # Add to_s to value to stop solr storing values \n # as ints and then refusing other types at a \n # later date (e.g. long)\n env.attributes[key] = Array.wrap(value)\n else\n env.attributes[key].concat(Array.wrap(value))\n end\n end\n env\n end", "def append(options = {})\n if entry = find_entry_by_ip_address(options[:ip_address])\n hosts = normalize(entry.hostname, entry.aliases, options[:hostname], options[:aliases])\n entry.hostname = hosts.shift\n entry.aliases = hosts\n\n unless entry.comment && options[:comment] && entry.comment.include?(options[:comment])\n entry.comment = normalize(entry.comment, options[:comment]).join(', ')\n end\n\n remove_existing_hostnames(entry) if options[:unique]\n else\n add(options)\n end\n end", "def << bindata\n count = @data.size < bindata.size ? @data.size : bindata.size\n (0...count).each do |i|\n Utils.string_setbyte @data,i,Utils.string_getbyte(bindata,i)\n end\n end", "def aggregate_tags!\n map = \"function() {\n if (!this.#{tags_field}) {\n return;\n }\n\n for (index in this.#{tags_field}) {\n emit(this.#{tags_field}[index], 1);\n }\n }\"\n\n reduce = \"function(previous, current) {\n var count = 0;\n\n for (index in current) {\n count += current[index]\n }\n\n return count;\n }\"\n\n map_reduce_options = { :out => tags_aggregation_collection }.\n merge(tag_aggregation_options)\n collection.master.map_reduce(map, reduce, map_reduce_options)\n end", "def hashed(tag, exclude=false)\n @query[:q] << \"#{exclude ? \"-\" : \"\"}\\##{tag}\"\n self\n end", "def collect_query(query, options = {})\n return query unless block_given?\n\n uniq = options[:uniq].nil? ? false : options[:uniq]\n keys = Set.new\n\n delims = query.scan(/(^|&|;)/).flatten\n query.split(/[&;]/).collect.with_index do |pairs, i|\n key, value = pairs.split('=', 2)\n key, value = yield(key, value, delims[i])\n if uniq && keys.include?(key)\n ''\n elsif key && value\n \"#{delims[i]}#{key}=#{value}\"\n elsif key\n \"#{delims[i]}#{key}\".tap { keys << key }\n # rubocop:disable Lint/DuplicateBranch\n else\n ''\n end\n # rubocop:enable Lint/DuplicateBranch\n end.join.sub(/^[&;]/, '')\n end", "def add_each_to_set(adds)\n view.update_many(\"$addToSet\" => collect_each_operations(adds))\n end", "def _merge_when(hash, &block)\n hash[:conditions] = Sequel.virtual_row(&block) if block\n\n if merge_when = @opts[:merge_when]\n clone(:merge_when => (merge_when.dup << hash.freeze).freeze)\n else\n clone(:merge_when => [hash.freeze].freeze)\n end\n end", "def add(hash)\n batch << hash\n\n if batch.count % batch_size == 0\n solr_service_connection.add(batch, softCommit: soft_commit, commit: commit)\n batch.clear\n end\n end", "def push_all(*args)\n if args.length == 1 && args.first.is_a?(Hash)\n query.update_all(\"$push\" => collect_each_operations(args.first))\n else\n query.update_all(\"$push\" => { database_field_name(args[0]) => { \"$each\" => Array.wrap(args[1]) } })\n end\n end", "def append(str, file, opts = {})\n file = expand_path(file)\n if opts[:uniq] and exists? file\n # Check to ensure the file does not contain the line already.\n begin\n grep(str, file) or raise\n rescue\n # We're clear, go ahead.\n tee '-a', file, :stdin => str\n end\n else\n # No need to check, just append.\n tee '-a', file, :stdin => str\n end\n end", "def process_append(command)\n key = command.first\n val = command[1]\n @connection.append(as_key(key), {@bin => val})\n\n @connection.execute_udf(as_key(key), REDIS_UDF, 'strlen', [::Aerospike::StringValue.new(@bin)])\n rescue ::Aerospike::Exceptions::Aerospike => e\n if (e.result_code == ::Aerospike::ResultCode::KEY_EXISTS_ERROR)\n return 0\n else\n raise\n end\n end", "def add_tags(new_tags)\n new_tags.each do |k, v|\n self.tags[k.to_s] = v\n end\n self\n end", "def append(*args)\n assert_exists\n assert_writable\n\n @element.send_keys(*args)\n end", "def tag_append_one(name)\n tag = Tag.find_or_create_by_name(name)\n tag.on(self) unless tags.include? tag\n end", "def tags_to_add=(value)\n @tags_to_add = value\n end", "def hash_add! tables, item_key, item_value\n if tables.has_key? item_key then\n tables[item_key] += item_value\n else\n tables.store item_key, item_value\n end\nend", "def add( toAdd )\n if toAdd.is_a?(Hash) # if toAdd is a hash\n toAdd.each do |keyWord, value|\n @entries[ keyWord ] = value # add as hash\n end\n else\n @entries[ toAdd ] = nil # if toAdd is NOT a hash, use keyword, as toAdd, to add a nil value\n end\n end", "def add_op\n\t\t\tring = current_ring\n\t\t\top = (self.respond_to?(:op) && self.op || params[:op])\n\t\t\tmodel = KojacUtils.model_class_for_key(op[:key].base_key)\n\t\t\traise \"ADD only supports associated collections at present eg order.items\" unless op[:key].index('.')\n\n\t\t\titem = KojacUtils.model_for_key(op[:key].base_key)\n\t\t\tassoc = (assoc=op[:key].key_assoc) && assoc.to_sym\n\t\t\tid = op[:value]['id']\n\n\t\t\tma = item.class.reflect_on_association(assoc)\n\t\t\tcase ma.macro\n\t\t\t\twhen :has_many\n\t\t\t\t\tassoc_class = ma.klass\n\t\t\t\t\tassoc_item = assoc_class.find(id)\n\t\t\t\t\titem.send(assoc) << assoc_item\n\n\t\t\t\t\t#ids_method = assoc.to_s.singularize+'_ids'\n\t\t\t\t\t#ids = item.send(ids_method.to_sym)\n\t\t\t\t\t#item.send((ids_method+'=').to_sym,ids + [id])\n\t\t\t\t\tresult_key = assoc_item.kojac_key\n\t\t\t\t\tmerge_model_into_results(assoc_item)\n\t\t\t\telse\n\t\t\t\t\traise \"ADD does not yet support #{ma.macro} associations\"\n\t\t\tend\n\t\t\t{\n\t\t\t\tkey: op[:key],\n\t\t\t verb: op[:verb],\n\t\t\t result_key: result_key,\n\t\t\t results: results\n\t\t\t}\n\t\tend", "def collect_query(query, options = {})\n return query unless block_given?\n uniq = options[:uniq].nil? ? false : options[:uniq]\n keys = Set.new\n\n delims = query.scan(/(^|&|;)/).flatten\n query.split(/[&;]/).collect.with_index do |pairs, i|\n key, value = pairs.split('=', 2)\n key, value = yield(key, value, delims[i])\n if uniq && keys.include?(key)\n ''\n elsif key && value\n \"#{delims[i]}#{key}=#{value}\"\n elsif key\n \"#{delims[i]}#{key}\".tap { keys << key }\n else\n ''\n end\n end.join.sub(/^[&;]/, '')\n end", "def append(data=nil,hold_open=false,&block)\n open_append(hold_open) {|f|block ? yield(f) : f.write(data)}\n end", "def add(tag, value)\n datastore.zadd(tag, 0, value)\n end", "def appendHelper(temp, appended)\n if temp.cdr.is_a? Pair\n appendHelper(temp.cdr, appended)\n elsif temp.cdr.nil?\n temp.setcdr(appended)\n else\n temp.setcdr(cons(temp.cdr, appended))\n end\n\tend", "def push(value, key = value, &block)\n @driver.push(value, key, &block)\n end", "def push(value, key = value, &block)\n @driver.push(value, key, &block)\n end", "def add relation, &block\n b = relation.factorization.to_bin\n @mutex.synchronize do\n if @uniqe[b]\n @relations << relation\n @uniqe[b] = false\n end\n yield if block_given? # executes the given code block\n end\n end", "def add(tag)\n return nil if tag.nil?\n get_list(tag) << tag\n end", "def linsert(key, where, pivot, value); end", "def linsert(key, where, pivot, value); end", "def add_key_data(key_data_); end", "def <<(tag)\n add(tag)\n end", "def add_tag(tag)\n @added_tags ||= Set.new\n @added_tags << tag\n end", "def push(key=nil, content=nil, &block)\n content, key = key, self.key if content.nil?\n (content ||= '') << block.call if block_given?\n @items[key] ||= []\n @items[key] << content\n end", "def file_set_append\n # Append the array of file metadata values to any FileSets with new FileNodes being appended\n parent.file_metadata += file_nodes\n file_nodes\n end", "def add(elem)\n return if @non_uniq.include? elem\n if @uniq.include? elem\n @uniq.delete elem\n @non_uniq.add elem\n else\n @uniq.add elem\n end\n end", "def append(album)\r\n @internal_list.push(album)\r\n \r\n self\r\n end", "def append_or_prepend(_method_, key, value)\n check_readonly!\n\n cache_key = make_cache_key(key)\n value = value.to_s\n\n old = quote_column_name(:value)\n new = quote_value(:value, value)\n pairs = {\n :value => concat_sql(*(_method_ == :append ? [old, new] : [new, old]))\n }\n\n affected_rows = @ar.connection.update(\n update_sql(cache_key, pairs, true, nil),\n sql_name(_method_)\n )\n\n affected_rows > 0 ? STORED : NOT_STORED unless @no_reply\n end", "def append *arg\n\t\t\t\n\t\t\t@orient.update { \"set #{@name.to_s} = #{@name} || #{arg.to_or} \"}[@name] if check_if_complete\n\t\t\t@orient.reload!\n\t\tend", "def append_tags\n self.text += (\" \"+self.tag_string) if !self.tag_string.blank?\n true\n end", "def append_tags\n self.text += (\" \"+self.tag_string) if !self.tag_string.blank?\n true\n end", "def append(key, time)\n Sidekiq.redis do |conn|\n conn.lpush(namespace_key(key), time.to_i)\n end\n end", "def append!(element)\n\t\t\trpc(:append, [@id, element.to_html])\n\t\tend", "def add(key, value)\n update_array(key, value, :add)\n end", "def insert(key, attrs)\n elements = self[key]\n if elements\n elements.merge!(attrs)\n else\n self[key] = key.singular? ? attrs : [attrs]\n end\n end", "def add_tag_to_node_group(ng_hash, tag_name, login, password_callback=PasswordCallback)\n tag_found = get_objects({:objecttype => 'tags', :exactget => {:name => tag_name}})\n if tag_found.empty?\n tagset_data = { :name => tag_name }\n set_objects('tags',{},tagset_data,login, password_callback)\n tag_found = get_objects({:objecttype => 'tags', :exactget => {:name => tag_name}})\n end\n # tag_found is hash, even tho only one result\n (tag_data = tag_found[tag_found.keys.first]) && (tag_id = tag_data['id'])\n ng_hash.each_pair do |ng_name,ng_data|\n setdata = { :taggable_type => 'NodeGroup', :taggable_id => ng_data['id'], :tag_id => tag_id }\n set_objects('taggings',{},setdata,login,password_callback)\n end\n end", "def merge!(hash={}, &block)\n @static_options = Variables.merge( @static_options, handle_array_and_deprecate(hash) )\n @dynamic_options = block if block_given?\n\n self\n end", "def <<(value)\n connection.rpush key_label, value\n end", "def append(value)\n end", "def append(data)\n append_array = data.split\n append_array.each do |item|\n if list.allowed(item)\n @list.append(item)\n else\n 0\n end\n end\n end", "def append_option(key, *value)\n @options[key] = ((@options[key] || []) + [value]).flatten\n end", "def add_element(key, value = nil, &block)\n key_node = Niceogiri::XML::Node.new(key)\n @xml.add_child(key_node)\n if block\n block.call(key_node)\n else\n key_node.content = value if value\n end\n key_node\n end", "def add_meta_data(meta_hash)\n meta.merge! meta_hash\n end", "def append_data(data)\n data = Encoding::ASCII_8BIT == data.encoding ? data : data.htb\n chunks << Tapyrus::Script.pack_pushdata(data)\n self\n end", "def search_data\n attributes.merge(tags: tags)\n end", "def handle_adding_tag(tag, tags)\n if tags.include?(tag)\n puts \"Warning: duplicate tag #{tag} detected\"\n else\n tags.push(tag)\n end\n return tags\n end" ]
[ "0.5391321", "0.52631164", "0.52631164", "0.5191369", "0.5191369", "0.5127608", "0.5097426", "0.5065116", "0.4988599", "0.49810627", "0.4977901", "0.4927516", "0.49184278", "0.49057356", "0.4896496", "0.4853333", "0.48265657", "0.47767368", "0.47651803", "0.47464642", "0.47261503", "0.47101462", "0.46843323", "0.4668761", "0.46687272", "0.46453696", "0.4642885", "0.46426532", "0.46340898", "0.4612101", "0.4585724", "0.4535393", "0.45282692", "0.45275956", "0.45238948", "0.44916704", "0.4491003", "0.44791532", "0.44765708", "0.4471212", "0.4466008", "0.44400257", "0.44333744", "0.442915", "0.44242755", "0.4421706", "0.44116774", "0.43875557", "0.43563107", "0.43515572", "0.4350799", "0.43463284", "0.4339244", "0.43341595", "0.4330722", "0.43270993", "0.4326087", "0.43228954", "0.4319722", "0.43085852", "0.43050656", "0.43019733", "0.42975107", "0.42969114", "0.42964542", "0.42934525", "0.4285683", "0.42835984", "0.4273972", "0.4273972", "0.42685527", "0.42599022", "0.42590535", "0.42590535", "0.42578274", "0.42512769", "0.42469734", "0.42412382", "0.42337906", "0.42229715", "0.42213944", "0.42202252", "0.420954", "0.42086127", "0.42086127", "0.42062697", "0.41998985", "0.41995382", "0.41923475", "0.41904488", "0.41873392", "0.41702524", "0.41656673", "0.41654965", "0.41650954", "0.4164996", "0.41625628", "0.41482136", "0.414394", "0.4143343" ]
0.5498181
0
The number of citizen not engaged in color pass in args
def citizens_ready_in(color) citizens.where(:color => color, :engaged => false).count end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def count_pieces(color)\n color == \"red\" ? whites_count : reds_count\n end", "def lnbColor _args\n \"lnbColor _args;\" \n end", "def diversity\n color_count.keys\n end", "def students_with_brown_eyes(eye_colors)\n\tbrown_eyes = 0\n\n\teye_colors.each do |eye_color|\n \t\tif eye_color == \"Brown\"\n\t\t\tbrown_eyes += 1\n\t\tend\n\tend\n\n\treturn brown_eyes\n\nend", "def nc\n Ncurses::COLOR_PAIR(@id)\n end", "def count_brown_eyes (eye_colors)\n\tn = 0\n\teye_colors.each do |eye_color|\n\t\tif eye_color == \"Brown\"\n\t\t\tn += 1\n\t\tend\n\tend\n\n\treturn n\nend", "def assign_game_color count\n case count\n when 0\n return \"transparent\"\n when 6\n return $app_red\n else\n return $app_blue\n end\n end", "def numColor(number)\n if(number > 0)\n return 'green'\n elsif(number < 0)\n return 'red'\n else\n return ''\n end\n end", "def color_counts\n color_counts = Hash.new(0)\n @pegs.each do |color|\n color_counts[color] += 1\n end\n color_counts\n end", "def count\n { value: @count, color: \"gray\" }\n end", "def as_red\n @red += 1\n end", "def yellow\n colorize(33)\n end", "def text_color(n)\n case n\n when Integer then super(n)\n when Array then Color.new(*n)\n when Color then n\n else super(0)\n end\n end", "def engaged_citizens(color, num)\n citizens.where(:color => color).limit(num).update_all(:engaged => true)\n end", "def red\n colorize(31)\n end", "def display_color_index\n require_color_echo_get\n\n CE.rainbow\n cnt = 134\n @padding = \" \" * 2\n\n header = \"OK, Let me check color index list... :)\"\n mes = CE.rainbow.get(@padding + \"-\" * cnt) + $/\n mes += @padding + \" \" * ((cnt - header.size)/2) + CE.rainbow.get(header) + $/\n mes += CE.rainbow.get(@padding + \"-\" * cnt) + $/\n\n mes += @padding\n 256.times do |i|\n num = i + 1\n mes += CE.fg(\"index#{num}\".intern).get(\"index#{num}\" + \" \" * (4 - num.to_s.size))\n mes += CE.bg(\"index#{num}\".intern).get(\" \" * 5)\n mes += \" \" * 3\n\n if num % 8 == 0\n mes += $/ * 2\n mes += @padding if num != 256\n end\n end\n print mes \n\n exit 0\nend", "def determine_color\n colors = {'Red' => 0, 'Green' => 0, 'Yellow' => 0, 'Blue' => 0}\n @hand.each do |card|\n colors[card.suit] += 1\n end\n return colors.key(colors.values.max)\n end", "def scan_for_colors; end", "def counter(*args)\n identifier(\"counter(#{args.map {|a| a.to_s(options)}.join(',')})\")\n end", "def duns_number; end", "def crisis_color\n return text_color(17)\n end", "def as_blue\n @blue += 1\n end", "def color(color); end", "def green\n colorize(32)\n end", "def much_green?(colors) ; colors[1] > 200 ; end", "def colors; end", "def success(*args)\n color(32, *args)\n end", "def color_in_board(board, color)\n counter = 0\n\n board.each do |array|\n array.each do |element|\n counter += 1 if color == element\n end\n end\n\n return counter\nend", "def cyan\n colorize(36)\n end", "def count_correct_colors\r\n total_correct_color_count = Hash.new(0)\r\n guess.length.times do |i|\r\n total_correct_color_count[guess[i]] += 1 if total_correct_color_count[guess[i]] < code_count[guess[i]]\r\n end\r\n total_correct_sum = 0\r\n total_correct_color_count.each { |k,v| total_correct_sum += v }\r\n total_correct_sum\r\n end", "def lnbSetColor _args\n \"lnbSetColor _args;\" \n end", "def colors(warm, cool)\n puts \"#{warm} is a contrast color to #{cool}\"\nend", "def counters(*args)\n identifier(\"counters(#{args.map {|a| a.to_s(options)}.join(',')})\")\n end", "def color_critical(n, critical, options = {})\n options = { :normal => \"#ff8700\", :critical => \"red\" }.merge(options)\n if n.to_i == 0\n n.to_s\n elsif n.to_i < critical\n _color(options[:normal], n.to_i)\n else\n _color(options[:critical], n.to_i)\n end\n end", "def sheep_count(num)\n \nend", "def green(text)\n colorize(text, 32)\nend", "def purple\n colorize(35)\n end", "def cyan; if @options[:colors]; \"\\e[1;36m\" else \"\" end end", "def qualified_color(candidates)\n candidates.each do |candidate| \n if experience?(candidate) && languages?(candidate) && last_15_days?(candidate) && over_17?(candidate)\n puts candidate.to_s.green\n else\n puts candidate.to_s.red\n end\n end\nend", "def warning(*args)\n color(33, *args)\n end", "def colorized?; end", "def getNbRecompense\n return 0\n end", "def red(text)\n colorize(text, 31)\nend", "def detected_styles=(_arg0); end", "def computer_code_acquisition\n @code_length.times.map { @colors.sample }\n end", "def count_correct_colors\n colors_by_difficulty.each do |color|\n if @code_guess.count(color) < @secret_code.count(color)\n @white_peg += @code_guess.count(color)\n else\n @white_peg += @secret_code.count(color)\n end\n end\n end", "def inc_c\n end", "def badge_counter\n @badges.count { |badge| badge == true }\n end", "def green; end", "def green; end", "def calculate_color\n\n self.color || color_by_title\n end", "def count=(_arg0); end", "def rank_of_colour\r\n COLOURS.each_with_index do |colour, i|\r\n if colour == @colour\r\n return i\r\n end\r\n end\r\n raise \"colour not found: #{@colour}\"\r\n end", "def ab_counts(_experiment, _alternative)\n raise \"Not implemented\"\n end", "def bg_red; use_code(41) end", "def style_notif_count(num)\n\t return \"\" if !num.is_a? Integer\n\t return \"font-size:5px;\" if num > 99\n\t return \"font-size:10px;\" if num > 9\n\tend", "def digit_count(titles)\n Math.log10(titles.size).to_i + 1\n end", "def initialize(color) #instance method\n @color = color #instance variable\n @price = nil #(have to put nil, otherwise it will give an error)\n @@counter += 1\n end", "def initialize(color) #instance method\n @color = color #instance variable\n @price = nil #(have to put nil, otherwise it will give an error)\n @@counter += 1\n end", "def color\n\t\t \t\t\t\"El color de tu vaca es #{@color}\"\n\t\t \t\tend", "def size\r\n @colours.size\r\n end", "def captiveNum _args\n \"captiveNum _args;\" \n end", "def colors\n return\n end", "def color; end", "def color; end", "def color; end", "def counting\n puts \"hard to do right\"\n end", "def chco\n (foreground || \"FFFFFF\") + \",\" + super\n end", "def painting_count\n self.paintings.length\n end", "def count_road_networks(cities:)\n result = cities\n result % 663_224_321\nend", "def color(*values); end", "def color(*values); end", "def red\n colorize(:red)\nend", "def check_color(guess)\n count = 0\n guess.upcase.chars.uniq.each do |char| \n if @secret_code.include? char\n count += 1 \n end\n end\n return count \n end", "def tvCount _args\n \"tvCount _args;\" \n end", "def error(*args)\n color(31, *args)\n end", "def count_gold\n us.gold = gets.to_i\n them.gold = gets.to_i\n end", "def count_gold\n us.gold = gets.to_i\n them.gold = gets.to_i\n end", "def info(*args); say $terminal.color(format(*args), :yellow); end", "def cyan(str)\n color(36, str)\n end", "def translate_color_to_num(color)\n case color\n when \"b\"\n 1\n when \"w\"\n 2\n when \"r\"\n 3\n when \"g\"\n 4\n end\n end", "def countEnemy _obj, _args\n \"_obj countEnemy _args;\" \n end", "def tally\n return \"\"\n\n text = \"%s concerns: %s passed, %s failed, %s errored (%s/%s assertions)\"\n total = @passed.size + @failed.size + @raised.size\n text = text % [total, @passed.size, @failed.size, @raised.size, $assertions - $failures, $assertions]\n if @failed.size > 0\n text.ansi(:red)\n elsif @raised.size > 0\n text.ansi(:yellow)\n else\n text.ansi(:green)\n end\n end", "def initialize(number, color)\n @number = number\n @color = color\n end", "def count_correct_positions\n color_index_checker = []\n @code_guess.each_with_index do |color, index|\n if color == @secret_code[index]\n @red_peg += 1\n end\n end\n end", "def comic_count\r\n \tsorted_articles.length\r\n end", "def sockMerchant(n, ar)\nsock_colors = Hash.new { | hash, key | hash[key] = 0 }\n\nar.each { | color | sock_colors[color] += 1 }\n\npairs = 0\nsock_colors.each_value { | sock_count | pairs += (sock_count / 2) }\n\nputs pairs\nreturn pairs\n\nend", "def initialize(*args) # Inicializador de los atributos invocado automáticamente por el constructor\n case args.size\n when 0\n @marcha=0\n @color=\"gris\"\n when 2\n @marcha, @color =args\n end\n @kilometrosRecorridos= 0\n Bicicleta.incrementarNumeroBicicletas\n @NUMEROSERIE=@@NumeroBicicletas+1 \n end", "def method_missing(name, *args)\n if @colours.include? name\n \"#{@colours[name]}#{args[0]}\\033[0m\"\n else\n \"#{@default}#{args[0]}\\033[0m\"\n end\n end", "def visionColors\n @colors = @json[\"responses\"][0][\"imagePropertiesAnnotation\"][\"dominantColors\"][\"colors\"]\n @color_rgb = []\n @color_scores = []\n\n @colors.each do |color|\n @color_rgb << color[\"color\"]\n @color_scores << color[\"score\"] * 100\n end\n\n # Find aggregare value of color scores and stretch to 100 if necessary\n color_percent = 0\n @color_scores.each { |a| color_percent+=a }\n if color_percent < 100 \n percent_diff = (100 - color_percent)\n @color_scores.map do |score|\n score = (score + (percent_diff/10))\n end\n end\n end", "def getMarkerColor _args\n \"getMarkerColor _args;\" \n end", "def door_count; end", "def inqtextcolorind\n inquiry_int { |pt| super(pt) }\n end", "def inqtextcolorind\n inquiry_int { |pt| super(pt) }\n end", "def cnt_bold(c)\n \"#{c}\"\n end", "def completion(boardGame, oldColor)\n count = 0.0;\n (0..boardGame.length - 1).each do |i|\n (0..boardGame[i].length - 1).each do |j|\n if boardGame[i][j] == oldColor then\n count += 1\n end\n end \n end\n return ((count/(boardGame.length*boardGame[0].length))*100.0).floor\nend", "def orangeCount\n return @oranges\n end", "def calc_num_vals\n # Get the hex string for each value.\n hex_alpha = (@alpha.to_s(16)).color_string\n hex_red = (@red.to_s(16)).color_string\n hex_green = (@green.to_s(16)).color_string\n hex_blue = (@blue.to_s(16)).color_string\n # Construct a hex string (only compatible with surfaces other than\n # the window) using the previously determined hex colors. Not sure\n # how alpha comes in here yet... I'll figure it out.\n surf_color_string = hex_red + hex_green + hex_blue\n @surface_num_val = surf_color_string.to_i(16)\n # *Note:* SDL's color format for the display is different than other\n # ordinary surfaces. It is: +BBGGRRAA+.\n display_color_string = hex_blue + hex_green + hex_red + hex_alpha\n @display_num_val = display_color_string.to_i(16)\n end", "def badges_count\n badges.count\n end", "def calculate_color_probabilities(adversary = nil)\n adversary ||= default_adversary\n\n Uno::COLORS.each do |col|\n p = @stack.select { |c| c.color == col }.length.to_f\n @prob_cache[col] = has_card_with_property p, adversary\n end\n end" ]
[ "0.6854763", "0.6338841", "0.62112564", "0.61960584", "0.6104309", "0.60489833", "0.60388446", "0.5973139", "0.5876759", "0.5823264", "0.57989615", "0.57937104", "0.57759714", "0.5770552", "0.5724761", "0.5696262", "0.5661501", "0.5639451", "0.5629358", "0.56132853", "0.5605812", "0.56017584", "0.55864376", "0.55581886", "0.55254954", "0.55245966", "0.54649854", "0.54627633", "0.54480374", "0.54462165", "0.543015", "0.5421096", "0.5419099", "0.5416258", "0.54100984", "0.5404092", "0.5388708", "0.5380693", "0.53692293", "0.53537756", "0.53420556", "0.53329176", "0.53034145", "0.5296332", "0.52899575", "0.52898073", "0.5287316", "0.52636874", "0.5260391", "0.5260391", "0.5259856", "0.5256032", "0.5249093", "0.52485013", "0.52469915", "0.52337325", "0.5212288", "0.52059907", "0.52059907", "0.5205395", "0.519951", "0.51972103", "0.5187355", "0.5183607", "0.5183607", "0.5183607", "0.5181928", "0.5177746", "0.5174085", "0.51714116", "0.51695496", "0.51695496", "0.516296", "0.516006", "0.5153778", "0.51496464", "0.5147517", "0.5147517", "0.51427346", "0.51425624", "0.51375663", "0.513368", "0.51324445", "0.5131383", "0.5128192", "0.5127864", "0.51182747", "0.511084", "0.5109884", "0.5098361", "0.5095682", "0.50945234", "0.5091324", "0.5091324", "0.5089374", "0.5088796", "0.5080885", "0.5080762", "0.50801873", "0.5080018" ]
0.6579883
1
Engaged citizen of color and in number pass in args
def engaged_citizens(color, num) citizens.where(:color => color).limit(num).update_all(:engaged => true) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def lnbColor _args\n \"lnbColor _args;\" \n end", "def color(*values); end", "def color(*values); end", "def color(color); end", "def colors(warm, cool)\n puts \"#{warm} is a contrast color to #{cool}\"\nend", "def qualified_color(candidates)\n candidates.each do |candidate| \n if experience?(candidate) && languages?(candidate) && last_15_days?(candidate) && over_17?(candidate)\n puts candidate.to_s.green\n else\n puts candidate.to_s.red\n end\n end\nend", "def success(*args)\n color(32, *args)\n end", "def colors; end", "def colorized?; end", "def yellow\n colorize(33)\n end", "def color(*args)\n @instructions << Instruction.new(:color, args)\n self\n end", "def lnbSetColor _args\n \"lnbSetColor _args;\" \n end", "def rgb(*args); end", "def rgb(*args); end", "def colorChange(couleur)\n @color=couleur\n apply\n end", "def text_color(n)\n case n\n when Integer then super(n)\n when Array then Color.new(*n)\n when Color then n\n else super(0)\n end\n end", "def call(*args)\n value = args.join\n @color.decorate(value, *styles)\n end", "def color; end", "def color; end", "def color; end", "def green(text)\n colorize(text, 32)\nend", "def blue(text)\n colorize(text, 34)\nend", "def method_missing(name, *args)\n if @colours.include? name\n \"#{@colours[name]}#{args[0]}\\033[0m\"\n else\n \"#{@default}#{args[0]}\\033[0m\"\n end\n end", "def red(text)\n colorize(text, 31)\nend", "def numColor(number)\n if(number > 0)\n return 'green'\n elsif(number < 0)\n return 'red'\n else\n return ''\n end\n end", "def calculate_color\n\n self.color || color_by_title\n end", "def red\n colorize(:red)\nend", "def scan_for_colors; end", "def colorize *args\n $terminal.color(*args)\nend", "def interpret(num) \n case num\n when 0\n \"red\"\n when 1\n \"blue\"\n when 2\n \"green\"\n when 3\n \"yellow\"\n when 4\n \"black\"\n when 5\n \"white\" \n end\n end", "def color_for (arg)\n arg = Yummi::Context::new(arg) unless arg.is_a? Context\n call(arg)\n end", "def cyan; if @options[:colors]; \"\\e[1;36m\" else \"\" end end", "def colorize(*args)\n shell.set_color(*args)\n end", "def info(*args); say $terminal.color(format(*args), :yellow); end", "def purple\n colorize(35)\n end", "def update!(**args)\n @color = args[:color] if args.key?(:color)\n end", "def lbColor _obj, _args\n \"_obj lbColor _args;\" \n end", "def getColor(c)\n if c == \"r\" then return :red\n elsif c == \"b\" then return :blue\n elsif c == \"g\" then return :green\n elsif c == \"y\" then return :yellow\n elsif c == \"c\" then return :cyan\n elsif c == \"m\" then return :magenta\n end\nend", "def red\n colorize(31)\n end", "def color(point, screen)\n screen[point[0]][point[1]]\nend", "def crisis_color\n return text_color(17)\n end", "def colorize!; @colors = true; end", "def initialize(*c)\n if !c[0] then @color = pick_color else @color = c[0] end\n end", "def color\n\t\t \t\t\t\"El color de tu vaca es #{@color}\"\n\t\t \t\tend", "def bold(*args)\n color('1', *args)\n end", "def bg_red; use_code(41) end", "def tutu_color(color) \n\t\tp \"your tutu color has changed to #{color}\"\n\tend", "def hsla_color; end", "def green; end", "def green; end", "def green\n colorize(32)\n end", "def colors_from_params(match, params); end", "def about\n @color = params[:color]\n end", "def initialize(number, color)\n @number = number\n @color = color\n end", "def display_color_index\n require_color_echo_get\n\n CE.rainbow\n cnt = 134\n @padding = \" \" * 2\n\n header = \"OK, Let me check color index list... :)\"\n mes = CE.rainbow.get(@padding + \"-\" * cnt) + $/\n mes += @padding + \" \" * ((cnt - header.size)/2) + CE.rainbow.get(header) + $/\n mes += CE.rainbow.get(@padding + \"-\" * cnt) + $/\n\n mes += @padding\n 256.times do |i|\n num = i + 1\n mes += CE.fg(\"index#{num}\".intern).get(\"index#{num}\" + \" \" * (4 - num.to_s.size))\n mes += CE.bg(\"index#{num}\".intern).get(\" \" * 5)\n mes += \" \" * 3\n\n if num % 8 == 0\n mes += $/ * 2\n mes += @padding if num != 256\n end\n end\n print mes \n\n exit 0\nend", "def getMarkerColor _args\n \"getMarkerColor _args;\" \n end", "def much_green?(colors) ; colors[1] > 200 ; end", "def text_color(param)\n begin \n colour = case param\n when Integer then super(param) rescue normal_color\n when Symbol then send(param) rescue normal_color\n when Array then Color.new(*param) rescue normal_color\n else\n normal_color\n end\n end\n colour.is_a?(Color) ? colour : normal_color\n end", "def students_with_brown_eyes(eye_colors)\n\tbrown_eyes = 0\n\n\teye_colors.each do |eye_color|\n \t\tif eye_color == \"Brown\"\n\t\t\tbrown_eyes += 1\n\t\tend\n\tend\n\n\treturn brown_eyes\n\nend", "def ptit_fraze_hala_kon(a)\n\t\tcase a\n\t\twhen 1\n\t\t\tputs \"tricheur\".colorize(:red) \n\t\twhen 2\n\t\t\tputs \"tu t'es trompé\".colorize(:red) \n\t\tend\n\tend", "def initialize(red, green, blue, alpha = 1.0); end", "def initialize(color={:cyan=> 1 ,:magenta => 0, :yellow => 0, :black => 0})\n @color=color\n end", "def cyan\n colorize(36)\n end", "def nc\n Ncurses::COLOR_PAIR(@id)\n end", "def red\n end", "def output_color(text, color=text.to_i)\r\n # Color matches: 1 - Black; 2 - White; 3 - Red; 4 - Yellow; 5 - Green; 6 - Blue; 7 - Gold\r\n colors = { 1 => 30, 2 => 36, 3 => 31, 4 => 33, 5 => 35, 6 => 34, 7 => 220 }\r\n # \\e[47m Is for the grey foreground \\e[{color} is for picking the color and \\e[0m is for resetting the terminal.\r\n \"\\e[1m\\e[47m\\e[#{colors[color]}m#{text}\\e[0m\\e[22m\"\r\n end", "def color(*options)\n mix = []\n color_seen = false\n\n if options.empty?\n mix << random(false) # random foreground color\n else\n options.each{ |option|\n case option\n when Symbol\n if ANSI_EFFECTS.keys.include?(option)\n mix << effect(option)\n elsif ANSI_COLORS.keys.include?(option)\n mix << simple(option, color_seen)\n color_seen = true\n else\n raise ArgumentError, \"Unknown color or effect: #{ option }\"\n end\n\n when Array\n if option.size == 3 && option.all?{ |n| n.is_a? Numeric }\n mix << rgb(*(option + [color_seen])) # 1.8 workaround\n color_seen = true\n else\n raise ArgumentError, \"Array argument must contain 3 numerals\"\n end\n\n when ::String\n if option =~ /^#?(?:[0-9a-f]{3}){1,2}$/\n mix << hex(option, color_seen)\n color_seen = true\n else\n mix << name(option, color_seen)\n color_seen = true\n end\n\n when Numeric\n integer = option.to_i\n color_seen = true if (30..49).include?(integer)\n mix << integer\n\n when nil\n color_seen = true\n \n else\n raise ArgumentError, \"Invalid argument: #{ option.inspect }\"\n\n end\n }\n end\n\n wrap(*mix)\n end", "def count_pieces(color)\n color == \"red\" ? whites_count : reds_count\n end", "def yellow(output)\n color(33, output)\n end", "def rgb_color; end", "def cyan(str)\n color(36, str)\n end", "def enter_colors\n speak\n guess\n end", "def citizens_ready_in(color)\n citizens.where(:color => color, :engaged => false).count\n end", "def creator_ai_input\n return Colors.sample(4)\n end", "def initialize(*args) # Inicializador de los atributos invocado automáticamente por el constructor\n case args.size\n when 0\n @marcha=0\n @color=\"gris\"\n when 2\n @marcha, @color =args\n end\n @kilometrosRecorridos= 0\n Bicicleta.incrementarNumeroBicicletas\n @NUMEROSERIE=@@NumeroBicicletas+1 \n end", "def foreground(*values); end", "def foreground(*values); end", "def cyan(output)\n color(36, output)\n end", "def initialize(color)#recibe el color de brown\n p super# trae el comportamiento de la superclase con los valores de name\n p @color = color #el valor de colo lo declaramos como variable de instancia\n end", "def color_critical(n, critical, options = {})\n options = { :normal => \"#ff8700\", :critical => \"red\" }.merge(options)\n if n.to_i == 0\n n.to_s\n elsif n.to_i < critical\n _color(options[:normal], n.to_i)\n else\n _color(options[:critical], n.to_i)\n end\n end", "def red; end", "def red; end", "def color(*args)\n say HighLine.default_instance.color(*args)\n end", "def green\n end", "def update!(**args)\n @blue = args[:blue] if args.key?(:blue)\n @green = args[:green] if args.key?(:green)\n @max_luminance = args[:max_luminance] if args.key?(:max_luminance)\n @min_luminance = args[:min_luminance] if args.key?(:min_luminance)\n @red = args[:red] if args.key?(:red)\n @white_point = args[:white_point] if args.key?(:white_point)\n end", "def color_pick\n if mark_ratio < (day_parameter + least_mark_ratio)\n color = \"#C7E6F2\" #light color below average performance\n elsif mark_ratio >= ((2*day_parameter) + least_mark_ratio)\n color = \"#44bbdf\" #dark color excellent perfomance\n else\n color = \"#70c9e5\" #meduim color average performance\n end \n return color \n end", "def color\n case (@code.to_i / 100)\n when 2\n color = :green\n when 3\n color = :yellow\n when 4, 5\n color = :red\n else\n color = :blue\n end\n color\n end", "def error(*args)\n color(31, *args)\n end", "def chco\n (foreground || \"FFFFFF\") + \",\" + super\n end", "def warning(*args)\n color(33, *args)\n end", "def color\n case news_type\n when 'critical', 'love', 'angry' then 'red'\n when 'info' then 'blue'\n when 'warning' then 'orange'\n when 'success' then 'green'\n when 'disconcert' then 'purple'\n when 'tech' then '#555555'\n when 'premium' then '#FFCC00'\n else\n 'primary'\n end\n end", "def red(output)\n color(31, output)\n end", "def assign_game_color count\n case count\n when 0\n return \"transparent\"\n when 6\n return $app_red\n else\n return $app_blue\n end\n end", "def as_blue\n @blue += 1\n end", "def printColorHelp()\n\tputs \"Red looks like this\".red()\n\tputs \"Green looks like this\".green()\n\tputs \"Yellow looks like this\".yellow()\n\tputs \"Blue looks like this\".blue()\n\tputs \"Magenta looks like this\".magenta()\n\tputs \"Cyan looks like this\".cyan()\n\tputs \"Complements are:\"\n\tputs \"Red and Cyan\"\n\tputs \"Green and Magenta\"\n\tputs \"Blue and Yellow\"\n\tputs \"When prompted for 'color', enter the color in which the word appears\"\n\tputs \"When prompted for 'word', enter the word that is written\"\n\tputs \"Please enter all data in lowercase and in a single line when \"\\\n\t\"prompted for two words\"\n\tputs \"Once you have attained the required points for a given level, \"\\\n\t \"you will be asked if you want to skip to the next level\"\n\tputs \"I apologize to all the colorblind folks out there!\"\nend", "def processed_color\n if(self.processed == \"1\")\n return \"green\"\n else\n return \"red\"\n end\n\n end", "def update!(**args)\n @color = args[:color] if args.key?(:color)\n @priority_override = args[:priority_override] if args.key?(:priority_override)\n end", "def colors\n Color.all.each_with_index do |color, i|\n puts \"#{i + 1}. #{color.name}\"\n end\n\n puts \"\\nType the number of the color to see a list of the associated crystals.\"\n puts \"To go back, type 'menu'.\\n\\n\"\n\n input = gets.strip.downcase\n if input == 'menu'\n elsif input.to_i > 0 && (input.to_i - 1) < Color.all.length\n index = input.to_i - 1\n # Show list of crystals for a given color\n c = Color.all[index]\n Color.crystals(c).each_with_index do |crystal, i|\n puts \"#{i + 1}. #{crystal.name}\"\n end\n\n puts \"\\nTo learn more about a crystal, type the number.\"\n input = gets.strip.downcase\n if input.to_i > 0 && (input.to_i - 1) < Color.crystals(c).length\n index = input.to_i - 1\n crystal = Color.crystals(c)[index]\n # Show info for given crystal\n crystal_info(crystal)\n end\n else\n puts 'Try one of these options:'\n colors\n end\n end", "def candy(sweet)\n yellow = sweet * 1000\n blue = yellow / 100\n red = blue / 50\n return yellow, blue, red\nend", "def set(red, green, blue, alpha = nil); end" ]
[ "0.67970896", "0.6783184", "0.6783184", "0.6774985", "0.6691556", "0.6352747", "0.6285676", "0.62644666", "0.6262144", "0.62046254", "0.61578137", "0.61045384", "0.61030763", "0.61030763", "0.60950005", "0.6093154", "0.605942", "0.6049151", "0.6049151", "0.6049151", "0.60030836", "0.5993457", "0.59515375", "0.59332246", "0.5928445", "0.59239024", "0.5902223", "0.588121", "0.58780557", "0.5877083", "0.58547485", "0.58509606", "0.5850899", "0.58492863", "0.58491755", "0.5842953", "0.5837173", "0.5836444", "0.5825782", "0.58124167", "0.5780231", "0.57777953", "0.5758061", "0.5735215", "0.5731804", "0.5727657", "0.5727227", "0.5710025", "0.57043576", "0.57043576", "0.5699203", "0.5697628", "0.56900865", "0.56889117", "0.5687574", "0.56862587", "0.5684231", "0.5678038", "0.5676793", "0.56589365", "0.5658095", "0.5643077", "0.5635235", "0.56314075", "0.56273407", "0.56228137", "0.5587418", "0.55855584", "0.5575697", "0.5570348", "0.5549617", "0.5546189", "0.5541827", "0.55384076", "0.55331314", "0.5530149", "0.5530149", "0.5527569", "0.5526408", "0.5525247", "0.55249894", "0.55249894", "0.55237937", "0.551163", "0.5511454", "0.550625", "0.550588", "0.5496431", "0.5493306", "0.549276", "0.549217", "0.5488796", "0.5487506", "0.5483561", "0.54818213", "0.54781747", "0.54731977", "0.547189", "0.54672444", "0.546368" ]
0.59550256
22
Return the IP associated with this record if it can be deduced from the record name
def ip ip = nil unless valid? return nil end begin case name when /\.in-addr\.arpa$/ name_without_suffix = name.sub(/\.in-addr\.arpa$/, '') quads = name_without_suffix.split('.') if quads.size == 4 quads.reverse! ip = quads.join('.') end when /\.ip6\.arpa$/ name_without_suffix = name.sub(/\.ip6\.arpa$/, '') nibbles = name_without_suffix.split('.') nibbles.each do |nibble| if nibble.empty? raise DnsRecord::EmptyNibbleError end end if nibbles.size == 32 n = nibbles.reverse! ip = \ n[0..3].join('') + ":" + n[4..7].join('') + ":" + n[8..11].join('') + ":" + n[12..15].join('') + ":" + n[16..19].join('') + ":" + n[20..23].join('') + ":" + n[24..27].join('') + ":" + n[28..31].join('') ip = NetAddr::CIDR.create(ip).ip(:Short => true) end end rescue DnsRecord::EmptyNibbleError ip = nil end ip end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def name\n ip_address\n end", "def name\n ip_address\n end", "def get_ip(ip_name, resource_group = armrest_configuration.resource_group)\n get(ip_name, resource_group).properties.ip_address\n end", "def ptr(ip)\n # use cache if ip was already resolved\n return @cache[ip] if @cache[ip]\n\n begin\n name = @hypedns.getname(ip).to_s\n @cache[ip] = name\n return name\n rescue Resolv::ResolvError, SocketError\n return nil\n end\n end", "def kvm_ip(name)\n addr = ip_by_mac(node_mac(name))\n addr.empty? ? ip_by_mount(name) : addr\nend", "def to_ipaddr\n unless ip_addr?\n lookup = `host #{to_s} | grep address`.split(/\\s+/)\n return to_s unless lookup.length == 4\n lookup[3]\n else \n to_s\n end\n end", "def ipaddress\n @network_payload['IP']\n end", "def ipaddr?; end", "def ip\n @attributes[:ip]\n end", "def ip\n @attributes[:ip]\n end", "def hostname\n if resolution = CloudModel::AddressResolution.where(ip: ip).first\n resolution.name\n else\n begin\n Resolv.getname(ip)\n rescue\n ip\n end\n end\n end", "def ip\n @data[\"ip\"]\n end", "def ip?(ip_or_name)\n # Get address always returns an IP, so if nothing changes this was one\n Resolv.getaddress(ip_or_name) == ip_or_name\n rescue Resolv::ResolvError\n false\n end", "def parse_ip\n @request[FHOST] || BLANK_STR\n end", "def ip_address_record(env)\n data_type = env[:machine].provider_config.private_only ? \"primaryBackendNetworkComponent\" : \"primaryNetworkComponent\"\n data_type = \"primaryBackendNetworkComponent\" if env[:machine].provider_config.force_private_ip\n mask = \"#{data_type}.primaryIpAddressRecord.id,#{data_type}.primaryIpAddressRecord.ipAddress\"\n record = sl_warden { env[:sl_machine].object_mask(\"mask[#{mask}]\").getObject }\n return {\n :address => record[data_type][\"primaryIpAddressRecord\"][\"ipAddress\"],\n :id => record[data_type][\"primaryIpAddressRecord\"][\"id\"]\n }\n end", "def ipaddress\n @attributes.fetch('ipaddress', nil)\n end", "def private_ip_address\n private_ip_addresses.first\n end", "def public_ip_address\n public_ip_addresses.first\n end", "def ip?\n return (proto == 'ip')\n end", "def ip_address(env)\n ip_address_record(env)[:address]\n end", "def ip\n @ip ||= select { |type,value| type == :ip }.map do |(type,value)|\n IPAddr.new(value)\n end\n end", "def reverse_name_lookup(ip, type = :A)\n # look for all the zones\n type = type.to_sym if type.class != Symbol\n dns_name = String.new\n @dns.domains.each do |zone|\n @dns.domains.get(zone.id).records.each do | record |\n if record.data == ip and record.type.to_sym == type\n dns_name = record.name\n break\n end\n end\n end\n return dns_name\n end", "def ip\n if (ip = @host.at('tag[name=host-ip]'))\n ip.inner_text\n end\n end", "def name\n if ipv4?\n \"[#{ip_address}]\"\n elsif ipv6?\n \"[IPv6:#{ip_address}]\"\n elsif @config[:host_encoding] && @config[:host_encoding] == :unicode\n ::SimpleIDN.to_unicode(host_name)\n else\n dns_name\n end\n end", "def ip\n if ifconfig =~ /inet addr:([0-9.]+)/\n $1\n else\n \"0.0.0.0\"\n end\n end", "def get_ip_address(name, eth)\n if ( eth_iface = network[:interfaces][eth] )\n eth_iface[:addresses].each do |key, info|\n linode[name] = key if info[\"family\"] == \"inet\"\n end\n end\n end", "def public_ip_address\n data[:public_ip_address]\n end", "def get_ip_address\n rpc_get_fact_direct('host_ip')\n end", "def ip_address\n Socket.ip_address_list.find { |ai| ai.ipv4? && !ai.ipv4_loopback? }.ip_address\n end", "def address(public_ip)\n addresses(public_ip)[0]\n end", "def get_public_ip_address\n rpc_get_fact_direct('public_ip')\n end", "def ip\n container.json['NetworkSettings']['IPAddress'] || 'N/A'\n rescue NoMethodError\n 'N/A'\n end", "def ip\n @ip ||= Socket.ip_address_list.detect{|intf| intf.ipv4_private?}.ip_address\n end", "def get_ip_address(name, eth)\n if eth_iface = network[:interfaces][eth]\n eth_iface[:addresses].each do |key, info|\n jpc2[name] = key if info['family'] == 'inet'\n end\n end\nend", "def ip_address; end", "def ip_address; end", "def ip_address; end", "def ip_address; end", "def ip_address; end", "def ip_address; end", "def ip_address_or_f_q_d_n\n return @ip_address_or_f_q_d_n\n end", "def ip(args = nil)\n if args and args[:meta]\n meta = args[:meta]\n elsif httpsession = Thread.current[:hayabusa][:httpsession]\n meta = httpsession.meta\n else\n raise \"Could not figure out meta-data.\"\n end\n \n if !meta[\"HTTP_X_FORWARDED_FOR\"].to_s.strip.empty? and ips = meta[\"HTTP_X_FORWARDED_FOR\"].split(/\\s*,\\s*/)\n return ips.first.to_s.strip\n elsif ip = meta[\"REMOTE_ADDR\"].to_s.strip and !ip.empty?\n return ip\n else\n raise \"Could not figure out IP from meta-data.\"\n end\n end", "def ip_v4_address; end", "def get_ip_address(type)\n network[:interfaces].each do |iface, info|\n next unless info['type'] == 'eth'\n info[:addresses].each do |addr, detail|\n next unless detail['family'] == 'inet'\n case type\n when :public_ip\n return addr if !is_private?(addr)\n when :private_ip\n return addr if is_private?(addr)\n end\n end\n end\n return nil\n end", "def ip\n @ip ||= @node.search('IP/listEntry').map(&:inner_text)\n end", "def public_ip_v4_address; end", "def get_gandi_ipv4\n get_record('A') if ipv4_available?\n end", "def ipsource\n lanconfig[\"ip address source\"].downcase!\n end", "def ip\n unless @vm\n warn 'No Vm assigned to locate IP'\n return\n end\n @ip ||= detect_ip\n end", "def ip\n @values.fetch('ai.device.ip') { \n @values['ai.device.ip'] = nil\n }\n end", "def is_ipaddr?\n begin\n ip = IPAddr.new(self)\n return ip.to_s == self\n rescue ArgumentError\n return false\n end\n end", "def public_ip\n get('tools/public_ip').body['ipv4'] || get('tools/public_ip').body['ipv6']\n end", "def ipaddr(iface=nil)\n @ipaddr[iface || default_iface]\n end", "def ipaddress\n resolve.nil? || resolve.empty? ? nil : resolve\n end", "def ipaddr; end", "def get_ip_address(name, eth)\n network[:interfaces][eth][:addresses].each do |key, info|\n rackspace[name] = key if info['family'] == 'inet'\n end\nend", "def member_get_ip(pool_member)\n server_ip = begin\n if pool_member.attribute?('cloud')\n if node.attribute?('cloud') && (pool_member['cloud']['provider'] == node['cloud']['provider'])\n pool_member['cloud']['local_ipv4']\n else\n pool_member['cloud']['public_ipv4']\n end\n else\n pool_member['ipaddress']\n end\n end\n server_ip\nend", "def public_ip() ; info[:public_ip] ; end", "def find_private_ip\n ip_addresses = interface_addresses\n ip_addresses.each do |ip|\n if ip.start_with?(\"192\") || ip.start_with?(\"10\")\n return ip\n end\n end\n return nil\n end", "def extract_ip(addrinfo)\n addrinfo[2]\n end", "def primary_institution_from_ip\n Institutions.with_ip(request.remote_ip).first unless request.nil?\n end", "def ip_address\n @ip_address ||= nil\n end", "def get_ip(node)\n provisioning.ipaddress(node)\n end", "def old_ip_address?\n dns.any? do |answer|\n answer.class == Net::DNS::RR::A && LEGACY_IP_ADDRESSES.include?(answer.address.to_s)\n end if dns?\n end", "def get_internal_ip_address\r\n sock = UDPSocket.new\r\n sock.connect('1.0.0.1', 1) #@igd_location.split('//').last.split('/').first.split(':').first\r\n return sock.addr.last\r\n rescue Exception\r\n return \"127.0.0.1\"\r\n end", "def peer_ip\n peername[0]\n end", "def ip_address\n # Does not work for now as the vmx path is not escape correctly by fission 0.4.0\n #return raw.network_info.data.first['ip_address']\n raise ::Fission::Error,\"VM #{name} does not exist\" unless self.exists?\n \n # Use alternate method to retrieve the IP address using vmrun readVariable\n \n ip_address = shell_exec(\"vmrun readVariable \\\"#{vmx_file_path}\\\" guestVar ip\", { :mute => true})\n return ip_address.stdout.strip\n \n # unless mac_address.nil?\n # lease = Fission::Lease.find_by_mac_address(mac_address).data\n # return lease.ip_address unless lease.nil?\n # return nil\n # else\n # # No mac address was found for this machine so we can't calculate the ip-address\n # return nil\n # end\n end", "def ip_address\n raise ::Fission::Error,\"VM #{@name} does not exist\" unless self.exists?\n\n unless mac_address.nil?\n lease=LeasesFile.new(\"/var/db/vmware/vmnet-dhcpd-vmnet8.leases\").find_lease_by_mac(mac_address)\n if lease.nil?\n return nil\n else\n return lease.ip\n end\n else\n # No mac address was found for this machine so we can't calculate the ip-address\n return nil\n end\n end", "def query_ip\n @attributes[:query_ip]\n end", "def unsafe_ip?(item, options = {})\n return [:ip, item] if in_pool?(:ip, item)\n return unless options.fetch(:smarter, true)\n\n found = contained_in_network?(item)\n return [:in_network, found] if found\n end", "def server_get_public_ip(server_name)\n public_ip = ''\n if server_exist?(server_name)\n server = find_match(@compute.servers, server_name)\n network_name = server.addresses.keys.reduce\n server.addresses.each do |address|\n if (address.include? network_name and address.length == 2) #TODO: research why is this 'private' for a public ip?\n if address[1].length >= 2\n Puppet.debug \"found floating ip = #{address[1][1].inspect}\"\n public_ip = address[1][1].addr\n end\n end\n end\n end\n return public_ip\n end", "def ip_address\n nil\n end", "def id\n self[:ip_id]\n end", "def find_for_ip(string)\n begin\n ip = IPAddr.new(string)\n type = ip.ipv4? ? TYPE_IPV4 : TYPE_IPV6\n _definitions(type).each do |_, definition|\n return factory(type, *definition) if IPAddr.new(definition.first).include?(ip)\n end\n rescue ArgumentError\n # continue\n nil\n end\n raise AllocationUnknown, \"IP Allocation for `#{string}' unknown\"\n end", "def hostip\n static_network_config[\"ipAddress\"]\n end", "def hostname\n Resolv.getname(ip_address) rescue nil\n end", "def arp_src_ip; self[:arp_src_ip].to_s; end", "def overlay_ip\n self.overlay_cidr.split('/')[0] if self.overlay_cidr\n end", "def private_ip_v4_address; end", "def private_ip_address\n data[:private_ip_address]\n end", "def private_ip_address\n data[:private_ip_address]\n end", "def get_ip(node)\n return node['network_adapters'].select { |n|\n n['mounted'] && n['device'] =~ /eth/\n }[0]['ip']\nend", "def external_ip\n begin\n ip = OpenURI.open_uri(\"http://myip.dk\") {|f|f.read.scan(/([0-9]{1,3}\\.){3}[0-9]{1,3}/); $~.to_s}\n rescue\n ip = local_ip\n puts \"Seems like there is a problem adquiring external IP address, ...using local address: (#{ip})\"\n end\n ip\n end", "def host_ip\n Socket.gethostbyname(@backend.host)[3].unpack('CCCC') rescue [0, 0, 0, 0]\n end", "def ip_address_id(env)\n ip_address_record(env)[:id]\n end", "def ip\n TestLab::Utility.ip(self.address)\n end", "def internal_ip?(ip)\n INTERNAL_SUBNETS.any? { |subnet| subnet.include?(ip) }\n end", "def public_ip_of(server)\n server[:cloud][:public_ips].first rescue server[:ipaddress]\n end", "def ip(arg = nil)\n set_or_return(:ip,\n arg,\n kind_of: String,\n default: '127.0.0.1',\n callbacks: {\n 'An `ip` must be a valid IP address' =>\n ->(a) { a.nil? ? true : !IPAddr.new(a).nil? }\n })\n end", "def ip\n nil\n end", "def ip(value)\n merge(bkip: value.to_s)\n end", "def read_host_ip\n ip = read_machine_ip\n base_ip = ip.split(\".\")\n base_ip[3] = \"1\"\n base_ip.join(\".\")\n end", "def has_ipv4_ip_address?\n self.options[:ip].is_a?(String) && self.options[:ip] =~ /\\A\\d+\\.\\d+\\.\\d+\\.\\d+/\n end", "def get_ipaddr(dns_query, parsed_dns, length)\n address = \"\"\n case length\n when IPV4_ADDR_LENGTH\n address = dns_query[parsed_dns[:index], length].unpack(\"CCCC\").join('.')\n when IPV6_ADDR_LENGTH\n address = dns_query[parsed_dns[:index], length].unpack(\"nnnnnnnn\").map{|v| sprintf(\"%x\", v)}.join(':')\n end\n parsed_dns[:index] += length\n return address\n end", "def ip\n self['ip'] = get_public_ip || get_ip\n end", "def get_fqdn(ip)\n begin\n resp = Socket.getaddrinfo(ip, nil)\n rescue\n return nil\n end\n fqdn = resp[0][2]\n nip = resp[0][3]\n return nil if (fqdn == nip)\n return fqdn\nend", "def get_fqdn(ip)\n begin\n resp = Socket.getaddrinfo(ip, nil)\n rescue\n return nil\n end\n fqdn = resp[0][2]\n nip = resp[0][3]\n return nil if (fqdn == nip)\n return fqdn\nend", "def GetIpFromId(id)\n \"192.168.0.#{id+1}\"\n end", "def ipaddress(node)\n @use_private_ip_for_ssh ? node['ec2']['local_ipv4'] : node['ec2']['public_ipv4']\n end", "def ipaddress\n config[\"ipaddress\"]\n end" ]
[ "0.65940094", "0.63443494", "0.6335534", "0.6318545", "0.63108426", "0.62106514", "0.6176224", "0.6142758", "0.6051862", "0.6051862", "0.6042356", "0.6031375", "0.6025368", "0.5973925", "0.5969801", "0.5958472", "0.5955676", "0.595448", "0.5931934", "0.5925773", "0.59148896", "0.59138185", "0.5879417", "0.58521396", "0.58485657", "0.58334833", "0.5828772", "0.5824106", "0.57561225", "0.57537925", "0.5742158", "0.5735514", "0.5734069", "0.5733296", "0.57149637", "0.57149637", "0.57149637", "0.57149637", "0.57149637", "0.57149637", "0.5708148", "0.5694101", "0.56935596", "0.5690945", "0.56841844", "0.56794626", "0.56792074", "0.5664551", "0.56517965", "0.5648105", "0.56438106", "0.5633688", "0.5629772", "0.56169146", "0.5616474", "0.56152385", "0.56089973", "0.55853283", "0.55816644", "0.55758154", "0.55746156", "0.556521", "0.5562588", "0.55588", "0.5552927", "0.5552729", "0.5547553", "0.55446804", "0.5543742", "0.55416226", "0.554129", "0.5539911", "0.55332214", "0.5525869", "0.55232203", "0.55210817", "0.5520565", "0.55090344", "0.55079716", "0.5491792", "0.5491792", "0.5476184", "0.54746413", "0.54680777", "0.54567856", "0.5454992", "0.5448068", "0.5442232", "0.54363436", "0.54339105", "0.5433841", "0.54328245", "0.542783", "0.54265875", "0.54241604", "0.5416331", "0.5416331", "0.54152185", "0.54137987", "0.54115766" ]
0.6641284
0
2 soustraction : x y = c
def substract(a,b) a.to_i - b.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def c\n @c ||= self.p1.x * self.p2.y - self.p1.y * self.p2.x\n end", "def c2= c; @c2 = (c == 1) ? 1 : 0; end", "def syyx\n @syy-@syx*@sxx.inverse*@sxy\n end", "def simplify\n super\n return CAS.invert(@y) if @x == CAS::Zero\n return @x if @y == CAS::Zero\n return CAS::Zero if @x == @y\n return CAS.const(self.call({})) if (@x.is_a? CAS::Constant and @y.is_a? CAS::Constant)\n return @x + @y.x if @y.is_a? CAS::Invert\n return -(@x.x + @y) if @x.is_a? CAS::Invert\n return self\n end", "def g(x,y) x + y end", "def get_co_x_y(x,y)\n co_y = x*BLOCK_DIMENTION + BLOCK_DIMENTION/2 + BOARD_SQUARE_POS[:board_start]\n co_x = y*BLOCK_DIMENTION + BLOCK_DIMENTION/2 + BOARD_SQUARE_POS[:board_start]\n return co_x,co_y\nend", "def f2c_x(x)\n (x - x_orig) * zoom\n end", "def transmogrifier (a,b,c)\n (a*b)^c\n end", "def vline(x, y1, y2, c)\n x, y1, y2 = x.to_i, y1.to_i, y2.to_i\n\n unless self.bounds?(x, y1) && self.bounds?(x, y2)\n puts \"ERR: Coordinates out of bounds\"\n return\n end\n\n (y1..y2).each {|y| self[y, x] = c}\n end", "def c1= c; @c1 = (c == 1) ? 1 : 0; end", "def ==(c) \n (@x == c.x) && (@y == c.y)\n end", "def sw(t, s, c)\n\n end", "def ndctowc(x, y)\n inquiry %i[double double] do |px, py|\n px.write_double x\n py.write_double y\n super(px, py)\n end\n end", "def x\n @x ||= X.new( c*r, a, (-1*c*(b - c*n)), (r*r*a - (b - c*n)*(b - c*n)) )\n end", "def x\n @x ||= X.new( c*r, a, (-1*c*(b - c*n)), (r*r*a - (b - c*n)*(b - c*n)) )\n end", "def c0= c; @c0 = (c == 1) ? 1 : 0; end", "def x_or_y\n x = @x.content\n y = @y.content\n z = Array.new @z.length, 0\n\n @z.length.times { |i| z[i] = x[i] | y[i] }\n\n @z.content = z\n end", "def x(y)\n return 1.0/2.0 * (y - 1.0)\n end", "def x(y)\n return 1.0/2.0 * (y - 1.0)\n end", "def x(y)\n return 1.0/2.0 * (y - 1.0)\n end", "def ctm_transform(x, y)\n [\n (ctm.a * x) + (ctm.c * y) + (ctm.e),\n (ctm.b * x) + (ctm.d * y) + (ctm.f)\n ]\n end", "def equation\n if p1.x == p2.x\n return \"x - #{p1.x}\"\n elsif p1.y == p2.y\n return \"#{p2.y} - p1.y\"\n end\n\n \"#{a}*x + #{b}*y + #{c} = 0\"\n end", "def eq_for_coordinates(p, s, t)\n q, r = first_point, second_point\n s, t = s.to_s+\"_to\", t.to_s + \"_to\"\n p.send(t,q)+r.send(s,q)+\"-\"+p.send(s,q)+r.send(t,q)\n end", "def []=(x, y, c)\n fail OutOfRange unless check_range(x, y)\n data[index(x, y)] = c\n end", "def min_2(x, y)\nend", "def x2\n x + w\n end", "def p1(x, y, z)\n # x or y\n xor(x, y)\nend", "def euc_2d(c1, c2)\n Math.sqrt((c1[0] - c2[0])**2.0 + (c1[1] - c2[1])**2.0).round\nend", "def interp ( ya, yb, xa, xb, x )\n# return ya if x == xa\n factor = (x - xa) / (xb - xa )\n return ya + factor * ( yb - ya )\nend", "def value(x, y)\r\n return 1 if x == 1 || y == 1\r\n value(x - 1, y) + value(x, y - 1)\r\nend", "def colour(x, y, c)\n x, y = x.to_i, y.to_i\n\n unless self.bounds?(x, y)\n puts \"ERR: Coordinates out of bounds\"\n return\n end\n\n self[y, x] = c\n end", "def MUX2X1(x,y) XOR(x,y); end", "def c2f_x(x)\n x / zoom + x_orig\n end", "def simplify\n super\n return @x[0] if @x.size == 1\n\n # return CAS::Zero if @x == -@y or -@x == @y\n # return (@x - @y.x) if @y.is_a? CAS::Invert\n # return CAS.const(self.call({})) if (@x.is_a? CAS::Constant and @y.is_a? CAS::Constant)\n # Removing Zeros\n @x = @x - [CAS::Zero]\n return CAS::Zero if @x.size == 0\n # Reduce constants\n @x = self.__reduce_constants(@x) do |cs, xs|\n xs + [cs.inject { |t, c| t += c.call({}) }]\n end\n # Multeplicity and associativity executed\n return self.reduce_associativity\n end", "def euc_2d(c1, c2)\n Math.sqrt((c1[0] - c2[0])**2.0 + (c1[1] - c2[1])**2.0).round\n end", "def state\n case [@c2, @c1, @c0]\n when [0,0,0] then \"Z -> Z\"\n when [0,0,1] then \"X + Y\"\n when [0,1,0] then \"rotate x\"\n when [0,1,1] then \"x & y\"\n when [1,0,0] then \"x | y\"\n when [1,0,1] then \"x ^ y\"\n when [1,1,0] then \"~ x\"\n when [1,1,1] then \"x == y\"\n else raise RuntimeError.new \"wrong alu operation: #{ [@c2, @c1, @c0] }\"\n end\n end", "def lcs(s1, s2); 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 simplify\n super\n return self if (@x == CAS::Zero and @y == CAS::Zero)\n return self if (@x == CAS::Infinity and @y == CAS::Infinity)\n return self if (@x == CAS::Infinity and @y == CAS::Zero)\n return self if (@x == CAS::Zero and @y == CAS::Infinity)\n\n return CAS::Zero if @x == CAS::Zero\n return CAS::Infinity if @y == CAS::Zero\n return @x if @y == CAS::One\n return CAS::Zero if @y == CAS::Infinity\n return CAS::One if @x == @y\n return CAS.const(self.call({})) if (@x.is_a? CAS::Constant and @y.is_a? CAS::Constant)\n return self\n end", "def simplify\n super\n return self if (@x == CAS::Zero and @y == CAS::Zero)\n return self if (@x == CAS::Infinity and @y == CAS::Infinity)\n return self if (@x == CAS::Infinity and @y == CAS::Zero)\n return self if (@x == CAS::Zero and @y == CAS::Infinity)\n\n return CAS::Zero if @x == CAS::Zero\n return CAS::One if @x == CAS::One\n return @x if @y == CAS::One\n return CAS::One if @y == CAS::Zero\n return CAS.const(self.call({})) if (@x.is_a? CAS::Constant and @y.is_a? CAS::Constant)\n return self\n end", "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 point x, y, c\n screen[x, h-y] = color[c]\n end", "def curveto(cp1x, cp1y, cp2x, cp2y, x, y)\n CGContextAddCurveToPoint(@ctx, cp1x, cp1y, cp2x, cp2y, x, y)\n end", "def mix_c!(i, j, c = nil)\n @body.mix_c!(i, j, c)\n @right.mix_c!(i, j, c)\n self\n end", "def transmogrifier (a, b, c)\n ((a * b) ** c)\nend", "def y2\n y + h\n end", "def f2c(temp_f)\n (temp_f - 32) * 5 / 9\nend", "def a(x,y)\n x + y\n end", "def identity_y\r\n new_point = identity\r\n new_point.x = 0\r\n return new_point\r\n end", "def s\n Math.sqrt(x**2 + y**2)\n end", "def getAt(x1, y1, x2, y2)\n if x1 == 0 || y1 == 0\n if x1 == 0 && y1 == 0\n return @sa[y2*@width + x2]\n elsif x1 == 0 && y1 != 0\n return @sa[y2*@width + x2] - @sa[(y1-1)*@width + x2]\n else # x1 != 0 && y1 == 0\n ty2 = y2*@width\n return @sa[ty2 + x2] - @sa[y2 + (x1 - 1)]\n end\n else\n tx1, ty1, tx2, ty2 = x1-1, (y1-1)*@width, x2, y2*@width\n return @sa[ty2 + tx2] - @sa[ty1 + tx2] - @sa[ty2 + tx1] + @sa[ty1 + tx1]\n end\n end", "def lcs(x, y, &block)\n x = [nil, *x]\n y = [nil, *y]\n block ||= proc {|a, b| a == b && a}\n lcs_backtrace(lcs_table(x, y, &block), x, y, x.size - 1, y.size - 1, &block)\n end", "def ease_in_out_circ(t, b, c, d)\n t = t.to_f\n b = b.to_f\n c = c.to_f\n d = d.to_f\n t /= d / 2\n return -c / 2 * (Math.sqrt(1 - t * t) - 1) + b if t < 1\n t -= 2\n c / 2 * (Math.sqrt(1 - t * t) + 1) + b\n end", "def cosh\n math :cosh\n end", "def sum_square(x, y)\n\tx**2 + y**2\nend", "def soustraction( vector2 )\n i = vector2.i - @i\n j = vector2.j - @j\n pt = Point2D.new(i, j)\n vectorSoust = Vector2D.new( 0, 0 )\n vectorSoust.initializeWithPoint( pt )\n \n return vectorSoust \n end", "def k(x,y)\n x * y\n end", "def catAndMouse(x, y, z)\n dis1 = z - x\n dis2 = z - y\n p dis1\n p dis2\n dis1.negative? ? dis1 = dis1 * -1 : nil\n dis2.negative? ? dis2 = dis2 * -1 : nil\n if dis1 < dis2\n \"Cat A\"\n elsif dis2 < dis1\n \"Cat B\"\n else\n \"Mouse C\"\n end\nend", "def transmogrifier(a, b, c)\n # (a * b).pow(c)\n (a * b) ** c\nend", "def gecos=(p0) end", "def squared_difference(x,y)\n 0.0 + (x-y)**2\n end", "def xor(x, y)\n\nend", "def sbc_a_c\n end", "def transmogrifier(a, b, c)\n p (a * b) ** c\nend", "def cross (a, b, c)\n return (b[0]-a[0])*(c[1]-a[1]) - (c[0]-a[0])*(b[1]-a[1])\nend", "def initialize(a,x,y)\n @a = Float(a)\n @x1 = Float(x)-(@a/2)\n @y1 = Float(y)-(@a/2)\n @x2 = x1+@a\n @y2 = y1+@a\n end", "def f2c(f)\n\tc = (5.0/9.0)*(f-32.0)\n\treturn c\nend", "def point x, y, c\n screen[x, y] = color[c]\n end", "def normal_towards(a, b, c)\n ac = a.dot(c)\n bc = b.dot(c)\n\n x = b.x * ac - a.x * bc\n y = b.y * ac - a.y * bc\n\n V.new(x, y)\n end", "def squared\n end", "def soma_numeros (x, y)\r\n x + y\r\nend", "def multiply_c!(j, c)\n @body.multiply_c!(j, c)\n @right.multiply_c!(j, c)\n self\n end", "def xor_c\n end", "def x_and_y\n x = @x.content\n y = @y.content\n z = Array.new @z.length, 0\n\n @z.length.times { |i| z[i] = x[i] & y[i] }\n\n @z.content = z\n end", "def sb(t, s, c)\n\n end", "def clk\n case [@c2, @c1, @c0]\n when [0,0,0] then do_nothing;\n when [0,0,1] then x_add_y\n when [0,1,0] then rotate_x\n when [0,1,1] then x_and_y\n when [1,0,0] then x_or_y\n when [1,0,1] then x_xor_y\n when [1,1,0] then not_x\n when [1,1,1] then x_equal_y\n else raise RuntimeError.new \"wrong alu operation: #{ [@c2, @c1, @c0] }\"\n end\n @z\n end", "def cross!(x=1/sqrt3,y=1/sqrt3,z=1/sqrt3)\n if x.kind_of? Numeric\n set((@y*z)-(@z*y), (@z*x)-(@x*z), (@x*y)-(@y*x))\n elsif x.point3_like?\n if y.kind_of? Numeric\n cross! x.x, x.y, x.z\n elsif y.point3_like?\n set(x).cross!(y)\n else\n raise_no_conversion y\n end\n else\n raise_no_conversion x\n end\n end", "def x2\n x + width\n end", "def moveto(x, y)\n @ox = @x = x\n @oy = @y = y \n @real_x = @x * 128\n @real_y = @y * 128 \n end", "def y2; y1 + HEIGHT ; end", "def y!() @y.value end", "def lw(t, s, c)\n\n end", "def solve(a, b, c)\n v = b ** 2 - 4 * a * c\n if v < 0: raise RangeError end\n s0 = ((-1)*b - Math.sqrt(v))/(2*a)\n s1 = ((-1)*b + Math.sqrt(v))/(2*a)\n return s0, s1\nend", "def c\n end", "def two_guys(x, y)\n puts x + y\nend", "def set(x, y)\n @x, @y = x, y\n end", "def sub_c\n end", "def swap_c!(i, j)\n @body.swap_c!(i, j)\n @right.swap_c!(i, j)\n self\n end", "def centerx=(x); self[0] = x - (self[2].div(2)); return x; end", "def divide_c!(j, c)\n @body.divide_c!(j, c)\n @right.divide_c!(j, c)\n end", "def subt(x, y)\n x - y\nend", "def to_code\n \"(#{@x.to_code} ** #{@y.to_code})\"\n end", "def to(x,y)\n\t\t\tdx = x - @attributes[:cx]\n\t\t\tdy = y - @attributes[:cy]\n\t\t\tr = (dx**2 + dy**2)**(0.5)\n\t\t\t@attributes[:r] = r\n\t\t\t\n\t\t\tyield self if block_given?\n\t\t\treturn self\n\t\tend", "def by(x, y)\n @cursor_loc ||= cursor_location\n to(@cursor_loc[:x] + x, @cursor_loc[:y] + y)\n end", "def two_method(x,y,z)\n\t\tx + y + z\nend", "def move_to!(x, y, z)\n @a1[0] = @a2[0] = @b1[0] = @b2[0] = x\n @a1[1] = @a2[1] = @d1[1] = @d2[1] = y\n @a1[2] = @b1[2] = @c1[2] = @d1[2] = z\n @a2[2] = @b2[2] = @c2[2] = @d2[2] = @a2[2] + z\n @b1[1] = @b2[1] = @c1[1] = @c2[1] = @b2[1] + y\n @c1[0] = @c2[0] = @d1[0] = @d2[0] = @d2[0] + x\n self\n end", "def evcon(c,a)\n if eval_one(caar(c), a)\n eval_one(cadar(c), a)\n else\n evcon(cdr(c), a)\n end\nend", "def sub!(rhs)\n @x -= rhs.x\n @y -= rhs.y\n self\n end", "def cuadrado(x)\n x * x\nend", "def f2c(t)\n\treturn (t - 32) * 5.fdiv(9)\nend", "def calc_distance(x1,y1, x2,y2)\r\n# - - - - - - - - - - - - - - - - - - - -\r\n if (x1 == x2) && (y1 == y2)\r\n c = 0\r\n else\r\n a = (x1 - x2).abs * 1.0\r\n b = (y1 - y2).abs * 1.0\r\n csqd = (a*a) + (b * b)\r\n c = Math.sqrt(csqd)\r\n end # else\r\n return c\r\nend" ]
[ "0.6860843", "0.6215986", "0.6019119", "0.6018704", "0.5946082", "0.58559877", "0.5808389", "0.57946384", "0.5735949", "0.57329434", "0.57296306", "0.5715282", "0.5700401", "0.5689341", "0.5689341", "0.5649059", "0.56076866", "0.5589604", "0.5589604", "0.5589604", "0.5584544", "0.5572295", "0.5565145", "0.5558346", "0.55518895", "0.5549255", "0.55448145", "0.5530864", "0.5506122", "0.55016553", "0.5491657", "0.54885274", "0.5487473", "0.5471831", "0.54692626", "0.54682577", "0.54579914", "0.5452805", "0.5418284", "0.5415924", "0.5400319", "0.5386156", "0.53809506", "0.53643155", "0.5349261", "0.5343064", "0.5339526", "0.5334536", "0.53060234", "0.5304869", "0.5304413", "0.52909535", "0.5284473", "0.5279454", "0.5275313", "0.52690774", "0.5263573", "0.52607083", "0.5260027", "0.525907", "0.5257661", "0.5250493", "0.52454394", "0.5240065", "0.5234043", "0.5231427", "0.5223471", "0.52230924", "0.5218648", "0.52180934", "0.52159953", "0.5215668", "0.521063", "0.5209502", "0.520752", "0.5205448", "0.5204348", "0.52018714", "0.5186855", "0.51771605", "0.5173304", "0.5171336", "0.5171141", "0.51677036", "0.51564276", "0.5154677", "0.5153384", "0.515086", "0.51490325", "0.51421165", "0.51409626", "0.5138084", "0.51336354", "0.51331633", "0.5130249", "0.51189876", "0.5117148", "0.51108307", "0.51076066", "0.5103907", "0.510239" ]
0.0
-1
3 si array, additionner les chiffres de larray .to_f
def sum(array) array.map(&:to_i).reduce(0, :+) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def map_float (arr)\n flo = arr.map(& :to_f)\n puts \"El array como flotantes #{flo}\" \nend", "def averagefloat(array)\n totalval = 0\n array.each { |x| totalval += x }\n totalval / array.length.to_f\nend", "def plusMinus(arr)\n lng = arr.length\n arr_resposta = []\n\n arr_resposta.push(arr.count{|x| x > 0})\n arr_resposta.push(arr.count{|x| x < 0})\n arr_resposta.push(arr.count{|x| x == 0})\n\n arr_resposta = arr_resposta.map{|x| x.fdiv(lng).round(6)}\n .map{|x| \"#{'%.6f' % x }\"}\n\n puts arr_resposta\nend", "def from_array(ary)\n return nil if ary.empty?\n ary[0..1].map(&:to_f)\n end", "def sum(arr)\n arr.inject(0.0) { |sum, el| sum + el.to_f }\n end", "def to_float(a)\n floats = a.map {|x| x.to_f}\n print floats\n \nend", "def total(array1)\n sum=0.0\n array1.each do|i|\n sum+=i\n end\n return sum\n end", "def object_to_float(array)\r\n array.map(&:to_f)\r\n end", "def sum(array)\n total = 0.0\n array.each { |num| total += num }\n return total\nend", "def sum (array)\n total = 0.0\n array.each { |elem| total += elem }\n total\nend", "def average_float(arr)\n sum = arr.reduce { |sum, x| sum + x }\n avg = sum.to_f / arr.length\n avg.round(2)\nend", "def total(array)\n sum = 0.0\n result = 0.0\n if array.length > 0 then\n array.each do |item|\n sum += item\n end\n result = sum \n end\n return result\nend", "def i_to_f(color_array)\n b = []\n color_array.each do |n|\n b.push(n / 255.0)\n end\n b\n end", "def numericize\n\t\tcollect(&:to_f)\n\tend", "def to_number_array(string_array)\nstring_array.map(&:to_f)\nend", "def plusMinus(arr)\r\n length = arr.length()\r\n \r\n pos = arr.count{|n| n>0}\r\n \r\n neg = arr.count{|n| n<0}\r\n \r\n zero = arr.count{|n| n==0}\r\n \r\n\r\n pos_frac = pos/length.to_f\r\n neg_frac = neg/length.to_f\r\n zero_frac = zero/length.to_f\r\n\r\n puts pos_frac.to_f\r\n puts neg_frac.to_f\r\n puts zero_frac.to_f\r\nend", "def average(array)\n result = array.inject(:+)\n # result / array.count.to_f\n sprintf \"%.2f\", result / array.count.to_f # used sprintf, num to return 2 decimal points\nend", "def average(arr)\n sum = arr.reduce(:+).to_f \n sum / arr.size\nend", "def gain(array)\n sum = array.inject(0) {|sum,x| sum + x }\n gain = 0.0\n array.each do |num|\n gain += (num.to_f/sum.to_f) * calcLog2(num.to_f/sum.to_f)\n end\n return -gain.round(3)\n end", "def average_of_array(array)\n sum_of_array = array.inject{ |x, y| x + y }.to_f\n (sum_of_array.to_f/array.length).round\nend", "def plusMinus(arr)\n res = [0.0, 0.0, 0.0]\n arr.each do |number|\n res[2] += 1 if number.zero?\n next if number.zero?\n res[(number.positive? ? 0 : 1)] += 1\n end\n res.map! do |num|\n format('%0.5f', (num / arr.length))\n end\n puts res\nend", "def to_f\n self.map {|e| e.to_f}\n end", "def convertFracts(fraction_array)\n least_common_multiple = fraction_array.transpose { |x, y, z| [x, y, z] }[1].reduce(1, :lcm)\n \n fraction_array.map do |numer, denom|\n [numer*least_common_multiple/denom, least_common_multiple]\n end\nend", "def sum_of(array)\n array.inject(0.0) { |sum, e| sum + e }\n end", "def plusMinus(arr)\n\n positiveNum = 0.0\n negativeNum = 0.0\n zeroNum = 0.0\n\n arr.each do |i|\n\n if i > 0\n positiveNum += 1\n elsif i < 0\n negativeNum += 1 \n else\n zeroNum += 1\n end\n \n end\n\n puts \"%.6f\" % (positiveNum / arr.length)\n puts \"%.6f\" % (negativeNum / arr.length)\n puts \"%.6f\" % (zeroNum / arr.length)\n \nend", "def total(my_array)\n my_array.reduce( :+ )\n end", "def plusMinus(arr)\n positive = arr.select{ |x| x > 0}.length.to_f\n negative = arr.select{ |x| x < 0}.length.to_f\n zero = arr.select{ |x| x == 0}.length.to_f\n puts format('%<num>0.6f', num: (positive/ arr.length)) \n puts format('%<num>0.6f', num: (negative/ arr.length)) \n puts format('%<num>0.6f', num: (zero/ arr.length)) \nend", "def total array\n array.reduce(0, :+)\nend", "def to_number_array(string_array)\n string_array.map(&:to_f)\nend", "def total(array)\n\tarray.inject(:+)\nend", "def to_f(aNum)\r\n# - - - - - - - - - - - - - - - - - -\r\n return 0.0 + aNum\r\nend", "def average(array)\n sum = array.reduce(:+)\n sum.to_f / array.size.to_f\nend", "def to_number_array(string_array)\nstring_array.map {|x| x.to_i }\ni = 0\nstring_array.map {|x| x + i += 0.1}\nend", "def avg(ll)\n sum = ll.reduce(0){ |sofar,i| sofar+i }\n n = ll.length\n return sum.to_f/n\nend", "def total_of_array(array)\n array.reduce(:+)\nend", "def average_f(arr)\n arr.inject(:+).fdiv(arr.size)\nend", "def average(arr)\n arr.reduce(:+).to_f / arr.size\nend", "def promedio(arreglo)\n\ttotal = 0.0\n\tfor i in 0...arreglo.size\n\t\ttotal = total + arreglo[i]\n\tend \n\n\treturn (total / arreglo.size).round(2)\nend", "def sum (anArray)\n\n\ttotal = 0.0\n\t# use array each method to add up the numbers\n\tanArray.each {|x| total = x + total}\n\n\treturn total\nend", "def total(array)\n\tsum = array.inject(0, :+)\nend", "def sum(arr)\n arr.reduce {|a,b| a+b}\n #correction : arr.reduce(:+,0) marche aussi\nend", "def to_f(data)\n return ((data[1].ord + (256 * data[0].ord)) / 1.2)\n end", "def up_array(arr)\n return nil if arr.length < 1\n condition = true\n arr.each { |i| condition = false if ( (i < 0) || (i > 9) || (i.class == Float) ) }\n return (arr.join.to_i + 1).to_s.chars.map {|i| i.to_i} if condition == true\nend", "def part2(in1, in2)\n (in1.to_f + in2.to_f)/3\nend", "def average(array_of_numeric_grades)\n sum = 0\n array_of_numeric_grades.each do |grade|\n sum += grade\n end\n average = sum / array_of_numeric_grades.length\nend", "def average_of_array(array)\n (array.sum).to_f / (array.length)\nend", "def add_elements(decimal_array)\n total = 0\n decimal_array.each do |number|\n total += number\n end\n return total\nend", "def total(array)\n=begin\n\tInput: Array of integers or floats \n\tOutput: Integer or float \n=end\n\t#SET variable, sum, to 0\n\t#ITERATE over array of numbers and add each element to sum\n\tsum = 0\n\tarray.each{|x| sum += x }\n\t#RETURN sum\n\treturn sum\nend", "def average(array)\n array.inject(:+).to_f / array.size\nend", "def total(array)\n\t\ttotal = 0\n\t\tfor number in array\n\t\t\ttotal += number\n\t\tend\n\t\treturn total\n\tend", "def average(array)\n total = 0\n array.each do |num|\n total += num\n end\n total.to_f / array.size\nend", "def make_ratio(array1, array2)\n if array1.empty? || array2.empty?\n result = 0\n else\n result = array1.compact.inject(0){|sum, item| sum + item}.to_f/array2.compact.inject(0){|sum, item| sum + item}.to_f\n end\n result\n end", "def show_multiplicative_average(arr)\n format(\"%.3f\",(arr.reduce(:*)) / arr.length.to_f)\nend", "def add_array_numbers(array)\n result = array.sum\n # .sum cannot be used on a string, only integars and floats\n return result\nend", "def average numbers\n sum = 0.0\n num_length = (numbers.length).to_f\n numbers.each do |number|\n sum+=number\n end\n sum_float = sum.to_f\n return sum_float / num_length\nend", "def average(array)\n sum = 0\n array.each { |x| sum += x }\n (sum / array.count).to_f\nend", "def average(array)\n (array.reduce(&:+) / array.length.to_f).round(2)\nend", "def plusMinus(arr)\n list = [0, 0, 0]\n arr.each do |n|\n if n > 0\n list[0] += 1\n elsif n < 0\n list[1] += 1\n else\n list[2] += 1\n end\n end\n\n sum = list.sum\n puts(format('%.6f', list[0].to_f / sum))\n puts(format('%.6f', list[1].to_f / sum))\n puts(format('%.6f', list[2].to_f / sum))\nend", "def sum(array)\n\treturn array.reduce(:+)\nend", "def sum(array)\n\tarray.reduce(:+)\nend", "def average(array)\n array.sum / array.size.to_f\nend", "def average(input_array)\n sum = 0\n \n input_array.each {|num| sum += num}\n \n average = sum.to_f/input_array.length\nend", "def average_of_array(array)\n (array.inject(:+) / array.size.to_f).round\nend", "def to_f\n if @last == 0\n raise ZeroDivisionError\n else\n @first.to_f / @last\n end\n end", "def to_f() end", "def to_f() end", "def to_f() end", "def to_f() end", "def average(array)\n puts array.sum.to_f / array.length\nend", "def suma_lyginiu(array)\n result = 0\n array.each do |number|\n result += number if yra_lyginis(number)\n end\n result\n end", "def a(array1, array2)\n n = array1.size\n m11, m10, m01, m00 = binary_compare(array1, array2)\n return :a, (m11/n.to_f).round(3)\nend", "def precision category,a\n x=getValue category\n y=getValue category\n return a[x][y]/colsum(a,y).to_f\nend", "def average(num_arr)\n (num_arr.sum/num_arr.length).to_f\nend", "def average numbers\n sum = numbers.reduce 0.0 do |total, number| #im using 0.0 to go directly into floats\n total + number\n end\n sum / numbers.length\nend", "def total(array)\n\ttotal = 0\n\tarray.each do |x|\n\t\ttotal += x\n\tend\n\treturn total\nend", "def something\n max = self.max_size\n arrays = self.lifts_array\n arrays.each do |array|\n if array.size < max \n difference1 = max - array.size\n difference = difference1 / 2\n difference.times do \n array << 0\n array << \"0\"\n end\n else\n end\n end\n arrays\n end", "def total(array)\n\tsum = 0\n\tarray.each { |x| sum += x }\t\n\tsum\nend", "def suma_arreglo(array)\n array.reduce(:+)\nend", "def add(*nums) \r\n p @result.class\r\n for num in nums\r\n if num.class == Array\r\n #loop through the array and sum the elements\r\n for x in num\r\n @result += x.to_f\r\n end\r\n else\r\n @result += num.to_f# @result = @result + num\r\n end\r\n end\r\n self\r\n end", "def simple_array_sum arr\n arr.reduce(:+)\n end", "def total (array)\n\tsum=0\n\tarray.each do |n| sum += n\n\tend\n\treturn sum\nend", "def plusMinus(arr)\n totalPositives = 0.0;\n totalNegatives = 0.0;\n totalZeros = 0.0;\n arrCount = 0.0;\n arr.each do |element|\n if element > 0 then \n totalPositives +=1\n elsif element < 0 then \n totalNegatives +=1\n else\n totalZeros +=1\n end \n arrCount += 1 \n end\n \n if arrCount == 0\n puts \"%.6f\" % totalPositives\n puts \"%.6f\" % totalNegatives\n puts \"%.6f\" % totalZeros\n else\n puts \"%.6f\" % (totalPositives/arrCount)\n puts \"%.6f\" % (totalNegatives/arrCount)\n puts \"%.6f\" % (totalZeros/arrCount)\n end\nend", "def to_f\n\n flotante = Array.new(matriz.size - 1)\n for i in 0...matriz.size\n flotante[i] = Array.new(matriz[i].size - 1)\n for j in 0...matriz[i].size\n flotante[i][j] = (matriz[i][j]).to_f\n end\n end\n MatrizDensa.new(flotante)\n\n\tend", "def Float(p0) end", "def plusMinus(arr)\n plus = []\n minus = []\n zero = []\n arr.each do |v|\n if v == 0\n zero << v\n elsif v > 0\n plus << v\n else\n minus << v\n end\n end\n total_count = arr.length\n puts sprintf(\"%.6f\", plus.length.to_f / total_count)\n puts sprintf(\"%.6f\", minus.length.to_f / total_count)\n puts sprintf(\"%.6f\", zero.length.to_f / total_count)\nend", "def cvr\n push pop.to_f\n end", "def rowsum a,row\n sum=0\n 0.upto(4){|i| sum+=a[row][i]}\n return sum.to_f\nend", "def average(input_array)\n n = input_array.length\n sum = 0 \n\n input_array.each do |num|\n sum = sum + num\n end\n average_of_array = sum.to_f / n\nend", "def total arr\nsum_total = 0\narr.each do |el|\nsum_total += el\nend\nsum_total\nend", "def show_multiplicative_average(arr)\n\n result = arr.inject(:*).to_f / arr.length.to_f\n\n \"The result is #{sprintf(\"%.3f\", result)}\"\n\nend", "def show_multiplicative_average2(arr)\n\n result = arr.inject(:*).to_f / arr.length \n\n puts \"The result is #{format('%.3f', result)}\"\n\nend", "def total(array)\n array.inject(:+)\nend", "def sum_only_numbers(array)\n ll_sum = 0.0\n if array.length > 0\n for idx in array do\n if idx.is_a?(Numeric)\n ll_sum += idx\n end\n end\n end\n return ll_sum\nend", "def total array\n\tsum = 0\n\tarray.each do |x|\n\t\tsum = sum + x\n\tend\n\treturn sum\nend", "def total_price\n @file.map { |f| f[2..3].map(&:to_f) }.flatten.reduce(:+)\n end", "def addAllFactors array\n array.each do |item|\n addFactor item[0], item[1]\n end\n end", "def mean(array)\n total = 0\n array.each { |i| total+= i.to_f }\n total / array.count\n puts total\nend", "def show_multiplicative_average(array)\n product = array.inject { |n, pro| n.to_f * pro.to_f}\n result = product / (array.count).to_f\n format('%.3f', result)\nend", "def total(array)\n\tsum = 0\n\tarray.each { |a| sum += a }\n\treturn sum\nend", "def average(array)\n array.inject(&:+) / array.length\n end", "def total(array)\n\ttoats = 0\n\tarray.each do |i|\n\t\ttoats = toats + i\nend\nreturn toats\nend" ]
[ "0.66376704", "0.63747257", "0.62233114", "0.6161797", "0.61540073", "0.6107448", "0.6092757", "0.60675347", "0.59704846", "0.59388", "0.58571047", "0.58316696", "0.5820625", "0.58148926", "0.5804778", "0.577983", "0.57683444", "0.57408506", "0.5734051", "0.571604", "0.5707347", "0.5693281", "0.5684448", "0.567136", "0.56561065", "0.5647678", "0.56436163", "0.5619358", "0.5610387", "0.56069565", "0.55850136", "0.5584234", "0.5578764", "0.55549616", "0.5551936", "0.55431074", "0.5539785", "0.55159384", "0.55158997", "0.54844296", "0.5477658", "0.54748404", "0.54737276", "0.5466344", "0.5441678", "0.5436367", "0.5435674", "0.54339415", "0.5430766", "0.5430592", "0.5429178", "0.54272276", "0.54243493", "0.5423734", "0.54227644", "0.5400786", "0.53989106", "0.5398285", "0.53966576", "0.5395576", "0.53946406", "0.5388778", "0.53795654", "0.53760785", "0.5373536", "0.5373536", "0.5373536", "0.5373536", "0.5372889", "0.5372331", "0.53701395", "0.5363715", "0.53618133", "0.5361107", "0.5356634", "0.5354316", "0.5350184", "0.5349703", "0.5348466", "0.53469795", "0.5342101", "0.53404856", "0.5340314", "0.53359", "0.53348315", "0.5332565", "0.5331114", "0.5327588", "0.5327029", "0.5321236", "0.5319443", "0.5318062", "0.5317988", "0.5314612", "0.5304705", "0.529974", "0.52960956", "0.5294301", "0.528954", "0.52837425", "0.5283315" ]
0.0
-1
+ multiplier : x;y = xy
def multiply(a,b) a.to_i * b.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def multiply(x,y) \n\tx * y\t\nend", "def multiply(x, y)\n return x * y * 37\n x * y\nend", "def multiply(x,y)\n\tx*y\nend", "def multiply(y)\n @x * y\n end", "def multiply(x, y)\n\tx * y\nend", "def mult(x,y)\n\tx * y\nend", "def adjust _x, _y\n x += _x\n y += _y\n end", "def y2; y1 + HEIGHT ; end", "def multiply(x,y)\n x*y\nend", "def multiply(x,y)\n x*y\nend", "def multiply(x,y)\n x*y\nend", "def multiply(x, y)\n x * y\nend", "def multiply (x, y)\n x * y\nend", "def multiply(x, y)\n product = x*y\nend", "def multiply(x,y)\n x * y\nend", "def multiply(x,y)\n x * y\nend", "def prod(x,y)\n x*y\nend", "def multiply(x, y)\n x * y\nend", "def multiply(x, y)\n x * y\nend", "def *(y)\n z = 0\n\n for i in 1..y do\n z += @x\n end\n z\n end", "def g(x,y) x + y end", "def multiply (x,y)\n return x * y\nend", "def multiply(x, y)\n return y if x == 1\n\n y + multiply(x - 1, y)\nend", "def getProd ( x , y )\n\tprod = x * y\n\treturn prod\nend", "def y2\n y + height\n end", "def mul!(rhs)\n @x *= rhs\n @y *= rhs\n self\n end", "def *(coef)\n Point.new(@x * coef, @y * coef)\n end", "def multiply!(x=1,y=1,z=1)\n if x.kind_of? Numeric\n set(@x*x, @y*y, @z*z)\n elsif x.point3_like?\n multiply! x.x, x.y, x.z\n else\n raise_no_conversion x\n end\n end", "def multiply_two_numbers( x, y )\n x * y\nend", "def mul(rhs)\n Vector2.new(@x * rhs, @y * rhs)\n end", "def x2\n x + width\n end", "def inflate!(x,y)\n self[0] -= x.div(2)\n self[1] -= y.div(2)\n self[2] += x\n self[3] += y\n return self\n end", "def gen(x, y)\n return 384 + x + (y * 8)\n end", "def mod_add (a, b)\n if b.inf\n return a\n end\n if a.inf\n return b\n end\n\n x1 = a.x\n x2 = b.x\n y1 = a.y\n y2 = b.y\n\n if x1 == x2 and y1 == -y2\n return Point.new Float::INFINITY, Float::INFINITY\n end\n\n if x1 == x2 and y1 == y2\n lambda = self.mod_inv 3 * x1 ** 2 + @a, 2 * y1\n else\n lambda = self.mod_inv y2 - y1, x2 - x1\n end\n\n x3 = Curve.mod lambda ** 2 - x1 - x2, @fp\n y3 = Curve.mod lambda * (x1 - x3) - y1, @fp\n\n Ecc::Point.new x3, y3\n end", "def magSq\n @x*@x + @y*@y\n end", "def mathoper4argum(n, y, a, b)\n\n\tn + y - a / b\n\nend", "def rec_int_mult(x,y)\n n = get_n(x)\n\n return x * y if n == 1\n\n a = split_upper(x, n)\n b = split_lower(x, n)\n c = split_upper(y, n)\n d = split_lower(y, n)\n\n a_c = rec_int_mult(a,c)\n b_d = rec_int_mult(b,d)\n a_d = rec_int_mult(a,d)\n c_b = rec_int_mult(b,c)\n\n return 10 ** (n) * (a_c) + 10 ** (n / 2) * (a_d + c_b) + b_d\nend", "def soma_numeros (x, y)\r\n x + y\r\nend", "def add!(p)\n@x += p.x\n@y += p.y\nself\nend", "def *( scalar )\n self.class.new( @x * scalar, @y * scalar )\n end", "def interp ( ya, yb, xa, xb, x )\n# return ya if x == xa\n factor = (x - xa) / (xb - xa )\n return ya + factor * ( yb - ya )\nend", "def add_2(x, y)\nend", "def +(y)\n @x + y\n end", "def x_add_y\n x = @x.content\n y = @y.content\n z = Array.new @x.length, 0\n\n carry = 0\n\n # claulate x + y = z\n @x.length.times do |i|\n tmp = x[i] + y[i] + carry\n z[i] = tmp % 2\n carry = tmp / 2\n end\n\n @z.content = z\n end", "def mul( val )\n @x.scale( val )\n @y.scale( val )\n self\n end", "def k(x,y)\n x * y\n end", "def multiplier\n Misc.pos_neg_read_multip(pos,neg,read)\n end", "def add!(point)\r\n @x += point.x\r\n @y += point.y\r\n end", "def value(x, y)\r\n return 1 if x == 1 || y == 1\r\n value(x - 1, y) + value(x, y - 1)\r\nend", "def y2\n y + h\n end", "def ady(y)\n y * MINIMAP_RATIO + P_Y\n end", "def plus(x, y)\n\nend", "def mult(x, op, y)\n x.send(op, y)\nend", "def x(y)\n return 1.0/2.0 * (y - 1.0)\n end", "def x(y)\n return 1.0/2.0 * (y - 1.0)\n end", "def x(y)\n return 1.0/2.0 * (y - 1.0)\n end", "def incr_y(val = 1)\n update(y + val, x)\n apply_pos\n end", "def x2\n x + w\n end", "def getExp ( x , y )\n\texp = x ** y\n\treturn exp\nend", "def add_2(x, y)\n x + y\n end", "def multiply_2_and_return(x, y)\n x * y\nend", "def call(x, y)\n @position_x += x\n @position_y += y\n end", "def sum_square(x, y)\n\tx**2 + y**2\nend", "def sum(x,y)\r\n\t x + y\r\n\tend", "def *(value)\n mul(value) ;\n end", "def add!(rhs)\n @x += rhs.x\n @y += rhs.y\n self\n end", "def method(x, y)\n x * y\nend", "def multiply(x , y)\n\tputs x * y \nend", "def multiplier(num1, num2)\nnum1 * num2\nend", "def multiplier(num1, num2)\nnum1 * num2\nend", "def multuply(one, two)\n\t# #{}=>插值\n\t\"#{one} multuplied by #{two} equals #{one * two}.\"\nend", "def multiplier_score(multiplier)\n\tself.score * multiplier\nend", "def a(x,y)\n x + y\n end", "def translate output_collection, ⛓, what\n what.x += ⛓.x\n what.y += ⛓.y\n output_collection << what\nend", "def power(x,y)\n x**y\nend", "def addittion(x, y)\n return (x + y)\nend", "def multiply(param1, param2, pos)\n @program[pos.value] = param_val(param1) * param_val(param2)\n end", "def scale(factor_x, factor_y=factor_x, &rendering_code); end", "def multiplier(num1, num2)\n num1 * num2\nend", "def * x; operation(:*, 2, \"x\", x); end", "def squared\n end", "def add(y)\n @x + y\n end", "def identity_y\r\n new_point = identity\r\n new_point.x = 0\r\n return new_point\r\n end", "def ptx__x(n, y); ptdist(n, 1.0 - y / 2.0); end", "def power (x,y)\n return x**y \nend", "def multiply_by x,y,n\n (1..n).map {|i| x * y**i}\nend", "def multiply\n match '*'\n factor\n emit_ln 'MULS (SP)+,D0'\nend", "def products_at_point(x,y)\n -1.upto(1) do |j|\n -1.upto(1) do |k|\n unless (j == 0 && k == 0)\n product = 1\n 0.upto(ADJACENT - 1) do |factor|\n row = x + j * factor\n col = y + k * factor\n next if row < 0 || col < 0 || row >= GRID_SIZE || col >= GRID_SIZE\n product *= @grid[row][col]\n fin = factor == ADJACENT - 1\n @largest_product = product if fin && product > @largest_product\n end\n end\n end\n end\n end", "def multiply(a, b)\nend", "def exponentiation(x, y)\n puts \"#{ x } ** #{ y } = #{ x ** y }\"\nend", "def perp\n self.class.new( -@y, @x )\n end", "def get_y(inter, slope, x)\n tmp = slope * x\n y = inter + tmp\n return y\nend", "def min_2(x, y)\nend", "def scale(factor_x, factor_y, around_x, around_y, &rendering_code); end", "def initialize(a,x,y)\n @a = Float(a)\n @x1 = Float(x)-(@a/2)\n @y1 = Float(y)-(@a/2)\n @x2 = x1+@a\n @y2 = y1+@a\n end", "def y(from = 0)\n self[1,2].to_i - 1 + from\n end", "def warp(x, y)\n\t\t@x, @y = x, y\n\tend", "def xxx(x, y)\n sum = 0\n\n x.each_index do |i|\n sum += (x[i] * y[i])\n end\n\n sum\nend", "def producto (other)\n\t\tprod=Fraccion.new(0,0)\n\t\tprod.x= @x * other.x\n\t\tprod.y= @y * other.y\n\treturn prod\t\t\t\n\tend", "def warp(x, y)\n @x, @y = x, y\n end", "def warp(x, y)\n @x, @y = x, y\n end" ]
[ "0.67512953", "0.6715715", "0.6713855", "0.67032087", "0.66509914", "0.6589833", "0.6556257", "0.6513399", "0.6487746", "0.6487746", "0.6487746", "0.64401674", "0.6438239", "0.64354855", "0.64171946", "0.64171946", "0.63933194", "0.638575", "0.638575", "0.6353673", "0.6292075", "0.62885857", "0.62304217", "0.61912334", "0.6164368", "0.6163835", "0.6162109", "0.61349994", "0.61310667", "0.61209095", "0.61186504", "0.610406", "0.61009634", "0.60760385", "0.60756546", "0.60228664", "0.60223585", "0.6018607", "0.6006071", "0.60054415", "0.5998771", "0.59557927", "0.5942072", "0.5928711", "0.5917417", "0.5904965", "0.5902052", "0.5898113", "0.589164", "0.5890559", "0.58878", "0.5865644", "0.5862152", "0.58599144", "0.58599144", "0.58599144", "0.5842494", "0.5841022", "0.5833045", "0.58214504", "0.58047736", "0.57938397", "0.5789837", "0.57819974", "0.57732624", "0.57675934", "0.5762651", "0.574525", "0.5734237", "0.5734237", "0.5721464", "0.5719836", "0.57135576", "0.5710441", "0.5706244", "0.57056785", "0.5700862", "0.569459", "0.5685888", "0.568209", "0.56724495", "0.56716466", "0.56665355", "0.56647104", "0.56542647", "0.5649919", "0.5646585", "0.56352717", "0.56343246", "0.5634141", "0.5632968", "0.56308305", "0.5621516", "0.56175506", "0.5616057", "0.5615735", "0.56143826", "0.56130767", "0.55969304", "0.55925703", "0.55925703" ]
0.0
-1
4 puissance de : x;y = xy
def power(a,b) a.to_i ** b.to_i end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def to_xy\n [x, y]\n end", "def coords; {:x => @x, :y => @y} end", "def position=(point); end", "def identity_y\r\n new_point = identity\r\n new_point.x = 0\r\n return new_point\r\n end", "def update_xy()\n if ((pxy=ref_xy) and (cs=column_space) and (rs=row_space) and (cr=colrow).length == 2)\n # see #xy_record for an explanation of this formula\n array = pxy + [pxy[0]+cs*cr[0], pxy[1]] + [pxy[0], pxy[1]+rs*cr[1]]\n @records.set(GRT_XY, array)\n else\n @records.set(GRT_XY, nil)\n end\n end", "def to_xy\n a = self\n a = [a[0].x, a[0].y] if length == 1\n return *a\n end", "def setxy(x, y)\n setpos y, x\n end", "def t2p(x, y)\n Vct.new(y, g_height - x)\n end", "def position \n\t\treturn @y,@x\n\tend", "def points; end", "def position(y, x)\n [START[0] + (y * SPACING[0]),\n START[1] + (x * SPACING[1])]\n end", "def moveto(x, y)\n @ox = @x = x\n @oy = @y = y \n @real_x = @x * 128\n @real_y = @y * 128 \n end", "def position\n [x, y]\n end", "def flip_range_xy(points); points.collect{ |v| Vertex.new(-v.y,-v.x)}; end", "def flip_range_y(points); points.collect{ |v| Vertex.new(-v.x,v.y)}; end", "def separate_coordinates\n piece = @input[0..1]\n @row = input_to_row(piece[1])\n @col = input_to_col(piece[0])\n\n location = @input[2..3]\n @row_new = input_to_row(location[1])\n @col_new = input_to_col(location[0])\n end", "def pos=(p0) end", "def pos=(p0) end", "def pos=(p0) end", "def pos=(p0) end", "def initialize\n self.x, self.y = 0, 0\n end", "def ref_xy(); @ref_xy; end", "def warp(x, y)\n\t\t@x, @y = x, y\n\tend", "def set_x_y(x,y)\r\n @x=x\r\n @y=y\r\n self\r\n end", "def initialize(a,x,y)\n @a = Float(a)\n @x1 = Float(x)-(@a/2)\n @y1 = Float(y)-(@a/2)\n @x2 = x1+@a\n @y2 = y1+@a\n end", "def fix_address(x = @x, y = @y)\n fixed_x = (x - x.to_i).abs < 0.500 ? x.to_i : x.to_i + 1\n fixed_y = (y - y.to_i).abs < 0.500 ? y.to_i : y.to_i + 1\n \n return [fixed_x,fixed_y]\n end", "def position\n\t\t[ @x, @y ]\n\tend", "def xy=(value); self.state = { :xy => value }; end", "def\n\t\tprint_point\n\t\tp \"(#{x}, #{y})\"\t\n\tend", "def getY() @y end", "def calculate_coordinates\n (\n egde(@x1, @y1, @x2, @y1) +\n egde(@x2, @y1, @x2, @y2) +\n egde(@x2, @y2, @x1, @y2) +\n egde(@x1, @y2, @x1, @y1)\n ).uniq\n end", "def y\n @p[1]\n end", "def y\n @p[1]\n end", "def get_y; \t\t@y \t\t\tend", "def initialize x, y\n\t\t@x = x\n\t\t@y = y\n\tend", "def coord2pos(x, y)\n (y % h)*w+(x % w)\n end", "def ptx__x(n, y); ptdist(n, 1.0 - y / 2.0); end", "def set(x, y)\n @x, @y = x, y\n end", "def ajustxy(d=nil)\n push_x, push_y = 0, 1 if d.nil? ? Input.dir4 == 2 : d.direction == 2\n push_x, push_y = - 1, 0 if d.nil? ? Input.dir4 == 4 : d.direction == 4\n push_x, push_y = 1, 0 if d.nil? ? Input.dir4 == 6 : d.direction == 6\n push_x, push_y = 0, - 1 if d.nil? ? Input.dir4 == 8 : d.direction == 8\n return [push_x, push_y] if d != nil\n push_x, push_y = 0, 0 if Input.dir4 == 0\n return [push_x, push_y]\n end", "def point(x,y)\n [x,y]\nend", "def moveto(x, y)\n @ox = @x = x\n @oy = @y = y\n @real_x = @x * 128\n @real_y = @y * 128\n end", "def xy(x = 0.5, y = 0.5, xt = :fraction, yt = :fraction)\n Kamelopard::XY.new x, y, xt, yt\n end", "def coords\n [x, y]\n end", "def get_co_x_y(x,y)\n co_y = x*BLOCK_DIMENTION + BLOCK_DIMENTION/2 + BOARD_SQUARE_POS[:board_start]\n co_x = y*BLOCK_DIMENTION + BLOCK_DIMENTION/2 + BOARD_SQUARE_POS[:board_start]\n return co_x,co_y\nend", "def get_arr_x(x, y) \n x # this coordinate doesn't change\nend", "def y2\n y + height\n end", "def gather_coords(x,y)\n if y == 100\n y = 99.9\n end\n if x == 100\n x = 99.9\n end\n id = (x * 10000 + 0.5).floor * 10000 + (y * 10000 + 0.5).floor\n return id/100\nend", "def warp(x, y)\n @x, @y = x, y\n end", "def warp(x, y)\n @x, @y = x, y\n end", "def move(x,y=@y)\r\n @x2=x+(@x2-@x1)\r\n @y2=y+(@y2-@y1)\r\n @y1=y\r\n @x1=x\r\n end", "def xy=(value)\n set(:xy => value)\n end", "def identity_x\r\n new_point = identity\r\n new_point.y = 0\r\n return new_point\r\n end", "def line(x, y)\n [x.value, y.value]\n end", "def perp\n self.class.new( -@y, @x )\n end", "def flip_range_neg_xy(points); points.collect{ |v| Vertex.new(v.y,v.x)}; end", "def init_oripost\n @ori_x = original_x\n @ori_y = original_y\n end", "def gecos=(p0) end", "def new_coords(x,y)\n [x % GRID_WIDTH, y % GRID_HEIGHT]\n end", "def gen(x, y)\n return 384 + x + (y * 8)\n end", "def convert_coords(screen, x, y, z)\n\t\txd = x * $persp / (z + $space_size) + screen.width / 2\n\t\tyd = y * $persp / (z + $space_size) + screen.height / 2\n\t\treturn xd, yd\n\tend", "def teleport( x, y )\n @x, @y = x, y\n end", "def y2; y1 + HEIGHT ; end", "def new_coords(x, y)\n [x % GRID_WIDTH, y % GRID_HEIGHT]\n end", "def position\n [@x, @y]\n end", "def coordinates\n [@y_location, @x_location]\n end", "def petunin(points)\n\tif points.size() < 4\n\t\tputs \"Error on #{__LINE__} in #{__FILE__}\"\n\t\texit(1)\n\tend\n\t#return [x,x0,y,y0]\n\trect = find_rect(points)\n\tdx, phi, coef = get_transf_coef(rect)\n\tdx.each {}\n\t#rect = translate(rect, -dx[0], -dx[1])\n\trect = rotate(rect, phi)\n\trect = scale(rect, 1.0, coef)\n\n\t#points = translate(points, -dx[0], -dx[1])\n\tpoints = rotate(points,phi)\n\tpoints = scale(points, 1, coef)\n\n\tcentre = rect[0].zip(rect[2]).to_a.map { |u,v| (u+v)/2 }\n\trs = []\n\tpoints.each do |p|\n\t\trs << [dist(p, centre), p]\n\tend\n\trs = rs.sort\n\n\tres = []\n\n\trs.each do |r,p|\n\t\tel = Ellipse.new\n\t\tel.centre = centre\n\t\tel.axes = [r]*2\n\n\t\t#back\n\t\tel.scale(1, 1/coef)\n\n\t\tel.rotate(-phi)\n\t\tres << [el,p]\n\tend\n\n\treturn res\n\n\t# For testing reasons only\n\n\t#rect = scale(rect, 1, 1/coef)\n\t#points = scale(points, 1, 1/coef)\n\t#rect = rotate(rect, -phi)\n\t#points = rotate(points, -phi)\n\t#points.map! { |x| [x] }\n\n\t#points + [rect] + res.inject([]) { |sum,el| sum + [el.get_draw_data] }\nend", "def fly(x,y,z) #remeber these start with 0 in numbering!! \n\t\t@@v_row[y][x].sub!(\"#{@@v_row[y][x]}\", \"#{z}\") #find the point, and then replace with object's symbol. #FIXME Fix'd 12/16\n\t\t@position = x, y\n\tend", "def set_loc(x, y)\n @curr_x = x\n @curr_y = y\n end", "def normalize_coords(x, y)\n x = x * -1 - 1 if x < 0\n y = y * -1 - 1 if y > -1\n [x, y]\n end", "def inflate!(x,y)\n self[0] -= x.div(2)\n self[1] -= y.div(2)\n self[2] += x\n self[3] += y\n return self\n end", "def transform \n \n @pixel_location = get_pixel_points \n puts \"px loc : #{@pixel_location}\"\n \n while @pixel_location.size != 0 \n transform_pixel_points(@pixel_location)\n @pixel_location.shift\n @pixel_location.shift\n end\n end", "def moveTo x, y\n\n\tend", "def initialize(x,y)\n @x, @y = x,y\n end", "def coordinates\n return 166, 72\n end", "def coords(x, y)\n return [x % WIDTH, y % HEIGHT]\n end", "def initialize(x,y)\n @x, @y = x,y\n end", "def calc_parab_y(x_in, fp_in)\r\n # - - - - - - - - - - - - - - - -\r\n lcy = (x_in * x_in) / (fp_in * 4.0)\r\n lcy\r\n end", "def xy(offset_x, offset_y)\n @board[3 * offset_y + offset_x - 4]\n end", "def initialize(x,y)\n @x,@y = x,y\n end", "def untransformed(p)\r\n (0..1).map do |i|\r\n (p[i] - @old_center[i])/@zoom + (@old_center[i] - @center[i]) + @old_center[i]\r\n end\r\n end", "def y\n @point[1]\n end", "def x_or_y\n x = @x.content\n y = @y.content\n z = Array.new @z.length, 0\n\n @z.length.times { |i| z[i] = x[i] | y[i] }\n\n @z.content = z\n end", "def moveto(x, y)\n @x = x \n @y = y \n @real_x = @x * 128\n @real_y = @y * 128\n @prelock_direction = 0\n end", "def position\n V[x, y]\n end", "def points\n [top_left, top_right, bottom_left, bottom_right]\n end", "def onMouseMove(flags, x, y, view)\n if( @state == 0 )\n # We are getting the first end of the line. Call the pick method\n # on the InputPoint to get a 3D position from the 2D screen position\n # that is bassed as an argument to this method.\n @ip.pick view, x, y\n if( @ip != @ip1 )\n # if the point has changed from the last one we got, then\n # see if we need to display the point. We need to display it\n # if it has a display representation or if the previous point\n # was displayed. The invalidate method on the view is used\n # to tell the view that something has changed so that you need\n # to refresh the view.\n view.invalidate if( @ip.display? or @ip1.display? )\n @ip1.copy! @ip\n if @ci == nil\n \t\t\t\t# there was no component selected when we started the tool\n \t\t\t\t# highlight whatever ci is under the mouse cursor\n \t\t\t\tmm = Sketchup.active_model\n \t\t\t\tss = mm.selection\n \t\t\t\tph = view.pick_helper\n \t\t\t\tph.do_pick(x,y)\n \t\t\t\tbp = ph.best_picked\n \t\t\t\tif bp.instance_of? Sketchup::ComponentInstance\n \t\t\t\t\tss.clear\n \t\t\t\t\tss.add(bp)\n \t\t\t\telse \n \t\t\t\t\tss.clear\n \t\t\t\tend\n \t\t\tend\n \t\t\t\n # set the tooltip that should be displayed to this point\n view.tooltip = @ip1.tooltip\n end\n else\n # Getting the second end of the line\n # If you pass in another InputPoint on the pick method of InputPoint\n # it uses that second point to do additional inferencing such as\n # parallel to an axis.\n @ip2.pick view, x, y, @ip1\n view.tooltip = @ip2.tooltip if( @ip2.valid? )\n view.invalidate\n \t\n if( @ip2.valid? )\n \t\t\t@gp2 = @ip2.position\t\t\t\t\t\t\t#global p2\n \t\t\t\t\t\t\n \t\t\ttplane = [@gp2, @gv]\t\t\t\t\t\t# target plane\n \t\t\t@tp = @gp1.project_to_plane(tplane)\t\t\t#target point (in global space)\n \t\t\tltp = @tp.clone\t\t\t\t\t\t\t\t# local target point\n \t\t\tltp.transform!(@ci.transformation.inverse)\n \t\t\t\n \t\t\t# Update the length displayed in the VCB\n \t\t\t@length = @gp1.distance_to_plane(tplane)\n \t\t\t@length = @gp1.distance(@tp)\n \t\t\tif @length != 0 \n \t\t\t\tvv = @tp.vector_to(@gp1)\n \t\t\t\tif vv.samedirection? @gv\n \t\t\t\t\t@length = @length * -1\n \t\t\t\tend\n \t\t\tend\n \t\t\treturn if @length < @min_length\n Sketchup.vcb_value = @length.to_l.to_s\n \t\t\t\n \t\t\toffs_vector = @prev_pos.vector_to(ltp)\n \t\t\t#puts \"offset vector \" << offs_vector.to_s\n \t\t\tmove_it(offs_vector)\n \t\t\t\n \t\t\t@prev_pos = ltp\n end\n end\n end", "def adjust _x, _y\n x += _x\n y += _y\n end", "def xy\n @attributes.fetch('xy', [0.0, 0.0])\n end", "def p2t(x, y)\n Vct.new(g_height - y, x)\n end", "def initialize(x,y)\n @x,@y = x, y\n end", "def initialize(x,y)\n @x, @y = x, y\n end", "def home()\n\t\t@x = @tam_ancho/2\n\t\t@y = @tam_alto/2\n\tend", "def initialize(x,y)\r\n @x = x\r\n @y = y \r\n end", "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 curve(x1, y1, x2, y2, x3, y3)\n [x1.value, y1.value, x2.value, y2.value, x3.value, y3.value]\n end", "def y2\n y + h\n end", "def setposition(x,y)\n\t\t@x = x\n\t\t@y = y\n\tend", "def get_x; \t\t@x \t\t\tend", "def update\n get_x\n get_y\n end", "def coordinates\n row_values.product(col_values)\n end", "def y_vertex(p_hn, p_v)\n case p_v\n when :n then return yp_from_hn(p_hn)\n when :ne, :no then return yp_from_hn(p_hn) + th\n when :s then return yp_from_hn(p_hn) + fh\n else return yp_from_hn(p_hn) + th + hex_side_length \n end \n end" ]
[ "0.63143045", "0.6305882", "0.62820786", "0.62705386", "0.6258456", "0.6170505", "0.6148908", "0.61111575", "0.60721296", "0.60547215", "0.6048659", "0.6003661", "0.598377", "0.59816134", "0.59616053", "0.5956957", "0.5956515", "0.5956515", "0.5956515", "0.5956515", "0.595593", "0.5912378", "0.5892355", "0.5882451", "0.58789736", "0.5864373", "0.58564997", "0.58554727", "0.58471733", "0.58427566", "0.5842129", "0.58351564", "0.58351564", "0.5830812", "0.58242315", "0.58212775", "0.58211", "0.5810059", "0.58056784", "0.58016455", "0.57936096", "0.57854825", "0.57813334", "0.578063", "0.5776365", "0.57700926", "0.57671076", "0.57614213", "0.57614213", "0.5756792", "0.5742358", "0.57409066", "0.5731599", "0.57301354", "0.5729736", "0.57152194", "0.57094043", "0.57057077", "0.56928325", "0.56852734", "0.5681769", "0.5679631", "0.5670092", "0.5668342", "0.5665462", "0.5650572", "0.56497204", "0.5639122", "0.56325203", "0.5631967", "0.5617935", "0.5614358", "0.56134796", "0.56129515", "0.5607068", "0.560297", "0.5602755", "0.56026375", "0.5597704", "0.5596079", "0.55934167", "0.55912256", "0.5575027", "0.5570244", "0.55659306", "0.5565295", "0.55645084", "0.55621684", "0.5552413", "0.55255353", "0.55240095", "0.5521582", "0.55214643", "0.5511637", "0.55098957", "0.55087954", "0.55077225", "0.5503707", "0.5503493", "0.5502728", "0.5491261" ]
0.0
-1
!!! Birol: don't think this is working...where is comparables set? before_action :set_comparisons_measures, only: [:edit] GET /result_statistic_sections/1/edit
def edit add_breadcrumb 'edit project', edit_project_path(@result_statistic_section.extraction.project) add_breadcrumb 'extractions', project_extractions_path(@result_statistic_section.extraction.project) add_breadcrumb 'work', work_extraction_path(@result_statistic_section.extraction, params: { eefpst1_id: @result_statistic_section.population.extractions_extraction_forms_projects_sections_type1_id }, anchor: "panel-tab-#{ @result_statistic_section.eefps_result.id }") add_breadcrumb @result_statistic_section.result_statistic_section_type.name.downcase, :edit_result_statistic_section_path end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_comparison_measures\n\t\tapply_to = params[:changes_apply_to]\n\t\tpreviously_saved = params[:previously_checked].nil? ? [] : params[:previously_checked]\n\t\tpreviously_user_defined = params[:previously_defined_checked].nil? ? [] : params[:previously_defined_checked]\n\t\tmeasures = params[:measures].nil? ? [] : params[:measures]\n\t\tuser_defined_measures = params[:user_defined_measures].nil? ? [] : params[:user_defined_measures]\n\t\tnew_measure_titles = params[:user_defined_titles]\n\t\tnew_measure_descriptions = params[:user_defined_descriptions]\n\t comparison_id = params[:comparison_id]\n\t comparison = Comparison.find(comparison_id)\n \tif apply_to == \"this\"\n \t\tComparison.update_measures(measures, comparison_id, previously_saved)\n\t\t\tComparison.update_measures(user_defined_measures, comparison_id, previously_user_defined,'user-defined')\n\t\t\tunless (new_measure_titles.nil?)\n\t\t\t\tComparison.create_new_measures(new_measure_titles, new_measure_descriptions, [comparison_id], comparison.within_or_between)\n\t\t\tend\n\t\telsif apply_to == \"all\"\n\t\t\tComparison.update_measures_for_all(measures, comparison.outcome_id, comparison.extraction_form_id, comparison.study_id,comparison.within_or_between,comparison.subgroup_id,'default',comparison.section)\n\t\t\tComparison.update_measures_for_all(user_defined_measures, comparison.outcome_id, comparison.extraction_form_id, comparison.study_id,comparison.within_or_between,comparison.subgroup_id,'user-defined',comparison.section)\n\t\t\tunless (new_measure_titles.nil?)\n\t\t\t\tcomparison_ids = Comparison.where(:within_or_between=>comparison.within_or_between, :study_id=>comparison.study_id,\n\t\t\t\t\t\t\t\t\t\t\t\t :extraction_form_id=>comparison.extraction_form_id, :outcome_id=>comparison.outcome_id).select(\"id\")\n\t\t\t\tcomparison_ids = comparison_ids.collect{|x| x.id}\n\t\t\t\tComparison.create_new_measures(new_measure_titles, new_measure_descriptions, comparison_ids, comparison.within_or_between)\n\t\t\tend\n\t\tend\n\t\t@selected_timepoints = params[:selected_timepoints]\n\t\t@selected_tp_array = @selected_timepoints.split(\"_\")\n\t \t@outcome_id = comparison.outcome_id\n\t \t@outcome = Outcome.find(@outcome_id)\n\t @subgroup = params[:subgroup_id] == 0 ? nil : OutcomeSubgroup.find(params[:subgroup_id])\n\t \t#-----------------------------------------\n\t \t# Data for the entry table\n\t \t#-----------------------------------------\n\t \t@is_diagnostic = ExtractionForm.is_diagnostic?(comparison.extraction_form_id)\n\t \t@checkbox_timepoints = @outcome.outcome_timepoints\n\t \t# If this extraction form deals with RCT data...\n\t\tif !@is_diagnostic\n\t \t\t@selected_timepoints = OutcomeDataEntry.get_selected_timepoints(@outcome,@subgroup)\n\n\t \t\t@outcome_id, @study_id,@extraction_form_id, @selected_tp_array, @timepoints, @OCDEs, \n\t\t\t@measures, @datapoints, @arms, @comparisons, @comparison_measures, @comparators, \n\t\t\t@all_comparators, @num_comparators, @comparison_datapoints, @wa_comparisons, @wa_measures, \n\t\t\t@wa_comparators, @wa_all_comparators, @wa_datapoints, @footnotes = OutcomeDataEntry.get_information_for_entry_table(@outcome,@subgroup,@selected_timepoints)\n\n\t\t# Otherwise, gather the diagnostic test comparison data.\n\t\telse\n\t\t\t@selected_timepoints = Comparison.get_selected_timepoints_for_diagnostic_tests(@outcome,@subgroup)\n\n\t\t\t@outcome_id, @study_id, @extraction_form_id, @selected_tp_array, @timepoints, \n\t\t\t@comparisons, @comparators, @all_comparators, @comparison_measures, @comparison_datapoints, @index_tests, \n\t\t\t@reference_tests, @thresholds, @footnotes = OutcomeDataEntry.get_diagnostic_test_results(@outcome,@subgroup,@selected_timepoints)\n\n\t\t\t@index_test_options, @reference_test_options = DiagnosticTest.get_select_options(@index_tests,@reference_tests,@thresholds)\n\t\tend\n\t\t\tef = ExtractionForm.find(@extraction_form_id)\n\t\t\t@project_id = ef.project_id\n\t \trender \"outcome_data_entries/update_measures\"\n\tend", "def update\n\t\t@comparison_measure = ComparisonMeasure.find(params[:id])\n\t\tif @comparison_measure.update_attributes(params[:comparison_measure]);\n\t\t\t@comparison = Comparison.find(@comparison_measure.comparison_id)\n\t\t\t@comparison_measures = ComparisonMeasure.where(:comparison_id=>@comparison.id)\n\t\t\t@comparison_data_points = ComparisonMeasure.get_data_points(@comparison_measures.collect{|x| x.id})\n\t\t\t@comparison_data_point = ComparisonDataPoint.new\n\t\t\t@comparison_measure = ComparisonMeasure.new\n\t\t\t@study = Study.find(@comparison.study_id)\n\t\t\t@outcome = Outcome.find(@comparison.outcome_id)\n\t\t\t@extraction_form = ExtractionForm.find(@comparison.extraction_form_id)\n\t\t\t@td_id = \"#\" + @comparison.comparators.to_s\n\t\t\t@type = @comparison.within_or_between\n\t\t\t@previous_measures = ComparisonMeasure.get_previous_measures(@comparison.study_id)\n\t\t\t@close_window = \"measure_form_div\"\n\t\t\t@entry_container = \"measure_form_div\"\n\t\t\t@entry_partial = \"comparison_measures/form\"\n\t\t\t@table_container = \"measure_display_div\"\n\t\t\t@table_partial = \"comparison_measures/measure_list\"\n\t\t\t@table_container2 = \"form_div\"\n\t\t\tobject_ids = @comparison.comparators.split(\"_\")\n\t\t\tif @type == \"between\"\n\t\t\t\t@table_partial2 = \"comparison_data_points/between_arm_comparisons\"\n\t\t\t\t@arms = []\n\t\t\t\tobject_ids.length.times do |i|\n\t\t\t\t\ttmp = Arm.find(object_ids[i])\n\t\t\t\t @arms[i] = tmp\n\t\t\t\tend\n\t\t\telse # if the type is 'within'...\n\t\t\t\t@table_partial2 = \"comparison_data_points/within_arm_comparisons\"\n\t\t\t\t@timepoints = []\n\t\t\t\tobject_ids.length.times do |i|\n\t\t\t\t\ttmp = OutcomeTimepoint.find(object_ids[i])\n\t\t\t\t @timepoints[i] = tmp\n\t\t\t\tend\n\t\t\tend\n\t\t\trender 'shared/saved.js.erb'\n\t\telse # if the update is unsuccessful...\n\t\t\t\n\t\tend\n\tend", "def show_comparison_measures_form\n\t @timepoint_id = params[:timepoint_id]\n\t @selected_timepoints = params[:selected_timepoints]\n\t @extraction_form_id = params[:extraction_form_id]\n\t @study_id = params[:study_id]\n\t @project_id = params[:project_id]\n\t @comparison_id = params[:comparison_id]\n\t outcome_type = params[:outcome_type]\n\t @subgroup_id = params[:subgroup_id] == \"\" ? 0 : params[:subgroup_id]\n\n\t # section number specific to diagnostic test entries\n\t section_num = params[:dx_section]\n\n\t # get a list of all measures\n\t ocType = section_num.nil? ? outcome_type.downcase : \"diagnostic_#{section_num}\"\n\t ocType = ocType == \"time to event\" ? \"survival\" : ocType\n\t if @project_id == 427 || @project_id == 553\n\t \t@all_measures = DefaultCevgMeasure.where(:outcome_type=>ocType,:results_type=>1)\n\t else\n\t \t@all_measures = DefaultComparisonMeasure.where(:outcome_type=>ocType,:within_or_between=>1)\n\t end\n\t \n\t # get the measures for this particular comparison\n\t @selected_measures = ComparisonMeasure.where(:comparison_id=>@comparison_id)\n\t comparison = Comparison.find(@comparison_id)\n\t unless comparison.nil?\n\t\t @all_user_defined_measures = comparison.get_all_user_defined_measures\n\t\telse\n\t\t\t@all_user_defined_measures = []\n\t\tend\n\t \n\t unless section_num.nil?\t\n\t \t@show_measures_for = case section_num.to_i\n\t\t \twhen 1\n\t\t \t\t'Diagnostic Test Descriptive Result Measures'\n\t\t \twhen 2\n\t\t \t\t'Diagnostic Test Measures Assuming a Reference Standard'\n\t\t \telse\n\t\t \t\t'Diagnostic Test Measures for Additional Analysis'\n\t\t \tend\n\t\t\n\t else\t\n\t \t@show_measures_for = \"Between-Arm Comparison\"\n\t end\n\t render '/outcome_data_entries/show_measures_form'\n\tend", "def edit\n\t\t@comparison_measure = ComparisonMeasure.find(params[:measure_id])\n\t\t@comparison = Comparison.find(@comparison_measure.comparison_id)\n\t\t@editing = true\n\t\t# render comparison_measures/edit.js.erb to view the update table\t\t\n\tend", "def set_comparison\n @comparison = Comparison.find(params[:id])\n end", "def show_within_arm_comparison_measures_form\n\t @selected_timepoints = params[:selected_timepoints]\n\t @comparison_id = params[:comparison_id]\n\t @outcome_type = params[:outcome_type]\n\t @outcome_id = params[:outcome_id]\n\t @subgroup_id = params[:subgroup_id]\n\t @project_id = params[:project_id]\n\t # get a list of all measures\n\t @all_measures = DefaultComparisonMeasure.where(:outcome_type=>@outcome_type.downcase,:within_or_between=>0)\n\t # get the measures for this particular comparison\n\t @selected_measures = ComparisonMeasure.where(:comparison_id=>@comparison_id)\n\t \n\t comparison = Comparison.find(@comparison_id)\n\t unless comparison.nil?\n\t\t @all_user_defined_measures = comparison.get_all_user_defined_measures\n\t\telse\n\t\t\t@all_user_defined_measures = []\n\t\tend\n\n\t\t@show_measures_for = \"Within-Arm Comparison\"\n\t render '/outcome_data_entries/show_measures_form'\n\tend", "def edit\n @comparison = Comparison.get(params[:id])\n end", "def set_comparison\n @comparison = Comparison.find(params[:id])\n end", "def set_comparison\n @comparison = Comparison.find(params[:id])\n end", "def comparisons\n @project = Project.find(params[:project_id])\n @study = Study.find(params[:study_id])\n makeStudyActive(@study)\n session[:project_id] = @study.project_id\n @study_extforms = StudyExtractionForm.where(:study_id => @study.id)\n @extraction_forms = Array.new\n @included_sections = Hash.new\n @borrowed_section_names, @section_donor_ids = [Hash.new,Hash.new]\n # an array of hashes to keep track of key questions addressed by\n # each individual section\n @kqs_per_section = Hash.new\n @saved_comparisons = Comparison.where(:study_id=>@study.id).order(\"within_or_between ASC\")\n @comparison_titles,@saved_measures, @saved_data_points = Comparison.get_comparison_details(@saved_comparisons)\n unless @study_extforms.empty?\n @study_extforms.each do |ef|\n tmpForm = ExtractionForm.find(ef.extraction_form_id)\n @extraction_forms << tmpForm\n included = ExtractionFormSection.get_included_sections(ef.extraction_form_id)\n borrowed = ExtractionFormSection.get_borrowed_sections(ef.extraction_form_id)\n @included_sections[ef.extraction_form_id] = included\n @borrowed_section_names[ef.extraction_form_id] = borrowed.collect{|x| x[0]}\n @section_donor_ids[ef.extraction_form_id] = borrowed.collect{|x| x[1]}\n @kqs_per_section[ef.extraction_form_id] = ExtractionFormSection.get_questions_per_section(ef.extraction_form_id,@study)\n end\n end\n if ExtractionFormSection.section_is_included(\"comparisons\", @study.id, params[:extraction_form_id])\n @arms = Arm.where(:study_id=>@study.id, :extraction_form_id=>params[:extraction_form_id]).all\n @outcomes = Outcome.where(:study_id => @study.id, :extraction_form_id => params[:extraction_form_id]).all\n @outcome_timepoints = Outcome.get_timepoints_for_outcomes(@outcomes.collect{|oc| oc.id})\n @project = Project.find(params[:project_id])\n @study_arms = Arm.where(:study_id => params[:study_id], :extraction_form_id => params[:extraction_form_id]).all\n extraction_form_id = params[:extraction_form_id]\n else\n flash[\"error\"] = \"That section is not included in the current extraction form.\"\n redirect_to edit_project_study_path(params[:project_id], @study.id)\t\t\t\t\n end\n render :layout=>false\n end", "def clear_comparisons\n\t\t@selected_timepoints = params[:selected_timepoints]\n\t\t@selected_tp_array = @selected_timepoints.split(\"_\")\n\t\t@outcome_id = params[:outcome_id]\n\t\t@subgroup_id = params[:subgroup_id]\n\t\t@study_id = params[:study_id]\n\t\t@extraction_form_id = params[:extraction_form_id]\n\t\tcomparison_type = params[:comparison_type]\n\t\t@outcome = Outcome.find(@outcome_id)\n\t\t@is_diagnostic = ExtractionForm.is_diagnostic?(@extraction_form_id)\n\t\tif OutcomeDataEntry.remove_comparison_data(comparison_type, @outcome_id, @subgroup_id, @study_id, @extraction_form_id)\n\t\t #flash[:notice] = \"Comparisons were successfully deleted.\"\n\t\telse\n\t\t\t\n\t\tend\n\t\t\n\t\tunless params[:subgroup_id].nil?\n\t\t\t@subgroup = OutcomeSubgroup.find(params[:subgroup_id])\n\t\telse\n\t\t\t@subgroup = nil\n\t\tend\n\t\t\n\t\t@checkbox_timepoints = @outcome.outcome_timepoints\n\t\t\n\t\t# If this extraction form deals with RCT data...\n\t\tif !@is_diagnostic\n\t \t\t@selected_timepoints = OutcomeDataEntry.get_selected_timepoints(@outcome,@subgroup)\n\n\t \t\t@outcome_id, @study_id,@extraction_form_id, @selected_tp_array, @timepoints, @OCDEs, \n\t\t\t@measures, @datapoints, @arms, @comparisons, @comparison_measures, @comparators, \n\t\t\t@all_comparators, @num_comparators, @comparison_datapoints, @wa_comparisons, @wa_measures, \n\t\t\t@wa_comparators, @wa_all_comparators, @wa_datapoints, @footnotes = OutcomeDataEntry.get_information_for_entry_table(@outcome,@subgroup,@selected_timepoints)\n\n\t\t# Otherwise, gather the diagnostic test comparison data.\n\t\telse\n\t\t\tall_tps = @outcome.outcome_timepoints.collect{|x| x.id.to_s}.join(\"_\")\n\t\t\t@selected_timepoints = {1=>all_tps, 2=>all_tps, 3=>all_tps}\n\n\t\t\t@outcome_id, @study_id, @extraction_form_id, @selected_tp_array, @timepoints, @comparisons, \n\t\t\t@comparators, @all_comparators, @comparison_measures, @comparison_datapoints, @index_tests, \n\t\t\t@reference_tests, @thresholds, @footnotes = OutcomeDataEntry.get_diagnostic_test_results(@outcome,@subgroup,@selected_timepoints)\n\n\t\t\t@index_test_options, @reference_test_options = DiagnosticTest.get_select_options(@index_tests,@reference_tests,@thresholds)\n\t\tend\n\t\t#----------------\n\t\t\tef = ExtractionForm.find(@extraction_form_id)\n\t\t\t@project_id = ef.project_id \n\t \trender \"/outcome_data_entries/show_timepoints\"\n\tend", "def set_comparison_result\n @comparison_result = ComparisonResult.find(params[:id])\n end", "def destroy\n\t\t@comparison_measure = ComparisonMeasure.find(params[:id]);\n\t\t\n\t\t# find and delete any associated data points\n\t\tdataPoints = ComparisonDataPoint.where(:comparison_measure_id=>@comparison_measure.id)\n\t\t\n\t\tunless dataPoints.empty?\n\t\t\tdataPoints.each do |dp|\n\t\t\t\tdp.destroy\t\n\t\t\tend\n\t\tend\n\t\t\n\t\t# get the comparison object that this measure belongs to\n\t\t@comparison = Comparison.find(@comparison_measure.comparison_id)\n\t\t\n\t\t# remove the comparison measure\n\t\t@comparison_measure.destroy\n\t\t\n\t\t# update the display tables and give a message that it was deleted successfully\n\t\t@comparison_measure = ComparisonMeasure.new\n\t\t@comparison_measures = ComparisonMeasure.where(:comparison_id=>@comparison.id)\n\t\t@comparison_data_points = ComparisonMeasure.get_data_points(@comparison_measures.collect{|x| x.id})\n\t\t@comparison_data_point = ComparisonDataPoint.new\n\t\t@comparison_measure = ComparisonMeasure.new\n\t\t@study = Study.find(@comparison.study_id)\n\t\t@outcome = Outcome.find(@comparison.outcome_id)\n\t\t@extraction_form = ExtractionForm.find(@comparison.extraction_form_id)\n\t\t@td_id = \"#\" + @comparison.comparators.to_s\n\t\t@type = @comparison.within_or_between\n\t\t@previous_measures = ComparisonMeasure.get_previous_measures(@comparison.study_id)\n\t\t@entry_container = \"measure_form_div\"\n\t\t@entry_partial = \"comparison_measures/form\"\n\t\t@editing=false\n\t\t\n\t\t@table_container = \"measure_display_div\"\n\t\t@table_partial = \"comparison_measures/measure_list\"\n\t\t\n\t\t@table_container2 = \"form_div\"\n\t\tobject_ids = @comparison.comparators.split(\"_\")\n\t\tif @type == \"between\"\n\t\t\t@table_partial2 = \"comparison_data_points/between_arm_comparisons\"\n\t\t\t@arms = []\n\t\t\tobject_ids.length.times do |i|\n\t\t\t\ttmp = Arm.find(object_ids[i])\n\t\t\t\t@arms[i] = tmp\n\t\t\tend\n\t\telse\n\t\t\t@table_partial2 = \"comparison_data_points/within_arm_comparisons\"\n\t\t\t@timepoints = []\t\n\t\t\tobject_ids.length.times do |i|\n\t\t\t\ttmp = OutcomeTimepoint.find(object_ids[i])\n\t\t\t\t@timepoints[i] = tmp\n\t\t\tend\t\t\n\t\tend\n\t\trender \"shared/saved\"\n\tend", "def result_statistic_section_params\n params.require(:result_statistic_section).permit(\n measures_attributes: [:id, :name, :_destroy],\n measure_ids: [],\n result_statistic_sections_measures_attributes: [measure_attributes: [:id, :name]],\n comparisons_attributes: [:id, :is_anova,\n comparate_groups_attributes: [:id,\n comparates_attributes: [:id,\n comparable_element_attributes: [:id, :comparable_type, :comparable_id]]]])\n#\n# measure_ids: [],\n# comparisons_attributes: [ :id, :_destroy, :result_statistic_section_id,\n# comparisons_measures_attributes: [ :id, :_destroy, :comparison_id, :measure_id ,\n# measurement_attributes: [ :id, :_destroy, :comparisons_measure_id, :value ] ],\n# comparate_groups_attributes: [ :id, :_destroy, :comparison_id,\n# comparates_attributes: [ :id, :_destroy, :comparate_group_id, :comparable_element_id,\n# comparable_element_attributes: [ :id, :_destroy, :comparable_type, :comparable_id, :_destroy ] ] ] ] )\n end", "def index\n @comparisons = Comparison.all\n end", "def update_measures\n\t\tapply_to = params[:changes_apply_to]\n\t\tpreviously_saved = params[:previously_checked]\n\t\tpreviously_user_defined = params[:previously_defined_checked]\n\t\tmeasures = params[:measures]\n\t\tuser_defined_measures = params[:user_defined_measures].nil? ? [] : params[:user_defined_measures]\n\t\t# Get information in regards to any new measures that the user created\n\t\tnew_measure_titles = params[:user_defined_titles]\n\t\tnew_measure_descriptions = params[:user_defined_descriptions]\n\t\t\n ocde_id = params[:ocde_id]\n ocde = OutcomeDataEntry.find(ocde_id)\n unless params[:subgroup_id].nil?\n\t\t\t@subgroup = OutcomeSubgroup.find(params[:subgroup_id])\n\t\telse\n\t\t\t@subgroup = nil\n\t\tend\n if apply_to == \"this\"\n\t\t\tOutcomeDataEntry.update_measures(measures, ocde_id, previously_saved)\n\t\t\tOutcomeDataEntry.update_measures(user_defined_measures, ocde_id, previously_user_defined,'user-defined') unless user_defined_measures.nil?\n\t\t\tunless (new_measure_titles.nil?)\n\t\t\t\tOutcomeDataEntry.create_new_measures(new_measure_titles, new_measure_descriptions, [ocde_id])\n\t\t\tend\n\t\telsif apply_to == \"all\"\n\t\t\tocdes = OutcomeDataEntry.where(:study_id=>ocde.study_id, :outcome_id=>ocde.outcome_id, :extraction_form_id=>ocde.extraction_form_id)\n\t\t\tocdes = ocdes.collect{|x| x.id}\n\t\t\tOutcomeDataEntry.update_measures_for_all(measures, ocde.outcome_id, ocde.extraction_form_id, ocde.study_id, @subgroup)\n\t\t\tOutcomeDataEntry.update_measures_for_all(user_defined_measures, ocde.outcome_id, ocde.extraction_form_id, ocde.study_id, @subgroup,'user-defined') unless user_defined_measures.nil?\n\t\t\tunless (new_measure_titles.nil?)\n\t\t\t\tOutcomeDataEntry.create_new_measures(new_measure_titles, new_measure_descriptions,ocdes)\n\t\t\tend\n\t\tend\n \t@selected_timepoints = params[:selected_timepoints]\n \t@selected_tp_array = @selected_timepoints.split(\"_\")\n \t@outcome_id = ocde.outcome_id\n \t@outcome = Outcome.find(@outcome_id)\n \t\n \t#-----------------------------------------\n \t# Data for the entry table\n \t#-----------------------------------------\n \t@outcome_id, @study_id,@extraction_form_id, @selected_tp_array, @timepoints, @OCDEs, \n\t\t@measures, @datapoints, @arms, @comparisons, @comparison_measures, @comparators, \n\t\t@all_comparators, @num_comparators, @comparison_datapoints, @wa_comparisons, @wa_measures, \n\t\t@wa_comparators, @wa_all_comparators, @wa_datapoints, @footnotes = OutcomeDataEntry.get_information_for_entry_table(@outcome,@subgroup,@selected_timepoints)\n\tend", "def add_to_compare\n @analysis = Analysis.find(params[:analysis][:id])\n session[:selected_analysis_id] = session[:selected_analysis_id] << params[:analysis][:id]\n @analyses = analysis_list_for_comparison(session[:selected_analysis_id])\n end", "def update_for_analysis_type\n \t@selected_analysis = params[:selected_analysis]\n \t\n \trespond_to do |format|\n format.js { \n \trender :update do |page|\n \t\tpartial_used = case @selected_analysis\n \t\t\t\twhen \"Log Rank\" then \"log_rank\"\n \t\t\t\twhen \"t-Test, 1-sided\" then \"choice_of_grouping\"\n \t\t\t\twhen \"t-Test, 2-sided\" then \"two_sided_t\"\n \t\t\t\telse \"default\"\n \t\t\tend\n \t page.replace_html \"comparison_level1\", :partial=>\"outcome_analyses/partials/analyses/\"+partial_used.to_s\n \tend\n }\n end\n end", "def edit_analyses\n @analyses = Analysis.all\n end", "def set_result_statistic_section\n @result_statistic_section = ResultStatisticSection\n .includes(subgroup: { extractions_extraction_forms_projects_sections_type1_row: { extractions_extraction_forms_projects_sections_type1: [:type1, extractions_extraction_forms_projects_section: [:extraction, extraction_forms_projects_section: :extraction_forms_project]] } })\n .includes(:result_statistic_section_type)\n .find(params[:id])\n end", "def update\n respond_to do |format|\n if @comparison.update(comparison_params)\n format.html { redirect_to @comparison, notice: 'Comparison was successfully updated.' }\n format.json { render :show, status: :ok, location: @comparison }\n else\n format.html { render :edit }\n format.json { render json: @comparison.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_scorable_tables\n department_category = self.scorable_type\n case department_category\n when \"GovernmentScore\"\n self.scorable.update_government_avg_score\n when \"SchoolScore\"\n self.scorable.update_school_avg_score\n when \"ParkScore\"\n self.scorable.update_park_avg_score\n when \"PoliceScore\"\n self.scorable.update_police_avg_score\n when \"PublicScore\"\n self.scorable.update_public_avg_score\n end\n end", "def comparison_params\n params.require(:comparison).permit(:compared_id, :comparer_id)\n end", "def show_measures_form\n\t\t@ocde_id = params[:ocde_id]\n\t\t@subgroup_id = params[:subgroup_id]\n\t\t@project_id = params[:project_id]\n\t\tocde = OutcomeDataEntry.find(@ocde_id)\n\t\t@timepoint_id = params[:timepoint_id]\n\t\toutcome_type = params[:outcome_type]\n\t\toutcome_type = outcome_type == \"Time to Event\" ? \"survival\" : outcome_type\n\t\tif @project_id == 427 || @project_id == 553\n\t\t\t@all_measures = DefaultCevgMeasure.find(:all, :conditions=>[\"outcome_type = ? AND results_type=?\",outcome_type, 0])\n\t\telse\n\t\t\t@all_measures = DefaultOutcomeMeasure.find(:all,:conditions=>[\"outcome_type = ? AND measure_type <> ?\", outcome_type.downcase, 0])\t\t\n\t\tend\n\t\t@selected_measures = ocde.get_measures(outcome_type)\n\t\t@all_user_defined_measures = ocde.get_all_user_defined_measures\n\t\t@selected_timepoints = params[:selected_timepoints] #indicates the timepoint in the dropdown\n\t\t@show_measures_for = \"Outcome\"\n\tend", "def cancel_edit\n\t\t@comparison = Comparison.find(params[:comparison_id])\n\t\t@comparison_measure = ComparisonMeasure.new\n\t\t@entry_container = \"measure_form_div\"\n\t\t@entry_partial = \"comparison_measures/form\"\n\t\t@editing=false\n\t\trender \"shared/saved\"\t\t\n\tend", "def update\n respond_to do |format|\n if @result_statistic_section.update(result_statistic_section_params)\n format.html { redirect_to edit_result_statistic_section_path(@result_statistic_section),\n notice: t('success') }\n format.json { render :show, status: :ok, location: @result_statistic_section }\n format.js do\n @eefpst1 = @result_statistic_section\n .population\n .extractions_extraction_forms_projects_sections_type1\n @extraction = @result_statistic_section.extraction\n @project = @result_statistic_section.project\n @extraction_forms_projects = @project.extraction_forms_projects\n @eefpst1s = ExtractionsExtractionFormsProjectsSectionsType1\n .by_section_name_and_extraction_id_and_extraction_forms_project_id('Outcomes',\n @extraction.id,\n @extraction_forms_projects.first.id)\n end\n else\n format.html { render :edit }\n format.json { render json: @result_statistic_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def comparison_result_params\n params.require(:comparison_result).permit(:response_id, :rule_id, :index)\n end", "def palmitome_comparison\n\n helper = ApplicationController.helpers\n \n session[:studies]||= []\n\n @organism = Organism.find(params[:id])\n @h_hits={}\n\n @h_studies = {} \n @h_cell_types = {}\n\n @all_studies = Study.find(:all, :conditions => {:large_scale => true, :organism_id => @organism.id}).select{|e| e.large_scale}.map{|e| @h_cell_types[e.cell_type_id] = e.cell_type; e}.sort{|a, b| [a.cell_type.name, a] <=> [b.cell_type.name, b]}\n session[:studies].delete_if{|e| !@all_studies.map{|e2| e2.id}.include?(e)}\n\n ### reject studies that are hidden\n @all_studies.reject!{|e| e.hidden == true} if !lab_user? and !admin?\n\n @studies = []\n if session[:studies].size > 0\n @studies = Study.find(:all, :conditions => {:large_scale => true, :organism_id => @organism.id, :id => session[:studies]})\n # @studies = Study.find(session[:studies])\n else\n @studies = Study.find(:all, :conditions => {:large_scale => true, :organism_id => @organism.id})\n end\n @studies= @studies.select{|e| e.large_scale}.map{|e| @h_cell_types[e.cell_type_id] = e.cell_type; e}.sort{|a, b| [a.cell_type.name, a] <=> [b.cell_type.name, b]}\n\n if !params[:nber_studies] or params[:nber_studies].to_i > @studies.size\n params[:nber_studies] = (@studies.size * 0.7).to_i\n end\n\n @h_study_by_prot={}\n @h_cell_types.keys.map{|e| @h_studies[e]=[]}\n @all_studies.map{|s| \n @h_studies[s.cell_type_id].push(s)\n }\n @studies.map{|s|\n @h_hits[s.id]={};\n }\n \n hits=Hit.find(:all, :joins => 'join proteins on (proteins.id = hits.protein_id)', :conditions => #[\" nber_studies >= ? and \n [\"proteins.organism_id = ? and hits.study_id in (?)\", @organism.id, @studies.map{|s| s.id}]) # {:proteins => {:organism_id => @organism.id}})\n \n hits.select{|h| @h_hits[h.study_id]}.map{|h|\n @h_study_by_prot[h.protein_id]||={}\n @h_study_by_prot[h.protein_id][h.study_id]=1; \n @h_hits[h.study_id][h.protein_id]||=[]; \n @h_hits[h.study_id][h.protein_id].push(h)\n }\n @proteins = Protein.find(hits.map{|h| h.protein_id}).uniq.select{|e| @h_study_by_prot[e.id].keys.size>params[:nber_studies].to_i-1 }\n\n @annotated_hits = Hit.find(:all, :conditions => {:protein_id => @proteins.map{|e| e.id}, :hit_list_id => nil})\n @annotated_sites = Site.find(:all, :conditions => {:hit_id => @annotated_hits.map{|e| e.id}})\n\n respond_to do |format|\n if params[:partial]\n format.html { render :partial => 'palmitome_comparison'}\n else \n format.html # show.html.erb\n end\n \n format.text { render text: \n ['UniProt AC', 'UniProt ID', 'Description', 'Gene names', @studies.map{|e| helper.format_study_name(e)}, \"# of studies\"].flatten.join(\"\\t\") + \"\\n\" + \n @proteins.map{|e|\n hit_list=[]\n @studies.each do |study|\n if (@h_hits[study.id][e.id])\n hits = @h_hits[study.id][e.id]\n hit_list.push( hits.map{ |h|\n hl = h.hit_list\n (hl) ? (\n (hl.confidence_level) ? hl.confidence_level.tag : ((hl.label!= '') ? hl.label : 'Yes')\n ) : 'Paper'\n }.join(\", \"))\n else \n hit_list.push('-')\n end\n end\n \n [e.up_ac, e.up_id, e.description, e.ref_proteins.select{|e| e.source_type and e.source_type.name == 'gene_name'}.map{|e| e.value}.join(', '),\n hit_list, @h_study_by_prot[e.id].keys.size\n ].flatten.join(\"\\t\")\n }.join(\"\\n\")}\n format.json { render json: @organism }\n end\n end", "def index\n @comparison_results = ComparisonResult.all\n end", "def initialize\n super\n# reset this functionality is now in CompletenessCorrectnessDiffs\n @descript = []\n @transDescript = []\n @totalmops = CompletenessCorrectnessDiffs.new\n end", "def list_comparisons\n # TODO: sync comparisons?\n comparisons = if unsafe_params[:editable]\n Comparison.editable_by(@context).accessible_by_private\n else\n Comparison.accessible_by(@context)\n end\n\n if unsafe_params[:scopes].present?\n check_scope!\n comparisons = comparisons.where(scope: unsafe_params[:scopes])\n end\n\n result = comparisons.order(id: :desc).map do |comparison|\n describe_for_api(comparison, unsafe_params[:describe])\n end\n\n render json: result\n end", "def show\n @comparison = Comparison.get(params[:id])\n end", "def set_score\n case competition.evaluation_type\n when 'mae'\n d1 = read_expected_csv.transpose\n d2 = read_csv.transpose\n df1 = Daru::DataFrame.new(extract_cols(d1), order: [:id, :value])\n df2 = Daru::DataFrame.new(extract_cols(d2), order: [:id, :value])\n means = df1.join(df2, on: [:id], how: :inner).vector_by_calculation { (value_1 - value_2).abs }\n self.evaluation_score = (means.sum.to_d / means.size.to_d)\n end\n end", "def update\n respond_to do |format|\n if @result_statistic_section.update(result_statistic_section_params)\n format.html { redirect_to edit_result_statistic_section_path(@result_statistic_section),\n notice: t('success') }\n format.json { render :show, status: :ok, location: @result_statistic_section }\n else\n format.html { render :edit }\n format.json { render json: @result_statistic_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def results\n @study = Study.find(params[:study_id])\n if ExtractionFormSection.section_is_included(\"results\", @study.id, params[:extraction_form_id])\n @ef = ExtractionForm.find(params[:extraction_form_id])\n @extraction_form_id = @ef.id\n @is_diagnostic = ExtractionForm.is_diagnostic?(@ef.id)\n # if this is an RCT extraction form, get the existing outcome data entries\n # and any comparison information that go along with them. \n if !@is_diagnostic\n @existing_results = @study.get_existing_results_for_session(@ef.id)\n ocdes = @study.get_data_entries\n @existing_comparisons = OutcomeDataEntry.get_existing_comparisons_for_session(ocdes)\n @study_arms = Arm.find(:all, :conditions=>[\"study_id = ? AND extraction_form_id=?\",@study.id, @ef.id], :order=>\"display_number ASC\", :select=>[\"id\",\"title\",\"description\",\"display_number\",\"extraction_form_id\",\"note\",\"default_num_enrolled\",\"is_intention_to_treat\"])\n # if this is a diagnostic test form, get only the comparison information associated\n # with the results\n else\n @existing_results = []\n @existing_comparisons = []\n comparisons = @study.get_comparison_entries\n @study_arms = nil\n @existing_comparisons, @existing_comparators = OutcomeDataEntry.get_existing_diagnostic_comparisons_for_session(comparisons)\n end\n\n makeStudyActive(@study)\n session[:project_id] = @study.project_id\n @study_extforms = StudyExtractionForm.where(:study_id => @study.id)\n\n @project = Project.find(params[:project_id])\n model = @ef.is_diagnostic == true ? \"DiagnosticTest\" : \"Arm\"\n puts \"\\n\\n-----------------\\n\\nStudy: #{@study.id}\\nEF: #{@ef.id}\\n\\n\"\n @arms_or_tests = model.constantize.where(:study_id=>@study.id, :extraction_form_id=>@ef.id)\n @outcomes = Outcome.find(:all, :conditions=>[\"study_id=? AND extraction_form_id=?\",@study.id, @ef.id], :order=>[\"outcome_type ASC, title ASC\"])\n @cont_outcomes = @outcomes.select{|x| x.outcome_type == \"Continuous\"}\n @cat_outcomes = @outcomes.select{|x| x.outcome_type == \"Categorical\"}\n @survival_outcomes = @outcomes.select{|x| [\"Survival\",\"Time to Event\"].include?(x.outcome_type)}\n\n # FLAG TO NOT SHOW OUTCOME EDIT OPTIONS ON THE OUTCOME LIST\n @noedits = true\n # @cont_outcomes = Outcome.find(:all, :conditions=>[\"study_id=? AND outcome_type=? AND extraction_form_id=?\",@study.id,\"Continuous\",@ef.id],:select=>[\"id\",\"title\",\"units\",\"description\",\"extraction_form_id\"])\n # @cat_outcomes = Outcome.find(:all, :conditions=>[\"study_id=? AND outcome_type=? AND extraction_form_id=?\",@study.id,\"Categorical\",@ef.id],:select=>[\"id\",\"title\",\"units\",\"description\",\"extraction_form_id\"])\n # @survival_outcomes = Outcome.find(:all, :conditions=>[\"study_id=? AND outcome_type IN (?) AND extraction_form_id=?\",@study.id,[\"Survival\",\"Time to Event\"],@ef.id],:select=>[\"id\",\"title\",\"units\",\"description\",\"extraction_form_id\"])\t\t\n @timepoints_hash = Outcome.get_timepoints_hash(@cont_outcomes + @cat_outcomes)\n\n # GET THE SUBGROUPS ASSOCIATED WITH THESE OUTCOMES\n @outcomes = @cont_outcomes + @cat_outcomes + @survival_outcomes\n @outcome_subgroups = Outcome.get_subgroups_by_outcome(@outcomes)\n puts \"OUTCOME SUBGROUPS KEYS IS #{@outcome_subgroups.keys.join(\", \")} AND THE VALUE FOR THIS ONE IS #{@outcome_subgroups[\"90\"]}\\n\\n\"\n @subgroups = @outcome_subgroups.to_json\n else\n flash[\"error\"] = \"That section is not included in the current extraction form.\"\n redirect_to edit_project_study_path(params[:project_id], @study.id)\t\t\t\t\n end\n render :layout=>false\n end", "def edit_qc_inspection_test_from_test_list\n edit_qc_inspection_test true\n end", "def set_statistic\n @statistic = Statistic.find(params[:id])\n end", "def add_cull_measure\n id = params[:id]\n if id && @qc_inspection_test = QcInspectionTest.find(id)\n @qc_inspection_type_code = @qc_inspection_test.qc_inspection.qc_inspection_type.qc_inspection_type_code\n return if authorise_for_web(program_name(@qc_inspection_type_code),'edit')== false\n @qc_measurement_type = QcMeasurementType.find(params[:cull_measure])\n @qc_result = @qc_inspection_test.qc_results.first\n\n begin\n @qc_result.add_cull_measurement( @qc_measurement_type )\n if !@qc_result.valid?\n ajax_error_alert('Validation error', nil, @qc_result)\n return\n end\n cull_measurements = @qc_result.cull_measurements( @qc_measurement_type )\n col_headers = cull_measurements.shift\n\n render :update do |page|\n page.insert_html :bottom, 'cull_results', :partial => 'cull_result_measurement',\n :object => cull_measurements[0],\n :locals => {:max_cols => @qc_inspection_test.max_columns_for_measurements,\n :col_headers => col_headers,\n :measurement_rules => @qc_inspection_test.measurement_rules}\n page << \"$$('#cull_measure option[value=#{@qc_measurement_type.id}]').each(function(e) { e.remove(); })\"\n page << \"if ($('cull_measure').options.length == 0) {$('cull_add_form').hide();}\"\n end\n rescue StandardError => error\n ajax_error_alert(nil, error, @qc_result)\n end\n end\n end", "def update\n @comparison = Comparison.get(params[:id])\n\n respond_to do |format|\n if @comparison.update(params[:comparison])\n format.html {redirect_to(@comparison, notice: \"Comparison was successfully updated\") }\n format.json { render :json => {}, :status => :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render json: @comparison.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @comparison_result.update(comparison_result_params)\n format.html { redirect_to @comparison_result, notice: 'Comparison result was successfully updated.' }\n format.json { render :show, status: :ok, location: @comparison_result }\n else\n format.html { render :edit }\n format.json { render json: @comparison_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_statistic\n @statistic = Statistic.find(params[:id])\n end", "def set_statistic\n @statistic = Statistic.find(params[:id])\n end", "def set_statistic\n @statistic = Statistic.find(params[:id])\n end", "def set_statistic\n @statistic = Statistic.find(params[:id])\n end", "def update\n @comparison = Comparison.find(params[:id])\n\n respond_to do |format|\n if @comparison.update_attributes(params[:comparison])\n format.html { redirect_to @comparison, notice: 'Comparison was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @comparison.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit_prescreen_common_assessment\n\t\tli_sub_section_id = 47#2 # working subsection\n\t\t@assessment_questions = AssessmentQuestion.get_questions_collection(li_sub_section_id) #\n\t\t@prescreen_household_id = params[:household_prescreening_id]\n\t\t@common_prescreen_assessment_answer_object = PrescreenAssessmentAnswer.new\n\tend", "def create_between_arm_table\n \t@selected_timepoints = params[:selected_timepoints]\n \t@selected_tp_array = @selected_timepoints.split(\"_\")\n \tsubgroup_id = params[:subgroup_id].nil? ? 0 : params[:subgroup_id]\n \t@subgroup = subgroup_id == 0 ? nil : OutcomeSubgroup.find(subgroup_id)\n \t@outcome_id = params[:outcome_id]\n \t@comparisons = OutcomeDataEntry.create_comparisons(\"between\",@selected_tp_array,@outcome_id,subgroup_id)\n \t@outcome = Outcome.find(@outcome_id)\n \t@project_id = params[:project_id]\n\t\t\n \t#-----------------------------------------\n \t# Data for the entry table\n \t#-----------------------------------------\n \t@outcome_id, @study_id,@extraction_form_id, @selected_tp_array, @timepoints, @OCDEs, \n\t\t@measures, @datapoints, @arms, @comparisons, @comparison_measures, @comparators, \n\t\t@all_comparators, @num_comparators, @comparison_datapoints, @wa_comparisons, @wa_measures, \n\t\t@wa_comparators, @wa_all_comparators, @wa_datapoints, @footnotes = OutcomeDataEntry.get_information_for_entry_table(@outcome,@subgroup,@selected_timepoints)\n\t\t\n\t\n\t render \"/outcome_data_entries/show_entry_table\"\n end", "def update_table_rows\n\t \t@outcome_id = params[:outcome_id]\n\t \t@outcome = Outcome.find(@outcome_id)\n\t \t@project_id = params[:project_id]\n\t \t@is_diagnostic = ExtractionForm.is_diagnostic?(@outcome.extraction_form_id)\n\t \t@checkbox_timepoints = @outcome.outcome_timepoints\n\t \tunless params[:subgroup_id].nil?\n\t\t\t@subgroup = OutcomeSubgroup.find(params[:subgroup_id])\n\t\telse\n\t\t\t@subgroup = nil\n\t\tend\n\n\t \t# IF THIS IS A DIAGNOSTIC TEST RESULT TABLE\n\t \tif @is_diagnostic\n\t \t\t@selected_timepoints = Comparison.get_selected_timepoints_for_diagnostic_tests(@outcome,@subgroup)\n\t \t\tparams[:tps_to_add].keys.each do |sectionNum|\n\t \t\t\ttpString = params[:tps_to_add][sectionNum].join(\"_\")\n\t \t\t\t#puts \"The original TP string is #{@selected_timepoints[sectionNum.to_i]} and the string we're adding is #{tpString}\"\n\t \t\t\tif @selected_timepoints[sectionNum.to_i].empty?\n\t\t\t\t\t@selected_timepoints[sectionNum.to_i] = tpString\n\t\t\t\telse\n\t\t\t\t\t@selected_timepoints[sectionNum.to_i] += \"_#{tpString}\"\n\t\t\t\tend\n\t\t\t\t#puts \"THE RESULT IS: #{@selected_timepoints[sectionNum.to_i]}\\n\\n\"\n\t \t\tend\n\t \t\n\t \t\t\n\t\t\t@outcome_id, @study_id, @extraction_form_id, @selected_tp_array, @timepoints, @comparisons, \n\t\t\t@comparators, @all_comparators, @comparison_measures, @comparison_datapoints, @index_tests, \n\t\t\t@reference_tests, @thresholds, @footnotes = OutcomeDataEntry.get_diagnostic_test_results(@outcome,@subgroup,@selected_timepoints)\n\n\t\t\t@outcomes = Outcome.find(:all, :conditions=>[\"study_id=?\",@outcome.study_id],:select=>[\"id\",\"title\",\"extraction_form_id\"])\n\t\t\t@outcome_subgroups = Outcome.get_subgroups_by_outcome(@outcomes)\n\n\t\t\t@index_test_options, @reference_test_options = DiagnosticTest.get_select_options(@index_tests,@reference_tests,@thresholds)\n\t \t\n\t \t# OTHERWISE, IF IT'S AN RCT RESULT TABLE\n\t \telse\n\t \t\t@selected_tp_array = params[:selected_timepoints].split(\"_\")\n\t \t\ttps_to_add = params[:tps_to_add]\n\t\t\tunless tps_to_add.nil?\n\t\t\t\t@selected_tp_array = @selected_tp_array + tps_to_add\n\t\t\tend\n\t\t\t@selected_timepoints = @selected_tp_array.join(\"_\")\n\n\t\t\t#-----------------------------------------\n\t\t \t# Data for the entry table\n\t\t \t#-----------------------------------------\n\t\t \t@outcome_id, @study_id,@extraction_form_id, @selected_tp_array, @timepoints, @OCDEs, \n\t\t\t@measures, @datapoints, @arms, @comparisons, @comparison_measures, @comparators, \n\t\t\t@all_comparators, @num_comparators, @comparison_datapoints, @wa_comparisons, @wa_measures, \n\t\t\t@wa_comparators, @wa_all_comparators, @wa_datapoints, @footnotes = OutcomeDataEntry.get_information_for_entry_table(@outcome,@subgroup,@selected_timepoints)\t\n\t\t\t\t\n\t\t @hide_wait_icon = true # indicate that we need to hide a loading icon\n\n\t \tend\n\n\t render '/outcome_data_entries/show_timepoints'\n\tend", "def update\n respond_to do |format|\n if @statistic.update(statistic_params)\n create_factors_for_statistic(@statistic)\n format.html { redirect_to @statistic, notice: 'Statistic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @statistic.errors, status: :unprocessable_entity }\n end\n end\n end", "def compare_action\n # ToDo: Change the hard coded report to a Report setting, or client base\n raise 'Hard coded report implementation' unless RAILS_ENV =~ /susbkk/\n end", "def show\n if current_user.admin?\n redirect_to fill_in_factors_path(@statistic.id)\n else\n @statistic\n end\n end", "def set_simicheck_comparison\n @simicheck_comparison = SimicheckComparison.find(params[:id])\n end", "def compare_view\n @tsd_file1 = 'heco14.TSD'\n @tsd_file2 = '13Q4.TSD'\n @series_name = params[:list_index].nil? ? params[:series_name] : @data_list.series_names[params[:list_index].to_i]\n\n @data1 = json_from_heroku_tsd(@series_name,@tsd_file1)\n\t\t@series1 = @data1 && Series.new_transformation(@data1['name']+'.'+@data1['frequency'], @data1['data'],\n Series.frequency_from_code(@data1['frequency'])).trim('2006-01-01','2017-10-01')\n\t\t@chg1 = @series1.annualized_percentage_change\n \n @data2 = json_from_heroku_tsd(@series_name,@tsd_file2)\n\t\t@series2 = @data2 && Series.new_transformation(@data2['name']+'.'+@data2['frequency'], @data2['data'],\n Series.frequency_from_code(@data2['frequency'])).trim('2006-01-01','2017-10-01')\n\t\t@chg2 = @series2.annualized_percentage_change\n\n @history_series = @series_name.ts.trim('2006-01-01','2017-10-01')\n @history_chg = @history_series.annualized_percentage_change\n end", "def test_ReduceElectricEquipmentByPercentageAudit_AllEquipment\n \n # create an instance of the measure\n measure = ReduceElectricEquipmentByPercentageAudit.new\n \n # create an instance of a runner\n runner = OpenStudio::Ruleset::OSRunner.new\n \n # get test model\n model = makeTestModel\n \n # get arguments and test that they are what we are expecting\n arguments = measure.arguments(model)\n assert_equal(6, arguments.size)\n assert_equal(\"equip_def\", arguments[0].name)\n assert_equal(\"equip_power_reduction_percent\", arguments[1].name)\n assert_equal(\"material_and_installation_cost\", arguments[2].name)\n assert_equal(\"expected_life\", arguments[3].name)\n assert_equal(\"om_cost\", arguments[4].name)\n assert_equal(\"om_frequency\", arguments[5].name)\n\n # fill in argument_map\n argument_map = OpenStudio::Ruleset::OSArgumentMap.new\n\n count = -1\n\n equip_def = arguments[count += 1].clone\n assert(equip_def.setValue(\"*All Equipment*\"))\n argument_map[\"equip_def\"] = equip_def\n\n equip_power_reduction_percent = arguments[count += 1].clone\n assert(equip_power_reduction_percent.setValue(20.0))\n argument_map[\"equip_power_reduction_percent\"] = equip_power_reduction_percent\n\n material_and_installation_cost = arguments[count += 1].clone\n assert(material_and_installation_cost.setValue(10.0))\n argument_map[\"material_and_installation_cost\"] = material_and_installation_cost\n\n expected_life = arguments[count += 1].clone\n assert(expected_life.setValue(20))\n argument_map[\"expected_life\"] = expected_life\n\n om_cost = arguments[count += 1].clone\n assert(om_cost.setValue(0.0))\n argument_map[\"om_cost\"] = om_cost\n\n om_frequency = arguments[count += 1].clone\n assert(om_frequency.setValue(1))\n argument_map[\"om_frequency\"] = om_frequency\n \n # test building\n building = model.getBuilding\n assert_equal(200, building.electricEquipmentPower)\n assert_equal(0, building.lifeCycleCosts.size)\n \n measure.run(model, runner, argument_map)\n result = runner.result\n puts \"test_ReduceElectricEquipmentByPercentage_AllEquipment\"\n show_output(result)\n assert(result.value.valueName == \"Success\")\n\n building = model.getBuilding\n assert_equal(160, building.electricEquipmentPower)\n assert_equal(1, building.lifeCycleCosts.size)\n end", "def compare\n @unit_numbers = @property.unit_numbers.to_set\n @manager_inspections = @property.manager_inspections.to_a\n @inspections = @property.current_inspections\n \n @current_inspections = []\n @stack = []\n \n @unit_numbers.each do |num|\n in_we_go = @inspections.find_by_unit_number(num) || Inspection.new({unit_number: num})\n @current_inspections << in_we_go\n end\n \n filter = Proc.new do |arr|\n arr.select!{|inspection| @unit_numbers.include? inspection.unit_number }\n end\n\n filter.call @manager_inspections\n \n @unit_numbers.each do |num|\n hereArr = []\n hereArr << num\n hereArr << @current_inspections.shift\n hereArr << @manager_inspections.shift\n\n # collector.call(@current_inspections, num, hereArr)\n # collector.call(@manager_inspections, num, hereArr)\n \n if hereArr[-2][:id] == nil\n hereArr << \"no-inspection\"\n elsif hereArr[-2].eql_manager_inspection(hereArr[-1])\n hereArr << \"matches\"\n else\n hereArr << \"mismatch\"\n end\n \n @stack << hereArr \n end\n \n render \"compare\"\n end", "def view_team\n @participant = AssignmentParticipant.find(params[:id])\n @assignment = @participant.assignment\n @team = @participant.team\n @team_id = @team.id\n @questions = {}\n questionnaires = @assignment.questionnaires\n retrieve_questions questionnaires\n @pscore = @participant.scores(@questions)\n @vmlist = []\n\n # loop through each questionnaire, and populate the view model for all data necessary\n # to render the html tables.\n counter_for_same_rubric = 0\n questionnaires.each do |questionnaire|\n @round = nil\n if @assignment.varying_rubrics_by_round? && questionnaire.type == \"ReviewQuestionnaire\"\n questionnaires = AssignmentQuestionnaire.where(assignment_id: @assignment.id, questionnaire_id: questionnaire.id)\n if questionnaires.count > 1\n @round = questionnaires[counter_for_same_rubric].used_in_round\n counter_for_same_rubric += 1\n else\n @round = questionnaires[0].used_in_round\n counter_for_same_rubric = 0\n end\n end\n vm = VmQuestionResponse.new(questionnaire, @assignment, @round)\n vmquestions = questionnaire.questions\n vm.add_questions(vmquestions)\n vm.add_team_members(@team)\n vm.add_reviews(@participant, @team, @assignment.varying_rubrics_by_round?)\n vm.get_number_of_comments_greater_than_10_words\n @vmlist << vm\n end\n @current_role_name = current_role_name\n end", "def write_comparison_table(app, cm)\n \n row_num = 0 # TODO use same numbering for all rows\n \n [['context_1', 'context_2'], ['context_1', 'context_3']].each{|ctx_set|\n \n cm.add_row(\n {:text=>(cm.html?)?'<strong>Scenarios:</strong>':'Scenarios:', :colspan=>2},\n {:text=>ctx_set.inspect.to_s, :colspan=>20}\n )\n \n cm.add_row({:text=>'', :colspan=>4}, {:text=>'IIS', :colspan=>6}, {:text=>'Apache', :colspan=>9})\n cm.add_row({:text=>'', :colspan=>4}, {:text=>'Load Agents', :colspan=>2}, {:text=>'No WinCache', :colspan=>3}, {:text=>'WinCache', :colspan=>3}, {:text=>'No APC', :colspan=>3}, {:text=>'APC', :colspan=>3}, {:text=>'APC w/ IGBinary', :colspan=>3})\n cm.add_row('', 'OS', 'Physical', 'Virtual', 'Base', 'Test', 'Gain', 'Base', 'Test', 'Gain', 'Base', 'Test', 'Gain', 'Base', 'Test', 'Gain')\n \n cm.add_row('1', 'Win 2003 x86 SP2', '2', '8', '50', '100', '50%', '100', '50', '50%', '50', '100', '50%', '100', '50', '50%')\n \n cm.add_row(\n {:text=>(cm.html?)?'<strong>Windows INI:</strong>':'INI:', :colspan=>2},\n # TODO show INI\n {:text=>ctx_set.inspect.to_s, :colspan=>20}\n )\n cm.add_row(\n {:text=>(cm.html?)?'<strong>Linux INI:</strong>':'INI:', :colspan=>2},\n # TODO show INI\n {:text=>ctx_set.inspect.to_s, :colspan=>20}\n )\n \n \n \n }\n \n return cm\n end", "def adv_search_load_choice\n @edit = session[:edit]\n if params[:chosen_search]\n @edit[@expkey][:exp_chosen_report] = nil\n if params[:chosen_search] == \"0\"\n @edit[@expkey][:exp_chosen_search] = nil\n else\n @edit[@expkey][:exp_chosen_search] = params[:chosen_search].to_i\n @exp_to_load = exp_build_table(MiqSearch.find(params[:chosen_search]).filter.exp)\n end\n else\n @edit[@expkey][:exp_chosen_search] = nil\n if params[:chosen_report] == \"0\"\n @edit[@expkey][:exp_chosen_report] = nil\n else\n @edit[@expkey][:exp_chosen_report] = params[:chosen_report].to_i\n @exp_to_load = exp_build_table(MiqReport.for_user(current_user).find(params[:chosen_report]).conditions.exp)\n end\n end\n adv_search_redraw_search_partials('load')\n end", "def apply\n# used by accelerator/_list.html.erb\n\n @questionnaire = Questionnaire.find(params[:id])\n\n @sortcolumn = params[:column] ||= \"startdate\"\n @sortorder = params[:order] ||= \"ASC\"\n # sort columns by param\n# only show Accelerators that accept FH applications, by sort column order\n# @accelerators = Accelerator.where(:acceptapp => \"Yes\").order(@sortcolumn+\" \"+@sortorder)\n @accelerators = Accelerator.order(@sortcolumn+\" \"+@sortorder)\n\n respond_to do |format|\n format.html # apply.html.erb\n format.xml { render :xml => @questionnaire }\n# flash[:notice] = params.inspect\n end\n end", "def update_with_measure_tests(product_params)\n add_measure_tests(product_params)\n save!\n add_filtering_tests if c4_test\n add_checklist_test if c1_test\n end", "def set_view_statistic\n @view_statistic = ViewStatistic.find(params[:id])\n end", "def compare\n results = []\n @sets.each do |set|\n results << interpret(set)\n end\n\n base = nil\n results.each do |res|\n if base.nil?\n base = res\n base[:slower] = 0\n else\n res[:slower] = ((res[:mean] / base[:mean]) * 100) - 100\n end\n end\n\n results\n end", "def show\n @operations_check = OperationsCheck.find(params[:id])\n @labs = Lab.all\n @labs_unchecked = Lab.select(\"name\").map(&:name) - \n @operations_check.lab_checks.select(\"lab_name\").map(&:lab_name)\n @printers = Printer.select(\"name\").map(&:name) - \n @operations_check.printer_checks.select(\"name\").map(&:name)\n @automounts = Automount.select(\"name\").map(&:name) - \n @operations_check.automount_checks.select(\"name\").map(&:name)\n @nagios_entries = NagiosEntry.select(\"name\").map(&:name) - \n @operations_check.nagios_checks.select(\"name\").map(&:name)\n @load_balancers = LoadBalancer.select(\"name\").map(&:name) - \n @operations_check.load_balancer_checks.select(\"name\").map(&:name)\n @ldap_entries = LdapEntry.select(\"name\").map(&:name) - \n @operations_check.ldap_checks.select(\"name\").map(&:name) \n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @operations_check }\n end\n end", "def index\n if params[:metric_id]\n @metric = Metric.find(params[:metric_id])\n @sensory_analyses = @sample.sensory_analyses.where(\"metric_id=?\",params[:metric_id])\n @definition = @product.experiment_definitions.where(\"metric_id=?\",params[:metric_id]).first\n\n else\n @sensory_analyses = @sample.sensory_analyses\n end\n respond_to do |format|\n format.html\n format.js\n end\n end", "def show\n @unit_planner = UnitPlanner.find(params[:id])\n \n @skills = Skill.all(:include=>{:strategies=>:approaches}, :order=>\"skills.label\", :conditions=>[\"approaches.unit_planner_id=?\", @unit_planner.id])\n\n # move to model? Also, this seems a bit complicated. Any way to simplify?\n x = @unit_planner.objectives\n y = @unit_planner.formative_tasks.collect{|ft| ft.objectives}.flatten.uniq\n @objectives_sans_formative_tasks = (x - y).collect{|z| \"#{z.criterion.category}.#{z.subcategory}\"}.sort\n @criterions_sans_summative_tasks = (@unit_planner.criterions - @unit_planner.summative_tasks.collect(&:criterions).flatten.uniq).collect(&:category).join(\", \")\n \n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @unit_planner }\n end\n end", "def set_comparison_function\n @comparison_function = @project.comparison_functions.find(params[:id])\n end", "def update_exam_collisions\n @colliding_courses = false\n\n @list_selected_courses.each do |model, path, iter|\n course = iter[2]\n next if course.first_test_date.nil?\n other_courses = @selected_courses - [ course ]\n\n my_test_dates = [course.first_test_date, course.second_test_date]\n\n my_test_dates.reject! { |x| x.nil? }\n\n exam_dates_a = other_courses.collect { |c| c.first_test_date }\n exam_dates_b = other_courses.collect { |c| c.second_test_date }\n\n exam_dates_a.reject! { |x| x.nil? }\n exam_dates_b.reject! { |x| x.nil? }\n\n exam_dates = Set.new(exam_dates_a + exam_dates_b)\n\n if exam_dates.intersection(my_test_dates).empty?\n iter[0] = course.name\n iter[3] = nil\n else\n @colliding_courses = true\n iter[0] = \"*%s*\" % course.name\n iter[3] = \"red\"\n end\n end\n\n on_selected_course_selection\n end", "def set_criterias\n @screen = session.active_screen\n @report = Report.find(params[:id])\n ref_screen_count = @report.reference_screen_ids.size\n params[:report] ||= {}\n params[:report][:criterias] ||= []\n\n params[:report][:criterias].delete_if do |c|\n c[:a_screen_index].nil? ||\n (c[:a_screen_index].to_i < ref_screen_count && c[:a_field_id].to_i == 0) ||\n c[:b_screen_index].nil? ||\n (c[:b_screen_index].to_i < ref_screen_count && c[:b_field_id].to_i == 0) ||\n c[:operation].to_s.empty?\n end\n\n params[:report][:criterias].each do |c|\n c[:a_screen_index] = c[:a_screen_index].to_i\n c[:a_field_id] = c[:a_field_id].to_i if c[:a_screen_index] < ref_screen_count\n c[:b_screen_index] = c[:b_screen_index].to_i\n c[:b_field_id] = c[:b_field_id].to_i if c[:b_screen_index] < ref_screen_count\n end\n\n @report.criterias = params[:report][:criterias]\n @report.save\n end", "def update\n\t\t@user = current_user\n\t\t@comparison = Comparison.find(params[:id])\n\t\t# @comparison.products.crunchm(@comparison, product, raw_link, products_hash, tributes_all_hash)\n\t\tredirect_to comparison_path\n\tend", "def update_status(compareActor)\n @ucHpCompareStat.set_values(@actor.maxhp, compareActor.maxhp - @actor.maxhp)\n @ucMpCompareStat.set_values(@actor.maxmp, compareActor.maxmp - @actor.maxmp)\n @ucAtkCompareStat.set_values(@actor.atk, compareActor.atk - @actor.atk)\n @ucDefCompareStat.set_values(@actor.def, compareActor.def - @actor.def)\n @ucSpiCompareStat.set_values(@actor.spi, compareActor.spi - @actor.spi)\n @ucAgiCompareStat.set_values(@actor.agi, compareActor.agi - @actor.agi)\n @ucEvaCompareStat.set_values(@actor.eva, compareActor.eva - @actor.eva)\n @ucHitCompareStat.set_values(@actor.hit, compareActor.hit - @actor.hit)\n @ucCriCompareStat.set_values(@actor.cri, compareActor.cri - @actor.cri)\n end", "def set_and_authorize_measure\n @measure = policy_scope(base_object).find(params[:id])\n authorize @measure\n end", "def show\n @assessments = Assessment.find(params[:id])\n\n @remoteScore = @assessments.remoteOneValue + @assessments.remoteTwoValue + @assessments.remoteThreeValue + @assessments.remoteFourValue + @assessments.remoteFiveValue;\n\n @strategyScore = @assessments.strategyOneValue + @assessments.strategyTwoValue + @assessments.strategyThreeValue + @assessments.strategyFourValue + @assessments.strategyFiveValue + @assessments.strategySixValue;\n\n @totalScore = @assessments.remoteOneValue + @assessments.remoteTwoValue + @assessments.remoteThreeValue + @assessments.remoteFourValue + @assessments.remoteFiveValue + @assessments.strategyOneValue + @assessments.strategyTwoValue + @assessments.strategyThreeValue + @assessments.strategyFourValue + @assessments.strategyFiveValue + @assessments.strategySixValue;\n end", "def set_evaluacion\n @evaluacions = Evaluacion.find(params[:id])\n end", "def set_criterion_detail\n #@criterion_detail = CriterionDetail.find(params[:id])\n @criterion = Criterion.find(params[:criterion_id])\n @criterion_detail = CriterionDetail.find(params[:id])\n end", "def run_report\n comparison_values.tap do |results|\n display_report(results)\n end\n end", "def test_ReduceLightingLoadsByPercentageAudit_AllLights\n \n # create an instance of the measure\n measure = ReduceLightingLoadsByPercentageAudit.new\n \n # create an instance of a runner\n runner = OpenStudio::Ruleset::OSRunner.new\n \n # get test model\n model = makeTestModel\n \n # get arguments and test that they are what we are expecting\n arguments = measure.arguments(model)\n assert_equal(6, arguments.size)\n assert_equal(\"light_def\", arguments[0].name)\n assert_equal(\"lighting_power_reduction_percent\", arguments[1].name)\n assert_equal(\"material_and_installation_cost\", arguments[2].name)\n assert_equal(\"expected_life\", arguments[3].name)\n assert_equal(\"om_cost\", arguments[4].name)\n assert_equal(\"om_frequency\", arguments[5].name)\n\n # fill in argument_map\n argument_map = OpenStudio::Ruleset::OSArgumentMap.new\n\n count = -1\n\n light_def = arguments[count += 1].clone\n assert(light_def.setValue(\"*All Lights*\"))\n argument_map[\"light_def\"] = light_def\n\n lighting_power_reduction_percent = arguments[count += 1].clone\n assert(lighting_power_reduction_percent.setValue(20.0))\n argument_map[\"lighting_power_reduction_percent\"] = lighting_power_reduction_percent\n\n material_and_installation_cost = arguments[count += 1].clone\n assert(material_and_installation_cost.setValue(10.0))\n argument_map[\"material_and_installation_cost\"] = material_and_installation_cost\n\n expected_life = arguments[count += 1].clone\n assert(expected_life.setValue(20))\n argument_map[\"expected_life\"] = expected_life\n\n om_cost = arguments[count += 1].clone\n assert(om_cost.setValue(0.0))\n argument_map[\"om_cost\"] = om_cost\n\n om_frequency = arguments[count += 1].clone\n assert(om_frequency.setValue(1))\n argument_map[\"om_frequency\"] = om_frequency\n \n # test building\n building = model.getBuilding\n assert_equal(200, building.lightingPower)\n assert_equal(0, building.lifeCycleCosts.size)\n \n measure.run(model, runner, argument_map)\n result = runner.result\n puts \"test_ReduceLightingLoadsByPercentageAudit_AllLights\"\n show_output(result)\n assert(result.value.valueName == \"Success\")\n\n building = model.getBuilding\n assert_equal(160, building.lightingPower)\n assert_equal(1, building.lifeCycleCosts.size)\n end", "def edit_recepce\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 show\r\n @se_product = SeProduct.find(params[:id])\r\n if !@se_product.se_result\r\n se_result = SeResult.new \r\n se_result.se_product_id = @se_product.id\r\n se_result.save\r\n @se_product.se_result = se_result\r\n end\r\n @se_result = @se_product.se_result\r\n @product = @se_product.product\r\n\r\n add_breadcrumb _(\"My products\").html_safe, :products_url\r\n add_breadcrumb @se_product.product.name, edit_product_url(@se_product.product)\r\n add_breadcrumb _(\"Environmental Assessment\").html_safe, se_manufacturing_path(@se_product)\r\n add_breadcrumb _(\"Results\").html_safe, se_result_path(@se_product)\r\n\r\n\r\n ################\r\n #Table 1 #\r\n #kg CO2-eq/year#\r\n ################\r\n\r\n #sensor_kg_year\r\n @se_result.sensor_kg_year_with = sensor_kg_year(@se_product,'with')\r\n @se_result.sensor_kg_year_without = 0\r\n @sensor_kg_year_increment_impact = @se_result.sensor_kg_year_with - @se_result.sensor_kg_year_without\r\n\r\n #energy_kg_year\r\n @se_result.energy_kg_year_with = energy_kg_year(@se_product,'with')\r\n @se_result.energy_kg_year_without = energy_kg_year(@se_product,'without')\r\n @energy_kg_year_increment_impact = @se_result.energy_kg_year_with - @se_result.energy_kg_year_without\r\n\r\n #consumables_kg_year\r\n @se_result.consumables_kg_year_with = consumables_kg_year(@se_product,'with')\r\n @se_result.consumables_kg_year_without = consumables_kg_year(@se_product,'without')\r\n @consumables_kg_year_increment_impact = @se_result.consumables_kg_year_with - @se_result.consumables_kg_year_without\r\n\r\n #utilities_kg_year\r\n @se_result.utilities_kg_year_with = utilities_kg_year(@se_product,'with')\r\n @se_result.utilities_kg_year_without = utilities_kg_year(@se_product,'without')\r\n @utilities_kg_year_increment_impact = @se_result.utilities_kg_year_with - @se_result.utilities_kg_year_without\r\n\r\n #yield_kg_year\r\n @se_result.yield_kg_year_with = yield_kg_year(@se_product,'with')\r\n @se_result.yield_kg_year_without = yield_kg_year(@se_product,'without')\r\n @yeld_kg_year_increment_impact = @se_result.yield_kg_year_with - @se_result.yield_kg_year_without\r\n\r\n #kg_year_sum_with\r\n @kg_year_sum_with = @se_result.sensor_kg_year_with + @se_result.energy_kg_year_with + @se_result.consumables_kg_year_with + @se_result.utilities_kg_year_with + @se_result.yield_kg_year_with\r\n\r\n #kg_year_sum_without\r\n @kg_year_sum_without = @se_result.sensor_kg_year_without + @se_result.energy_kg_year_without + @se_result.consumables_kg_year_without + @se_result.utilities_kg_year_without + @se_result.yield_kg_year_without\r\n\r\n #kg_year_sum_increment_impact\r\n @kg_year_sum_increment_impact = @sensor_kg_year_increment_impact + @energy_kg_year_increment_impact + @consumables_kg_year_increment_impact + @utilities_kg_year_increment_impact + @yeld_kg_year_increment_impact\r\n\r\n\r\n ######################\r\n #Table 2 #\r\n #kg CO2-eq/kg product#\r\n ######################\r\n \r\n #sensor_kg_product\r\n @se_result.sensor_kg_product_with = @se_result.sensor_kg_year_with / (@se_product.se_use_product.output_with * @se_product.se_use_production.productive_time(\"with\"))\r\n @se_result.sensor_kg_product_without = 0\r\n @sensor_kg_product_increment_impact = @se_result.sensor_kg_product_with - @se_result.sensor_kg_product_without\r\n\r\n #energy_kg_product\r\n @se_result.energy_kg_product_with = @se_result.energy_kg_year_with / (@se_product.se_use_product.output_with * @se_product.se_use_production.productive_time(\"with\"))\r\n @se_result.energy_kg_product_without = @se_result.energy_kg_year_without / (@se_product.se_use_product.output_without * @se_product.se_use_production.productive_time(\"without\"))\r\n @energy_kg_product_increment_impact = @se_result.energy_kg_product_with - @se_result.energy_kg_product_without\r\n\r\n #consumable_kg_product\r\n @se_result.consumables_kg_product_with = @se_result.consumables_kg_year_with / (@se_product.se_use_product.output_with * @se_product.se_use_production.productive_time(\"with\"))\r\n @se_result.consumables_kg_product_without = @se_result.consumables_kg_year_without / (@se_product.se_use_product.output_without * @se_product.se_use_production.productive_time(\"without\"))\r\n @consumable_kg_product_increment_impact = @se_result.consumables_kg_product_with - @se_result.consumables_kg_product_without\r\n\r\n #utilities_kg_product\r\n @se_result.utilities_kg_product_with = @se_result.utilities_kg_year_with / (@se_product.se_use_product.output_with * @se_product.se_use_production.productive_time(\"with\"))\r\n @se_result.utilities_kg_product_without = @se_result.utilities_kg_year_without / (@se_product.se_use_product.output_without * @se_product.se_use_production.productive_time(\"without\"))\r\n @utilities_kg_product_increment_impact = @se_result.utilities_kg_product_with - @se_result.utilities_kg_product_without\r\n\r\n @se_result.yield_kg_product_with = @se_result.yield_kg_year_with / (@se_product.se_use_product.output_with * @se_product.se_use_production.productive_time(\"with\"))\r\n @se_result.yield_kg_product_without = @se_result.yield_kg_year_without / (@se_product.se_use_product.output_without * @se_product.se_use_production.productive_time(\"without\"))\r\n\r\n @yield_loss_kg_product_increment_impact = @se_result.yield_kg_product_with - @se_result.yield_kg_product_without\r\n\r\n #kg_product_sum_with\r\n @kg_product_sum_with = @se_result.sensor_kg_product_with + @se_result.energy_kg_product_with + @se_result.consumables_kg_product_with + @se_result.utilities_kg_product_with + @se_result.yield_kg_product_with\r\n\r\n #kg_product_sum_without\r\n @kg_product_sum_without = @se_result.sensor_kg_product_without + @se_result.energy_kg_product_without + @se_result.consumables_kg_product_without + @se_result.utilities_kg_product_without + @se_result.yield_kg_product_without\r\n\r\n #kg_product_sum_increment_impact\r\n @kg_product_sum_increment_impact = @sensor_kg_product_increment_impact + @energy_kg_product_increment_impact + @consumable_kg_product_increment_impact + @utilities_kg_product_increment_impact + @yield_loss_kg_product_increment_impact\r\n\r\n\r\n ######################\r\n #Table 3 #\r\n #euro/year #\r\n ######################\r\n\r\n if !@se_product.se_use_consumption.sensor_system_with.nil?\r\n @se_result.sensor_euro_year_with = @se_product.se_manufacturing.purchase / @se_product.se_manufacturing.sensor_lifetime + @se_product.se_manufacturing.installation / @se_product.se_manufacturing.sensor_lifetime + @se_product.se_manufacturing.maintenance + @se_product.se_use_consumption.sensor_system_with * @se_product.se_use_production.maximum_production * @se_product.se_use_cost.electricity\r\n else\r\n @se_result.sensor_euro_year_with = 0\r\n end\r\n @se_result.sensor_euro_year_without = 0\r\n @sensor_euro_year_increment_impact = @se_result.sensor_euro_year_with - @se_result.sensor_euro_year_without\r\n\r\n #production_euro_year\r\n @se_result.production_euro_year_with = production_euro_year(@se_product,\"with\")\r\n @se_result.production_euro_year_without = production_euro_year(@se_product,\"without\")\r\n @production_euro_year_increment_impact = @se_result.production_euro_year_with - @se_result.production_euro_year_without\r\n\r\n #yield_loss_euro_year\r\n @se_result.yield_euro_year_with = yield_loss_euro_year(@se_product,\"with\")\r\n @se_result.yield_euro_year_without = yield_loss_euro_year(@se_product,\"without\")\r\n @yield_euro_year_increment_impact = @se_result.yield_euro_year_with - @se_result.yield_euro_year_without\r\n\r\n #value_euro_year\r\n @se_result.value_euro_year_with = value_euro_year(@se_product,\"with\")\r\n @se_result.value_euro_year_without = value_euro_year(@se_product,\"without\")\r\n @value_euro_year_increment_impact = @se_result.value_euro_year_with - @se_result.value_euro_year_without\r\n\r\n #euro_year_sum_with\r\n @euro_year_sum_with = @se_result.sensor_euro_year_with + @se_result.production_euro_year_with + @se_result.yield_euro_year_with + @se_result.value_euro_year_with\r\n #euro_year_sum_without\r\n @euro_year_sum_without = @se_result.sensor_euro_year_without + @se_result.production_euro_year_without + @se_result.yield_euro_year_without + @se_result.value_euro_year_without\r\n @euro_year_sum_increment_impact = @sensor_euro_year_increment_impact + @production_euro_year_increment_impact + @yield_euro_year_increment_impact + @value_euro_year_increment_impact\r\n\r\n ######################\r\n #Table 4 #\r\n #euro/kg #\r\n ######################\r\n total_anual_output_with = @se_product.se_use_product.total_anual_output(\"with\")\r\n total_anual_output_without = @se_product.se_use_product.total_anual_output(\"without\")\r\n\r\n #sensors_euro_kg\r\n @se_result.sensor_euro_product_with = @se_result.sensor_euro_year_with / total_anual_output_with\r\n @se_result.sensor_euro_product_without = @se_result.sensor_euro_year_without / total_anual_output_without\r\n @sensors_euro_kg_increment_impact = @se_result.sensor_euro_product_with - @se_result.sensor_euro_product_without\r\n\r\n #production_euro_kg\r\n @se_result.production_euro_product_with = @se_result.production_euro_year_with / total_anual_output_with\r\n @se_result.production_euro_product_without = @se_result.production_euro_year_without / total_anual_output_without\r\n @production_euro_kg_increment_impact = @se_result.production_euro_product_with - @se_result.production_euro_product_without\r\n\r\n #yield_euro_kg\r\n @se_result.yield_euro_product_with = @se_result.yield_euro_year_with / total_anual_output_with\r\n @se_result.yield_euro_product_without = @se_result.yield_euro_year_without / total_anual_output_without\r\n @yield_euro_kg_increment_impact = @se_result.yield_euro_product_with - @se_result.yield_euro_product_without\r\n\r\n #value_euro_kg\r\n @se_result.value_euro_product_with = @se_result.value_euro_year_with / total_anual_output_with\r\n @se_result.value_euro_product_without = @se_result.value_euro_year_without / total_anual_output_without\r\n @value_euro_kg_increment_impact = @se_result.value_euro_product_with - @se_result.value_euro_product_without\r\n\r\n #euro_kg_sum_with\r\n @euro_kg_sum_with = @se_result.sensor_euro_product_with + @se_result.production_euro_product_with + @se_result.yield_euro_product_with + @se_result.value_euro_product_with\r\n #euro_kg_sum_without\r\n @euro_kg_sum_without = @se_result.sensor_euro_product_without + @se_result.production_euro_product_without + @se_result.yield_euro_product_without + @se_result.value_euro_product_without\r\n #euro_kg_sum_increment_impact\r\n @euro_kg_sum_increment_impact = @sensors_euro_kg_increment_impact + @production_euro_kg_increment_impact + @yield_euro_kg_increment_impact + @value_euro_kg_increment_impact\r\n\r\n\r\n @se_result.save\r\n @step = 1\r\n \r\n end", "def iiop_statistics\n super\n end", "def show_type\n tools = Tool.all\n display_type = params[:id].to_i\n benchmarks = []\n all_benches = BenchmarkName.all\n all_types = BenchmarkType.all()\n\n all_benches.each do |benchmark|\n type_id = all_types.find(benchmark.benchmark_type_id).display_type_id\n if display_type == type_id\n benchmarks << benchmark\n end\n end\n\n @benchmark_results = []\n\n benchmarks.each do |benchmark|\n if benchmark.benchmark_splited_id != nil\n next\n end\n result_datas = []\n tools.each do |tool|\n test_result = TestResult.where(:tool_id => tool.id, :benchmark => benchmark.name).order(\"created_at DESC\").first\n if test_result != nil\n result = ResultData.new(tool, test_result, false)\n result_datas << result\n end\n end\n benchmark_result = BenchmarkResult.new(benchmark.name, result_datas)\n @benchmark_results << benchmark_result\n end\n\n bs_cnt = 0\n BenchmarkSplited.where(:display_type_id => params[:id]).each do |bs|\n total_datas = []\n\n tools.each do |tool|\n result_datas = []\n summary = TestResult.new({date: \"\", sat: 0, unsat: 0, timeout: 0, misc: 0, tool_id: tool.id, benchmark: bs.name, name: tool.name, unknown: 0, exception: 0})\n c_date = 0\n\n benchmarks.each do |benchmark|\n if benchmark.benchmark_splited_id != bs.id\n next\n end\n test_result = TestResult.where(:tool_id => tool.id, :benchmark => benchmark.name).order(\"created_at DESC\").first\n if test_result != nil\n result = ResultData.new(tool, test_result, false)\n result_datas << result\n summary.sat += test_result.sat\n summary.unsat += test_result.unsat\n summary.timeout += test_result.timeout\n summary.misc += test_result.misc\n summary.unknown += test_result.unknown\n summary.exception += test_result.exception\n n_date = test_result.date.to_i\n if n_date > c_date\n c_date = n_date\n end\n end\n if c_date != 0\n summary.date = c_date.to_s\n end\n # End for benchmarks.where...\n end\n\n if result_datas.length != 0\n total = ResultData.new(tool, summary, true)\n total.set_children(result_datas)\n total.set_id(bs_cnt)\n bs_cnt += 1\n total_datas << total\n end\n\n # End for tools.each\n end\n benchmark_result = BenchmarkResult.new(bs.name, total_datas)\n @benchmark_results << benchmark_result\n # End for BenchmarkSplited\n end\n \n @display_types = DisplayType.all\n end", "def set_performance_interview\n @performance_interview = PerformanceInterview.find(params[:id])\n end", "def add_within_arm_comparison_row\n\t # gather up the information sent via ajax\n\t\t@outcome_id = params[:outcome_id]\n\t\t@outcome_type = params[:outcome_type]\n\t\t@subgroup_id = params[:subgroup_id].nil? ? 0 : params[:subgroup_id]\n\t study_id = params[:study_id]\n\t ef_id = params[:ef_id]\n\t @comparator_id = params[:comparator_id]\n\t row_num = params[:group_id]\n\t @selected_timepoints = params[:selected_timepoints]\n\t @selected_tp_array = @selected_timepoints.split(\"_\")\n\t @timepoints = OutcomeTimepoint.find(@selected_tp_array)\n\t @comparison = Comparison.create(:within_or_between=>\"within\",:study_id=>study_id,:extraction_form_id=>ef_id,\n\t \t\t\t\t\t\t\t:outcome_id=>@outcome_id, :subgroup_id=>@subgroup_id, :group_id=>row_num)\n\t @comparison.assign_measures\n\t @comparison_id = @comparison.id\n\t @wa_measures = OutcomeDataEntry.get_within_arm_measures([@comparison])\n\t @arms = Study.get_arms(study_id)\n\t @project_id = params[:project_id]\n\t render 'outcome_data_entries/wa_comparisons/add_within_arm_comparison_row.js.erb'\n\tend", "def edit\n @english = @semester.test_sets.find_english\n @spanish = @semester.test_sets.find_spanish\n end", "def edit_params_setting\n @assignment = Assignment.find(params[:id])\n @num_submissions_round = @assignment.find_due_dates('submission').nil? ? 0 : @assignment.find_due_dates('submission').count\n @num_reviews_round = @assignment.find_due_dates('review').nil? ? 0 : @assignment.find_due_dates('review').count\n\n @topics = SignUpTopic.where(assignment_id: params[:id])\n @assignment_form = AssignmentForm.create_form_object(params[:id])\n @user = current_user\n\n @assignment_questionnaires = AssignmentQuestionnaire.where(assignment_id: params[:id])\n @due_date_all = AssignmentDueDate.where(parent_id: params[:id])\n @due_date_nameurl_not_empty = false\n @due_date_nameurl_not_empty_checkbox = false\n @metareview_allowed = false\n @metareview_allowed_checkbox = false\n @signup_allowed = false\n @signup_allowed_checkbox = false\n @drop_topic_allowed = false\n @drop_topic_allowed_checkbox = false\n @team_formation_allowed = false\n @team_formation_allowed_checkbox = false\n @participants_count = @assignment_form.assignment.participants.size\n @teams_count = @assignment_form.assignment.teams.size\n end", "def edit\n @quality_rating_field = QualityRatingField.find(params[:id])\n\t@extraction_form = ExtractionForm.find(params[:extraction_form_id])\n\t@has_study_data = QualityRatingField.has_study_data(@extraction_form.id)\t\n @editing_rtg=true\n end", "def item_difficulty_analysis\n dif={}\n @ds.vectors.each{|f| dif[f]=@ds[f].mean }\n dif_sort = dif.sort { |a,b| -(a[1]<=>b[1]) }\n scores_sort={}\n scores=@ds.vector_mean\n scores.each_index{ |i| scores_sort[i]=scores[i] }\n scores_sort=scores_sort.sort{|a,b| a[1]<=>b[1]}\n ds_new = Daru::DataFrame.new({}, order: ([:case,:score] + dif_sort.collect{|a,b| a.to_sym}))\n scores_sort.each do |i,score|\n row = [i, score]\n case_row = @ds.row[i].to_h\n dif_sort.each{ |variable,dif_value| row.push(case_row[variable]) }\n ds_new.add_row(row)\n end\n ds_new\n end", "def show\n @trtype = Trtype.find(params[:id])\n # want to make sql for view\n v_column_array = [\"trfiles.subjectid\",\"trfiles.secondary_key\",\"trfiles.enrollment_id\",\"trfiles.scan_procedure_id\", \"trfiles.file_completed_flag\",\"trfiles.qc_value\",\"trfiles.qc_notes\"]\n v_table_array = [\"trfiles\"]\n v_table_conditions =[\"trfiles.trtype_id = \"+params[:id]+\" \"]\n\n @tractiontypes = Tractiontype.where(\"trtype_id in (?)\",params[:id]).where(\"tractiontypes.form_display_label is not null and tractiontypes.form_display_label >''\" ).order(:display_order)\n @tractiontypes.each do |act|\n v_value_sql = \"\"\n # (\"trfiles.id = v_\"+act.id.to_s+\".trfile_id\")\n v_col = (act.form_display_label).gsub(/ /,\"\").gsub(/\\'/,\"_\").gsub(/\\\"/,\"_\").gsub(/\\-/,\"_\").downcase+\"_\" \n v_column_array.push(\"v_\"+act.id.to_s+\".\"+v_col) \n # need last edit\n if !act.ref_table_b_1.blank?\n v_value_sql = \"LEFT JOIN (select \"+act.ref_table_a_1+\".description \"+v_col+\", trfile2.id trfile_id from trfiles trfile2, tredits , tredit_actions, \"+act.ref_table_a_1+\" \n where trfile2.id = tredits.trfile_id \n and tredits.id = tredit_actions.tredit_id \n and tredit_actions.tractiontype_id = \"+act.id.to_s+\" \n and \"+act.ref_table_a_1+\".label = '\"+act.ref_table_b_1+\"'\n and tredit_actions.value = \"+act.ref_table_a_1+\".ref_value\n and tredits.id in ( select max(tredit2.id) from tredits tredit2 where tredit2.trfile_id = trfile2.id) ) v_\"+act.id.to_s+\" on trfiles.id = v_\"+act.id.to_s+\".trfile_id \"\n v_table_array.push(v_value_sql)\n\n elsif !act.ref_table_a_1.blank?\n v_value_sql = \"LEFT JOIN (select \"+act.ref_table_a_1.pluralize.underscore+\".description \"+v_col+\", trfile2.id trfile_id from trfiles trfile2, tredits , tredit_actions, \"+act.ref_table_a_1.pluralize.underscore+\" \n where trfile2.id = tredits.trfile_id \n and tredits.id = tredit_actions.tredit_id \n and tredit_actions.tractiontype_id = \"+act.id.to_s+\" \n and \"+act.ref_table_a_1+\".label = '\"+act.ref_table_b_1+\"'\n and tredit_actions.value = \"+act.ref_table_a_1.pluralize.underscore+\".id\n and tredits.id in ( select max(tredit2.id) from tredits tredit2 where tredit2.trfile_id = trfile2.id) ) v_\"+act.id.to_s+\" on trfiles.id = v_\"+act.id.to_s+\".trfile_id \"\n v_table_array.push(v_value_sql)\n\n else\n v_value_sql = \"LEFT JOIN (select tredit_actions.value \"+v_col+\", trfile2.id trfile_id from trfiles trfile2, tredits , tredit_actions \n where trfile2.id = tredits.trfile_id \n and tredits.id = tredit_actions.tredit_id \n and tredit_actions.tractiontype_id = \"+act.id.to_s+\" \n and tredits.id in ( select max(tredit2.id) from tredits tredit2 where tredit2.trfile_id = trfile2.id) ) v_\"+act.id.to_s+\" on trfiles.id = v_\"+act.id.to_s+\".trfile_id \"\n v_table_array.push(v_value_sql)\n end\n end\n # using LEFT JOIN\n @sql_view = \"select * from ( select \"+v_column_array.join(',')+\" from \"+v_table_array.join(' ')+\" where \"+v_table_conditions.join(' and ') +\" ) t1\"\n\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @trtype }\n end\n end", "def collection_search_params_logic\n base_logic = [:default_solr_parameters, :add_query_to_solr, :add_access_controls_to_solr_params]\n base_logic += [:add_collection_filter, :some_rows]\n base_logic\n end", "def refresh_existing_results\n\t\t@study = Study.find(params[:study_id])\n\t\t@extraction_form_id = params[:extraction_form_id]\n\t\t\n\t\t@is_diagnostic = ExtractionForm.is_diagnostic?(@extraction_form_id)\t\n\t\t\n\t\tunless @is_diagnostic\n\t\t\t@existing_results = @study.get_existing_results_for_session(@extraction_form_id)\n\t\t\tocdes = @study.get_data_entries\n\t\t\t@existing_comparisons = OutcomeDataEntry.get_existing_comparisons_for_session(ocdes)\n\t\t\tsession[:study_arms] = Arm.find(:all, :conditions=>[\"study_id = ? AND extraction_form_id=?\",@study.id, @extraction_form_id], :order=>\"display_number ASC\", :select=>[\"id\",\"title\",\"description\",\"display_number\",\"extraction_form_id\",\"note\",\"default_num_enrolled\",\"is_intention_to_treat\"])\n\t\telse\n\t\t\tcomparisons = @study.get_comparison_entries\n\t\t\tsession[:study_arms] = nil\n\t\t\t@existing_comparisons, @existing_comparators = OutcomeDataEntry.get_existing_diagnostic_comparisons_for_session(comparisons)\n\t\t\t# GET THE SUBGROUPS ASSOCIATED WITH THESE OUTCOMES\n\t\t\t@outcomes = Outcome.find(:all, :conditions=>[\"study_id=? AND extraction_form_id=?\",@study.id,@extraction_form_id],:select=>[\"id\",\"title\",\"units\",\"description\",\"extraction_form_id\"])\n\t\t\t@outcome_subgroups = Outcome.get_subgroups_by_outcome(@outcomes)\n\t\t\t@subgroups = @outcome_subgroups.to_json\n\t\tend\n\tend", "def setup_summary_report\n assign_to_from_dates\n @filter = @filter.remove_blanks_in_arrays\n @filter_name = @filter[:name]\n assign_grouping_type\n assign_facilities\n end", "def show_entry_table\n \t@outcome_id = params[:outcome_id]\n \t@outcome = Outcome.find(@outcome_id)\n \t@selected_timepoints = params[:selected_timepoints]\n \t@project_id = params[:project_id]\n \tunless params[:subgroup_id].nil?\n\t\t\t@subgroup = OutcomeSubgroup.find(params[:subgroup_id])\n\t\telse\n\t\t\t@subgroup = nil\n\t\tend\n \t#-----------------------------------------\n \t# Data for the entry table\n \t#-----------------------------------------\n \t\t@outcome_id, @study_id,@extraction_form_id, @selected_tp_array, @timepoints, @OCDEs, \n\t\t@measures, @datapoints, @arms, @comparisons, @comparison_measures, @comparators, \n\t\t@all_comparators, @num_comparators, @comparison_datapoints, @wa_comparisons, @wa_measures, \n\t\t@wa_comparators, @wa_all_comparators, @wa_datapoints, @footnotes = OutcomeDataEntry.get_information_for_entry_table(@outcome,@subgroup,@selected_timepoints)\n\n end", "def set_extractions_extraction_forms_projects_sections_type1\n @extractions_extraction_forms_projects_sections_type1 = ExtractionsExtractionFormsProjectsSectionsType1.find(params[:id])\n authorize(@extractions_extraction_forms_projects_sections_type1)\n end", "def create_within_arm_table\n \t@selected_timepoints = params[:selected_timepoints]\n \t@selected_tp_array = @selected_timepoints.split(\"_\")\n \t@outcome_id = params[:outcome_id]\n \tsubgroup_id = params[:subgroup_id].nil? ? 0 : params[:subgroup_id]\n \t@subgroup = subgroup_id == 0 ? nil : OutcomeSubgroup.find(subgroup_id)\n \t# comparisons within-arm are created on a row-by-row basis, using the row number as the group_id\n \tOutcomeDataEntry.create_comparisons(\"within\",[1],@outcome_id,subgroup_id)\n \t@outcome = Outcome.find(@outcome_id)\n \t@project_id = params[:project_id]\n \tunless params[:subgroup_id].nil?\n\t\t\t@subgroup = OutcomeSubgroup.find(params[:subgroup_id])\n\t\telse\n\t\t\t@subgroup = nil\n\t\tend\n \t#-----------------------------------------\n \t# Data for the entry table\n \t#-----------------------------------------\n \t@outcome_id, @study_id,@extraction_form_id, @selected_tp_array, @timepoints, @OCDEs, \n\t\t@measures, @datapoints, @arms, @comparisons, @comparison_measures, @comparators, \n\t\t@all_comparators, @num_comparators, @comparison_datapoints, @wa_comparisons, @wa_measures, \n\t\t@wa_comparators, @wa_all_comparators, @wa_datapoints, @footnotes = OutcomeDataEntry.get_information_for_entry_table(@outcome,@subgroup,@selected_timepoints)\n\n\t\trender \"/outcome_data_entries/show_entry_table\"\n\tend", "def edit_advice\n @questionnaire = get(Questionnaire, params[:id])\n \n for question in @questionnaire.questions\n if question.true_false\n num_questions = 2\n else\n num_questions = @questionnaire.max_question_score - @questionnaire.min_question_score\n end\n \n sorted_advice = question.question_advices.sort {|x,y| y.score <=> x.score } \n if question.question_advices.length != num_questions or\n sorted_advice[0].score != @questionnaire.min_question_score or\n sorted_advice[sorted_advice.length-1] != @questionnaire.max_question_score\n # The number of advices for this question has changed.\n QuestionnaireHelper::adjust_advice_size(@questionnaire, question)\n end\n end\n @questionnaire = get(Questionnaire, params[:id])\n end", "def set_evaluacione\r\n @evaluacione = Evaluacione.find(params[:id])\r\n end", "def show\n @explanation = Explanation.new\n @explanations = @lesson.explanations.select(:id, :title, :position_prior, :privacy, :video_token).order('id ASC')\n @prior_expl = @lesson.explanations.find_by(position_prior: '1')\n\n @prompt = Prompt.new\n @prompts = @lesson.prompts.select(:id, :title, :position_prior, :privacy, :video_token).order('id ASC')\n @prior_prompt = @lesson.prompts.find_by(position_prior: '1')\n\n @model = Model.new\n @models = @lesson.models.select(:id, :title, :position_prior, :privacy, :video_token).order('id ASC')\n @prior_model = @lesson.models.find_by(position_prior: '1')\n\n @topic_lessons = {}\n \n @lesson.topic.lessons_order.each do |l|\n lesson = Lesson.find_by_refnum(l)\n \n if topic_lesson_status(lesson)\n @topic_lessons[lesson.id] = lesson.completion_status(current_user)\n elsif lesson.instructor == current_user\n @topic_lessons[lesson.id] = [\"new\", \"Incomplete lesson\"]\n end\n \n end\n\n\n \n\n if (@lesson.lesson_type.to_i == 0 || @lesson.lesson_type == nil) && @prior_expl && @prior_prompt && @prior_model\n @lesson_ready = true, @all_prt = true \n elsif @lesson.lesson_type.to_i == 1 && @prior_expl && @prior_model \n @lesson_ready = true, @mdl_prt = true \n elsif @lesson.lesson_type.to_i == 2 && @prior_expl && @prior_prompt\n @lesson_ready = true, @prmt_prt = true \n end\n\n @concept = Concept.new\n @rehearsal = Rehearsal.new\n\n @lessons_arr = []\n @lessons = @topic.lessons\n @lessons.each { |lesson| @lessons_arr << lesson.id }\n\n end", "def diagnostics\n @study = Study.find(params[:study_id])\n puts \"............ studies_controller::arms on project \"+@study.project_id.to_s+\" EF id \"+params[:extraction_form_id].to_s\n @project = Project.find(@study.project_id)\n makeStudyActive(@study)\n session[:project_id] = @study.project_id\n @study_extforms = StudyExtractionForm.where(:study_id => @study.id)\n\n # get information regarding the extraction forms, pre-defined diagnostic tests and descriptions,\n # sections in each form, sections borrowed from other forms, key questions associated with \n # each section, etc.\n unless @study_extforms.empty?\n @extraction_forms,@included_sections,@borrowed_section_names,@section_donor_ids,@kqs_per_section = DiagnosticTest.get_extraction_form_information(@study_extforms,@study,@study.project_id)\n end\n efid = params[:extraction_form_id].to_i\n # now get the diagnostic tests that have already been added to this study\n if @included_sections[efid].include?(\"diagnostics\")\n @index_test_list = DiagnosticTest.where(:extraction_form_id=>efid, :study_id=>@study.id, :test_type=>1)\n @reference_test_list = DiagnosticTest.where(:extraction_form_id=>efid, :study_id=>@study.id, :test_type=>2)\n @thresholds = Hash.new\n # gather the thresholds for each test\n (@index_test_list + @reference_test_list).each do |test|\n @thresholds[test.id] = test.diagnostic_test_thresholds\n end\n else\n flash[\"error\"] = \"That section is not included in the current extraction form.\"\n redirect_to edit_project_study_path(params[:project_id], @study.id)\t\t\t\t\n end\n # Now get any additional user instructions for this section\n @user_instructions = EfInstruction.find(:first, :conditions=>[\"ef_id = ? and section = ? and data_element = ?\", efid, \"DIAGNOSTIC_TESTS\", \"GENERAL\"])\n @user_instructions = @user_instructions.nil? ? \"\" : @user_instructions.instructions\n render :layout=>false\n end", "def quality\n @study = Study.find(params[:study_id])\n #makeStudyActive(@study)\n #session[:project_id] = @study.project_id\n @extraction_form = ExtractionForm.find(params[:extraction_form_id])\n @study_extforms = StudyExtractionForm.where(:study_id => @study.id)\n @extraction_forms = Array.new\n @included_sections = Hash.new\n @borrowed_section_names, @section_donor_ids = [Hash.new,Hash.new]\n # an array of hashes to keep track of key questions addressed by\n # each individual section\n @kqs_per_section = Hash.new\n unless @study_extforms.empty?\n @study_extforms.each do |ef|\n tmpForm = ExtractionForm.find(ef.extraction_form_id)\n @extraction_forms << tmpForm\n included = ExtractionFormSection.get_included_sections(ef.extraction_form_id)\n borrowed = ExtractionFormSection.get_borrowed_sections(ef.extraction_form_id)\n @included_sections[ef.extraction_form_id] = included\n @borrowed_section_names[ef.extraction_form_id] = borrowed.collect{|x| x[0]}\n @section_donor_ids[ef.extraction_form_id] = borrowed.collect{|x| x[1]}\n @kqs_per_section[ef.extraction_form_id] = ExtractionFormSection.get_questions_per_section(ef.extraction_form_id,@study)\n end\n end\n @ef_id = params[:extraction_form_id]\n if ExtractionFormSection.section_is_included(\"quality\", @study.id, @ef_id)\t\n session[:study_id] = @study.id\n @project = Project.find(params[:project_id])\n @exists = QualityRatingDataPoint.where(:study_id => @study.id, :extraction_form_id => @ef_id).first\n @quality_rating = @exists.nil? ? QualityRatingDataPoint.new : @exists\n @quality_dimension_field = QualityDimensionField.new\n @quality_dimension_data_point = QualityDimensionDataPoint.new\n @quality_dimension_extraction_form_fields = QualityDimensionField.where(:extraction_form_id => @ef_id).order(\"question_number ASC\")\n else\n flash[\"error\"] = \"That section is not included in the current extraction form.\"\n redirect_to edit_project_study_path(params[:project_id], @study.id)\t\t\t\t\n end\t\n # Now get any additional user instructions for this section\n @extraction_form_quality_instr = EfInstruction.find(:first, :conditions=>[\"ef_id = ? and section = ? and data_element = ?\", params[:extraction_form_id].to_s, \"QUALITY\", \"GENERAL\"])\n render :layout=>false\n end", "def get_similar \n similarity_scores = SimilarityScore.find(:all,:conditions=>[\"engineer_id_1 = ? OR engineer_id_2 = ?\",params[:id],params[:id]],:limit => 5,:order => \"score DESC\")\n @scores = Array.new \n similarity_scores.each do |similarity_score|\n other_engineer = similarity_score.engineer_id_1 \n other_engineer = similarity_score.engineer_id_2 if other_engineer == params[:id].to_i \n @scores << [Name.find(other_engineer), sprintf(\"%.3f\",similarity_score.score)]\n end\n \n render :update do |page|\n page.replace_html 'top_five_similar', :partial => \"engineers/top_five_similar\"\n end \n end", "def historic_diff\n # get the two versions to diff\n @new_measure = Measure.by_user(current_user).where({:_id => params[:new_id]}).first\n unless @new_measure\n @new_measure = ArchivedMeasure.where({:measure_db_id => params[:new_id]}).first.to_measure\n end\n\n @old_measure = Measure.by_user(current_user).where({:_id => params[:old_id]}).first\n unless @old_measure\n @old_measure = ArchivedMeasure.where({:measure_db_id => params[:old_id]}).first.to_measure\n end\n\n results = {}\n results['diff'] = []\n results['pre_upload'] = { \n 'cms_id' => @old_measure.cms_id,\n 'updateTime' => (@old_measure.updated_at.tv_sec * 1000),\n 'hqmf_id' => @old_measure.hqmf_id,\n 'hqmf_version_number' => @old_measure.hqmf_version_number }\n results['post_upload'] = { \n 'cms_id' => @new_measure.cms_id,\n 'updateTime' => (@new_measure.updated_at.tv_sec * 1000),\n 'hqmf_id' => @new_measure.hqmf_id,\n 'hqmf_version_number' => @new_measure.hqmf_version_number }\n\n measure_logic_names = HQMF::Measure::LogicExtractor::POPULATION_MAP.clone\n measure_logic_names['VARIABLES'] = 'Variables'\n\n # Walk through the population sets and populations for the measure and create a\n # diffy for each populationm.\n @new_measure.populations.each_with_index do |new_population_set, population_set_index|\n old_population_set = @old_measure.populations[population_set_index]\n population_diff = []\n\n # For each population within the population set, get the population logic and\n # perform the diffy\n measure_logic_names.each_pair do |population_code, population_title|\n # if the code is for VARIABLE, leave it. If it's IPP, etc., then access the actual code name from the\n # population set (e.g. IPP_1).\n code = (population_code == 'VARIABLES') ? 'VARIABLES' : new_population_set[population_code]\n new_logic = @new_measure.measure_logic.find { |logic| logic['code'] == code }\n old_logic = @old_measure.measure_logic.find { |logic| logic['code'] == code }\n\n # skip if both are non existent\n next if !new_logic && !old_logic\n \n # Remove the first line of the measure logic, which is the the name of the population.\n old_logic_text = old_logic ? old_logic['lines'][1..-1].join() : \"\"\n new_logic_text = new_logic ? new_logic['lines'][1..-1].join() : \"\"\n\n logic_diff = Diffy::SplitDiff.new(old_logic_text, new_logic_text,\n format: :html, include_plus_and_minus_in_html: true, allow_empty_diff: false)\n\n population_diff << {code: population_code, title: population_title, pre_upload: logic_diff.left, post_upload: logic_diff.right}\n end\n\n results['diff'] << population_diff\n end\n\n render :json => results\n end" ]
[ "0.6647048", "0.6490044", "0.6451081", "0.6401665", "0.61363214", "0.6094371", "0.60551697", "0.60022587", "0.60022587", "0.5980021", "0.594385", "0.58678436", "0.57674235", "0.57654464", "0.5712564", "0.5695426", "0.56824934", "0.5530345", "0.5506401", "0.5501154", "0.5442651", "0.54263765", "0.5416785", "0.5406528", "0.5402903", "0.5395155", "0.5392386", "0.5384416", "0.5371603", "0.53682464", "0.53647894", "0.5363676", "0.53185177", "0.5312877", "0.52959013", "0.52947724", "0.52938443", "0.5280156", "0.52608943", "0.523995", "0.52375734", "0.52375734", "0.52375734", "0.52375734", "0.5236333", "0.5225435", "0.52234864", "0.52114147", "0.52055216", "0.51896834", "0.5188716", "0.51886284", "0.51804554", "0.5156988", "0.5156771", "0.5154652", "0.5139782", "0.51320815", "0.51239175", "0.51121134", "0.5109366", "0.51090693", "0.5098575", "0.5090041", "0.5081493", "0.5072557", "0.5071214", "0.5069746", "0.5048324", "0.5028779", "0.50064844", "0.4996836", "0.4993304", "0.4992364", "0.4989859", "0.4989441", "0.49857694", "0.49854127", "0.49849507", "0.49840224", "0.4975823", "0.49745274", "0.4964967", "0.49585456", "0.4951662", "0.49487376", "0.49485484", "0.4946924", "0.49370128", "0.4935915", "0.4930227", "0.49181572", "0.49139133", "0.49111107", "0.49109313", "0.48999983", "0.48980927", "0.48946983", "0.4894629", "0.4893628" ]
0.57076466
15
PATCH/PUT /result_statistic_sections/1 PATCH/PUT /result_statistic_sections/1.json
def update respond_to do |format| if @result_statistic_section.update(result_statistic_section_params) format.html { redirect_to edit_result_statistic_section_path(@result_statistic_section), notice: t('success') } format.json { render :show, status: :ok, location: @result_statistic_section } format.js do @eefpst1 = @result_statistic_section .population .extractions_extraction_forms_projects_sections_type1 @extraction = @result_statistic_section.extraction @project = @result_statistic_section.project @extraction_forms_projects = @project.extraction_forms_projects @eefpst1s = ExtractionsExtractionFormsProjectsSectionsType1 .by_section_name_and_extraction_id_and_extraction_forms_project_id('Outcomes', @extraction.id, @extraction_forms_projects.first.id) end else format.html { render :edit } format.json { render json: @result_statistic_section.errors, status: :unprocessable_entity } end end end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update\n respond_to do |format|\n if @result_statistic_section.update(result_statistic_section_params)\n format.html { redirect_to edit_result_statistic_section_path(@result_statistic_section),\n notice: t('success') }\n format.json { render :show, status: :ok, location: @result_statistic_section }\n else\n format.html { render :edit }\n format.json { render json: @result_statistic_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def set_result_statistic_section\n @result_statistic_section = ResultStatisticSection\n .includes(subgroup: { extractions_extraction_forms_projects_sections_type1_row: { extractions_extraction_forms_projects_sections_type1: [:type1, extractions_extraction_forms_projects_section: [:extraction, extraction_forms_projects_section: :extraction_forms_project]] } })\n .includes(:result_statistic_section_type)\n .find(params[:id])\n end", "def update\n respond_to do |format|\n if @statistic.update(statistic_params)\n create_factors_for_statistic(@statistic)\n format.html { redirect_to @statistic, notice: 'Statistic was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @statistic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n results = result_params\n unless results.nil?\n stay = true\n if results.is_a?(String) #Update comes from online testing\n parts = results.split(\"#\")\n labels = parts[0].split(\",\")\n unless @result.nil?\n @result.parse_csv(parts[1])\n @result.parse_data(labels[1, labels.length-1], parts[2, parts.length-1]) if parts.length > 2\n head 200\n end\n else\n if results.has_key?(\"students\") #Update comes from editing form\n @measurement.update_students(results[\"students\"])\n else\n results.each do |id, val|\n r = @measurement.results.find_by_student_id(id)\n unless r.nil?\n if val.is_a?(String)\n r.parse_csv(val)\n stay = false\n else\n r.parse_Hash(val)\n end\n end\n end\n end\n respond_to do |format|\n format.js {\n unless stay\n render 'assessments/show'\n else\n render :edit\n end\n }\n end\n end\n end\n end", "def result_statistic_section_params\n params.require(:result_statistic_section).permit(\n measures_attributes: [:id, :name, :_destroy],\n measure_ids: [],\n result_statistic_sections_measures_attributes: [measure_attributes: [:id, :name]],\n comparisons_attributes: [:id, :is_anova,\n comparate_groups_attributes: [:id,\n comparates_attributes: [:id,\n comparable_element_attributes: [:id, :comparable_type, :comparable_id]]]])\n#\n# measure_ids: [],\n# comparisons_attributes: [ :id, :_destroy, :result_statistic_section_id,\n# comparisons_measures_attributes: [ :id, :_destroy, :comparison_id, :measure_id ,\n# measurement_attributes: [ :id, :_destroy, :comparisons_measure_id, :value ] ],\n# comparate_groups_attributes: [ :id, :_destroy, :comparison_id,\n# comparates_attributes: [ :id, :_destroy, :comparate_group_id, :comparable_element_id,\n# comparable_element_attributes: [ :id, :_destroy, :comparable_type, :comparable_id, :_destroy ] ] ] ] )\n end", "def update\n respond_to do |format|\n if @statistic.update(statistic_params)\n format.html { redirect_to @statistic, notice: 'Statistic was successfully updated.' }\n format.json { render :show, status: :ok, location: @statistic }\n else\n format.html { render :edit }\n format.json { render json: @statistic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @statistic.update(statistic_params)\n format.html { redirect_to @statistic, notice: 'Statistic was successfully updated.' }\n format.json { render :show, status: :ok, location: @statistic }\n else\n format.html { render :edit }\n format.json { render json: @statistic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @statistic.update(statistic_params)\n format.html { redirect_to @statistic, notice: 'Statistic was successfully updated.' }\n format.json { render :show, status: :ok, location: @statistic }\n else\n format.html { render :edit }\n format.json { render json: @statistic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @result = Result.find(params[:id])\n\n respond_to do |format|\n if @result.update_attributes(result_params)\n format.js { render :partial => @result }\n format.json { render :json => @result.to_json(:methods => [:name, :bib_number, :category_name]) }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @result.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @section = Section.find(params[:pk])\n @section.update_attributes( params[:name] => params[:value] )\n \n if @section.save\n render json: { :results => true }\n else\n render json: { :results => false }\n end\n \n end", "def update\n respond_to do |format|\n if @survey_result.update(survey_result_params)\n format.html { redirect_to @survey_result, notice: 'Survey result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @survey_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @survey_result = SurveyResult.find(params[:id])\n\n respond_to do |format|\n if @survey_result.update_attributes(params[:survey_result])\n format.html { redirect_to @survey_result, notice: 'Survey result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @survey_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_case_result.update(test_case_result_params)\n format.html { redirect_to @test_case_result, notice: 'Test case result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @test_case_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @survey_result.update(survey_result_params)\n format.html { redirect_to @survey_result, notice: 'Survey result was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey_result }\n else\n format.html { render :edit }\n format.json { render json: @survey_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\n respond_to do |format|\n if @result.update_attributes(result_params)\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @result.update(result_params)\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @result.update(result_params)\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # respond_to do |format|\n # #if @survey_result.update(survey_result_params)\n # if @survey_result = SurveyResult.new(params[:survey_result])\n # format.html { redirect_to user_survey_results_url(survey_user,@survey_result), notice: 'Survey result was successfully updated.' }\n # format.json { head :no_content }\n # else\n # format.html { render action: 'edit' }\n # format.json { render json: @survey_result.errors, status: :unprocessable_entity }\n # end\n # end\n end", "def update\n @result = Result.find(params[:id])\n\n respond_to do |format|\n if @result.update_attributes(params[:result])\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @result = Result.find(params[:id])\n\n respond_to do |format|\n if @result.update_attributes(params[:result])\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @result = Result.find(params[:id])\n\n respond_to do |format|\n if @result.update_attributes(params[:result])\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @result = Result.find(params[:id])\n\n respond_to do |format|\n if @result.update_attributes(params[:result])\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @section_test = SectionTest.find(params[:id])\n\n respond_to do |format|\n if @section_test.update_attributes(params[:section_test])\n format.html { redirect_to @section_test, notice: 'Section test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section_test.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @result1 = Result1.find(params[:id])\n\n respond_to do |format|\n if @result1.update_attributes(params[:result1])\n format.html { redirect_to @result1, notice: 'Result1 was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_result = TestResult.find(params[:id])\n\n respond_to do |format|\n if @test_result.update_attributes(params[:test_result])\n format.html { redirect_to @test_result, notice: 'Test result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @test_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_example_result.update(test_example_result_params)\n format.html { redirect_to @test_example_result, notice: 'Test example result was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_example_result }\n else\n format.html { render :edit }\n format.json { render json: @test_example_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @result_info.update(result_info_params)\n format.html { redirect_to @result_info, notice: 'Result info was successfully updated.' }\n format.json { render :show, status: :ok, location: @result_info }\n else\n format.html { render :edit }\n format.json { render json: @result_info.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_result.update(test_result_params)\n format.html { redirect_to @test_result, notice: 'Test result was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_result }\n else\n format.html { render :edit, status: :unprocessable_entity }\n format.json { render json: @test_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @test_result.update(test_result_params)\n format.html { redirect_to @test_result, notice: 'Test result was successfully updated.' }\n format.json { render :show, status: :ok, location: @test_result }\n else\n format.html { render :edit }\n format.json { render json: @test_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize! :manage, @vspec\n\n respond_to do |format|\n if @vspec.update(vspec_params)\n format.html { redirect_to [@vspec.metric, @vspec], notice: 'Vspec was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @vspec.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @result = Result.find(params[:id])\n @result.student = @student\n @result.jpm = current_user\n date1 = params[:result][:result_date].to_datetime.change(:hour => 1)\n params[:result][:result_date] = date1\n respond_to do |format|\n if @result.update_attributes(params[:result])\n format.html { redirect_to student_results_path(@student), notice: 'Result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def result_statistic_section_params\n params.require(:result_statistic_section).permit()\n end", "def update\n respond_to do |format|\n if @survey_section.update(survey_section_params)\n format.html { redirect_to @survey_section, notice: 'Survey section was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey_section }\n else\n format.html { render :edit }\n format.json { render json: @survey_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @result.update(result_params)\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { render :show, status: :ok, location: @result }\n else\n format.html { render :edit }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @result.update(result_params)\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { render :show, status: :ok, location: @result }\n else\n format.html { render :edit }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @result.update(result_params)\n format.html { redirect_to @result, notice: 'Result was successfully updated.' }\n format.json { render :show, status: :ok, location: @result }\n else\n format.html { render :edit }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @suite_result = SuiteResult.find(params[:id])\n\n respond_to do |format|\n if @suite_result.update_attributes(params[:suite_result])\n format.html { redirect_to @suite_result, notice: 'Suite result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @suite_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update_for_analysis_type\n \t@selected_analysis = params[:selected_analysis]\n \t\n \trespond_to do |format|\n format.js { \n \trender :update do |page|\n \t\tpartial_used = case @selected_analysis\n \t\t\t\twhen \"Log Rank\" then \"log_rank\"\n \t\t\t\twhen \"t-Test, 1-sided\" then \"choice_of_grouping\"\n \t\t\t\twhen \"t-Test, 2-sided\" then \"two_sided_t\"\n \t\t\t\telse \"default\"\n \t\t\tend\n \t page.replace_html \"comparison_level1\", :partial=>\"outcome_analyses/partials/analyses/\"+partial_used.to_s\n \tend\n }\n end\n end", "def update\n if @question.status == 'published' || @question.version_independent_id != question_params[:version_independent_id]\n render json: @question.errors, status: :unprocessable_entity\n else\n update_response_sets(params)\n @question.update_concepts('Question')\n @question.updated_by = current_user\n if @question.update(question_params)\n @question.groups.each do |group|\n @question.add_to_group(group.id)\n end\n render :show, status: :ok, location: @question\n else\n @categories = Category.all\n render json: @question.errors, status: :unprocessable_entity\n end\n end\n end", "def update\n respond_to do |format|\n if @result.update(result_params)\n format.html { redirect_to @result, notice: 'result was successfully updated.' }\n format.json { render :show, status: :ok, location: @result }\n else\n format.html { render :edit }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @section.update(section_params)\n @section.check_index()\n form_wrapper = FormWrapper.find(@section.form_wrapper_id)\n format.html { redirect_to sections_section_path(form_wrapper), alert: I18n.t('activerecord.models.section.single') + I18n.t('helpers_locale.models.created') }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def edit\n add_breadcrumb 'edit project', edit_project_path(@result_statistic_section.extraction.project)\n add_breadcrumb 'extractions', project_extractions_path(@result_statistic_section.extraction.project)\n add_breadcrumb 'work', work_extraction_path(@result_statistic_section.extraction,\n params: { eefpst1_id: @result_statistic_section.population.extractions_extraction_forms_projects_sections_type1_id },\n anchor: \"panel-tab-#{ @result_statistic_section.eefps_result.id }\")\n add_breadcrumb @result_statistic_section.result_statistic_section_type.name.downcase,\n :edit_result_statistic_section_path\n end", "def update\n respond_to do |format|\n if @comparison_result.update(comparison_result_params)\n format.html { redirect_to @comparison_result, notice: 'Comparison result was successfully updated.' }\n format.json { render :show, status: :ok, location: @comparison_result }\n else\n format.html { render :edit }\n format.json { render json: @comparison_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n if section.update_attributes(params[:section_datum])\n head :no_content\n else\n render json: section.errors.full_messages,\n status: :unprocessable_entity\n end\n end", "def update\n if @section.update(section_params)\n render :show, status: :ok, location: @section\n else\n render json: @section.errors, status: :unprocessable_entity\n end\n end", "def update\n @result = Result.find(@given_answer.result_id)\n correctness = @given_answer.correct_answer\n respond_to do |format|\n if @given_answer.update(given_answer_params)\n if correctness.nil?\n if @given_answer.correct_answer\n @result.total_number_of_correct_answers += 1\n end\n else\n if correctness != @given_answer.correct_answer\n if correctness && !@given_answer.correct_answer\n @result.total_number_of_correct_answers -= 1\n else\n @result.total_number_of_correct_answers += 1\n end\n end\n end\n @result.save\n \n format.html { redirect_to @given_answer, notice: 'Given answer was successfully updated.' }\n format.json { render :show, status: :ok, location: @given_answer }\n else\n format.html { render :edit }\n format.json { render json: @given_answer.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n @statistic.avg_time_on_site *= 60 # conversion mn en seconde-\n if @statistic.update(statistic_params)\n format.html { redirect_to statistics_path, notice: 'Statistic was successfully updated.' }\n format.json { render :show, status: :ok, location: @statistic }\n else\n format.html { render :edit }\n format.json { render json: @statistic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @daily_statistic = DailyStatistic.find(params[:id])\n\n if @daily_statistic.update(params[:daily_statistic])\n head :no_content\n else\n render json: @daily_statistic.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @subset.update(subset_params)\n format.html { redirect_to @subset, notice: 'Subset was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @subset.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @exam_result.update(exam_result_params)\n format.html { redirect_to @exam_result, notice: 'Exam result was successfully updated.' }\n format.json { render :show, status: :ok, location: @exam_result }\n else\n format.html { render :edit }\n format.json { render json: @exam_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @result_figure.update(result_figure_params)\n format.html { redirect_to @result_figure, notice: 'Result figure was successfully updated.' }\n format.json { render :show, status: :ok, location: @result_figure }\n else\n format.html { render :edit }\n format.json { render json: @result_figure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @student_result.update(student_result_params)\n format.html { redirect_to @student_result, notice: 'Student result was successfully updated.' }\n format.json { render :show, status: :ok, location: @student_result }\n else\n format.html { render :edit }\n format.json { render json: @student_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n old_series_statement = @series_has_manifestation.series_statement\n if @series_has_manifestation.update_attributes(params[:series_has_manifestation])\n old_series_statement.index\n if params[:mode] == 'edit_manifestation'\n format.html { redirect_to edit_manifestation_path(@series_has_manifestation.manifestation) }\n else\n format.html { redirect_to @series_has_manifestation, :notice => t('controller.successfully_updated', :model => t('activerecord.models.series_has_manifestation')) }\n format.json { head :no_content }\n end\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @series_has_manifestation.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update_progress_key_result\n key_result_id = params[:id]\n progress = params[:progress]\n initial_progress = params[:initial]\n contribution = params[:contribution]\n progress_decimal = BigDecimal.new(progress)\n initial_progress_decimal = BigDecimal.new(initial_progress)\n personal_key_result = PersonalKeyResult.find(key_result_id) \n\n status = PersonalKeyResult.update_progress_personal_key_result(\n key_result_id,\n progress_decimal,\n initial_progress_decimal,\n contribution,\n current_user.id\n )\n\n respond_to do |format|\n if status == 200\n format.json { render json: 'Progress of the key result is updated successfully!', status: :ok }\n else\n format.json { render json: 'Fail to update progress!', status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @submission_result.update(submission_result_params)\n format.html { redirect_to @submission_result, notice: 'Submission result was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @submission_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @survey.update(survey_params)\n VehicleStat.import(@survey, params[:survey][:vehicle_stat]) if params[:survey][:vehicle_stat]\n format.html { redirect_to @survey, notice: 'Survey was successfully updated.' }\n format.json { render :show, status: :ok, location: @survey }\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n params[:product_section][:audit_user_name] = current_user.full_name\n @fo = @product_section.product.room.fabrication_order_id\n if @product_section.update(product_section_params)\n\n params_redirect = {id: @fo}\n params_redirect.merge!({scroll: true}) if params[:scroll]\n\n format.html { redirect_to edit_fabrication_order_path(params_redirect), notice: 'Section was successfully updated.' }\n format.json do\n flash[:notice] = \"status for #{@product_section.name} was successfully updated\"\n sects = {id: @product_section.id, name: @product_section.name, status: @product_section.status, size_type: @product_section.size_type, size_a: @product_section.size_a, fraction_size_a: @product_section.fraction_size_a, size_b: @product_section.size_b, fraction_size_b: @product_section.fraction_size_a, edge_type_a_id: @product_section.edge_type_a_id, edge_type_a: @product_section.edge_type_a.to_s, edge_type_b: @product_section.edge_type_b.to_s, edge_type_b_id: @product_section.edge_type_b_id, edge_type_c: @product_section.edge_type_c.to_s, edge_type_c_id: @product_section.edge_type_c_id, edge_type_d: @product_section.edge_type_d.to_s, edge_type_d_id: @product_section.edge_type_d_id}\n render json: api_response(:success, nil, sects)\n end \n format.js {render layout: false}\n else\n format.html {\n set_edge_type\n renderr = product_section_params.has_key?(:size_a) ? :size : :edit\n render renderr, :layout => \"application\" \n }\n format.json { render json: api_response(:failed, @product_section.errors.full_messages.join(' '), @product_section.errors), status: :unprocessable_entity }\n format.js\n end\n end\n end", "def update\n @criterion = Criterion.find(params[:id])\n\n if @criterion.update_attributes(params[:criterion])\n head :no_content\n else\n render json: @criterion.errors, status: :unprocessable_entity\n end\n end", "def update\n respond_to do |format|\n if @summary.update(summary_params)\n format.html { redirect_to @summary }\n format.json { render :show, status: :ok, location: @summary }\n else\n format.html { render :edit }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @state_statistic.update(state_statistic_params)\n format.html { redirect_to @state_statistic, notice: 'State statistic was successfully updated.' }\n format.json { render :show, status: :ok, location: @state_statistic }\n else\n format.html { render :edit }\n format.json { render json: @state_statistic.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @test_score = @participant.test_scores.find(params[:id])\n @test_score.test_type_id = params[:test_score][:test_type_id]\n @test_score.test_type.reload\n @test_score.add_section_score_attribute_methods\n\n respond_to do |format|\n if @test_score.update_attributes(params[:test_score])\n flash[:notice] = 'TestScore was successfully updated.'\n format.html { redirect_to participant_path(@participant, :anchor => \"!/section/test_scores\") }\n format.xml { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.xml { render :xml => @test_score.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n if @scenario.update(scenario_params)\n \trender json: @scenario\n else\n \trender json: {status: 'ERROR', data: @scenario.errors}\n end\n end", "def update\n respond_to do |format|\n if @summary.update(summary_params)\n format.html { redirect_to @summary, notice: 'Summary was successfully updated.' }\n format.json { render :show, status: :ok, location: @summary }\n else\n format.html { render :edit }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @summary.update(summary_params)\n format.html { redirect_to @summary, notice: 'Summary was successfully updated.' }\n format.json { render :show, status: :ok, location: @summary }\n else\n format.html { render :edit }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @summary.update(summary_params)\n format.html { redirect_to @summary, notice: 'Summary was successfully updated.' }\n format.json { render :show, status: :ok, location: @summary }\n else\n format.html { render :edit }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n redirect_to(root_url) && return unless current_user.can_edit_patient?\n\n content = params.require(:patient).permit(:id).merge!(allowed_params)\n patient = current_user.get_patient(content[:id])\n laboratory = params.permit(laboratory: %i[id lab_type specimen_collection report result])[:laboratory]\n common_exposure_cohorts = params.permit(common_exposure_cohorts: [%i[id cohort_type cohort_name cohort_location]])[:common_exposure_cohorts]\n other_updates = {}\n # If we failed to find a subject given the id, redirect to index\n redirect_to(root_url) && return if patient.nil?\n\n # Update first positive lab if present\n if laboratory.present?\n # If the laboratory id is not provided, redirect to index\n redirect_to(root_url) && return unless laboratory.key?(:id)\n\n # If we failed to find a laboratory given the id, redirect to index\n first_positive_lab = patient.laboratories.find(laboratory[:id])\n redirect_to(root_url) && return if first_positive_lab.blank?\n\n first_positive_lab.update(laboratory)\n History.lab_result(patient: patient, created_by: current_user.email, comment: \"User edited a lab result (ID: #{laboratory[:id]}).\")\n end\n\n # Update common exposure cohorts if present (need to use nil? check instead of empty?/present? for deletions)\n unless common_exposure_cohorts.nil?\n original_cohort_ids = patient.common_exposure_cohorts.pluck(:id)\n updated_cohort_ids = common_exposure_cohorts.pluck(:id)\n deleted_cohort_ids = original_cohort_ids - updated_cohort_ids\n\n # Save old cohort data for history\n deleted_cohorts = patient.common_exposure_cohorts.where(id: deleted_cohort_ids)\n other_updates[:common_exposure_cohorts] = { created: [], updated: [], deleted: deleted_cohorts.map(&:attributes).map(&:symbolize_keys) }\n\n # Update cohorts\n common_exposure_cohorts.each do |cohort|\n sanitized_cohort = cohort.slice(*%i[cohort_type cohort_name cohort_location])\n if cohort[:id]\n other_updates[:common_exposure_cohorts][:updated] << [patient.common_exposure_cohorts.find_by(id: cohort[:id]), sanitized_cohort]\n patient.common_exposure_cohorts.find_by(id: cohort[:id]).update(sanitized_cohort)\n else\n other_updates[:common_exposure_cohorts][:created] << patient.common_exposure_cohorts.create(sanitized_cohort)\n end\n end\n\n # Delete cohorts\n deleted_cohorts.destroy_all\n end\n\n # Propagate desired fields to household except jurisdiction_id\n propagated_fields = params[:propagated_fields]\n unless propagated_fields.empty?\n propagated_content = content.select { |field| propagated_fields.include?(field) && field != 'jurisdiction_id' }\n patient.dependents_exclude_self.update(propagated_content)\n end\n\n # If the assigned jurisdiction is updated, verify that the jurisdiction exists and that it is assignable by the current user, update history and propagate\n if content[:jurisdiction_id] && content[:jurisdiction_id] != patient.jurisdiction_id\n if current_user.jurisdiction.subtree_ids.include?(content[:jurisdiction_id].to_i)\n old_jurisdiction = patient.jurisdiction[:path]\n new_jurisdiction = Jurisdiction.find(content[:jurisdiction_id])[:path]\n transfer = Transfer.create!(patient: patient, from_jurisdiction: patient.jurisdiction, to_jurisdiction_id: content[:jurisdiction_id], who: current_user)\n comment = \"User changed Jurisdiction from \\\"#{old_jurisdiction}\\\" to \\\"#{new_jurisdiction}\\\".\"\n history = History.monitoring_change(patient: patient, created_by: current_user.email, comment: comment)\n if propagated_fields.include?('jurisdiction_id')\n dependents_exclude_hoh = patient.dependents_exclude_self\n dependents_exclude_hoh.update(jurisdiction_id: content[:jurisdiction_id])\n dependents_exclude_hoh.each do |group_member|\n propagated_history = history.dup\n propagated_history.patient = group_member\n propagated_history.comment = \"System changed Jurisdiction from \\\"#{old_jurisdiction}\\\" to \\\"#{new_jurisdiction}\\\" because User updated Jurisdiction\n for another member in this monitoree's household and chose to update this field for all household members.\"\n propagated_history.save\n propagated_transfer = transfer.dup\n propagated_transfer.patient = group_member\n propagated_transfer.save\n end\n end\n else\n content[:jurisdiction_id] = patient.jurisdiction_id\n end\n end\n\n # If the assigned user is updated, update history and propagate\n if content[:assigned_user] && content[:assigned_user] != patient.assigned_user\n old_assigned_user = patient.assigned_user || ''\n new_assigned_user = content[:assigned_user] || ''\n comment = \"User changed Assigned User from \\\"#{old_assigned_user}\\\" to \\\"#{new_assigned_user}\\\".\"\n history = History.monitoring_change(patient: patient, created_by: current_user.email, comment: comment)\n if propagated_fields.include?('assigned_user')\n dependents_exclude_hoh = patient.dependents_exclude_self\n dependents_exclude_hoh.update(assigned_user: content[:assigned_user])\n dependents_exclude_hoh.each do |group_member|\n propagated_history = history.dup\n propagated_history.patient = group_member\n propagated_history.comment = \"System changed Assigned User from \\\"#{old_assigned_user}\\\" to \\\"#{new_assigned_user}\\\" because User updated Assigned\n User for another member in this monitoree's household and chose to update this field for all household members.\"\n propagated_history.save\n end\n end\n end\n\n # Update patient history with detailed edit diff\n patient_before = patient.dup\n\n render(json: patient.errors, status: :unprocessable_entity) and return unless patient.update(content)\n\n allowed_fields = allowed_params&.keys&.reject { |apk| %w[jurisdiction_id assigned_user].include? apk }\n Patient.detailed_history_edit(patient_before, patient, allowed_fields, other_updates, current_user.email)\n # Add a history update for any changes from moving from isolation to exposure\n patient.update_patient_history_for_isolation(patient_before, content[:isolation]) unless content[:isolation].nil?\n\n render json: patient\n end", "def update\n respond_to do |format|\n if @section_timing.update(section_timing_params)\n format.html { redirect_to @section_timing, notice: 'Section timing was successfully updated.' }\n format.json { render :show, status: :ok, location: @section_timing }\n else\n format.html { render :edit }\n format.json { render json: @section_timing.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @extractions_extraction_forms_projects_sections_type1.update(extractions_extraction_forms_projects_sections_type1_params)\n format.html { redirect_to work_extraction_path(@extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section\n .extraction,\n anchor: \"panel-tab-#{ @extractions_extraction_forms_projects_sections_type1\n .extractions_extraction_forms_projects_section.id }\"),\n notice: t('success') }\n format.json { head :no_content }\n else\n format.html { render :edit }\n format.json { render json: @extractions_extraction_forms_projects_sections_type1.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @result = Result.find(params[:id])\n @result.name = params[:name]\n\n if params[:type] == \"Statuswechsel\"\n @result.type = \"ResultStateChange\"\n clear_entity\n if params[:selected_state] != nil && params[:selected_state] != \"\"\n @state = State.find(params[:selected_state])\n @result.state = @state\n end\n\n end\n\n if params[:type] == \"Ereignistypen Menge aendern\"\n @result.type = \"ResultChangeEventTypeAmount\"\n clear_entity\n if params[:event_type_operator] != nil && params[:event_type_operator] != \"\"\n @result.event_type_operator = params[:event_type_operator]\n\n if (params[:event_type_operator]) == \"Zur Menge Hinzufuegen\" || (params[:event_type_operator]) == \"Aus Menge entfernen\"\n\n if params[:add_event_types] != nil\n params[:add_event_types].each do |f|\n @event_type = EventType.find(f)\n @result.event_types << @event_type\n end\n end\n end\n end\n end\n\n if params[:info] != nil && (params[:type]) == \"Info\"\n @result.type = \"ResultInfo\"\n clear_entity\n @result.info = params[:info]\n end\n\n if params[:type] == \"Client Sperren\"\n @result.type = \"ResultLock\"\n clear_entity\n end\n\n respond_to do |format|\n if @result.save\n format.html { redirect_to @result, notice: 'Ergebnis wurde erfolgreich aktualisiert' }\n format.json { head :no_content }\n else\n self.reload_edit_params\n format.html { render \"edit\" }\n format.json { render json: @result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @section_heading = SectionHeading.find(params[:id])\n\n respond_to do |format|\n if @section_heading.update_attributes(params[:section_heading])\n format.html { redirect_to @section_heading, notice: 'Section heading was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section_heading.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @operation = Operation.find(params[:id])\n params[:operation][\"inputs\"] = filter_distribution_ids(params[:operation][\"inputs\"])\n @model = Model.find(params[:model_id])\n respond_to do |format|\n if @operation.update_attributes(params[:operation])\n format.html { redirect_to user_model_path(@model.user,@model), notice: 'Operation was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @operation.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n authorize(@extractions_extraction_forms_projects_section)\n respond_to do |format|\n if @extractions_extraction_forms_projects_section.update(extractions_extraction_forms_projects_section_params)\n format.html do\n if params[:extractions_extraction_forms_projects_section].has_key? :extraction_ids\n redirect_to consolidate_project_extractions_path(@extractions_extraction_forms_projects_section.project,\n extraction_ids: params[:extractions_extraction_forms_projects_section][:extraction_ids],\n 'panel-tab': @extractions_extraction_forms_projects_section.extraction_forms_projects_section.id.to_s),\n notice: t('success')\n else\n redirect_to work_extraction_path(\n @extractions_extraction_forms_projects_section.extraction,\n \"panel-tab\": @extractions_extraction_forms_projects_section.extraction_forms_projects_section.id.to_s\n ),\n notice: t('success')\n end\n end\n format.json do\n type1_params = extractions_extraction_forms_projects_section_params[:extractions_extraction_forms_projects_sections_type1s_attributes]\n type1_params = type1_params['0']['type1_attributes']\n type1 = Type1.find_by(name: type1_params['name'], description: type1_params['description'])\n eefpst1 = ExtractionsExtractionFormsProjectsSectionsType1\n .find_by(\n extractions_extraction_forms_projects_section: @extractions_extraction_forms_projects_section,\n type1:\n )\n render json: { extractions_extraction_forms_projects_sections_type1_id: eefpst1.id }\n end\n format.js do\n if params[:extractions_extraction_forms_projects_section][:action] == 'work'\n @consolidated_extraction = @extractions_extraction_forms_projects_section.extraction\n render '/extractions_extraction_forms_projects_sections/work_update'\n else\n @action = params[:extractions_extraction_forms_projects_section][:action]\n @extraction = @extractions_extraction_forms_projects_section.extraction\n @linked_type2_sections = @extractions_extraction_forms_projects_section.link_to_type2s\n @results_eefps = @extraction.find_eefps_by_section_type('Results')\n end\n end\n else\n format.html do\n redirect_to work_extraction_path(\n @extractions_extraction_forms_projects_section.extraction,\n \"panel-tab\": @extractions_extraction_forms_projects_section.extraction_forms_projects_section.id.to_s\n ),\n alert: t('failure')\n end\n format.json do\n render json: @extractions_extraction_forms_projects_section.errors, status: :unprocessable_entity\n end\n format.js do\n end\n end\n end\n end", "def update\n respond_to do |format|\n # Everytime when progress is being updated, update the team OKR progress and company OKR progress\n if @personal_key_result.update(personal_key_result_params)\n format.html { redirect_to @personal_key_result, notice: 'Personal key result was successfully updated.' }\n format.json { render :show, status: :ok, location: @personal_key_result }\n else\n format.html { render :edit }\n format.json { render json: @personal_key_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @result_second.update(result_second_params)\n format.html { redirect_to @result_second, notice: 'Result second was successfully updated.' }\n format.json { render :show, status: :ok, location: @result_second }\n else\n format.html { render :edit }\n format.json { render json: @result_second.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @questions = Question.all\n @categories = [\"Learning from Labs\", \"Lab Instructor\", \"Lab Space and Equipment\", \"Time Required to Complete Labs\", \"Lecture Section Instructor\"]\n respond_to do |format|\n if @survey.update(survey_params)\n format.html { redirect_to @survey, notice: 'Survey was successfully submitted.' }\n format.json { render :show, status: :ok, location: @survey }\n\n # Update 'completed' attribute to true\n submission = Survey.find_by(survey_ID: @survey.survey_ID)\n submission.update(status: true)\n\n # Increment 'completed' attribute for section\n @section = Section.find_by(class_num: @survey.class_num)\n @section.update(completed: @section.completed + 1)\n\n\n else\n format.html { render :edit }\n format.json { render json: @survey.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @metric_speedtest.update(metric_speedtest_params)\n format.html { redirect_to @metric_speedtest, notice: 'Metric speedtest was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @metric_speedtest.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @lab_section.update(lab_section_params)\n format.html { redirect_to @lab_section, notice: 'Lab section was successfully updated.' }\n format.json { render :show, status: :ok, location: @lab_section }\n else\n format.html { render :edit }\n format.json { render json: @lab_section.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @section.update(section_params)\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { render json: @section }\n else\n format.html { render action: 'edit' }\n format.json { render json: ErrorSerializer.serialize(@section.errors), status: :unprocessable_entity }\n end\n end\n end", "def update\n @insure_results_sub = InsureResultsSub.find(params[:id])\n\n respond_to do |format|\n if @insure_results_sub.update_attributes(params[:insure_results_sub])\n format.html { redirect_to @insure_results_sub, :notice => 'Insure results sub was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @insure_results_sub.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @summary = Summary.find(params[:id])\n\n respond_to do |format|\n if @summary.update_attributes(params[:summary])\n format.html { redirect_to @summary, notice: 'Summary was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @summary.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n render_json_auto @survey.update_filter(params[:id].to_i, params[:filter]) and return\n end", "def update\n respond_to do |format|\n if @section_heading.update(section_heading_params)\n format.html { redirect_to @section_heading, notice: 'Section heading was successfully updated.' }\n format.json { render :show, status: :ok, location: @section_heading }\n else\n format.html { render :edit }\n format.json { render json: @section_heading.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n #raise params.inspect\n @evaluation_result = EvaluationResult.find(params[:id])\n\n if params[:commit].to_s == \"Gravar Rascunho\"\n app = Appointment.find(params[:appoint_id].to_i)\n s = AppointmentStatus.find_by_name(\"Em Avaliacao\")\n app.appointment_status = s\n app.save\n else\n app = Appointment.find(params[:appoint_id].to_i)\n s = AppointmentStatus.find_by_name(\"Realizada\")\n app.appointment_status = s\n app.save\n end\n\n respond_to do |format|\n if @evaluation_result.update_attributes(params[:evaluation_result])\n if params[:commit].to_s == \"Gravar Rascunho\"\n format.html { redirect_to appointments_path, notice: 'Resultados da avaliacao guardados com sucesso.' }\n else\n format.html { redirect_to \"http://localhost:8000/reporting?report=Avaliacao&Appointment_Id=#{params[:appoint_id].to_s}\", notice: 'Resultados da avaliacao guardados com sucesso.' }\n end\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @evaluation_result.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n result = V1::StudyHour::Update.(params, current_user: @current_user)\n if result.success?\n render json: result['model'], status: :ok\n elsif result['result.policy.failure']\n render json: { 'errors': [] }, status: :unauthorized\n else\n render json: {\n 'errors': result['contract.default'].errors.full_messages\n }, status: :unprocessable_entity\n end\n end", "def update\n @unit_of_measure = UnitOfMeasure.find(params[:id])\n\n respond_to do |format|\n if @unit_of_measure.update_attributes(params[:unit_of_measure])\n format.html { redirect_to @unit_of_measure, notice: t(:unit_of_measure_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @unit_of_measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @overview.update(overview_params)\n format.html { redirect_to @overview, notice: 'Overview was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @overview.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\r\n @section = Section.find(params[:id])\r\n\r\n respond_to do |format|\r\n if @section.update_attributes(params[:section])\r\n format.html { redirect_to @section, notice: 'Section 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: @section.errors, status: :unprocessable_entity }\r\n end\r\n end\r\n end", "def update\n @products = Product.where(validity: true)\n @warehouses = Warehouse.where(validity: true)\n @unit_of_measures = UnitOfMeasure.where(validity: true)\n @remainder = Remainder.find(params[:id])\n\n respond_to do |format|\n if @remainder.update_attributes(params[:remainder])\n format.html { redirect_to @remainder, notice: t(:remainder_updated) }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @remainder.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @calculated_data_assessment = CalculatedDataAssessment.find(params[:id])\n\n respond_to do |format|\n if @calculated_data_assessment.update_attributes(params[:calculated_data_assessment])\n format.html { redirect_to @calculated_data_assessment, notice: 'Calculated data assessment was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @calculated_data_assessment.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @section = Section.find(params[:id])\n\n respond_to do |format|\n if @section.update_attributes(params[:section])\n format.html { redirect_to @section, notice: 'Section was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @section.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n # @person = Person.find(params[:id])\n # @person.pct_complete = @person.requirement_progress\n respond_to do |format|\n if @person.update_attributes(params[:person])\n format.html { redirect_to @person, :notice => 'Person was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @person.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @analysis.update(analysis_params)\n format.html { redirect_to @analysis, notice: 'Analysis was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: 'edit' }\n format.json { render json: @analysis.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n\t\tstudent = Student.update_student(params[:id], student_params, params[:student][:dojo])\n\t\thtml \t= render_to_string partial: 'students/templates/student_row', locals: { cohort: student[:result][:student]}\n\n\t\trender :json => { student: student[:result][:student], current_dojo: session[:current_dojo], html: html, status: true } if student[:status]\n\t\trender :json => { :status => false } unless student[:status]\n\trescue Exception \n\t\trender :json => { :status => false } \n\tend", "def update\n respond_to do |format|\n if @unit_measure.update(unit_measure_params)\n format.html { redirect_to @unit_measure, notice: 'Unit measure was successfully updated.' }\n format.json { render :show, status: :ok, location: @unit_measure }\n else\n format.html { render :edit }\n format.json { render json: @unit_measure.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @analytics_used_analysable.update(analytics_used_analysable_params)\n format.html { redirect_to @analytics_used_analysable, notice: 'Analytics used analysable was successfully updated.' }\n format.json { render :show, status: :ok, location: @analytics_used_analysable }\n else\n format.html { render :edit }\n format.json { render json: @analytics_used_analysable.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @analysis = Analysis.find(params[:id])\n\n respond_to do |format|\n if @analysis.update_attributes(params[:analysis])\n format.html { redirect_to @analysis, notice: 'Analysis was successfully updated.' }\n format.json { head :no_content }\n else\n format.html { render action: \"edit\" }\n format.json { render json: @analysis.errors, status: :unprocessable_entity }\n end\n end\n end", "def update\n @insure_result = InsureResult.find(params[:id])\n\n respond_to do |format|\n if @insure_result.update_attributes(params[:insure_result])\n format.html { redirect_to @insure_result, :notice => 'Insure result was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @insure_result.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n @performance_test = PerformanceTest.find(params[:id])\n\n respond_to do |format|\n if @performance_test.update_attributes(params[:performance_test])\n format.html { redirect_to @performance_test, :notice => 'Performance test was successfully updated.' }\n format.json { head :ok }\n else\n format.html { render :action => \"edit\" }\n format.json { render :json => @performance_test.errors, :status => :unprocessable_entity }\n end\n end\n end", "def update\n respond_to do |format|\n if @api_v1_outcome.update(api_v1_outcome_params)\n format.html { redirect_to @api_v1_outcome, notice: 'Outcome was successfully updated.' }\n format.json { render :show, status: :ok, location: @api_v1_outcome }\n else\n format.html { render :edit }\n format.json { render json: @api_v1_outcome.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.7273932", "0.6620052", "0.62830526", "0.62604064", "0.6242381", "0.6073254", "0.6073254", "0.6072117", "0.59847325", "0.59212625", "0.5899397", "0.58261436", "0.57995874", "0.5789772", "0.57820976", "0.5774859", "0.5774859", "0.5770771", "0.57252145", "0.57252145", "0.57252145", "0.57252145", "0.57247317", "0.5708786", "0.5706448", "0.5698106", "0.5659621", "0.5659306", "0.56573266", "0.5656625", "0.56564695", "0.56390685", "0.5634061", "0.5632007", "0.5632007", "0.5632007", "0.5624728", "0.5619718", "0.5619618", "0.5606923", "0.5603249", "0.56026334", "0.5601401", "0.558928", "0.5579579", "0.5575798", "0.5575786", "0.5567053", "0.5560914", "0.5559614", "0.55509096", "0.5543751", "0.5539454", "0.5525023", "0.55172485", "0.55143005", "0.5508245", "0.5507038", "0.55007535", "0.549417", "0.5493531", "0.548672", "0.5482983", "0.5482983", "0.5482983", "0.5482754", "0.54824954", "0.5481301", "0.547087", "0.54693305", "0.5467365", "0.54581696", "0.5444017", "0.54387665", "0.5430799", "0.54289794", "0.54274577", "0.5425267", "0.5425112", "0.54250747", "0.5414624", "0.54139346", "0.5406604", "0.54063046", "0.54014844", "0.54013234", "0.5400557", "0.5396536", "0.53961056", "0.53916615", "0.539073", "0.5387133", "0.5386443", "0.5385297", "0.5378407", "0.53771883", "0.537416", "0.53736836", "0.5365475", "0.53494287" ]
0.70481396
1
check if all the join table entries are in place, create if needed def set_comparisons_measures
def set_arms @arms = ExtractionsExtractionFormsProjectsSectionsType1.by_section_name_and_extraction_id_and_extraction_forms_project_id('Arms', @result_statistic_section.population.extractions_extraction_forms_projects_sections_type1.extractions_extraction_forms_projects_section.extraction.id, @result_statistic_section.population.extractions_extraction_forms_projects_sections_type1.extractions_extraction_forms_projects_section.extraction_forms_projects_section.extraction_forms_project.id) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def update_comparison_measures\n\t\tapply_to = params[:changes_apply_to]\n\t\tpreviously_saved = params[:previously_checked].nil? ? [] : params[:previously_checked]\n\t\tpreviously_user_defined = params[:previously_defined_checked].nil? ? [] : params[:previously_defined_checked]\n\t\tmeasures = params[:measures].nil? ? [] : params[:measures]\n\t\tuser_defined_measures = params[:user_defined_measures].nil? ? [] : params[:user_defined_measures]\n\t\tnew_measure_titles = params[:user_defined_titles]\n\t\tnew_measure_descriptions = params[:user_defined_descriptions]\n\t comparison_id = params[:comparison_id]\n\t comparison = Comparison.find(comparison_id)\n \tif apply_to == \"this\"\n \t\tComparison.update_measures(measures, comparison_id, previously_saved)\n\t\t\tComparison.update_measures(user_defined_measures, comparison_id, previously_user_defined,'user-defined')\n\t\t\tunless (new_measure_titles.nil?)\n\t\t\t\tComparison.create_new_measures(new_measure_titles, new_measure_descriptions, [comparison_id], comparison.within_or_between)\n\t\t\tend\n\t\telsif apply_to == \"all\"\n\t\t\tComparison.update_measures_for_all(measures, comparison.outcome_id, comparison.extraction_form_id, comparison.study_id,comparison.within_or_between,comparison.subgroup_id,'default',comparison.section)\n\t\t\tComparison.update_measures_for_all(user_defined_measures, comparison.outcome_id, comparison.extraction_form_id, comparison.study_id,comparison.within_or_between,comparison.subgroup_id,'user-defined',comparison.section)\n\t\t\tunless (new_measure_titles.nil?)\n\t\t\t\tcomparison_ids = Comparison.where(:within_or_between=>comparison.within_or_between, :study_id=>comparison.study_id,\n\t\t\t\t\t\t\t\t\t\t\t\t :extraction_form_id=>comparison.extraction_form_id, :outcome_id=>comparison.outcome_id).select(\"id\")\n\t\t\t\tcomparison_ids = comparison_ids.collect{|x| x.id}\n\t\t\t\tComparison.create_new_measures(new_measure_titles, new_measure_descriptions, comparison_ids, comparison.within_or_between)\n\t\t\tend\n\t\tend\n\t\t@selected_timepoints = params[:selected_timepoints]\n\t\t@selected_tp_array = @selected_timepoints.split(\"_\")\n\t \t@outcome_id = comparison.outcome_id\n\t \t@outcome = Outcome.find(@outcome_id)\n\t @subgroup = params[:subgroup_id] == 0 ? nil : OutcomeSubgroup.find(params[:subgroup_id])\n\t \t#-----------------------------------------\n\t \t# Data for the entry table\n\t \t#-----------------------------------------\n\t \t@is_diagnostic = ExtractionForm.is_diagnostic?(comparison.extraction_form_id)\n\t \t@checkbox_timepoints = @outcome.outcome_timepoints\n\t \t# If this extraction form deals with RCT data...\n\t\tif !@is_diagnostic\n\t \t\t@selected_timepoints = OutcomeDataEntry.get_selected_timepoints(@outcome,@subgroup)\n\n\t \t\t@outcome_id, @study_id,@extraction_form_id, @selected_tp_array, @timepoints, @OCDEs, \n\t\t\t@measures, @datapoints, @arms, @comparisons, @comparison_measures, @comparators, \n\t\t\t@all_comparators, @num_comparators, @comparison_datapoints, @wa_comparisons, @wa_measures, \n\t\t\t@wa_comparators, @wa_all_comparators, @wa_datapoints, @footnotes = OutcomeDataEntry.get_information_for_entry_table(@outcome,@subgroup,@selected_timepoints)\n\n\t\t# Otherwise, gather the diagnostic test comparison data.\n\t\telse\n\t\t\t@selected_timepoints = Comparison.get_selected_timepoints_for_diagnostic_tests(@outcome,@subgroup)\n\n\t\t\t@outcome_id, @study_id, @extraction_form_id, @selected_tp_array, @timepoints, \n\t\t\t@comparisons, @comparators, @all_comparators, @comparison_measures, @comparison_datapoints, @index_tests, \n\t\t\t@reference_tests, @thresholds, @footnotes = OutcomeDataEntry.get_diagnostic_test_results(@outcome,@subgroup,@selected_timepoints)\n\n\t\t\t@index_test_options, @reference_test_options = DiagnosticTest.get_select_options(@index_tests,@reference_tests,@thresholds)\n\t\tend\n\t\t\tef = ExtractionForm.find(@extraction_form_id)\n\t\t\t@project_id = ef.project_id\n\t \trender \"outcome_data_entries/update_measures\"\n\tend", "def clean_join_table\n # these 2 lines run pretty much the same sql, self.parses adds a where in clause\n self.parsers = []\n # OR\n # ActiveRecord::Base.connection.execute(\"DELETE FROM parsers_transformations WHERE transformation_id = #{id}\")\n end", "def update_expected_value_structure!(measure)\n measure_population_count = measure.population_sets.count\n # add stratifications to the count\n measure.population_sets.each do |population_set|\n measure_population_count += population_set.stratifications.count\n end\n\n # keep track of the population indexes we have seen so we can reject duplicates\n population_indexes_found = Hash.new { |h, k| h[k] = [] } # make is so uninitialized keys are set to []\n # delete population sets present on the patient but not in the measure. also get rid of garbage and duplicate data.\n expectedValues.reject! do |expected_value_set|\n # if there is no measure_id then just clean this up\n if !expected_value_set.key?('measure_id')\n matches_measure = true\n is_garbage_data = true\n else # if there is a measure_id, do the rest of the checks\n matches_measure = expected_value_set[:measure_id] ? expected_value_set[:measure_id] == measure.hqmf_set_id : false\n # check if population_index or is non-existent, i.e. this is a set of garbage data\n is_garbage_data = !expected_value_set.key?('population_index')\n is_extra_population = expected_value_set[:population_index] ? expected_value_set[:population_index] >= measure_population_count : false\n\n is_duplicate_population = false\n # if it isn't garbage data or an extra population, check if it's a duplicate and/or add it to the list of seen populations\n if !is_garbage_data && !is_extra_population\n if population_indexes_found[expected_value_set[:measure_id]].include? expected_value_set[:population_index]\n is_duplicate_population = true\n else\n # add this population_index to the list of ones we have already seen\n population_indexes_found[expected_value_set[:measure_id]] << expected_value_set[:population_index]\n end\n end\n end\n\n # remove if it is part of this measure and has any of the three checked issues\n if matches_measure && (is_extra_population || is_garbage_data || is_duplicate_population)\n # if a block is given prepare some data and yield info about the removal\n if block_given?\n if is_extra_population\n change_reason = :extra_population\n elsif is_garbage_data\n change_reason = :garbage_data\n elsif is_duplicate_population\n change_reason = :dup_population\n end\n # Yield this change being made, with change_type symbol, change_reason symbol and the structure being removed\n yield :population_set_removal, change_reason, expected_value_set.deep_dup\n end\n\n true\n else\n false\n end\n end\n\n # add missing population sets\n patient_population_count = expectedValues.count { |expected_value_set| expected_value_set[:measure_id] == measure.hqmf_set_id }\n # add new population sets. the rest of the data gets added below.\n if patient_population_count < measure_population_count\n (patient_population_count..measure_population_count-1).each do |index|\n new_expected_values = {'measure_id' => measure.hqmf_set_id, 'population_index' => index}\n # yield info about this addition\n yield :population_set_addition, :missing_population, new_expected_values.deep_dup if block_given?\n expectedValues << new_expected_values\n end\n end\n\n # ensure there's the correct number of populations for each population set\n expectedValues.each do |expected_value_set|\n # ignore if it's not related to the measure (can happen for portfolio users)\n next unless expected_value_set['measure_id'] == measure.hqmf_set_id\n\n pop_idx = expected_value_set['population_index']\n is_stratification = false\n\n # if the population index is greater than the count of population sets, then it is a\n # stratification, we need to determine the corresponding population_set\n if pop_idx >= measure.population_sets.count\n actual_pop_idx = nil\n is_stratification = true\n # create a counter to count down as we traverse stratifications\n # once this runs out, we have found the corresponding population_set\n remaining_idx = pop_idx - measure.population_sets.count\n measure.population_sets.each_with_index do |population_set, index|\n if remaining_idx >= population_set.stratifications.count\n remaining_idx -= population_set.stratifications.count\n else\n actual_pop_idx = index\n break\n end\n end\n pop_idx = actual_pop_idx\n end\n\n expected_value_population_set = expected_value_set.keys & CQM::Measure::ALL_POPULATION_CODES\n measure_population_set = measure.population_sets[pop_idx].bonnie_result_criteria_names\n measure_population_set += ['STRAT'] if is_stratification\n\n # add population sets that didn't exist (populations in the measure that don't exist in the expected values)\n added_populations = measure_population_set - expected_value_population_set\n # create the structure to yield about these changes\n added_changes = {'measure_id' => measure.hqmf_set_id, 'population_index' => pop_idx}\n if added_populations.count.positive?\n added_populations.each do |population|\n if population == 'OBSERV'\n expected_value_set[population] = []\n added_changes[population] = []\n else\n expected_value_set[population] = 0\n added_changes[population] = 0\n end\n end\n # yield the info about things that are added.\n yield :population_addition, :missing_population, added_changes if block_given?\n end\n\n # delete populations that no longer exist (populations in the expected values that don't exist in the measure)\n removed_populations = expected_value_population_set - measure_population_set\n next unless removed_populations.count.positive?\n # create the structure to yield about these changes\n removed_changes = {'measure_id' => measure.hqmf_set_id, 'population_index' => pop_idx}\n removed_populations.each { |population| removed_changes[population] = expected_value_set[population] }\n\n expected_value_set.except!(*removed_populations)\n # yield the info about things removed\n yield :population_removal, :extra_population, removed_changes if block_given?\n\n end\n save!\n end", "def build_exam_set\n @scores = new_collection\n @total_max = 0\n @total_score = 0\n @overrided_subjects = assessment_group.override_assessment_marks.find_all_by_course_id(batch.course_id).collect(&:subject_code)\n process_scores\n \n Models::ExamSet.new(\n :obj_id => assessment_group.id,\n :name => assessment_group.display_name,\n :scores => @scores,\n :aggregates => process_aggregates,\n :term_name => term_name(assessment_group),\n :term_exam => assessment_group.is_final_term,\n :group_exam => is_assessment_group?,\n :planner_exam => (assessment_group.is_final_term and (assessment_group.parent_type == 'AssessmentPlan')),\n :attendance_report => process_attendance,\n :planner_name => assessment_plan.name,\n :scoring_type => AssessmentGroup::SCORE[assessment_group.scoring_type],\n :show_percentage => (assessment_group.is_final_term && assessment_group.show_percentage?),\n :maximum_mark => assessment_group.maximum_marks,\n :hide_marks => assessment_group.hide_marks,\n :consider_skills => assessment_group.consider_skills\n )\n end", "def update_measures\n\t\tapply_to = params[:changes_apply_to]\n\t\tpreviously_saved = params[:previously_checked]\n\t\tpreviously_user_defined = params[:previously_defined_checked]\n\t\tmeasures = params[:measures]\n\t\tuser_defined_measures = params[:user_defined_measures].nil? ? [] : params[:user_defined_measures]\n\t\t# Get information in regards to any new measures that the user created\n\t\tnew_measure_titles = params[:user_defined_titles]\n\t\tnew_measure_descriptions = params[:user_defined_descriptions]\n\t\t\n ocde_id = params[:ocde_id]\n ocde = OutcomeDataEntry.find(ocde_id)\n unless params[:subgroup_id].nil?\n\t\t\t@subgroup = OutcomeSubgroup.find(params[:subgroup_id])\n\t\telse\n\t\t\t@subgroup = nil\n\t\tend\n if apply_to == \"this\"\n\t\t\tOutcomeDataEntry.update_measures(measures, ocde_id, previously_saved)\n\t\t\tOutcomeDataEntry.update_measures(user_defined_measures, ocde_id, previously_user_defined,'user-defined') unless user_defined_measures.nil?\n\t\t\tunless (new_measure_titles.nil?)\n\t\t\t\tOutcomeDataEntry.create_new_measures(new_measure_titles, new_measure_descriptions, [ocde_id])\n\t\t\tend\n\t\telsif apply_to == \"all\"\n\t\t\tocdes = OutcomeDataEntry.where(:study_id=>ocde.study_id, :outcome_id=>ocde.outcome_id, :extraction_form_id=>ocde.extraction_form_id)\n\t\t\tocdes = ocdes.collect{|x| x.id}\n\t\t\tOutcomeDataEntry.update_measures_for_all(measures, ocde.outcome_id, ocde.extraction_form_id, ocde.study_id, @subgroup)\n\t\t\tOutcomeDataEntry.update_measures_for_all(user_defined_measures, ocde.outcome_id, ocde.extraction_form_id, ocde.study_id, @subgroup,'user-defined') unless user_defined_measures.nil?\n\t\t\tunless (new_measure_titles.nil?)\n\t\t\t\tOutcomeDataEntry.create_new_measures(new_measure_titles, new_measure_descriptions,ocdes)\n\t\t\tend\n\t\tend\n \t@selected_timepoints = params[:selected_timepoints]\n \t@selected_tp_array = @selected_timepoints.split(\"_\")\n \t@outcome_id = ocde.outcome_id\n \t@outcome = Outcome.find(@outcome_id)\n \t\n \t#-----------------------------------------\n \t# Data for the entry table\n \t#-----------------------------------------\n \t@outcome_id, @study_id,@extraction_form_id, @selected_tp_array, @timepoints, @OCDEs, \n\t\t@measures, @datapoints, @arms, @comparisons, @comparison_measures, @comparators, \n\t\t@all_comparators, @num_comparators, @comparison_datapoints, @wa_comparisons, @wa_measures, \n\t\t@wa_comparators, @wa_all_comparators, @wa_datapoints, @footnotes = OutcomeDataEntry.get_information_for_entry_table(@outcome,@subgroup,@selected_timepoints)\n\tend", "def apply_harvesting_set_membership(sets)\n\t\t#We delete previous set memberships and move to new set\n old_sets = harvesting_set_membership.dup\n old_sets.each { |s| self.remove_relationship(:is_member_of_collection, s) }\n sets.delete_if { |s| s == \"\"}.each { |s| self.add_relationship :is_member_of_collection, s }\n\tend", "def apply_harvesting_set_membership(sets)\n\t\t#We delete previous set memberships and move to new set\n old_sets = harvesting_set_membership.dup\n old_sets.each { |s| self.remove_relationship(:is_member_of_collection, s) }\n sets.delete_if { |s| s == \"\"}.each { |s| self.add_relationship :is_member_of_collection, s }\n\tend", "def clear_comparisons\n\t\t@selected_timepoints = params[:selected_timepoints]\n\t\t@selected_tp_array = @selected_timepoints.split(\"_\")\n\t\t@outcome_id = params[:outcome_id]\n\t\t@subgroup_id = params[:subgroup_id]\n\t\t@study_id = params[:study_id]\n\t\t@extraction_form_id = params[:extraction_form_id]\n\t\tcomparison_type = params[:comparison_type]\n\t\t@outcome = Outcome.find(@outcome_id)\n\t\t@is_diagnostic = ExtractionForm.is_diagnostic?(@extraction_form_id)\n\t\tif OutcomeDataEntry.remove_comparison_data(comparison_type, @outcome_id, @subgroup_id, @study_id, @extraction_form_id)\n\t\t #flash[:notice] = \"Comparisons were successfully deleted.\"\n\t\telse\n\t\t\t\n\t\tend\n\t\t\n\t\tunless params[:subgroup_id].nil?\n\t\t\t@subgroup = OutcomeSubgroup.find(params[:subgroup_id])\n\t\telse\n\t\t\t@subgroup = nil\n\t\tend\n\t\t\n\t\t@checkbox_timepoints = @outcome.outcome_timepoints\n\t\t\n\t\t# If this extraction form deals with RCT data...\n\t\tif !@is_diagnostic\n\t \t\t@selected_timepoints = OutcomeDataEntry.get_selected_timepoints(@outcome,@subgroup)\n\n\t \t\t@outcome_id, @study_id,@extraction_form_id, @selected_tp_array, @timepoints, @OCDEs, \n\t\t\t@measures, @datapoints, @arms, @comparisons, @comparison_measures, @comparators, \n\t\t\t@all_comparators, @num_comparators, @comparison_datapoints, @wa_comparisons, @wa_measures, \n\t\t\t@wa_comparators, @wa_all_comparators, @wa_datapoints, @footnotes = OutcomeDataEntry.get_information_for_entry_table(@outcome,@subgroup,@selected_timepoints)\n\n\t\t# Otherwise, gather the diagnostic test comparison data.\n\t\telse\n\t\t\tall_tps = @outcome.outcome_timepoints.collect{|x| x.id.to_s}.join(\"_\")\n\t\t\t@selected_timepoints = {1=>all_tps, 2=>all_tps, 3=>all_tps}\n\n\t\t\t@outcome_id, @study_id, @extraction_form_id, @selected_tp_array, @timepoints, @comparisons, \n\t\t\t@comparators, @all_comparators, @comparison_measures, @comparison_datapoints, @index_tests, \n\t\t\t@reference_tests, @thresholds, @footnotes = OutcomeDataEntry.get_diagnostic_test_results(@outcome,@subgroup,@selected_timepoints)\n\n\t\t\t@index_test_options, @reference_test_options = DiagnosticTest.get_select_options(@index_tests,@reference_tests,@thresholds)\n\t\tend\n\t\t#----------------\n\t\t\tef = ExtractionForm.find(@extraction_form_id)\n\t\t\t@project_id = ef.project_id \n\t \trender \"/outcome_data_entries/show_timepoints\"\n\tend", "def check_tables_left\n if self.tables_left <= 6\n self.tables_left = (20..30).to_a.sample\n self.save\n end\n end", "def test_add_valid_expression\n n_manifestations = Manifestation.count\n expression = Expression.find(:first)\n assert_equal true, @manifestation.add_expression(expression)\n join_objects = ExpressionManifestation.find(:all, \n :conditions => [\"expression_id = ? and manifestation_id = ?\",expression.expression_id,@manifestation.manifestation_id])\n assert_equal 1, join_objects.length \n \n end", "def initialize_trial_squads_status\n trial_squads.each do |trial_squad|\n trial_squad.trial_mobs.each do |trial_mob|\n trial_mob.hp = trial_mob.max_hp\n trial_mob.sp = trial_mob.max_sp\n trial_mob.save\n end\n end\n end", "def update_exam_collisions\n @colliding_courses = false\n\n @list_selected_courses.each do |model, path, iter|\n course = iter[2]\n next if course.first_test_date.nil?\n other_courses = @selected_courses - [ course ]\n\n my_test_dates = [course.first_test_date, course.second_test_date]\n\n my_test_dates.reject! { |x| x.nil? }\n\n exam_dates_a = other_courses.collect { |c| c.first_test_date }\n exam_dates_b = other_courses.collect { |c| c.second_test_date }\n\n exam_dates_a.reject! { |x| x.nil? }\n exam_dates_b.reject! { |x| x.nil? }\n\n exam_dates = Set.new(exam_dates_a + exam_dates_b)\n\n if exam_dates.intersection(my_test_dates).empty?\n iter[0] = course.name\n iter[3] = nil\n else\n @colliding_courses = true\n iter[0] = \"*%s*\" % course.name\n iter[3] = \"red\"\n end\n end\n\n on_selected_course_selection\n end", "def needs_goggle_cup_recalculation?()\n need_recalculation = false\n goggle_cup_standard_collector = @row_collectors[ GoggleCupStandard.table_name ]\n if goggle_cup_standard_collector && goggle_cup_standard_collector.duplicate_rows.size > 0\n need_recalculation = true\n end\n need_recalculation\n end", "def compare_product_tests(test1, test2)\n # compare relevant details\n test1.save\n test2.save\n assert_performed_jobs 2\n\n test1.reload\n test2.reload\n compare_results(test1, test2)\n\n # compare records\n test1.patients.each_index do |x|\n patient1 = test1.patients.fetch(x)\n patient2 = test2.patients.fetch(x)\n compare_records(patient1, patient2)\n end\n end", "def skip_test_inmutable\n #they come fully loaded\n Status.load_inmutable_instances\n status1 = Status.where.all.sort_by { |s| s.code }\n status2 = Status.where.all.sort_by { |s| s.code }\n assert status1.length == 4\n assert status2.length == 4\n #same referencs\n status1.each_index do |i|\n assert status1[i].object_id==status2[i].object_id \n end\n\n #create a new object\n stt = Status.new(code: \"xx\", description: (\"xx\" + \" some desc\"))\n stt.save\n\n status1 = Status.where.all.sort_by { |s| s.code }\n status2 = Status.where.all.sort_by { |s| s.code }\n assert status1.length == 5\n assert status2.length == 5\n #same referencs\n status1.each_index do |i|\n assert status1[i].object_id==status2[i].object_id \n end \n\n status1.each do |st|\n assert st.code\n assert st.description\n end\n\n marr = Status.find(\"divorced\").first\n assert marr.code == \"divorced\"\n assert marr.description\n assert marr.object_id == status1.first.object_id\n\n people = Person.where.include(:name, status: [ :code, :description ]).all\n people.each do |p|\n assert p.status.object_id == status1.select { |st| st.id == p.status.id }.first.object_id\n assert p.status.code\n assert p.status.description\n end\n end", "def test_unranked_recall\n\n add_test_judgements \n add_unranked_query_result\n assert_equal(1.0, @query_result.statistics[:recall])\n \n end", "def test_unranked_precision\n \n add_test_judgements\n add_unranked_query_result\n assert_equal(0.4, @query_result.statistics[:precision])\n \n end", "def test_should_find_optimum_fill_complex\n @swap = swaps(:registration_period)\n @old = swaps(:expired)\n (\"A\"..\"H\").each { |i| create_user(:login => \"user_#{i}\", :email => \"#{i}@test.com\") }\n @old_set_1 = @old.swapsets.create :name => \"Old Set 1\"\n @old_set_2 = @old.swapsets.create :name => \"Old Set 2\"\n @old_set_3 = @old.swapsets.create :name => \"Old Set 3\"\n @old_set_4 = @old.swapsets.create :name => \"Old Set 4\"\n @old_set_5 = @old.swapsets.create :name => \"Old Set 5\"\n @old_set_6 = @old.swapsets.create :name => \"Old Set 6\"\n @set = @swap.swapsets.create :name => \"New Set\"\n # old sets are constructed so that [G,H] is the best possible solution\n %w{ A E }.each { |i| @old_set_1.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ B F }.each { |i| @old_set_2.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ C E }.each { |i| @old_set_3.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ D F }.each { |i| @old_set_4.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ A G }.each { |i| @old_set_5.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ B H }.each { |i| @old_set_6.assign(User.find_by_login(\"user_#{i}\")) }\n %w{ A B C D }.each do |i|\n user = User.find_by_login(\"user_#{i}\")\n @set.assign user\n end\n %w{ E F G H }.each do |i|\n user = User.find_by_login(\"user_#{i}\")\n user.registrations.find_by_swap_id(@swap).set_as_double\n end\n @swap.initialize_set(@swap.users, SWAPSET_SIZE, Swapset.find(:all).map {|set| set.users})\n @swap.fill_set(@set)\n @set.reload\n assert_equal 6, @set.users.size\n %w{ A B C D G H}.each do |i|\n assert @set.users.include?(User.find_by_login(\"user_#{i}\"))\n end\n %w{ E F }.each do |i|\n assert !(@set.users.include?(User.find_by_login(\"user_#{i}\")))\n end\n end", "def needs_season_personal_standard_recalculation?()\n need_recalculation = false\n season_personal_standard_collector = @row_collectors[ SeasonPersonalStandard.table_name ]\n if season_personal_standard_collector && season_personal_standard_collector.duplicate_rows.size > 0\n need_recalculation = true\n end\n need_recalculation\n end", "def test_change_criteria\n # attribute change\n @test.checked_criteria[0].replacement_attribute = 'relevantPeriod'\n @test.checked_criteria[0].change_criteria\n has_relevant_period = @test.checked_criteria.any? do |cc|\n cc.source_data_criteria['dataElementAttributes'][cc.attribute_index]['attribute_name'] == 'relevantPeriod'\n end\n assert has_relevant_period\n\n # attribute change with valueset\n @test.checked_criteria[0].replacement_attribute = 'dischargeDisposition:1.5.6.7'\n @test.checked_criteria[0].change_criteria\n has_discharge_disposition = @test.checked_criteria.any? do |cc|\n cc.source_data_criteria['dataElementAttributes'][cc.attribute_index]['attribute_name'] == 'dischargeDisposition'\n end\n assert has_discharge_disposition\n\n # data_criteria change\n index = Measure.first.source_data_criteria.index { |a| a['description'] == 'Patient Characteristic Ethnicity: Ethnicity' }\n @test.checked_criteria[0].replacement_data_criteria = Measure.first.source_data_criteria[index]._id.to_s\n @test.checked_criteria[0].change_criteria\n has_ethnicity = @test.checked_criteria.any? { |cc| cc.source_data_criteria['description'] == 'Patient Characteristic Ethnicity: Ethnicity' }\n assert has_ethnicity\n\n # both change\n index = Measure.first.source_data_criteria.index { |a| a['description'] == 'Encounter, Performed: EncounterInpatient' }\n @test.checked_criteria[0].replacement_data_criteria = Measure.first.source_data_criteria[index]._id.to_s\n @test.checked_criteria[0].replacement_attribute = 'relevantPeriod'\n @test.checked_criteria[0].change_criteria\n has_ethnicity = @test.checked_criteria.any? { |cc| cc.source_data_criteria['description'] == 'Patient Characteristic Ethnicity: Ethnicity' }\n assert has_ethnicity\n end", "def update_with_measure_tests(product_params)\n add_measure_tests(product_params)\n save!\n add_filtering_tests if c4_test\n add_checklist_test if c1_test\n end", "def set_doe_util_changes\n\n # there is no bldg_id column for sca projects\n buildings = self.school_buildings\n\n buildings_ids_array = buildings.map {|b| b['bldg_id']}.uniq\n\n doe_significant_utilization_changes = CeqrData::DoeSignificantUtilizationChanges.version(\n data_package.table_for(\"doe_significant_utilization_changes\")\n ).doe_util_changes_matching_with_building_ids(buildings_ids_array)\n\n self.doe_util_changes = doe_significant_utilization_changes.map do |d|\n {\n url: d[:url],\n title: d[:title],\n org_id: d[:org_id],\n bldg_id: d[:bldg_id],\n vote_date: d[:vote_date],\n at_scale_year: d[:at_scale_year],\n at_scale_enroll: d[:at_scale_enroll],\n bldg_id_additional: d[:bldg_id_additional]\n }\n end\nend", "def create_within_arm_table\n \t@selected_timepoints = params[:selected_timepoints]\n \t@selected_tp_array = @selected_timepoints.split(\"_\")\n \t@outcome_id = params[:outcome_id]\n \tsubgroup_id = params[:subgroup_id].nil? ? 0 : params[:subgroup_id]\n \t@subgroup = subgroup_id == 0 ? nil : OutcomeSubgroup.find(subgroup_id)\n \t# comparisons within-arm are created on a row-by-row basis, using the row number as the group_id\n \tOutcomeDataEntry.create_comparisons(\"within\",[1],@outcome_id,subgroup_id)\n \t@outcome = Outcome.find(@outcome_id)\n \t@project_id = params[:project_id]\n \tunless params[:subgroup_id].nil?\n\t\t\t@subgroup = OutcomeSubgroup.find(params[:subgroup_id])\n\t\telse\n\t\t\t@subgroup = nil\n\t\tend\n \t#-----------------------------------------\n \t# Data for the entry table\n \t#-----------------------------------------\n \t@outcome_id, @study_id,@extraction_form_id, @selected_tp_array, @timepoints, @OCDEs, \n\t\t@measures, @datapoints, @arms, @comparisons, @comparison_measures, @comparators, \n\t\t@all_comparators, @num_comparators, @comparison_datapoints, @wa_comparisons, @wa_measures, \n\t\t@wa_comparators, @wa_all_comparators, @wa_datapoints, @footnotes = OutcomeDataEntry.get_information_for_entry_table(@outcome,@subgroup,@selected_timepoints)\n\n\t\trender \"/outcome_data_entries/show_entry_table\"\n\tend", "def set_should_calculate_product_similarities\n @should_calculate_product_similarities = true\n\n # don't run if it's part of a bulk upload; bulk upload takes care of that\n @should_calculate_product_similarities = false if bulk_upload_source_id && new_record?\n # don't run if it's an update and neither name nore tags_delimited have changed\n @should_calculate_product_similarities = false if !new_record? && !(name_changed? || tags_delimited_changed?)\n true # need to return true for validation\n end", "def test_get_etc_function_by_qa\n\t\tbatch = Batch.create!( :batchid => 291206,\n :facility => facilities(:facility1),\n :date => Date.today.strftime(\"%m/%d/%Y\"),\n :arrival_time => \"#{Time.now}\",\n :target_time\t=> \"#{Time.now.tomorrow - 64.minutes}\",\n :status => \"New\",\n :manual_override => false)\n\n\t\tjob_new = Job.create!(:batch=>batch,\n :tiff_number=>1234,:check_number=>12131,\n :count=>12,:estimated_eob => 50,\n :qa_id => 1)\n\t\tbatch.reload\n\t\tbatch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_with_qa = batch.expected_completion_time\n\n job_one_more = Job.create(:batch=>batch,:tiff_number=>1231,\n :check_number=>12135,:count=>12,\n :estimated_eob => 50,\n :qa_id => 2)\n\t\tbatch.reload\n\t\tbatch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_with_two_jobs = batch.expected_completion_time\n \tassert_in_delta etc_with_qa.to_i, etc_with_two_jobs.to_i,1\n\n\t\tjob_one_more.qa_id = 1\n\t\tjob_one_more.update\n\t\tbatch.reload\n\t\tbatch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_after_change_qa = batch.expected_completion_time\n\n\t\tassert_not_equal(etc_with_qa, etc_after_change_qa)\n\n\t\tjob_new.qa_id = nil\n\t\tjob_new.update\n\t\tbatch.reload\n batch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_after_deallocate = batch.expected_completion_time\n\t\tassert_not_equal(etc_after_deallocate, etc_after_change_qa)\n\t\tassert_in_delta etc_after_deallocate.to_i, etc_with_two_jobs.to_i, 1\n end", "def has_many_update data, relation\n data = { model.compare => ''}.merge data\n\n if relation.blank?\n warn \"[ARRGUMENT MISSING]: 'has_many_update' don't know about current relation, and check all relations\"\n end\n\n has_many_cleaner data.symbolize_keys, relation\n end", "def default_data collection, factor\n your_data, comparison_data, l1_data, l2_data, l3_data = [], [], [], [], []\n average_l1_comp_data, average_l2_comp_data, average_l3_comp_data = [],[],[]\n duration = params[\"duration\"]\n uniq_exam_dates = collection.map(&:exam_date).uniq\n if duration == \"12\"\n Date.today.month.times do |count|\n l1_temp_data, l2_temp_data, l3_temp_data = [], [], []\n collection.where(exam_date:(Time.now-count.month).all_month()).each do |r|\n l1_temp_data << r.send(:\"l1_#{factor}\")\n l2_temp_data << r.send(:\"l2_#{factor}\")\n l3_temp_data << r.send(:\"l3_#{factor}\")\n end\n l1_comp_data, l2_comp_data, l3_comp_data = [], [], [] \n Report.where(exam_date: (Time.now-count.month).all_month(), school_id:current_user.school.id).each do |m|\n l1_comp_data << m.send(:\"l1_#{factor}\")\n l2_comp_data << m.send(:\"l2_#{factor}\")\n l3_comp_data << m.send(:\"l3_#{factor}\")\n end\n l1_data << average(l1_temp_data)\n l1_data.reverse!\n l2_data << average(l2_temp_data)\n l2_data.reverse!\n l3_data << average(l3_temp_data)\n l3_data.reverse!\n average_l1_comp_data << average(l1_comp_data)\n average_l1_comp_data.reverse!\n average_l2_comp_data << average(l2_comp_data)\n average_l2_comp_data.reverse!\n average_l3_comp_data << average(l3_comp_data)\n average_l3_comp_data.reverse!\n end\n else\n uniq_exam_dates.each do |date|\n l1_temp_data, l2_temp_data, l3_temp_data = [], [], []\n collection.where(exam_date:date).each do |r|\n l1_temp_data << r.send(:\"l1_#{factor}\")\n l2_temp_data << r.send(:\"l2_#{factor}\")\n l3_temp_data << r.send(:\"l3_#{factor}\")\n end\n l1_comp_data, l2_comp_data, l3_comp_data = [], [], [] \n Report.where(exam_date: date, school_id:current_user.school.id).each do |m|\n l1_comp_data << m.send(:\"l1_#{factor}\")\n l2_comp_data << m.send(:\"l2_#{factor}\")\n l3_comp_data << m.send(:\"l3_#{factor}\")\n end\n l1_data << average(l1_temp_data)\n l2_data << average(l2_temp_data)\n l3_data << average(l3_temp_data)\n average_l1_comp_data << average(l1_comp_data)\n average_l2_comp_data << average(l2_comp_data)\n average_l3_comp_data << average(l3_comp_data)\n end\n end\n your_data = [l1_data, l2_data, l3_data]\n comparison_data = [average_l1_comp_data, average_l2_comp_data, average_l3_comp_data]\n factor == \"time\" ? plot_timedistribution(your_data, comparison_data) : plot_strategy(your_data, comparison_data)\n end", "def test_assignments_must_have_qualities\n a = Assignment.create(course_id: 3, name: \"Assignment 3\", percent_of_grade: 20.00)\n a1 = Assignment.new(course_id: 3, name: \"Assignment 3\")\n refute a1.save\n a2 = Assignment.new(course_id: 4)\n refute a2.save\n end", "def affect_relation_values!\n Relations.new(@klass).affect_relation_values!\n end", "def create_between_arm_table\n \t@selected_timepoints = params[:selected_timepoints]\n \t@selected_tp_array = @selected_timepoints.split(\"_\")\n \tsubgroup_id = params[:subgroup_id].nil? ? 0 : params[:subgroup_id]\n \t@subgroup = subgroup_id == 0 ? nil : OutcomeSubgroup.find(subgroup_id)\n \t@outcome_id = params[:outcome_id]\n \t@comparisons = OutcomeDataEntry.create_comparisons(\"between\",@selected_tp_array,@outcome_id,subgroup_id)\n \t@outcome = Outcome.find(@outcome_id)\n \t@project_id = params[:project_id]\n\t\t\n \t#-----------------------------------------\n \t# Data for the entry table\n \t#-----------------------------------------\n \t@outcome_id, @study_id,@extraction_form_id, @selected_tp_array, @timepoints, @OCDEs, \n\t\t@measures, @datapoints, @arms, @comparisons, @comparison_measures, @comparators, \n\t\t@all_comparators, @num_comparators, @comparison_datapoints, @wa_comparisons, @wa_measures, \n\t\t@wa_comparators, @wa_all_comparators, @wa_datapoints, @footnotes = OutcomeDataEntry.get_information_for_entry_table(@outcome,@subgroup,@selected_timepoints)\n\t\t\n\t\n\t render \"/outcome_data_entries/show_entry_table\"\n end", "def hybrid_measures?\n !!measures.map(&:hqmf_id).intersect?(APP_CONSTANTS['result_measures'].map(&:hqmf_id))\n end", "def set_score\n case competition.evaluation_type\n when 'mae'\n d1 = read_expected_csv.transpose\n d2 = read_csv.transpose\n df1 = Daru::DataFrame.new(extract_cols(d1), order: [:id, :value])\n df2 = Daru::DataFrame.new(extract_cols(d2), order: [:id, :value])\n means = df1.join(df2, on: [:id], how: :inner).vector_by_calculation { (value_1 - value_2).abs }\n self.evaluation_score = (means.sum.to_d / means.size.to_d)\n end\n end", "def addFeaturesAndLabel(home_team, away_team, earliest_date, latest_date)\n home_faceoffs = Game.where(\"home_team = ? and away_team = ? and game_date > ? and game_date <= ?\", home_team, away_team, earliest_date, latest_date).order(\"game_date desc\")\n away_faceoffs = Game.where(\"home_team = ? and away_team = ? and game_date > ? and game_date <= ?\", away_team, home_team, earliest_date, latest_date).order(\"game_date desc\")\n past_games = home_faceoffs.concat(away_faceoffs)\n past_games = past_games.sort {|game1, game2| game1.game_date <=> game2.game_date }\n\n if past_games.size < 3\n return\n end\n\n run_differentials = [0, 0, 0]\n\n past_games.each_with_index do |past_game, index|\n feature_set = Feature.new\n\n feature_set.game_id = past_game.id\n feature_set.home_team_won = past_game.home_team_won\n\n if past_game.home_team == home_team.to_s\n feature_set.h2h_diff_1 = run_differentials[2]\n feature_set.h2h_diff_2 = run_differentials[1]\n feature_set.h2h_diff_3 = run_differentials[0]\n\n run_differentials << past_game.home_team_runs - past_game.away_team_runs\n else \n feature_set.h2h_diff_1 = -1*run_differentials[2]\n feature_set.h2h_diff_2 = -1*run_differentials[1]\n feature_set.h2h_diff_3 = -1*run_differentials[0]\n\n run_differentials << past_game.away_team_runs - past_game.home_team_runs \n end\n\n feature_set.save\n\n if run_differentials.size > 3\n run_differentials.shift\n end\n end\nend", "def check_questionnaires_usage\n @assignment_questionnaires.each do |aq|\n unless aq.used_in_round.nil?\n @reviewvarycheck = 1\n break\n end\n end\n end", "def finalize_calculations\n\t\t\t@timeFactors.each do |t|\n\t\t\t\tif @metricsDataAggregator[t].hasDataToDump?\n\t\t\t\t\t@metricsDataAggregator[t].aggregateValues()\n\t\t\t\t\t@summaryMetricHashArr << @metricsDataAggregator[t].getCurrentData(@sequenceCounter)\n\t\t\t\tend\n\t\t\tend\n\n\t\t\t# write the last batch to db\n\t\t\twrite_batch_to_db()\n\n\t\t\treturn true\n\t\tend", "def update\n\t\t@comparison_measure = ComparisonMeasure.find(params[:id])\n\t\tif @comparison_measure.update_attributes(params[:comparison_measure]);\n\t\t\t@comparison = Comparison.find(@comparison_measure.comparison_id)\n\t\t\t@comparison_measures = ComparisonMeasure.where(:comparison_id=>@comparison.id)\n\t\t\t@comparison_data_points = ComparisonMeasure.get_data_points(@comparison_measures.collect{|x| x.id})\n\t\t\t@comparison_data_point = ComparisonDataPoint.new\n\t\t\t@comparison_measure = ComparisonMeasure.new\n\t\t\t@study = Study.find(@comparison.study_id)\n\t\t\t@outcome = Outcome.find(@comparison.outcome_id)\n\t\t\t@extraction_form = ExtractionForm.find(@comparison.extraction_form_id)\n\t\t\t@td_id = \"#\" + @comparison.comparators.to_s\n\t\t\t@type = @comparison.within_or_between\n\t\t\t@previous_measures = ComparisonMeasure.get_previous_measures(@comparison.study_id)\n\t\t\t@close_window = \"measure_form_div\"\n\t\t\t@entry_container = \"measure_form_div\"\n\t\t\t@entry_partial = \"comparison_measures/form\"\n\t\t\t@table_container = \"measure_display_div\"\n\t\t\t@table_partial = \"comparison_measures/measure_list\"\n\t\t\t@table_container2 = \"form_div\"\n\t\t\tobject_ids = @comparison.comparators.split(\"_\")\n\t\t\tif @type == \"between\"\n\t\t\t\t@table_partial2 = \"comparison_data_points/between_arm_comparisons\"\n\t\t\t\t@arms = []\n\t\t\t\tobject_ids.length.times do |i|\n\t\t\t\t\ttmp = Arm.find(object_ids[i])\n\t\t\t\t @arms[i] = tmp\n\t\t\t\tend\n\t\t\telse # if the type is 'within'...\n\t\t\t\t@table_partial2 = \"comparison_data_points/within_arm_comparisons\"\n\t\t\t\t@timepoints = []\n\t\t\t\tobject_ids.length.times do |i|\n\t\t\t\t\ttmp = OutcomeTimepoint.find(object_ids[i])\n\t\t\t\t @timepoints[i] = tmp\n\t\t\t\tend\n\t\t\tend\n\t\t\trender 'shared/saved.js.erb'\n\t\telse # if the update is unsuccessful...\n\t\t\t\n\t\tend\n\tend", "def apply_set_membership(sets)\n\t\t#We delete previous set memberships and move to new set\n old_sets = set_membership.dup\n old_sets.each { |s| self.remove_relationship(:is_member_of, s) unless HULL_QUEUES.has_key?(s) }\n sets.delete_if { |s| s == \"\"}.each { |s| self.add_relationship :is_member_of, s }\n\tend", "def complete_weak_set\n relation.weaker.each do |r|\n if relation_set(r).blank?\n t = relation_set.build :relation => r\n t._without_inverse = true\n t.save!\n end\n end\n end", "def process_rows!\n # Correct incorrect rows in the table\n table.each do |row|\n row_metric = row[\"metric\"] # perf optimization\n # TODO inject Saikuro reference\n if row_metric == :saikuro\n fix_row_file_path!(row)\n end\n tool_tables[row_metric] << row\n file_tables[row[\"file_path\"]] << row\n class_tables[row[\"class_name\"]] << row\n method_tables[row[\"method_name\"]] << row\n end\n end", "def point_attribution_all\n \tnewrating = Array.new\n \tnewpartial = Array.new\n \texistpartial = Array.new\n \texercise_value = Array.new\n \texercise_section = Array.new\n \tqcm_value = Array.new\n \tqcm_section = Array.new\n \tproblem_value = Array.new\n \tproblem_section = Array.new\n \tsectionid = Array.new\n \tn_section = Section.count\n \t\n \t(1..n_section).each do |i|\n \t\tnewpartial[i] = Array.new\n \t\texistpartial[i] = Array.new\n \tend\n \t\n \tUser.all.each do |u|\n \t\tnewrating[u.id] = 0\n \t\t(1..n_section).each do |i|\n \t\t\tnewpartial[i][u.id] = 0\n \t\t\texistpartial[i][u.id] = false\n \t\tend\n \tend\n \t\n \tPointspersection.all.each do |p|\n \t\texistpartial[p.section_id][p.user_id] = true\n \tend\n \t\n \tUser.all.each do |u|\n \t\t(1..n_section).each do |i|\n \t\t\tif !existpartial[i][u.id]\n \t\t\t\tnewpoint = Pointspersection.new\n \t \tnewpoint.points = 0\n \tnewpoint.section_id = i\n \tuser.pointspersections << newpoint\n \t\t\tend\n \t\tend\n \tend\n \t\n \tChapter.all.each do |c|\n \tsectionid[c.id] = c.section_id\n end\n \n \tExercise.all.each do |e|\n \t\texercise_value[e.id] = e.value\n \t\texercise_section[e.id] = sectionid[e.chapter_id]\n \tend\n \t\n \tQcm.all.each do |q|\n \t\tqcm_value[q.id] = q.value\n \t\tqcm_section[q.id] = sectionid[q.chapter_id]\n \tend\n \t\n \tProblem.all.each do |p|\n \t\tproblem_value[p.id] = p.value\n \t\tproblem_section[p.id] = p.section_id\n \tend\n \t\n \tSolvedexercise.all.each do |e|\n \t\tif e.correct\n pt = exercise_value[e.exercise_id]\n u = e.user_id\n s = exercise_section[e.exercise_id]\n newrating[u] = newrating[u] + pt\n newpartial[s][u] = newpartial[s][u] + pt\n \t\tend\n \tend\n \t\n \tSolvedqcm.all.each do |q|\n \t\tif q.correct\n pt = qcm_value[q.qcm_id]\n u = q.user_id\n s = qcm_section[q.qcm_id]\n newrating[u] = newrating[u] + pt\n newpartial[s][u] = newpartial[s][u] + pt\n \t\tend\n \tend\n \t\n \tSolvedproblem.all.each do |p|\n \t\tpt = problem_value[p.problem_id]\n \t\tu = p.user_id\n \t\ts = problem_section[p.problem_id]\n \t\tnewrating[u] = newrating[u] + pt\n newpartial[s][u] = newpartial[s][u] + pt\n \tend\n \t\n \twarning = \"\"\n \t\n \tPointspersection.all.each do |p|\n \t\tif newpartial[p.section_id][p.user_id] != p.points\n \t\t\tp.points = newpartial[p.section_id][p.user_id]\n \t\t\tp.save\n \t\tend\n \tend\n \t\n \tUser.all.each do |u|\n \t\tif newrating[u.id] != u.rating\n \t\t\twarning = warning + \"Le rating de #{u.name} a changé... \"\n \t\t\tu.rating = newrating[u.id]\n \t\t\tu.save\n \t\tend\n \tend\n \t\n \tif(warning.size > 0)\n \t\tflash[:danger] = warning\n \tend\n end", "def test_should_find_optimum_fill_simple\n @swap = swaps(:registration_period)\n @old = swaps(:expired)\n (\"A\"..\"H\").each { |i| create_user(:login => \"user_#{i}\", :email => \"#{i}@test.com\") }\n @old_set_1 = @old.swapsets.create :name => \"Old Set 1\"\n @old_set_2 = @old.swapsets.create :name => \"Old Set 2\"\n %w{ A E }.each { |i| @old_set_1.assign User.find_by_login(\"user_#{i}\") }\n %w{ B F }.each { |i| @old_set_2.assign User.find_by_login(\"user_#{i}\") }\n @set = @swap.swapsets.create :name => \"New Set\"\n %w{ A B C D }.each do |i|\n user = User.find_by_login \"user_#{i}\"\n @set.assign user\n end\n %w{ E F G H }.each do |i|\n user = User.find_by_login \"user_#{i}\"\n user.registrations.first.set_as_double\n end\n @swap.initialize_set(@swap.users, SWAPSET_SIZE, Swapset.find(:all).map {|set| set.users})\n @swap.fill_set(@set)\n @set.reload\n assert_equal 6, @set.users.size\n %w{ A B C D G H}.each do |i|\n assert @set.users.include?(User.find_by_login(\"user_#{i}\"))\n end\n %w{ E F }.each do |i|\n assert !(@set.users.include?(User.find_by_login(\"user_#{i}\")))\n end\n end", "def initialize\n super\n# reset this functionality is now in CompletenessCorrectnessDiffs\n @descript = []\n @transDescript = []\n @totalmops = CompletenessCorrectnessDiffs.new\n end", "def set_totals\n if stat!=\"diff\"\n self.update_attributes({fga:fga_pg*games, fgm:fgm_pg*games})\n totals_dist_att = {dist_0to3feet_fga:dist_0to3feet_percshots*fga, dist_3to10feet_fga:dist_3to10feet_percshots*fga, dist_10to16feet_fga:dist_10to16feet_percshots*fga, dist_16to3pt_fga:dist_16to3pt_percshots*fga, threept_fga:threept_percshots*fga, twopt_fga:twopt_perc_shots*fga}\n self.update_attributes(totals_dist_att)\n self.update_attributes({corner_fga:corner_perc3pt*threept_fga, non_corner_fga:(1-corner_perc3pt)*threept_fga})\n totals_dist_made = {dist_0to3feet_fgm:dist_0to3feet_perc*dist_0to3feet_fga, dist_3to10feet_fgm:dist_3to10feet_perc*dist_3to10feet_fga, dist_10to16feet_fgm:dist_10to16feet_perc*dist_10to16feet_fga, dist_16to3pt_fgm:dist_16to3pt_perc*dist_16to3pt_fga, threept_fgm:threept_perc*threept_fga, twopt_fgm:twopt_perc*twopt_fga}\n self.update_attributes(totals_dist_made)\n self.update_attributes(corner_fgm:corner_perc*corner_fga) \n self.update_attributes(non_corner_fgm:threept_fgm-corner_fgm)\n end\n end", "def add_filtering_tests\n measure = ApplicationController.helpers.pick_measure_for_filtering_test(measure_ids, bundle)\n reload_relations\n\n return if product_tests.filtering_tests.any?\n criteria = %w(races ethnicities genders payers age).shuffle\n filter_tests = []\n filter_tests.concat [build_filtering_test(measure, criteria[0, 2]), build_filtering_test(measure, criteria[2, 2])]\n filter_tests << build_filtering_test(measure, ['providers'], 'NPI, TIN & Provider Location')\n filter_tests << build_filtering_test(measure, ['providers'], 'NPI & TIN', false)\n criteria = ApplicationController.helpers.measure_has_diagnosis_criteria?(measure) ? ['problems'] : criteria.values_at(4, (0..3).to_a.sample)\n filter_tests << build_filtering_test(measure, criteria)\n ApplicationController.helpers.generate_filter_records(filter_tests)\n end", "def calculate_intra_consensus_value\n count=0\n if IntraResidueContact.all(:seq_id => self.seq_id, :first_residue=>self.original_position) || IntraResidueContact.all(:seq_id => self.seq_id, :second_residue=>self.original_position)\n count +=1\n end\n #if !Conseq.first(:aasequence_id => self.AAsequence_id).nil? && Conseq.first(:aasequence_id => self.AAsequence_id).color > 4\n if !Conseq.first(:aasequence_id => self.AAsequence_id).nil? && Conseq.first(:aasequence_id => self.AAsequence_id).score < 0\n count +=1\n end\n if !Xdet.first(:aasequence_id => self.AAsequence_id).nil? && (Xdet.first(:aasequence_id => self.AAsequence_id).correlation > 0.0 || Xdet.first(:aasequence_id => self.AAsequence_id).correlation == -2)\n count +=1\n end\n if !NewCap.first(:seq_id=> self.seq_id, :position_one => self.original_position).nil? || !NewCap.first(:seq_id=> self.seq_id, :position_two => self.original_position).nil?\n count +=1\n end\n self.contact_consensus = count /4\n puts self.contact_consensus\n self.save\n end\n \n def calculate_intra_consensus_value_special\n count=0\n #if !Conseq.first(:aasequence_id => self.AAsequence_id).nil? && Conseq.first(:aasequence_id => self.AAsequence_id).color > 4\n if !Conseq.first(:aasequence_id => self.AAsequence_id).nil? && Conseq.first(:aasequence_id => self.AAsequence_id).score < 0\n count +=1\n end\n if !Xdet.first(:aasequence_id => self.AAsequence_id).nil? && (Xdet.first(:aasequence_id => self.AAsequence_id).correlation > 0.0 || Xdet.first(:aasequence_id => self.AAsequence_id).correlation == -2)\n count +=1\n end\n if !NewCap.first(:seq_id=> self.seq_id, :position_one => self.original_position).nil? || !NewCap.first(:seq_id=> self.seq_id, :position_two => self.original_position).nil?\n count +=1\n end\n self.contact_consensus = count/3\n self.save\n puts self.contact_consensus\n end", "def assemble_expert_performance\n # Load all Matches\n matches = Match.all\n expert = Expert.where(name: \"zulubet\").first().id\n\n # For each Match check whether Odds and Predictions exist\n matches.each do |match|\n predictions = Prediction.where(match: match).where(expert_id: expert).first()\n odds = Odd.where(match: match)\n\n # If Odds and Predictions exist, calculate min, max, avg, etc for each\n if predictions && odds.count > 0 && match.home_goals && match.away_goals\n\n odds_home_average = odds.average(:home_odd)\n odds_draw_average = odds.average(:draw_odd)\n odds_away_average = odds.average(:away_odd)\n\n odds_home_max = odds.maximum(:home_odd)\n odds_draw_max = odds.maximum(:draw_odd)\n odds_away_max = odds.maximum(:away_odd)\n\n odds_home_min = odds.minimum(:home_odd)\n odds_draw_min = odds.minimum(:draw_odd)\n odds_away_min = odds.minimum(:away_odd)\n\n predictions_home = predictions.home_probability\n predictions_draw = predictions.draw_probability\n predictions_away = predictions.away_probability\n\n winner = match.home_goals - match.away_goals\n # TODO: Add standard deviaton calculation for odds and predictions\n # Include expert quality score to weight the predictions\n\n # Write all Data with append to the training file\n CSV.open(\"csv_input/assemble_expert_performance.csv\", \"ab\") do |csv|\n csv << [\n winner,\n # I need the Outcome of the Game to improve the ML Algo\n # As Difference of Goals?\n # As Winner?\n # As Percentage (of what though)?\n\n odds_home_average,\n odds_draw_average,\n odds_away_average,\n odds_home_max,\n odds_draw_max,\n odds_away_max,\n odds_home_min,\n odds_draw_min,\n odds_away_min,\n predictions_home,\n predictions_draw,\n predictions_away,\n ]\n end\n end\n end\n end", "def prepare_hgt_com_trsf_prkgrs_old()\n \n @conn.execute \\\n \"truncate table hgt_com_trsf_prkgrs\"\n \n puts \"hgt_com_trsf_prkgrs table truncated...\"\n \n #\n sql = \"select id,\n gene_id,\n TXSRC_ID,\n TXDST_ID,\n WEIGHT_TR_TX\n from HGT_COM_TRSF_TAXONS\"\n \n #puts \"sql: #{sql}\"\n \n \n tr_taxons = HgtComTrsfTaxon.find_by_sql(sql)\n \n tr_taxons.each {|tr|\n \n\n #debugging\n #next unless tr.gene_id == 111 and tr.txsrc_id == 768679 and tr.txdst_id == 374847\n \n #puts \"tr: #{tr.inspect}\"\n #puts \"tr.id: #{tr.id}, #{tr.gene_id}\"\n \n #for each chiteria\n (0..1).each {|crit|\n \n #for each criteria and\n #for each source and destination prok groups\n sql = \"select tg.PROK_GROUP_ID,\n tg.WEIGHT_PG\n from TAXON_GROUPS tg \n join PROK_GROUPS pg on pg.id = tg.PROK_GROUP_ID\n where tg.TAXON_ID = #{tr.txsrc_id} and\n pg.GROUP_CRITER_ID = #{crit}\"\n #puts \"sql: \\n #{sql}\"\n \n pg_src = TaxonGroup.find_by_sql(sql)\n \n \n sql = \"select tg.PROK_GROUP_ID,\n tg.WEIGHT_PG\n from TAXON_GROUPS tg \n join PROK_GROUPS pg on pg.id = tg.PROK_GROUP_ID\n where tg.TAXON_ID = #{tr.txdst_id} and\n pg.GROUP_CRITER_ID = #{crit}\"\n #puts \"sql: \\n #{sql}\"\n \n pg_dst = TaxonGroup.find_by_sql(sql)\n \n pg_src.each {|src|\n pg_dst.each {|dst|\n \n #puts \"src: #{src.inspect}\"\n #puts \"dst: #{dst.inspect}\"\n \n #insert alternative\n prkg = HgtComTrsfPrkgr.new \n prkg.gene_id = tr.gene_id\n prkg.hgt_com_trsf_taxon_id = tr.id\n prkg.pgsrc_id = src.prok_group_id\n prkg.pgdst_id = dst.prok_group_id\n prkg.weight_tr_pg = tr.weight_tr_tx * src.weight_pg * dst.weight_pg\n prkg.save\n \n #prkg.gene_id = tr.gene_id \n #prkg.save\n \n \n }\n }\n \n \n \n \n \n } \n }\n \n \n end", "def determine_useful_measures(validation_id)\n useful_checks = [\n useful_measures_by_performance_rate(validation_id),\n useful_measures_by_measure_type(validation_id)\n ]\n useful_checks.inject(:&)\n end", "def test_terms_must_have_qualities\n t = Term.new()\n refute t.save\n t1 = Term.new(name: \"Summer\", starts_on: 2015-01-04)\n refute t1.save\n end", "def destroy\n\t\t@comparison_measure = ComparisonMeasure.find(params[:id]);\n\t\t\n\t\t# find and delete any associated data points\n\t\tdataPoints = ComparisonDataPoint.where(:comparison_measure_id=>@comparison_measure.id)\n\t\t\n\t\tunless dataPoints.empty?\n\t\t\tdataPoints.each do |dp|\n\t\t\t\tdp.destroy\t\n\t\t\tend\n\t\tend\n\t\t\n\t\t# get the comparison object that this measure belongs to\n\t\t@comparison = Comparison.find(@comparison_measure.comparison_id)\n\t\t\n\t\t# remove the comparison measure\n\t\t@comparison_measure.destroy\n\t\t\n\t\t# update the display tables and give a message that it was deleted successfully\n\t\t@comparison_measure = ComparisonMeasure.new\n\t\t@comparison_measures = ComparisonMeasure.where(:comparison_id=>@comparison.id)\n\t\t@comparison_data_points = ComparisonMeasure.get_data_points(@comparison_measures.collect{|x| x.id})\n\t\t@comparison_data_point = ComparisonDataPoint.new\n\t\t@comparison_measure = ComparisonMeasure.new\n\t\t@study = Study.find(@comparison.study_id)\n\t\t@outcome = Outcome.find(@comparison.outcome_id)\n\t\t@extraction_form = ExtractionForm.find(@comparison.extraction_form_id)\n\t\t@td_id = \"#\" + @comparison.comparators.to_s\n\t\t@type = @comparison.within_or_between\n\t\t@previous_measures = ComparisonMeasure.get_previous_measures(@comparison.study_id)\n\t\t@entry_container = \"measure_form_div\"\n\t\t@entry_partial = \"comparison_measures/form\"\n\t\t@editing=false\n\t\t\n\t\t@table_container = \"measure_display_div\"\n\t\t@table_partial = \"comparison_measures/measure_list\"\n\t\t\n\t\t@table_container2 = \"form_div\"\n\t\tobject_ids = @comparison.comparators.split(\"_\")\n\t\tif @type == \"between\"\n\t\t\t@table_partial2 = \"comparison_data_points/between_arm_comparisons\"\n\t\t\t@arms = []\n\t\t\tobject_ids.length.times do |i|\n\t\t\t\ttmp = Arm.find(object_ids[i])\n\t\t\t\t@arms[i] = tmp\n\t\t\tend\n\t\telse\n\t\t\t@table_partial2 = \"comparison_data_points/within_arm_comparisons\"\n\t\t\t@timepoints = []\t\n\t\t\tobject_ids.length.times do |i|\n\t\t\t\ttmp = OutcomeTimepoint.find(object_ids[i])\n\t\t\t\t@timepoints[i] = tmp\n\t\t\tend\t\t\n\t\tend\n\t\trender \"shared/saved\"\n\tend", "def prepare_to_store\n # Check if data already collected and collect if needed\n scan_for_gender_category_and_event if @single_events.count == 0\n @single_events.each do |event|\n # Check if time standard already exists and create or update\n if TimeStandard.exists?(\n season_id: @season.id,\n gender_type_id: event.gender_type.id,\n category_type_id: event.category_type.id,\n pool_type_id: event.pool_type.id,\n event_type_id: event.event_type.id\n )\n # Exists. Needs update\n @update_events << event\n else\n # Doesn't exist. Needs insert\n @insert_events << event\n end\n end\n @update_events.count + @insert_events.count == @single_events.count\n end", "def fix_subset_operators(dc)\n if (dc.subset_operators)\n dc.subset_operators.each do |subset|\n subset.value.high.instance_variable_set(:@unit, nil) if subset.value.respond_to?(:high) && subset.value.try(:high).try(:unit).try(:strip).try(:empty?)\n subset.value.low.instance_variable_set(:@unit, nil) if subset.value.respond_to?(:low) && subset.value.try(:low).try(:unit).try(:strip).try(:empty?)\n subset.value = nil if subset.type == 'TIMEDIFF' && subset.value.is_a?(HQMF::AnyValue)\n end\n end\n end", "def after_create_competition_results_for(race)\n race.results.each do |result|\n # Don't bother sorting scores unless we need to drop some\n if result.scores.size > 6\n result.scores.sort! { |x, y| x.source_result.place <=> y.source_result.place }\n lowest_scores = result.scores[6, 2]\n lowest_scores.each do |lowest_score|\n result.scores.destroy(lowest_score)\n end\n # Rails destroys Score in database, but doesn't update the current association\n result.scores(true)\n end\n \n if preliminary?(result)\n result.preliminary = true \n end \n end\n end", "def compare_data(table)\n data1 = query(@db1, \"SELECT * FROM #{table}\", \"hash\")\n data2 = query(@db2, \"SELECT * FROM #{table}\", \"hash\")\n \n changes = false\n data1.each do |row|\n if ! data2.include?(row)\n to_insert(@db2_output, table, row)\n changes = true\n end\n end \n @db2_output << \"\\n\" if changes\n \n changes = false\n data2.each do |row|\n if ! data1.include?(row)\n to_insert(@db1_output, table, row)\n changes = true\n end\n end\n @db1_output << \"\\n\" if changes\n end", "def test_field_size\n for person in Person.find(:all)\n person.member_to = Date.new(2009, 12, 31)\n person.save!\n end\n cross_crusade = Series.create!(:name => \"Cross Crusade\")\n\n # Large event\n barton = SingleDayEvent.create!({\n :name => \"Cross Crusade: Barton Park\",\n :discipline => \"Cyclocross\",\n :date => Date.new(2009, 11, 7),\n :parent => cross_crusade\n })\n men_a = Category.find_by_name(\"Men A\")\n barton_a = barton.races.create(:category => men_a)\n barton_a.results.create({\n :place => 3,\n :person => people(:tonkin)\n })\n barton_a.results.create({\n :place => 15,\n :person => people(:weaver)\n })\n barton_a.field_size = 75\n barton_a.save!\n\n # Smaller event\n estacada = SingleDayEvent.create!({\n :name => \"Cross Crusade: Estacada\",\n :discipline => \"Cyclocross\",\n :date => Date.new(2009, 11, 14),\n :parent => cross_crusade\n })\n estacada_a = estacada.races.create(:category => men_a)\n estacada_a.results.create({\n :place => 1,\n :person => people(:tonkin)\n })\n estacada_a.results.create({\n :place => 8,\n :person => people(:weaver)\n })\n estacada_a.field_size = 74\n estacada_a.save!\n\n # Large \"national\" event\n alpenrose = SingleDayEvent.create!({\n :name => \"Cross Crusade: alpenrose\",\n :discipline => \"Cyclocross\",\n :date => Date.new(2009, 11, 14),\n :parent => cross_crusade\n })\n alpenrose.bar_points = 3\n alpenrose.save!\n alpenrose_a = alpenrose.races.create(:category => men_a)\n alpenrose_a.results.create({\n :place => 10,\n :person => people(:tonkin)\n })\n alpenrose_a.field_size = 75\n alpenrose_a.save!\n\n # Too small event\n dfl = SingleDayEvent.create!({\n :name => \"dfL Outlaw Race\",\n :discipline => \"Cyclocross\",\n :date => Date.new(2009, 9, 3)\n })\n dfl_a = dfl.races.create(:category => men_a)\n dfl_a.results.create({\n :place => 2,\n :person => people(:tonkin)\n })\n dfl_a.results.create({\n :place => 3,\n :person => people(:weaver)\n })\n dfl_a.field_size = 4\n dfl_a.save!\n\n # Too small event in other discipline\n ice_breaker = SingleDayEvent.create!({\n :name => \"Ice Breaker\",\n :discipline => \"Criterium\",\n :date => Date.new(2009, 2, 21)\n })\n ice_breaker_a = ice_breaker.races.create(:category => categories(:sr_p_1_2))\n ice_breaker_a.results.create({\n :place => 14,\n :person => people(:tonkin)\n })\n ice_breaker_a.field_size = 4\n ice_breaker_a.save!\n\n Bar.calculate!(2009)\n \n cx_bar = Bar.find_by_year_and_discipline(2009, \"Cyclocross\")\n men_a_bar = cx_bar.races.detect { |race| race.name == 'Men A' }\n \n assert_not_nil(men_a_bar, 'Men A Cyclocross BAR')\n assert_equal(2, men_a_bar.results.size, 'Men A Cyclocross BAR results')\n\n men_a_bar.results.sort!\n tonkin_bar_result = men_a_bar.results.first\n assert_equal(people(:tonkin), tonkin_bar_result.person)\n assert_equal(33 + 30 + 25 + 21, tonkin_bar_result.points, 'Tonkin BAR points')\n weaver_bar_result = men_a_bar.results.last\n assert_equal(people(:weaver), weaver_bar_result.person)\n assert_equal(1.5 + 11 + 22, weaver_bar_result.points, 'Weaver BAR points')\n\n crit_bar = Bar.find_by_year_and_discipline(2009, \"Criterium\")\n sr_men_crit_bar = crit_bar.races.detect { |race| race.name == 'Senior Men' }\n \n assert_not_nil(sr_men_crit_bar, 'Senior Men Crit BAR')\n assert_equal(1, sr_men_crit_bar.results.size, 'Senior Men Crit BAR results')\n\n tonkin_bar_result = sr_men_crit_bar.results.first\n assert_equal(people(:tonkin), tonkin_bar_result.person)\n assert_equal(2, tonkin_bar_result.points, 'Tonkin Crit BAR points')\n end", "def update_expected_value_structure!(measure)\n measure_population_count = measure.populations.count\n\n # keep track of the population indexes we have seen so we can reject duplicates\n population_indexes_found = []\n # delete population sets present on the patient but not in the measure. also get rid of garbage and duplicate data.\n self.expected_values.reject! do |expected_value_set|\n # if there is no measure_id then just clean this up\n if !expected_value_set.has_key?('measure_id')\n matches_measure = true\n is_garbage_data = true\n else # if there is a measure_id, do the rest of the checks\n matches_measure = expected_value_set[:measure_id] ? expected_value_set[:measure_id] == measure.hqmf_set_id : false\n # check if population_index or is non-existent, i.e. this is a set of garbage data\n is_garbage_data = !expected_value_set.has_key?('population_index')\n is_extra_population = expected_value_set[:population_index] ? expected_value_set[:population_index] >= measure_population_count : false\n\n is_duplicate_population = false\n # if it isn't garbage data or an extra population, check if it's a duplicate and/or add it to the list of seen populations\n if !is_garbage_data && !is_extra_population\n if population_indexes_found.include? expected_value_set[:population_index]\n is_duplicate_population = true\n else\n # add this population_index to the list of ones we have already seen\n population_indexes_found << expected_value_set[:population_index]\n end\n end\n end\n\n # remove if it is part of this measure and has any of the three checked issues\n if matches_measure && (is_extra_population || is_garbage_data || is_duplicate_population)\n # if a block is given prepare some data and yield info about the removal\n if block_given?\n if is_extra_population\n change_reason = :extra_population\n elsif is_garbage_data\n change_reason = :garbage_data\n elsif is_duplicate_population\n change_reason = :dup_population\n end\n # Yield this change being made, with change_type symbol, change_reason symbol and the structure being removed\n yield :population_set_removal, change_reason, expected_value_set.deep_dup\n end\n\n true\n else\n false\n end\n end\n\n # add missing population sets\n patient_population_count = self.expected_values.count { |expected_value_set| expected_value_set[:measure_id] == measure.hqmf_set_id }\n # add new population sets. the rest of the data gets added below.\n if patient_population_count < measure_population_count\n (patient_population_count..measure_population_count-1).each do |index|\n new_expected_values = {\"measure_id\" => measure.hqmf_set_id, \"population_index\" => index}\n # yield info about this addition\n yield :population_set_addition, :missing_population, new_expected_values.deep_dup if block_given?\n self.expected_values << new_expected_values\n end\n end\n\n # ensure there's the correct number of populations for each population set\n self.expected_values.each do |expected_value_set|\n # ignore if it's not related to the measure (can happen for portfolio users)\n next unless expected_value_set[\"measure_id\"] == measure.hqmf_set_id\n\n expected_value_population_set = expected_value_set.slice(*HQMF::PopulationCriteria::ALL_POPULATION_CODES).keys\n measure_population_set = measure.populations[expected_value_set[\"population_index\"]].slice(*HQMF::PopulationCriteria::ALL_POPULATION_CODES).keys\n\n # add population sets that didn't exist (populations in the measure that don't exist in the expected values)\n added_populations = measure_population_set - expected_value_population_set\n # create the structure to yield about these changes\n added_changes = {\"measure_id\" => measure.hqmf_set_id, \"population_index\" => expected_value_set[\"population_index\"]}\n if added_populations.count > 0\n added_populations.each do |population|\n if population == 'OBSERV'\n expected_value_set[population] = []\n added_changes[population] = []\n else\n expected_value_set[population] = 0\n added_changes[population] = 0\n end\n end\n # yield the info about things that are added.\n yield :population_addition, :missing_population, added_changes if block_given? \n end\n\n # delete populations that no longer exist (populations in the expected values that don't exist in the measure)\n removed_populations = expected_value_population_set - measure_population_set\n if removed_populations.count > 0 && block_given?\n # create the structure to yield about these changes\n removed_changes = {\"measure_id\" => measure.hqmf_set_id, \"population_index\" => expected_value_set[:population_index]}\n removed_populations.each { |population| removed_changes[population] = expected_value_set[population] }\n\n expected_value_set.except!(*removed_populations)\n # yield the info about things removed\n yield :population_removal, :extra_population, removed_changes if block_given?\n end\n\n end\n self.save!\n end", "def recalculate_similarity\n query_one = Like.select(:user_id).where(product_id: product_one_id).order('user_id asc').to_sql\n query_two = Like.select(:user_id).where(product_id: product_two_id).order('user_id asc').to_sql\n user_ids_one = ActiveRecord::Base.connection.execute(query_one).column_values(0)\n user_ids_two = ActiveRecord::Base.connection.execute(query_two).column_values(0)\n intersection = (user_ids_one & user_ids_two).size\n union = (user_ids_one | user_ids_two).size\n \n if intersection == 0 || union == 0\n self.similarity = 0\n else\n self.similarity = intersection.to_f / union.to_f\n end\n self.save\n end", "def save\n unless @added.empty? && @deleted.empty?\n # We cannot reuse the allocated space, since the data\n # that is copied would be destroyed.\n if polymorphic?\n offset = @database.allocate_polymorphic_join_elements(@size)\n else\n offset = @database.allocate_join_elements(@size)\n end\n pairs =\n @size.times.map do |index|\n rod_id = id_for(index)\n if rod_id.is_a?(Model)\n object = rod_id\n if object.new?\n if polymorphic?\n object.reference_updaters <<\n ReferenceUpdater.for_plural(self,index,@database)\n else\n object.reference_updaters <<\n ReferenceUpdater.for_plural(self,index,@database)\n end\n next\n else\n rod_id = object.rod_id\n end\n end\n [rod_id,index]\n end.compact\n if polymorphic?\n pairs.each do |rod_id,index|\n class_id = (rod_id == 0 ? 0 : class_for(index).name_hash)\n @database.set_polymorphic_join_element_id(offset,index,rod_id,class_id)\n end\n else\n pairs.each do |rod_id,index|\n @database.set_join_element_id(offset,index,rod_id)\n end\n end\n @offset = offset\n @added.clear\n @deleted.clear\n @map.clear\n @original_size = @size\n end\n @offset\n end", "def after_create_competition_results_for(race)\n race.results.each do |result|\n result.scores.sort! { |x, y| y.points <=> x.points }\n remove_duplicate_discipline_results result.scores\n\n if result.scores.size > 5\n lowest_scores = result.scores[5, result.scores.size - 5]\n lowest_scores.each do |lowest_score|\n result.scores.destroy lowest_score\n end\n # Rails destroys Score in database, but doesn't update the current association\n result.scores true\n end\n end\n end", "def test_lessons_and_readings_dependent\n create_reading = Reading.create(order_number: \"5\", lesson_id: \"1\", url: \"http://www.lesson.com\")\n tuesday_lesson = Lesson.create(name: \"Lesson\")\n tuesday_lesson.readings << create_reading\n assert tuesday_lesson.reload.readings.include?(create_reading)\n end", "def reconcile!\n table_reconciles = []\n Volt::RootModels.model_classes.each do |model_class|\n table_reconciles << TableReconcile.new(@adaptor, @db, model_class)\n end\n\n # Make any missing tables\n table_reconciles.each(&:ensure_table)\n\n # Make sure the migrations are up to date first.\n Volt::MigrationRunner.new(@db).run\n\n # After the migrations, reconcile tables\n table_reconciles.each(&:run)\n\n # After the initial reconcile!, we add a listener for any new models\n # created, so we can reconcile them (in specs mostly)\n reset!\n @@listener = RootModels.on('model_created') do |model_class|\n # We do a full invalidate and wait for the next db access, because the\n # model_created gets called before the class is actually fully defined.\n # (ruby inherited limitation)\n @adaptor.invalidate_reconcile!\n end\n end", "def write_comparison_table(app, cm)\n \n row_num = 0 # TODO use same numbering for all rows\n \n [['context_1', 'context_2'], ['context_1', 'context_3']].each{|ctx_set|\n \n cm.add_row(\n {:text=>(cm.html?)?'<strong>Scenarios:</strong>':'Scenarios:', :colspan=>2},\n {:text=>ctx_set.inspect.to_s, :colspan=>20}\n )\n \n cm.add_row({:text=>'', :colspan=>4}, {:text=>'IIS', :colspan=>6}, {:text=>'Apache', :colspan=>9})\n cm.add_row({:text=>'', :colspan=>4}, {:text=>'Load Agents', :colspan=>2}, {:text=>'No WinCache', :colspan=>3}, {:text=>'WinCache', :colspan=>3}, {:text=>'No APC', :colspan=>3}, {:text=>'APC', :colspan=>3}, {:text=>'APC w/ IGBinary', :colspan=>3})\n cm.add_row('', 'OS', 'Physical', 'Virtual', 'Base', 'Test', 'Gain', 'Base', 'Test', 'Gain', 'Base', 'Test', 'Gain', 'Base', 'Test', 'Gain')\n \n cm.add_row('1', 'Win 2003 x86 SP2', '2', '8', '50', '100', '50%', '100', '50', '50%', '50', '100', '50%', '100', '50', '50%')\n \n cm.add_row(\n {:text=>(cm.html?)?'<strong>Windows INI:</strong>':'INI:', :colspan=>2},\n # TODO show INI\n {:text=>ctx_set.inspect.to_s, :colspan=>20}\n )\n cm.add_row(\n {:text=>(cm.html?)?'<strong>Linux INI:</strong>':'INI:', :colspan=>2},\n # TODO show INI\n {:text=>ctx_set.inspect.to_s, :colspan=>20}\n )\n \n \n \n }\n \n return cm\n end", "def count_records_in_measure_groups\n patient_cache = get_db.collection('patient_cache')\n base_query = {'value.measure_id' => @measure_id, 'value.sub_id' => @sub_id,\n 'value.effective_date' => @parameter_values['effective_date'],\n 'value.test_id' => @parameter_values['test_id']}\n\n base_query.merge!(filter_parameters)\n \n query = base_query.clone\n\n query.merge!({'value.manual_exclusion' => {'$in' => [nil, false]}})\n \n result = {:measure_id => @measure_id, :sub_id => @sub_id, \n :effective_date => @parameter_values['effective_date'],\n :test_id => @parameter_values['test_id'], :filters => @parameter_values['filters']}\n \n # need to time the old way agains the single query to verify that the single query is more performant\n aggregate = {\"population\"=>0, \"denominator\"=>0, \"numerator\"=>0, \"antinumerator\"=>0, \"exclusions\"=>0}\n %w(population denominator numerator antinumerator exclusions).each do |measure_group|\n patient_cache.find(query.merge(\"value.#{measure_group}\" => true)) do |cursor|\n aggregate[measure_group] = cursor.count\n end\n end\n aggregate[\"considered\"] = patient_cache.find(query).count\n aggregate[\"exclusions\"] += patient_cache.find(base_query.merge({'value.manual_exclusion'=>true})).count\n result.merge!(aggregate)\n\n result.merge!(execution_time: (Time.now.to_i - @parameter_values['start_time'].to_i)) if @parameter_values['start_time']\n\n get_db.collection(\"query_cache\").save(result, safe: true)\n result\n end", "def create_question_set(round_id)\n puts 'Entering create_question_set()'\n diff_lvl = Round.find(round_id).difficulty_level_id\n\n existing_qo_set = QuestionOccurrence.where(round_id: round_id)\n last_qo_index = existing_qo_set.length\n\n if (last_qo_index < MAX_NUM_QUESTIONS)\n puts \"Creating #{MAX_NUM_QUESTIONS - last_qo_index} QO objects for round #{round_id}\"\n existing_questions = existing_qo_set.map{|qo| qo.question}\n question_pool = Question.where(\"difficulty_level_id = ?\", diff_lvl).shuffle - existing_questions\n question_pool.first(MAX_NUM_QUESTIONS - last_qo_index).each{|q| last_qo_index += 1; qo=QuestionOccurrence.new(round_id: round_id, question_id: q.id, index_in_round: last_qo_index); qo.save; }\n else\n puts 'No need to create additional QO objects'\n end\n puts 'Exiting create_question_set()'\n end", "def add_measures(connection, food_record)\n results = connection.exec(\"SELECT amount, description, grams FROM weight WHERE id = '#{food_record['id']}' ORDER BY sequence\")\n list = []\n list.push( { 'measure' => '100 grams', 'kcals' => food_record['kcal'].to_i, 'grams' => 100 })\n # example record: { \"amount\": \"1\", \"description\": \"cup\", \"grams\": \"185\" }\n results.each do |rec|\n text = [ rec['amount'].to_s, rec['description'] ].join(' ')\n kcals = food_record['kcal'].to_f * rec['grams'].to_f / 100\n list.push( { 'measure' => text.strip, 'kcals' => kcals.to_i, 'grams' => rec['grams'].to_i })\n end\n food_record['measures'] = list\nrescue PG::Error => e\n STDERR.puts e\n exit -1\nend", "def summarize_per_table_dum\n @having = NO_ROWS\n end", "def test_3\n charge1 = Charge.new(:reservation_id => 10,\n\t\t\t :season_id => 3,\n\t\t\t :rate => 10.00,\n\t\t\t :period => 2,\n\t\t\t :start_date => Date.today,\n\t\t\t :end_date => Date.today + 2.days,\n\t\t\t :amount => 20.00,\n\t\t\t :discount => 0.00,\n\t\t\t :charge_units => 1)\n charge2 = Charge.new(:reservation_id => 20,\n\t\t\t :season_id => 2,\n\t\t\t :rate => 20.00,\n\t\t\t :period => 2,\n\t\t\t :start_date => Date.today + 3.days,\n\t\t\t :end_date => Date.today + 4.days,\n\t\t\t :amount => 20.00,\n\t\t\t :discount => 0.00,\n\t\t\t :charge_units => 2)\n charge1.methods.sort\n assert_raise(RuntimeError, 'different_units') { charge1.combine charge2 }\n charge2.charge_units = 1\n assert_raise(RuntimeError, 'different_rate') { charge1.combine charge2 }\n charge2.rate = 10.00\n assert_raise(RuntimeError, 'different_season') { charge1.combine charge2 }\n charge2.season_id = 3\n assert_raise(RuntimeError, 'different_reservation') { charge1.combine charge2 }\n charge2.reservation_id = 10\n assert_raise(RuntimeError, 'not_sequential') { charge1.combine charge2 }\n charge2.start_date = Date.today + 2.days\n assert_nothing_raised() { charge1 += charge2 }\n end", "def save\n attribs = attributes.clone\n\n # Don't care about these attributes\n attribs.delete(\"periodBegin\")\n attribs.delete(\"periodEnd\")\n attribs.delete(\"fk_Activity\")\n attribs.delete(\"peopleGroup\")\n attribs.delete(\"updated_by\")\n\n # Need to compare the semester/quarter stats to previous stat record\n prev_stat = get_previous_stat\n changed = false\n if prev_stat\n Statistic.semester_stats.each do |field|\n changed = changed || self[field] != prev_stat[field]\n attribs.delete(field)\n end\n end\n\n values = attribs.values.compact\n if !values.empty? || changed\n super\n end\n end", "def aremos_comparison(save_series = true)\n begin\n as = AremosSeries.get self.name\n if as.nil?\n #puts \"NO MATCH: #{self.name}\"\n self.aremos_missing = \"-1\"\n self.save if save_series\n return {:missing => \"No Matching Aremos Series\", :diff => \"No Matching Aremos Series\"}\n end\n missing_keys = (as.data.keys - self.data.keys)\n \n #remove all suppressed values\n missing_keys.delete_if {|key| as.data[key] == 1000000000000000.0}\n \n self.aremos_missing = missing_keys.count\n self.aremos_diff = 0\n #self.units ||= 1\n as.data.each do |datestring, value|\n unless self.data[datestring].nil?\n #have to do all the rounding because it still seems to suffer some precision errors after initial rounding\n diff = a_diff(value, self.units_at(datestring))\n self.aremos_diff += diff \n puts \"#{self.name}: #{datestring}: #{value}, #{self.units_at(datestring)} diff:#{diff}\" if diff != 0\n end\n end\n self.save if save_series\n #puts \"Compared #{self.name}: Missing: #{self.aremos_missing} Diff:#{self.aremos_diff}\"\n return {:missing => self.aremos_missing, :diff => self.aremos_diff}\n rescue Exception => e\n puts e.message\n puts \"ERROR WITH \\\"#{self.name}\\\".ts.aremos_comparison\"\n end\n end", "def test_get_etc_by_processor\n\t\tclient = Client.create!(:name => 'New Client', :contracted_tat => 12, :tat => 30)\n\t\tfacility = Facility.create!(:name => 'New Facility', :client => client, :sitecode => '00902')\n\t\tprocessor = User.new(:name => 'gg', :userid => 'gg', :password => 'gg',\n :processing_rate_triad => 10, :processing_rate_others => 15)\n\t\tbatch = Batch.create!(:batchid \t\t\t\t\t=> 14567,\n :facility \t\t\t\t=> facility,\n :date \t\t\t\t\t\t=> Date.today.strftime(\"%m/%d/%Y\"),\n :arrival_time \t\t=> \"#{Time.now}\",\n :target_time \t\t=> \"#{Time.now.tomorrow - 64.minutes}\",\n :status \t\t=> \"New\",\n :manual_override \t=> false)\n\n\t\tjob_new = Job.create!(:batch=>batch,:tiff_number=>1234,\n :check_number=>12131,:count=>12,\n :estimated_eob => 50, :processor => processor,\n :processor_status => 'Processor Allocated',:job_status => 'Processing')\n\t\tbatch.reload\n batch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_with_one_job = batch.expected_completion_time\n\n job_one_more = Job.new(:batch=>batch,:tiff_number=>1231,\n :check_number=>12135,:count=>12,\n :estimated_eob => 50,:processor => processor,\n :processor_status => 'Processor Allocated',:job_status => 'Processing')\n\t\tjob_one_more.save\n\t\tbatch.reload\n\t\tbatch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_with_two_jobs = batch.expected_completion_time\n\n\t\tassert_not_equal(etc_with_one_job, etc_with_two_jobs)\n\n\t\tjob_one_more.processor = nil\n\t\tjob_one_more.job_status = ''\n\t\tjob_one_more.update\n\t\tbatch.reload\n\t\tbatch.expected_completion_time = batch.expected_time\n batch.save\n\t\tetc_after_deallocation = batch.expected_completion_time\n assert_in_delta(etc_after_deallocation, etc_with_one_job, 1, \"ETC after deallocation varys by more than 1 second.\")\n end", "def calc_base_query(condition_type)\n @join_tables = []\n @condition_values = {}\n @extra_conditions = []\n @non_query_conditions = {}\n @sub_conditions = {}\n\n @condition_config.each do |c_table, t_conds|\n join_table_name = c_table.to_sym\n table_name = ModelReference.record_type_to_table_name(c_table).to_sym\n\n if is_selection_type(table_name)\n # Nested conditions are ignored, since they are\n # handled directly in the condition processing logic\n\n else\n\n t_conds.each do |field_name, val|\n # non query conditions are those aren't formulated with a series of\n # inner joins on the master. They are handled as individual queries.\n non_query_condition = is_non_query_condition table_name, field_name, val\n\n if val.is_a?(Hash) && !val.key?(:element)\n # Since the conditional value is actually a hash, we need to\n # get the value to be matched from another referenced record (or this)\n # Generate the query condition to do this\n val = generate_match_query_condition(val, join_table_name)\n end\n\n if non_query_condition\n # We have decided this is a non query condition, and will not be joined on the master\n # Set this so they can be evaluated at runtime.\n @non_query_conditions[table_name] ||= {}\n @non_query_conditions[table_name][field_name] = val\n else\n # We have finally decided that this is a regular query condition\n # Handle setting up the condition values\n generate_query_condition_values(val, table_name, field_name, join_table_name)\n\n # And handle any returns value / results config\n generate_returns_config(val, join_table_name, field_name)\n\n # We can add this table to the joins\n @join_tables << join_table_name\n\n end\n end\n end\n end\n\n # Make the list of tables to be joined valid (in case anything slipped through) and unique\n @join_tables = (@join_tables - NonJoinTableNames).uniq\n\n # Specify `no_masters: {}` at the top level to directly query the record, rather than doing\n # an inner join on the masters table\n if @condition_config.respond_to?(:key?) && @condition_config.key?(:no_masters) ||\n @condition_config.map(&:first).include?(:no_masters)\n # Use the first specified table as the base, not joining on masters table\n @join_tables.delete_if { |a| a == :no_masters }\n rn = @join_tables.first\n r = Resources::Models.find_by(resource_name: rn)\n raise FphsException, \"No resource found for #{rn} with no_masters specified in calc_actions\" unless r\n\n c = r.class_name.constantize\n @base_query = c.all\n @current_scope = c.all\n return\n end\n\n # Specify `masters: {...}` to not tie the action to the item's current master, but instead use the\n # set of masters specified. `{}` indicates any master, or use standard conditions to specify a list of ids,\n # such as { id: [1,2,3] }\n if @condition_config.respond_to?(:key?) && @condition_config.key?(:masters) ||\n @condition_config.map(&:first).include?(:masters)\n # Use the full masters table as the base, allowing the configuration to limit the masters records if needed\n @base_query = Master.all\n @current_scope = Master.all\n @join_tables.delete_if { |a| a == :masters }\n end\n\n if @join_tables.first == :users\n # Get the users records without a join to the masters table, which makes no sense\n @base_query = User.all\n @current_scope = User.all\n elsif %i[all not_all].include? condition_type\n # Inner join, since our conditions require the existence of records in the joined tables\n @base_query = @current_scope.joins(@join_tables)\n else\n # Left join, since our conditions do not absolutely require the existence of records in the joined tables\n @base_query = @current_scope.includes(@join_tables)\n end\n end", "def allow_inconsistency?\n @allowed_inconsistencies ||= (@result_set.size * @options[:error_pct]).floor\n if @allowed_inconsistencies > 0\n @allowed_inconsistencies -= 1\n true\n else\n false\n end\n end", "def prepare_job_and_associations\r\n temp_job = @temp_job\r\n payer_group = '--'\r\n @original_job = Job.includes(:images_for_jobs).find(temp_job.job_id)\r\n @micr_record, payer_group = get_micr_and_payer_group if @original_job.micr_applicable?\r\n\r\n job = prepare_job\r\n job.payer_group = payer_group\r\n job.is_correspondence = @original_job.is_correspondence\r\n\r\n check_information = prepare_check\r\n job.check_informations << check_information\r\n check_information.micr_line_information = @micr_record if @micr_record\r\n\r\n Batch.where(:id => @original_job.batch_id).update_all(:associated_entity_updated_at => Time.now)\r\n job\r\n end", "def create_join_excluded_tbl(preserve_null_pk = true)\n if @excluded_join_tbl.nil?\n join_list =join_list()\n cross_join_from = ''\n full_join_from = ''\n satisfied_tbl = create_satisfied_tbl()\n 0.upto(join_list.count-1) do |i|\n join = join_list.find{|j| j['id'] ==i }\n l_rel_list = join['l_rel_list']\n quals = join['quals']\n q = ReverseParseTree.whereClauseConst(quals)\n has_quals = (not join['quals'].nil?)\n join_type = ReverseParseTree.joinTypeConvert(join['jointype'].to_s, has_quals)\n\n r_rel = join['r_rel_list'][0]\n l_arg = (i==0 ? \"#{l_rel_list[0].relname} #{l_rel_list[0].relalias}\" : \"\")\n # for efficiency only change the last join to cross join\n if i == join_list.count-1\n cross_join_from = cross_join_from + \"#{l_arg} CROSS JOIN #{r_rel.relname} #{r_rel.relalias} \"\n else\n cross_join_from = cross_join_from + \"#{l_arg} #{join_type} #{r_rel.relname} #{r_rel.relalias} on #{q} \"\n end\n # full_join_from = full_join_from + \"#{l_arg} CROSS JOIN #{r_rel.relname} #{r_rel.relalias} on #{q}\"\n end\n @excluded_join_tbl = \"#{@table}_join_excluded\"\n # renamed_pk_col = @pk_full_list.map { |pk| \"#{pk['col']} as #{pk['alias']}_pk\" }.join(', ')\n \n if preserve_null_pk\n renamed_pk_col = @pk_full_list.map { |pk| \"#{pk['col']} as #{pk['alias']}_pk\" }.join(', ')\n else\n renamed_pk_col = @pk_full_list.map do |pk|\n pkcol = @all_cols.find{|col| col.colname == pk['colname'] and col.relname==pk['relname']}\n \"COALESCE(#{pkcol.select_name},#{pkcol.null_replacement}) as #{pkcol.colalias}_pk\"\n end.join(',')\n end\n targetListReplacement = \"#{renamed_pk_col},#{@all_cols_select}\"\n query = ReverseParseTree.reverseAndreplace(@parseTree, targetListReplacement, '')\n old_from = from_query()\n # cross join\n all_cols_renamed()\n cross_join_query = query.gsub(/#{old_from}/i,cross_join_from)\n # pk_join_satisfied_tbl = @pk_full_list.map { |pk| \"t.#{pk['alias']}_pk = s.#{pk['alias']}_pk\" }.join(' AND ')\n # pk_not_in_satisfied_tbl = @pk_full_list.map { |pk| \"s.#{pk['alias']}_pk is null\" }.join(' OR ')\n\n create_tbl_query = \"select * from #{satisfied_tbl} where 1=2\"\n create_tbl_query = QueryBuilder.create_tbl(@excluded_join_tbl, '', create_tbl_query)\n DBConn.exec(create_tbl_query)\n # limit to 1000 rows due to resource limitation\n cross_join_query = \"with cross_join as (#{cross_join_query} limit 1000) INSERT INTO #{@excluded_join_tbl} select * from (select t.* from cross_join as t except select * from #{satisfied_tbl}) as tmp\"\n puts cross_join_query\n DBConn.exec(cross_join_query)\n\n # unless preserve_null_pk\n # pk = @pk_full_list.map { |pk| \"#{pk['alias']}_pk\" }.join(',')\n # DBConn.update_null_columns(@excluded_join_tbl,pk)\n # end\n # # full join\n # full_join_query = query.gsub(old_from,full_join_from)\n # full_join_query = \"(#{full_join_query} except select #{@all_cols_renamed} from #{satisfied_tbl})\"\n # full_join_query = \"INSERT INTO #{@excluded_tbl} #{full_join_query}\"\n # DBConn.exec(query)\n end\n return @excluded_join_tbl\n end", "def aggregate\r\n calc_id = Calculation.find(params[:id]).id\r\n # loeschen alter Werte\r\n Demand0.where(calculation_id: calc_id).delete_all\r\n Demand1.where(calculation_id: calc_id).delete_all\r\n Demand2.where(calculation_id: calc_id).delete_all\r\n @specialty = Specialty.all\r\n\r\n #if Demand0.where(calculation_id: calc_id).empty?\r\n \r\n dem_mon = 0\r\n dem_tue = 0\r\n dem_wed = 0\r\n dem_thu = 0\r\n dem_fri = 0\r\n\r\n# Fuer alle Specialties summiere die OP Zeiten der Patienten Typ 0 \r\n @specialty.each do |n|\r\n dem_mon = Patient.where(:specialty_id => [Specialty.find(n).id]).where(:startday_of_stay =>'Mon').where(:type_of_patient =>'0').sum(:op_time)\r\n dem_tue = Patient.where(:specialty_id => [Specialty.find(n).id]).where(:startday_of_stay =>'Tue').where(:type_of_patient =>'0').sum(:op_time)\r\n dem_wed = Patient.where(:specialty_id => [Specialty.find(n).id]).where(:startday_of_stay =>'Wed').where(:type_of_patient =>'0').sum(:op_time)\r\n dem_thu = Patient.where(:specialty_id => [Specialty.find(n).id]).where(:startday_of_stay =>'Thu').where(:type_of_patient =>'0').sum(:op_time)\r\n dem_fri = Patient.where(:specialty_id => [Specialty.find(n).id]).where(:startday_of_stay =>'Fri').where(:type_of_patient =>'0').sum(:op_time)\r\n Demand0.create!(calculation_id: calc_id, specialty_id: Specialty.find(n).id, Mon: dem_mon, Tue: dem_tue, Wed: dem_wed, Thu: dem_thu, Fri: dem_fri)\r\n end\r\n\r\n @specialty.each do |m|\r\n dem_mon = Patient.where(:specialty_id => [Specialty.find(m).id]).where(:startday_of_stay =>'Mon').where(:type_of_patient =>'1').sum(:op_time)\r\n dem_tue = Patient.where(:specialty_id => [Specialty.find(m).id]).where(:startday_of_stay =>'Tue').where(:type_of_patient =>'1').sum(:op_time)\r\n dem_wed = Patient.where(:specialty_id => [Specialty.find(m).id]).where(:startday_of_stay =>'Wed').where(:type_of_patient =>'1').sum(:op_time)\r\n dem_thu = Patient.where(:specialty_id => [Specialty.find(m).id]).where(:startday_of_stay =>'Thu').where(:type_of_patient =>'1').sum(:op_time)\r\n dem_fri = Patient.where(:specialty_id => [Specialty.find(m).id]).where(:startday_of_stay =>'Fri').where(:type_of_patient =>'1').sum(:op_time)\r\n Demand1.create!(calculation_id: calc_id, specialty_id: Specialty.find(m).id, Mon: dem_mon, Tue: dem_tue, Wed: dem_wed, Thu: dem_thu, Fri: dem_fri)\r\n end\r\n\r\n @specialty.each do |o|\r\n dem_mon = Patient.where(:specialty_id => [Specialty.find(o).id]).where(:startday_of_stay =>'Mon').where(:type_of_patient =>'2').sum(:op_time)\r\n dem_tue = Patient.where(:specialty_id => [Specialty.find(o).id]).where(:startday_of_stay =>'Tue').where(:type_of_patient =>'2').sum(:op_time)\r\n dem_wed = Patient.where(:specialty_id => [Specialty.find(o).id]).where(:startday_of_stay =>'Wed').where(:type_of_patient =>'2').sum(:op_time)\r\n dem_thu = Patient.where(:specialty_id => [Specialty.find(o).id]).where(:startday_of_stay =>'Thu').where(:type_of_patient =>'2').sum(:op_time)\r\n dem_fri = Patient.where(:specialty_id => [Specialty.find(o).id]).where(:startday_of_stay =>'Fri').where(:type_of_patient =>'2').sum(:op_time)\r\n Demand2.create!(calculation_id: calc_id, specialty_id: Specialty.find(o).id, Mon: dem_mon, Tue: dem_tue, Wed: dem_wed, Thu: dem_thu, Fri: dem_fri)\r\n end\r\n\r\n flash[:started] = \"Demands calculated!\"\r\n redirect_to calculations_path\r\n # else\r\n # flash[:not_available] = \"Demands already aggregated!\"\r\n # redirect_to calculations_path\r\n # end\r\n end", "def clean_members(fix=false)\n before_report 'Members'\n Member.all.each do |m|\n #* check_and_fix_link(m, :residence_location, m.name)\n check_and_fix_link(m, :work_location, m.name)\n check_and_fix_link(m, :family, m.name)\n check_and_fix_link(m, :status, m.name)\n check_and_fix_link(m, :spouse, m.name)\n check_and_fix_link(m, :country, m.name)\n check_and_fix_link(m, :ministry, m.name)\n p = m.personnel_data\n if p\n check_and_fix_link(p, :employment_status, m.name)\n check_and_fix_link(p, :education, m.name)\n p.save if p.changed? & fix\n end\n m.update_record_without_timestamping if m.changed? & fix\n end # each member\n after_report 'Members', fix\n end", "def update_department_organization_and_area_in_stats_counters\n true\n end", "def assign_disorders_scores\n # Check if disorders_scores exist then add relationship\n end", "def CheckForNewSpecial(db, award, query, selection=\"having CHECKED_SCORE > RECORD order by CHECKED_SCORE desc\", isCA)\n res = db.query(\"select LOG.ID, QTH, MULTIPLIER.ID, CHECKED_SCORE, CHECKED_MULT, TRUNCATE(CLAIMED_CW_Q + - D2_CW - 0.5*D1_CW,0) AS CW_QSOS, TRUNCATE(CLAIMED_PH_Q - D2_PH - 0.5*D1_PH,0) as PH_QSOS, SCORE.T2_58, MAX(SPECIAL.SCORE) as RECORD, MIN(SPECIAL.T2_58) as TIMERECORD from LOG, SCORE, SPECIAL,MULTIPLIER where LOG.ID=SCORE.LOG_ID and SCORE.QTH=MULTIPLIER.NAME and LOG.CONTEST_YEAR=#{THISYEAR} and SPECIAL.NAME = \\\"#{award}\\\" #{query} group by LOG.ID, QTH #{selection} limit 1\")\n res.each(:as => :array) { |row|\n name = OpName(db, row[0].to_i)\n db.query(\"insert into SPECIAL (LOG_ID, NAME, STATION, YEAR, SCORE, QSOs, MULTIPLIERS, T2_58, CA) values (#{row[0]}, \\\"#{award}\\\", \\\"#{name}\\\", #{THISYEAR}, #{row[3]}, #{row[5].to_i + row[6].to_i}, #{row[4]}, #{row[7] ? (\"\\\"\" + row[7] + \"\\\"\") : \"NULL\"}, #{isCA})\")\n print \"New score for #{award} by #{name}\\n\"\n }\nend", "def addFeaturesAndLabel(earliest_date, latest_date, examples, labels)\n all_games = Game.where(\"game_date > ? AND game_date < ?\", earliest_date, latest_date)\n\n all_games.each do |game|\n feature = Feature.find_by_game_id(game.id)\n if feature == nil\n feature = Feature.new\n feature.game_id = game.id\n feature.home_team_won = game.home_team_won\n feature.save\n end\n\n feature_set = []\n\n # Add in individual features\n feature_set << feature.h2h_diff_1\n feature_set << feature.h2h_diff_2\n feature_set << feature.h2h_diff_3\n \n#=begin\n feature_set << feature.run_differentials_1\n feature_set << feature.opp_differentials_1\n feature_set << feature.run_differentials_2\n feature_set << feature.opp_differentials_2\n feature_set << feature.run_differentials_5\n feature_set << feature.opp_differentials_5\n feature_set << feature.run_differentials_10\n feature_set << feature.opp_differentials_10\n feature_set << feature.run_differentials_20\n feature_set << feature.opp_differentials_20\n\n feature_set << feature.win_differentials_1\n feature_set << feature.opp_win_differentials_1\n feature_set << feature.win_differentials_2\n feature_set << feature.opp_win_differentials_2\n feature_set << feature.win_differentials_5\n feature_set << feature.opp_win_differentials_5\n feature_set << feature.win_differentials_10\n feature_set << feature.opp_win_differentials_10\n feature_set << feature.win_differentials_20\n feature_set << feature.opp_win_differentials_20\n#=end\n\n=begin\n # Add in the differences between features. Could be preferable?\n feature_set << feature.run_differentials_1 - feature.opp_differentials_1\n feature_set << feature.run_differentials_2 - feature.opp_differentials_2\n feature_set << feature.run_differentials_5 - feature.opp_differentials_5\n feature_set << feature.run_differentials_10 - feature.opp_differentials_10\n feature_set << feature.run_differentials_20 - feature.opp_differentials_20\n \n feature_set << feature.win_differentials_1 - feature.opp_win_differentials_1\n feature_set << feature.win_differentials_2 - feature.opp_win_differentials_2\n feature_set << feature.win_differentials_5 - feature.opp_win_differentials_5\n feature_set << feature.win_differentials_10 - feature.opp_win_differentials_10\n feature_set << feature.win_differentials_20 - feature.opp_win_differentials_20\n=end\n\n#=begin\n feature_set << feature.home_batting_spot_1_walks_last_1_game\n feature_set << feature.home_batting_spot_2_walks_last_1_game\n feature_set << feature.home_batting_spot_3_walks_last_1_game\n feature_set << feature.home_batting_spot_4_walks_last_1_game\n feature_set << feature.home_batting_spot_5_walks_last_1_game\n feature_set << feature.home_batting_spot_6_walks_last_1_game\n feature_set << feature.home_batting_spot_7_walks_last_1_game\n feature_set << feature.home_batting_spot_8_walks_last_1_game\n feature_set << feature.home_batting_spot_9_walks_last_1_game\n\n feature_set << feature.away_batting_spot_1_walks_last_1_game\n feature_set << feature.away_batting_spot_2_walks_last_1_game\n feature_set << feature.away_batting_spot_3_walks_last_1_game\n feature_set << feature.away_batting_spot_4_walks_last_1_game\n feature_set << feature.away_batting_spot_5_walks_last_1_game\n feature_set << feature.away_batting_spot_6_walks_last_1_game\n feature_set << feature.away_batting_spot_7_walks_last_1_game\n feature_set << feature.away_batting_spot_8_walks_last_1_game\n feature_set << feature.away_batting_spot_9_walks_last_1_game\n\n feature_set << feature.home_batting_spot_1_walks_last_2_games\n feature_set << feature.home_batting_spot_2_walks_last_2_games\n feature_set << feature.home_batting_spot_3_walks_last_2_games\n feature_set << feature.home_batting_spot_4_walks_last_2_games\n feature_set << feature.home_batting_spot_5_walks_last_2_games\n feature_set << feature.home_batting_spot_6_walks_last_2_games\n feature_set << feature.home_batting_spot_7_walks_last_2_games\n feature_set << feature.home_batting_spot_8_walks_last_2_games\n feature_set << feature.home_batting_spot_9_walks_last_2_games\n\n feature_set << feature.away_batting_spot_1_walks_last_2_games\n feature_set << feature.away_batting_spot_2_walks_last_2_games\n feature_set << feature.away_batting_spot_3_walks_last_2_games\n feature_set << feature.away_batting_spot_4_walks_last_2_games\n feature_set << feature.away_batting_spot_5_walks_last_2_games\n feature_set << feature.away_batting_spot_6_walks_last_2_games\n feature_set << feature.away_batting_spot_7_walks_last_2_games\n feature_set << feature.away_batting_spot_8_walks_last_2_games\n feature_set << feature.away_batting_spot_9_walks_last_2_games\n\n feature_set << feature.home_batting_spot_1_walks_last_5_games\n feature_set << feature.home_batting_spot_2_walks_last_5_games\n feature_set << feature.home_batting_spot_3_walks_last_5_games\n feature_set << feature.home_batting_spot_4_walks_last_5_games\n feature_set << feature.home_batting_spot_5_walks_last_5_games\n feature_set << feature.home_batting_spot_6_walks_last_5_games\n feature_set << feature.home_batting_spot_7_walks_last_5_games\n feature_set << feature.home_batting_spot_8_walks_last_5_games\n feature_set << feature.home_batting_spot_9_walks_last_5_games\n\n feature_set << feature.away_batting_spot_1_walks_last_5_games\n feature_set << feature.away_batting_spot_2_walks_last_5_games\n feature_set << feature.away_batting_spot_3_walks_last_5_games\n feature_set << feature.away_batting_spot_4_walks_last_5_games\n feature_set << feature.away_batting_spot_5_walks_last_5_games\n feature_set << feature.away_batting_spot_6_walks_last_5_games\n feature_set << feature.away_batting_spot_7_walks_last_5_games\n feature_set << feature.away_batting_spot_8_walks_last_5_games\n feature_set << feature.away_batting_spot_9_walks_last_5_games\n\n feature_set << feature.home_batting_spot_1_walks_last_10_games\n feature_set << feature.home_batting_spot_2_walks_last_10_games\n feature_set << feature.home_batting_spot_3_walks_last_10_games\n feature_set << feature.home_batting_spot_4_walks_last_10_games\n feature_set << feature.home_batting_spot_5_walks_last_10_games\n feature_set << feature.home_batting_spot_6_walks_last_10_games\n feature_set << feature.home_batting_spot_7_walks_last_10_games\n feature_set << feature.home_batting_spot_8_walks_last_10_games\n feature_set << feature.home_batting_spot_9_walks_last_10_games\n\n feature_set << feature.away_batting_spot_1_walks_last_10_games\n feature_set << feature.away_batting_spot_2_walks_last_10_games\n feature_set << feature.away_batting_spot_3_walks_last_10_games\n feature_set << feature.away_batting_spot_4_walks_last_10_games\n feature_set << feature.away_batting_spot_5_walks_last_10_games\n feature_set << feature.away_batting_spot_6_walks_last_10_games\n feature_set << feature.away_batting_spot_7_walks_last_10_games\n feature_set << feature.away_batting_spot_8_walks_last_10_games\n feature_set << feature.away_batting_spot_9_walks_last_10_games\n\n feature_set << feature.home_batting_spot_1_walks_last_20_games\n feature_set << feature.home_batting_spot_2_walks_last_20_games\n feature_set << feature.home_batting_spot_3_walks_last_20_games\n feature_set << feature.home_batting_spot_4_walks_last_20_games\n feature_set << feature.home_batting_spot_5_walks_last_20_games\n feature_set << feature.home_batting_spot_6_walks_last_20_games\n feature_set << feature.home_batting_spot_7_walks_last_20_games\n feature_set << feature.home_batting_spot_8_walks_last_20_games\n feature_set << feature.home_batting_spot_9_walks_last_20_games\n\n feature_set << feature.away_batting_spot_1_walks_last_20_games\n feature_set << feature.away_batting_spot_2_walks_last_20_games\n feature_set << feature.away_batting_spot_3_walks_last_20_games\n feature_set << feature.away_batting_spot_4_walks_last_20_games\n feature_set << feature.away_batting_spot_5_walks_last_20_games\n feature_set << feature.away_batting_spot_6_walks_last_20_games\n feature_set << feature.away_batting_spot_7_walks_last_20_games\n feature_set << feature.away_batting_spot_8_walks_last_20_games\n feature_set << feature.away_batting_spot_9_walks_last_20_games\n\n feature_set << feature.home_batting_spot_1_batting_percentage_last_1_game\n feature_set << feature.home_batting_spot_2_batting_percentage_last_1_game\n feature_set << feature.home_batting_spot_3_batting_percentage_last_1_game\n feature_set << feature.home_batting_spot_4_batting_percentage_last_1_game\n feature_set << feature.home_batting_spot_5_batting_percentage_last_1_game\n feature_set << feature.home_batting_spot_6_batting_percentage_last_1_game\n feature_set << feature.home_batting_spot_7_batting_percentage_last_1_game\n feature_set << feature.home_batting_spot_8_batting_percentage_last_1_game\n feature_set << feature.home_batting_spot_9_batting_percentage_last_1_game\n\n feature_set << feature.away_batting_spot_1_batting_percentage_last_1_game\n feature_set << feature.away_batting_spot_2_batting_percentage_last_1_game\n feature_set << feature.away_batting_spot_3_batting_percentage_last_1_game\n feature_set << feature.away_batting_spot_4_batting_percentage_last_1_game\n feature_set << feature.away_batting_spot_5_batting_percentage_last_1_game\n feature_set << feature.away_batting_spot_6_batting_percentage_last_1_game\n feature_set << feature.away_batting_spot_7_batting_percentage_last_1_game\n feature_set << feature.away_batting_spot_8_batting_percentage_last_1_game\n feature_set << feature.away_batting_spot_9_batting_percentage_last_1_game\n\n feature_set << feature.home_batting_spot_1_batting_percentage_last_2_games\n feature_set << feature.home_batting_spot_2_batting_percentage_last_2_games\n feature_set << feature.home_batting_spot_3_batting_percentage_last_2_games\n feature_set << feature.home_batting_spot_4_batting_percentage_last_2_games\n feature_set << feature.home_batting_spot_5_batting_percentage_last_2_games\n feature_set << feature.home_batting_spot_6_batting_percentage_last_2_games\n feature_set << feature.home_batting_spot_7_batting_percentage_last_2_games\n feature_set << feature.home_batting_spot_8_batting_percentage_last_2_games\n feature_set << feature.home_batting_spot_9_batting_percentage_last_2_games\n\n feature_set << feature.away_batting_spot_1_batting_percentage_last_2_games\n feature_set << feature.away_batting_spot_2_batting_percentage_last_2_games\n feature_set << feature.away_batting_spot_3_batting_percentage_last_2_games\n feature_set << feature.away_batting_spot_4_batting_percentage_last_2_games\n feature_set << feature.away_batting_spot_5_batting_percentage_last_2_games\n feature_set << feature.away_batting_spot_6_batting_percentage_last_2_games\n feature_set << feature.away_batting_spot_7_batting_percentage_last_2_games\n feature_set << feature.away_batting_spot_8_batting_percentage_last_2_games\n feature_set << feature.away_batting_spot_9_batting_percentage_last_2_games\n\n feature_set << feature.home_batting_spot_1_batting_percentage_last_5_games\n feature_set << feature.home_batting_spot_2_batting_percentage_last_5_games\n feature_set << feature.home_batting_spot_3_batting_percentage_last_5_games\n feature_set << feature.home_batting_spot_4_batting_percentage_last_5_games\n feature_set << feature.home_batting_spot_5_batting_percentage_last_5_games\n feature_set << feature.home_batting_spot_6_batting_percentage_last_5_games\n feature_set << feature.home_batting_spot_7_batting_percentage_last_5_games\n feature_set << feature.home_batting_spot_8_batting_percentage_last_5_games\n feature_set << feature.home_batting_spot_9_batting_percentage_last_5_games\n\n feature_set << feature.away_batting_spot_1_batting_percentage_last_5_games\n feature_set << feature.away_batting_spot_2_batting_percentage_last_5_games\n feature_set << feature.away_batting_spot_3_batting_percentage_last_5_games\n feature_set << feature.away_batting_spot_4_batting_percentage_last_5_games\n feature_set << feature.away_batting_spot_5_batting_percentage_last_5_games\n feature_set << feature.away_batting_spot_6_batting_percentage_last_5_games\n feature_set << feature.away_batting_spot_7_batting_percentage_last_5_games\n feature_set << feature.away_batting_spot_8_batting_percentage_last_5_games\n feature_set << feature.away_batting_spot_9_batting_percentage_last_5_games\n\n feature_set << feature.home_batting_spot_1_batting_percentage_last_10_games\n feature_set << feature.home_batting_spot_2_batting_percentage_last_10_games\n feature_set << feature.home_batting_spot_3_batting_percentage_last_10_games\n feature_set << feature.home_batting_spot_4_batting_percentage_last_10_games\n feature_set << feature.home_batting_spot_5_batting_percentage_last_10_games\n feature_set << feature.home_batting_spot_6_batting_percentage_last_10_games\n feature_set << feature.home_batting_spot_7_batting_percentage_last_10_games\n feature_set << feature.home_batting_spot_8_batting_percentage_last_10_games\n feature_set << feature.home_batting_spot_9_batting_percentage_last_10_games\n\n feature_set << feature.away_batting_spot_1_batting_percentage_last_10_games\n feature_set << feature.away_batting_spot_2_batting_percentage_last_10_games\n feature_set << feature.away_batting_spot_3_batting_percentage_last_10_games\n feature_set << feature.away_batting_spot_4_batting_percentage_last_10_games\n feature_set << feature.away_batting_spot_5_batting_percentage_last_10_games\n feature_set << feature.away_batting_spot_6_batting_percentage_last_10_games\n feature_set << feature.away_batting_spot_7_batting_percentage_last_10_games\n feature_set << feature.away_batting_spot_8_batting_percentage_last_10_games\n feature_set << feature.away_batting_spot_9_batting_percentage_last_10_games\n\n feature_set << feature.home_batting_spot_1_batting_percentage_last_20_games\n feature_set << feature.home_batting_spot_2_batting_percentage_last_20_games\n feature_set << feature.home_batting_spot_3_batting_percentage_last_20_games\n feature_set << feature.home_batting_spot_4_batting_percentage_last_20_games\n feature_set << feature.home_batting_spot_5_batting_percentage_last_20_games\n feature_set << feature.home_batting_spot_6_batting_percentage_last_20_games\n feature_set << feature.home_batting_spot_7_batting_percentage_last_20_games\n feature_set << feature.home_batting_spot_8_batting_percentage_last_20_games\n feature_set << feature.home_batting_spot_9_batting_percentage_last_20_games\n\n feature_set << feature.away_batting_spot_1_batting_percentage_last_20_games\n feature_set << feature.away_batting_spot_2_batting_percentage_last_20_games\n feature_set << feature.away_batting_spot_3_batting_percentage_last_20_games\n feature_set << feature.away_batting_spot_4_batting_percentage_last_20_games\n feature_set << feature.away_batting_spot_5_batting_percentage_last_20_games\n feature_set << feature.away_batting_spot_6_batting_percentage_last_20_games\n feature_set << feature.away_batting_spot_7_batting_percentage_last_20_games\n feature_set << feature.away_batting_spot_8_batting_percentage_last_20_games\n feature_set << feature.away_batting_spot_9_batting_percentage_last_20_games\n\n feature_set << feature.home_batting_spot_1_OPS_last_1_game\n feature_set << feature.home_batting_spot_2_OPS_last_1_game\n feature_set << feature.home_batting_spot_3_OPS_last_1_game\n feature_set << feature.home_batting_spot_4_OPS_last_1_game\n feature_set << feature.home_batting_spot_5_OPS_last_1_game\n feature_set << feature.home_batting_spot_6_OPS_last_1_game\n feature_set << feature.home_batting_spot_7_OPS_last_1_game\n feature_set << feature.home_batting_spot_8_OPS_last_1_game\n feature_set << feature.home_batting_spot_9_OPS_last_1_game\n\n feature_set << feature.away_batting_spot_1_OPS_last_1_game\n feature_set << feature.away_batting_spot_2_OPS_last_1_game\n feature_set << feature.away_batting_spot_3_OPS_last_1_game\n feature_set << feature.away_batting_spot_4_OPS_last_1_game\n feature_set << feature.away_batting_spot_5_OPS_last_1_game\n feature_set << feature.away_batting_spot_6_OPS_last_1_game\n feature_set << feature.away_batting_spot_7_OPS_last_1_game\n feature_set << feature.away_batting_spot_8_OPS_last_1_game\n feature_set << feature.away_batting_spot_9_OPS_last_1_game\n\n feature_set << feature.home_batting_spot_1_OPS_last_2_games\n feature_set << feature.home_batting_spot_2_OPS_last_2_games\n feature_set << feature.home_batting_spot_3_OPS_last_2_games\n feature_set << feature.home_batting_spot_4_OPS_last_2_games\n feature_set << feature.home_batting_spot_5_OPS_last_2_games\n feature_set << feature.home_batting_spot_6_OPS_last_2_games\n feature_set << feature.home_batting_spot_7_OPS_last_2_games\n feature_set << feature.home_batting_spot_8_OPS_last_2_games\n feature_set << feature.home_batting_spot_9_OPS_last_2_games\n\n feature_set << feature.away_batting_spot_1_OPS_last_2_games\n feature_set << feature.away_batting_spot_2_OPS_last_2_games\n feature_set << feature.away_batting_spot_3_OPS_last_2_games\n feature_set << feature.away_batting_spot_4_OPS_last_2_games\n feature_set << feature.away_batting_spot_5_OPS_last_2_games\n feature_set << feature.away_batting_spot_6_OPS_last_2_games\n feature_set << feature.away_batting_spot_7_OPS_last_2_games\n feature_set << feature.away_batting_spot_8_OPS_last_2_games\n feature_set << feature.away_batting_spot_9_OPS_last_2_games\n\n feature_set << feature.home_batting_spot_1_OPS_last_5_games\n feature_set << feature.home_batting_spot_2_OPS_last_5_games\n feature_set << feature.home_batting_spot_3_OPS_last_5_games\n feature_set << feature.home_batting_spot_4_OPS_last_5_games\n feature_set << feature.home_batting_spot_5_OPS_last_5_games\n feature_set << feature.home_batting_spot_6_OPS_last_5_games\n feature_set << feature.home_batting_spot_7_OPS_last_5_games\n feature_set << feature.home_batting_spot_8_OPS_last_5_games\n feature_set << feature.home_batting_spot_9_OPS_last_5_games\n\n feature_set << feature.away_batting_spot_1_OPS_last_5_games\n feature_set << feature.away_batting_spot_2_OPS_last_5_games\n feature_set << feature.away_batting_spot_3_OPS_last_5_games\n feature_set << feature.away_batting_spot_4_OPS_last_5_games\n feature_set << feature.away_batting_spot_5_OPS_last_5_games\n feature_set << feature.away_batting_spot_6_OPS_last_5_games\n feature_set << feature.away_batting_spot_7_OPS_last_5_games\n feature_set << feature.away_batting_spot_8_OPS_last_5_games\n feature_set << feature.away_batting_spot_9_OPS_last_5_games\n\n feature_set << feature.home_batting_spot_1_OPS_last_10_games\n feature_set << feature.home_batting_spot_2_OPS_last_10_games\n feature_set << feature.home_batting_spot_3_OPS_last_10_games\n feature_set << feature.home_batting_spot_4_OPS_last_10_games\n feature_set << feature.home_batting_spot_5_OPS_last_10_games\n feature_set << feature.home_batting_spot_6_OPS_last_10_games\n feature_set << feature.home_batting_spot_7_OPS_last_10_games\n feature_set << feature.home_batting_spot_8_OPS_last_10_games\n feature_set << feature.home_batting_spot_9_OPS_last_10_games\n\n feature_set << feature.away_batting_spot_1_OPS_last_10_games\n feature_set << feature.away_batting_spot_2_OPS_last_10_games\n feature_set << feature.away_batting_spot_3_OPS_last_10_games\n feature_set << feature.away_batting_spot_4_OPS_last_10_games\n feature_set << feature.away_batting_spot_5_OPS_last_10_games\n feature_set << feature.away_batting_spot_6_OPS_last_10_games\n feature_set << feature.away_batting_spot_7_OPS_last_10_games\n feature_set << feature.away_batting_spot_8_OPS_last_10_games\n feature_set << feature.away_batting_spot_9_OPS_last_10_games\n\n feature_set << feature.home_batting_spot_1_OPS_last_20_games\n feature_set << feature.home_batting_spot_2_OPS_last_20_games\n feature_set << feature.home_batting_spot_3_OPS_last_20_games\n feature_set << feature.home_batting_spot_4_OPS_last_20_games\n feature_set << feature.home_batting_spot_5_OPS_last_20_games\n feature_set << feature.home_batting_spot_6_OPS_last_20_games\n feature_set << feature.home_batting_spot_7_OPS_last_20_games\n feature_set << feature.home_batting_spot_8_OPS_last_20_games\n feature_set << feature.home_batting_spot_9_OPS_last_20_games\n\n feature_set << feature.away_batting_spot_1_OPS_last_20_games\n feature_set << feature.away_batting_spot_2_OPS_last_20_games\n feature_set << feature.away_batting_spot_3_OPS_last_20_games\n feature_set << feature.away_batting_spot_4_OPS_last_20_games\n feature_set << feature.away_batting_spot_5_OPS_last_20_games\n feature_set << feature.away_batting_spot_6_OPS_last_20_games\n feature_set << feature.away_batting_spot_7_OPS_last_20_games\n feature_set << feature.away_batting_spot_8_OPS_last_20_games\n feature_set << feature.away_batting_spot_9_OPS_last_20_games\n\n feature_set << feature.home_batting_spot_1_strikeout_rate_last_1_game\n feature_set << feature.home_batting_spot_2_strikeout_rate_last_1_game\n feature_set << feature.home_batting_spot_3_strikeout_rate_last_1_game\n feature_set << feature.home_batting_spot_4_strikeout_rate_last_1_game\n feature_set << feature.home_batting_spot_5_strikeout_rate_last_1_game\n feature_set << feature.home_batting_spot_6_strikeout_rate_last_1_game\n feature_set << feature.home_batting_spot_7_strikeout_rate_last_1_game\n feature_set << feature.home_batting_spot_8_strikeout_rate_last_1_game\n feature_set << feature.home_batting_spot_9_strikeout_rate_last_1_game\n\n feature_set << feature.away_batting_spot_1_strikeout_rate_last_1_game\n feature_set << feature.away_batting_spot_2_strikeout_rate_last_1_game\n feature_set << feature.away_batting_spot_3_strikeout_rate_last_1_game\n feature_set << feature.away_batting_spot_4_strikeout_rate_last_1_game\n feature_set << feature.away_batting_spot_5_strikeout_rate_last_1_game\n feature_set << feature.away_batting_spot_6_strikeout_rate_last_1_game\n feature_set << feature.away_batting_spot_7_strikeout_rate_last_1_game\n feature_set << feature.away_batting_spot_8_strikeout_rate_last_1_game\n feature_set << feature.away_batting_spot_9_strikeout_rate_last_1_game\n\n feature_set << feature.home_batting_spot_1_strikeout_rate_last_2_games\n feature_set << feature.home_batting_spot_2_strikeout_rate_last_2_games\n feature_set << feature.home_batting_spot_3_strikeout_rate_last_2_games\n feature_set << feature.home_batting_spot_4_strikeout_rate_last_2_games\n feature_set << feature.home_batting_spot_5_strikeout_rate_last_2_games\n feature_set << feature.home_batting_spot_6_strikeout_rate_last_2_games\n feature_set << feature.home_batting_spot_7_strikeout_rate_last_2_games\n feature_set << feature.home_batting_spot_8_strikeout_rate_last_2_games\n feature_set << feature.home_batting_spot_9_strikeout_rate_last_2_games\n\n feature_set << feature.away_batting_spot_1_strikeout_rate_last_2_games\n feature_set << feature.away_batting_spot_2_strikeout_rate_last_2_games\n feature_set << feature.away_batting_spot_3_strikeout_rate_last_2_games\n feature_set << feature.away_batting_spot_4_strikeout_rate_last_2_games\n feature_set << feature.away_batting_spot_5_strikeout_rate_last_2_games\n feature_set << feature.away_batting_spot_6_strikeout_rate_last_2_games\n feature_set << feature.away_batting_spot_7_strikeout_rate_last_2_games\n feature_set << feature.away_batting_spot_8_strikeout_rate_last_2_games\n feature_set << feature.away_batting_spot_9_strikeout_rate_last_2_games\n\n feature_set << feature.home_batting_spot_1_strikeout_rate_last_5_games\n feature_set << feature.home_batting_spot_2_strikeout_rate_last_5_games\n feature_set << feature.home_batting_spot_3_strikeout_rate_last_5_games\n feature_set << feature.home_batting_spot_4_strikeout_rate_last_5_games\n feature_set << feature.home_batting_spot_5_strikeout_rate_last_5_games\n feature_set << feature.home_batting_spot_6_strikeout_rate_last_5_games\n feature_set << feature.home_batting_spot_7_strikeout_rate_last_5_games\n feature_set << feature.home_batting_spot_8_strikeout_rate_last_5_games\n feature_set << feature.home_batting_spot_9_strikeout_rate_last_5_games\n\n feature_set << feature.away_batting_spot_1_strikeout_rate_last_5_games\n feature_set << feature.away_batting_spot_2_strikeout_rate_last_5_games\n feature_set << feature.away_batting_spot_3_strikeout_rate_last_5_games\n feature_set << feature.away_batting_spot_4_strikeout_rate_last_5_games\n feature_set << feature.away_batting_spot_5_strikeout_rate_last_5_games\n feature_set << feature.away_batting_spot_6_strikeout_rate_last_5_games\n feature_set << feature.away_batting_spot_7_strikeout_rate_last_5_games\n feature_set << feature.away_batting_spot_8_strikeout_rate_last_5_games\n feature_set << feature.away_batting_spot_9_strikeout_rate_last_5_games\n\n feature_set << feature.home_batting_spot_1_strikeout_rate_last_10_games\n feature_set << feature.home_batting_spot_2_strikeout_rate_last_10_games\n feature_set << feature.home_batting_spot_3_strikeout_rate_last_10_games\n feature_set << feature.home_batting_spot_4_strikeout_rate_last_10_games\n feature_set << feature.home_batting_spot_5_strikeout_rate_last_10_games\n feature_set << feature.home_batting_spot_6_strikeout_rate_last_10_games\n feature_set << feature.home_batting_spot_7_strikeout_rate_last_10_games\n feature_set << feature.home_batting_spot_8_strikeout_rate_last_10_games\n feature_set << feature.home_batting_spot_9_strikeout_rate_last_10_games\n\n feature_set << feature.away_batting_spot_1_strikeout_rate_last_10_games\n feature_set << feature.away_batting_spot_2_strikeout_rate_last_10_games\n feature_set << feature.away_batting_spot_3_strikeout_rate_last_10_games\n feature_set << feature.away_batting_spot_4_strikeout_rate_last_10_games\n feature_set << feature.away_batting_spot_5_strikeout_rate_last_10_games\n feature_set << feature.away_batting_spot_6_strikeout_rate_last_10_games\n feature_set << feature.away_batting_spot_7_strikeout_rate_last_10_games\n feature_set << feature.away_batting_spot_8_strikeout_rate_last_10_games\n feature_set << feature.away_batting_spot_9_strikeout_rate_last_10_games\n\n feature_set << feature.home_batting_spot_1_strikeout_rate_last_20_games\n feature_set << feature.home_batting_spot_2_strikeout_rate_last_20_games\n feature_set << feature.home_batting_spot_3_strikeout_rate_last_20_games\n feature_set << feature.home_batting_spot_4_strikeout_rate_last_20_games\n feature_set << feature.home_batting_spot_5_strikeout_rate_last_20_games\n feature_set << feature.home_batting_spot_6_strikeout_rate_last_20_games\n feature_set << feature.home_batting_spot_7_strikeout_rate_last_20_games\n feature_set << feature.home_batting_spot_8_strikeout_rate_last_20_games\n feature_set << feature.home_batting_spot_9_strikeout_rate_last_20_games\n\n feature_set << feature.away_batting_spot_1_strikeout_rate_last_20_games\n feature_set << feature.away_batting_spot_2_strikeout_rate_last_20_games\n feature_set << feature.away_batting_spot_3_strikeout_rate_last_20_games\n feature_set << feature.away_batting_spot_4_strikeout_rate_last_20_games\n feature_set << feature.away_batting_spot_5_strikeout_rate_last_20_games\n feature_set << feature.away_batting_spot_6_strikeout_rate_last_20_games\n feature_set << feature.away_batting_spot_7_strikeout_rate_last_20_games\n feature_set << feature.away_batting_spot_8_strikeout_rate_last_20_games\n feature_set << feature.away_batting_spot_9_strikeout_rate_last_20_games\n \n feature_set << feature.home_batting_spot_1_walks_per_game_career\n feature_set << feature.home_batting_spot_2_walks_per_game_career\n feature_set << feature.home_batting_spot_3_walks_per_game_career\n feature_set << feature.home_batting_spot_4_walks_per_game_career\n feature_set << feature.home_batting_spot_5_walks_per_game_career\n feature_set << feature.home_batting_spot_6_walks_per_game_career\n feature_set << feature.home_batting_spot_7_walks_per_game_career\n feature_set << feature.home_batting_spot_8_walks_per_game_career\n feature_set << feature.home_batting_spot_9_walks_per_game_career\n \n feature_set << feature.away_batting_spot_1_walks_per_game_career\n feature_set << feature.away_batting_spot_2_walks_per_game_career\n feature_set << feature.away_batting_spot_3_walks_per_game_career\n feature_set << feature.away_batting_spot_4_walks_per_game_career\n feature_set << feature.away_batting_spot_5_walks_per_game_career\n feature_set << feature.away_batting_spot_6_walks_per_game_career\n feature_set << feature.away_batting_spot_7_walks_per_game_career\n feature_set << feature.away_batting_spot_8_walks_per_game_career\n feature_set << feature.away_batting_spot_9_walks_per_game_career\n \n feature_set << feature.home_batting_spot_1_batting_percentage_career\n feature_set << feature.home_batting_spot_2_batting_percentage_career\n feature_set << feature.home_batting_spot_3_batting_percentage_career\n feature_set << feature.home_batting_spot_4_batting_percentage_career\n feature_set << feature.home_batting_spot_5_batting_percentage_career\n feature_set << feature.home_batting_spot_6_batting_percentage_career\n feature_set << feature.home_batting_spot_7_batting_percentage_career\n feature_set << feature.home_batting_spot_8_batting_percentage_career\n feature_set << feature.home_batting_spot_9_batting_percentage_career\n \n feature_set << feature.away_batting_spot_1_batting_percentage_career\n feature_set << feature.away_batting_spot_2_batting_percentage_career\n feature_set << feature.away_batting_spot_3_batting_percentage_career\n feature_set << feature.away_batting_spot_4_batting_percentage_career\n feature_set << feature.away_batting_spot_5_batting_percentage_career\n feature_set << feature.away_batting_spot_6_batting_percentage_career\n feature_set << feature.away_batting_spot_7_batting_percentage_career\n feature_set << feature.away_batting_spot_8_batting_percentage_career\n feature_set << feature.away_batting_spot_9_batting_percentage_career\n \n feature_set << feature.home_batting_spot_1_OPS_career\n feature_set << feature.home_batting_spot_2_OPS_career\n feature_set << feature.home_batting_spot_3_OPS_career\n feature_set << feature.home_batting_spot_4_OPS_career\n feature_set << feature.home_batting_spot_5_OPS_career\n feature_set << feature.home_batting_spot_6_OPS_career\n feature_set << feature.home_batting_spot_7_OPS_career\n feature_set << feature.home_batting_spot_8_OPS_career\n feature_set << feature.home_batting_spot_9_OPS_career\n \n feature_set << feature.away_batting_spot_1_OPS_career\n feature_set << feature.away_batting_spot_2_OPS_career\n feature_set << feature.away_batting_spot_3_OPS_career\n feature_set << feature.away_batting_spot_4_OPS_career\n feature_set << feature.away_batting_spot_5_OPS_career\n feature_set << feature.away_batting_spot_6_OPS_career\n feature_set << feature.away_batting_spot_7_OPS_career\n feature_set << feature.away_batting_spot_8_OPS_career\n feature_set << feature.away_batting_spot_9_OPS_career\n \n feature_set << feature.home_batting_spot_1_strikeout_rate_career\n feature_set << feature.home_batting_spot_2_strikeout_rate_career\n feature_set << feature.home_batting_spot_3_strikeout_rate_career\n feature_set << feature.home_batting_spot_4_strikeout_rate_career\n feature_set << feature.home_batting_spot_5_strikeout_rate_career\n feature_set << feature.home_batting_spot_6_strikeout_rate_career\n feature_set << feature.home_batting_spot_7_strikeout_rate_career\n feature_set << feature.home_batting_spot_8_strikeout_rate_career\n feature_set << feature.home_batting_spot_9_strikeout_rate_career\n \n feature_set << feature.away_batting_spot_1_strikeout_rate_career\n feature_set << feature.away_batting_spot_2_strikeout_rate_career\n feature_set << feature.away_batting_spot_3_strikeout_rate_career\n feature_set << feature.away_batting_spot_4_strikeout_rate_career\n feature_set << feature.away_batting_spot_5_strikeout_rate_career\n feature_set << feature.away_batting_spot_6_strikeout_rate_career\n feature_set << feature.away_batting_spot_7_strikeout_rate_career\n feature_set << feature.away_batting_spot_8_strikeout_rate_career\n feature_set << feature.away_batting_spot_9_strikeout_rate_career \n#=end\n\n=begin\n feature_set << feature.home_batting_spot_1_walks_last_1_game - feature.away_batting_spot_1_walks_last_1_game\n feature_set << feature.home_batting_spot_2_walks_last_1_game - feature.away_batting_spot_2_walks_last_1_game\n feature_set << feature.home_batting_spot_3_walks_last_1_game - feature.away_batting_spot_3_walks_last_1_game\n feature_set << feature.home_batting_spot_4_walks_last_1_game - feature.away_batting_spot_4_walks_last_1_game\n feature_set << feature.home_batting_spot_5_walks_last_1_game - feature.away_batting_spot_5_walks_last_1_game\n feature_set << feature.home_batting_spot_6_walks_last_1_game - feature.away_batting_spot_6_walks_last_1_game\n feature_set << feature.home_batting_spot_7_walks_last_1_game - feature.away_batting_spot_7_walks_last_1_game\n feature_set << feature.home_batting_spot_8_walks_last_1_game - feature.away_batting_spot_8_walks_last_1_game\n feature_set << feature.home_batting_spot_9_walks_last_1_game - feature.away_batting_spot_9_walks_last_1_game\n=end\n\n=begin\n walk_diff = 0\n walk_diff += feature.home_batting_spot_1_walks_last_1_game - feature.away_batting_spot_1_walks_last_1_game\n walk_diff += feature.home_batting_spot_2_walks_last_1_game - feature.away_batting_spot_2_walks_last_1_game\n walk_diff += feature.home_batting_spot_3_walks_last_1_game - feature.away_batting_spot_3_walks_last_1_game\n walk_diff += feature.home_batting_spot_4_walks_last_1_game - feature.away_batting_spot_4_walks_last_1_game\n walk_diff += feature.home_batting_spot_5_walks_last_1_game - feature.away_batting_spot_5_walks_last_1_game\n walk_diff += feature.home_batting_spot_6_walks_last_1_game - feature.away_batting_spot_6_walks_last_1_game\n walk_diff += feature.home_batting_spot_7_walks_last_1_game - feature.away_batting_spot_7_walks_last_1_game\n walk_diff += feature.home_batting_spot_8_walks_last_1_game - feature.away_batting_spot_8_walks_last_1_game\n walk_diff += feature.home_batting_spot_9_walks_last_1_game - feature.away_batting_spot_9_walks_last_1_game\n feature_set << walk_diff\n=end\n \n\n #feature_set << (feature.home_team_won ? 1 : -1)\n\n examples << feature_set\n labels << (feature.home_team_won ? 1 : 0)\n end\nend", "def apply_single\n validate_schema\n\n # Prepare some lists of columns.\n key_cols = @db1.primary_key(@table1)\n data_cols = @db1.except_primary_key(@table1)\n all_cols = @db1.column_names(@table1)\n\n # Let our public know we are beginning.\n @patch.begin_diff\n\n # Advertise column names.\n @rc_columns = DiffColumns.new\n @rc_columns.title_row = all_cols\n @rc_columns.update(0)\n cells = all_cols.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"@@\",cells)\n @patch.apply_row(rc)\n\n # If requested, we will be providing context rows around changed rows.\n # This is not a natural thing to do with SQL, so we do it only on request.\n # When requested, we need to buffer row changes.\n @pending_rcs = []\n\n # Prepare some useful SQL fragments to assemble later.\n sql_table1 = @db1.quote_table(@table1)\n sql_table2 = @db1.quote_table(@table2)\n sql_key_cols = key_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_all_cols = all_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_key_match = key_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS #{sql_table2}.#{c}\"}.join(\" AND \")\n sql_data_mismatch = data_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS NOT #{sql_table2}.#{c}\"}.join(\" OR \")\n\n # For one query we will need to interleave columns from two tables. For\n # portability we need to give these columns distinct names.\n weave = all_cols.map{|c| [[sql_table1,@db1.quote_column(c)],\n [sql_table2,@db2.quote_column(c)]]}.flatten(1)\n dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]}\"}\n sql_dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]} AS #{c[0].gsub(/[^a-zA-Z0-9]/,'_')}_#{c[1].gsub(/[^a-zA-Z0-9]/,'_')}\"}.join(\",\")\n\n # Prepare a map of primary key offsets.\n keys_in_all_cols = key_cols.each.map{|c| all_cols.index(c)}\n keys_in_dbl_cols = keys_in_all_cols.map{|x| 2*x}\n\n # Find rows in table2 that are not in table1.\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table2} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table1} WHERE #{sql_key_match})\"\n apply_inserts(sql,all_cols,keys_in_all_cols)\n\n # Find rows in table1 and table2 that differ while having the same primary\n # key.\n sql = \"SELECT #{sql_dbl_cols} FROM #{sql_table1} INNER JOIN #{sql_table2} ON #{sql_key_match} WHERE #{sql_data_mismatch}\"\n apply_updates(sql,dbl_cols,keys_in_dbl_cols)\n\n # Find rows that are in table1 but not table2\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table1} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table2} WHERE #{sql_key_match})\"\n apply_deletes(sql,all_cols,keys_in_all_cols)\n\n # If we are supposed to provide context, we need to deal with row order.\n if @patch.want_context\n sql = \"SELECT #{sql_all_cols}, 0 AS __coopy_tag__ FROM #{sql_table1} UNION SELECT #{sql_all_cols}, 1 AS __coopy_tag__ FROM #{sql_table2} ORDER BY #{sql_key_cols}, __coopy_tag__\"\n apply_with_context(sql,all_cols,keys_in_all_cols)\n end\n\n # Done!\n @patch.end_diff\n end", "def apply_single\n validate_schema\n\n # Prepare some lists of columns.\n key_cols = @db1.primary_key(@table1)\n data_cols = @db1.except_primary_key(@table1)\n all_cols = @db1.column_names(@table1)\n\n # Let our public know we are beginning.\n @patch.begin_diff\n\n # Advertise column names.\n @rc_columns = DiffColumns.new\n @rc_columns.title_row = all_cols\n @rc_columns.update(0)\n cells = all_cols.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"@@\",cells)\n @patch.apply_row(rc)\n\n # If requested, we will be providing context rows around changed rows.\n # This is not a natural thing to do with SQL, so we do it only on request.\n # When requested, we need to buffer row changes.\n @pending_rcs = []\n\n # Prepare some useful SQL fragments to assemble later.\n sql_table1 = @db1.quote_table(@table1)\n sql_table2 = @db1.quote_table(@table2)\n sql_key_cols = key_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_all_cols = all_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_key_match = key_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS #{sql_table2}.#{c}\"}.join(\" AND \")\n sql_data_mismatch = data_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS NOT #{sql_table2}.#{c}\"}.join(\" OR \")\n\n # For one query we will need to interleave columns from two tables. For\n # portability we need to give these columns distinct names.\n weave = all_cols.map{|c| [[sql_table1,@db1.quote_column(c)],\n [sql_table2,@db2.quote_column(c)]]}.flatten(1)\n dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]}\"}\n sql_dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]} AS #{c[0].gsub(/[^a-zA-Z0-9]/,'_')}_#{c[1].gsub(/[^a-zA-Z0-9]/,'_')}\"}.join(\",\")\n\n # Prepare a map of primary key offsets.\n keys_in_all_cols = key_cols.each.map{|c| all_cols.index(c)}\n keys_in_dbl_cols = keys_in_all_cols.map{|x| 2*x}\n\n # Find rows in table2 that are not in table1.\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table2} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table1} WHERE #{sql_key_match})\"\n apply_inserts(sql,all_cols,keys_in_all_cols)\n\n # Find rows in table1 and table2 that differ while having the same primary\n # key.\n sql = \"SELECT #{sql_dbl_cols} FROM #{sql_table1} INNER JOIN #{sql_table2} ON #{sql_key_match} WHERE #{sql_data_mismatch}\"\n apply_updates(sql,dbl_cols,keys_in_dbl_cols)\n\n # Find rows that are in table1 but not table2\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table1} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table2} WHERE #{sql_key_match})\"\n apply_deletes(sql,all_cols,keys_in_all_cols)\n\n # If we are supposed to provide context, we need to deal with row order.\n if @patch.want_context\n sql = \"SELECT #{sql_all_cols}, 0 AS __coopy_tag__ FROM #{sql_table1} UNION SELECT #{sql_all_cols}, 1 AS __coopy_tag__ FROM #{sql_table2} ORDER BY #{sql_key_cols}, __coopy_tag__\"\n apply_with_context(sql,all_cols,keys_in_all_cols)\n end\n\n # Done!\n @patch.end_diff\n end", "def apply_single\n validate_schema\n\n # Prepare some lists of columns.\n key_cols = @db1.primary_key(@table1)\n data_cols = @db1.except_primary_key(@table1)\n all_cols = @db1.column_names(@table1)\n\n # Let our public know we are beginning.\n @patch.begin_diff\n\n # Advertise column names.\n @rc_columns = DiffColumns.new\n @rc_columns.title_row = all_cols\n @rc_columns.update(0)\n cells = all_cols.map{|v| { :txt => v, :value => v, :cell_mode => \"\" }}\n rc = RowChange.new(\"@@\",cells)\n @patch.apply_row(rc)\n\n # If requested, we will be providing context rows around changed rows.\n # This is not a natural thing to do with SQL, so we do it only on request.\n # When requested, we need to buffer row changes.\n @pending_rcs = []\n\n # Prepare some useful SQL fragments to assemble later.\n sql_table1 = @db1.quote_table(@table1)\n sql_table2 = @db1.quote_table(@table2)\n sql_key_cols = key_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_all_cols = all_cols.map{|c| @db1.quote_column(c)}.join(\",\")\n sql_key_match = key_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS #{sql_table2}.#{c}\"}.join(\" AND \")\n sql_data_mismatch = data_cols.map{|c| @db1.quote_column(c)}.map{|c| \"#{sql_table1}.#{c} IS NOT #{sql_table2}.#{c}\"}.join(\" OR \")\n\n # For one query we will need to interleave columns from two tables. For\n # portability we need to give these columns distinct names.\n weave = all_cols.map{|c| [[sql_table1,@db1.quote_column(c)],\n [sql_table2,@db2.quote_column(c)]]}.flatten(1)\n dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]}\"}\n sql_dbl_cols = weave.map{|c| \"#{c[0]}.#{c[1]} AS #{c[0].gsub(/[^a-zA-Z0-9]/,'_')}_#{c[1].gsub(/[^a-zA-Z0-9]/,'_')}\"}.join(\",\")\n\n # Prepare a map of primary key offsets.\n keys_in_all_cols = key_cols.each.map{|c| all_cols.index(c)}\n keys_in_dbl_cols = keys_in_all_cols.map{|x| 2*x}\n\n # Find rows in table2 that are not in table1.\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table2} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table1} WHERE #{sql_key_match})\"\n apply_inserts(sql,all_cols,keys_in_all_cols)\n\n # Find rows in table1 and table2 that differ while having the same primary\n # key.\n sql = \"SELECT #{sql_dbl_cols} FROM #{sql_table1} INNER JOIN #{sql_table2} ON #{sql_key_match} WHERE #{sql_data_mismatch}\"\n apply_updates(sql,dbl_cols,keys_in_dbl_cols)\n\n # Find rows that are in table1 but not table2\n sql = \"SELECT #{sql_all_cols} FROM #{sql_table1} WHERE NOT EXISTS (SELECT 1 FROM #{sql_table2} WHERE #{sql_key_match})\"\n apply_deletes(sql,all_cols,keys_in_all_cols)\n\n # If we are supposed to provide context, we need to deal with row order.\n if @patch.want_context\n sql = \"SELECT #{sql_all_cols}, 0 AS __coopy_tag__ FROM #{sql_table1} UNION SELECT #{sql_all_cols}, 1 AS __coopy_tag__ FROM #{sql_table2} ORDER BY #{sql_key_cols}, __coopy_tag__\"\n apply_with_context(sql,all_cols,keys_in_all_cols)\n end\n\n # Done!\n @patch.end_diff\n end", "def data_collector collection, factor, duration\n your_data, comparison_data = [], [], []\n uniq_exam_dates = collection.map(&:exam_date).uniq\n if duration == \"12\"\n Date.today.month.times do |count|\n your_temp_data, todays_data = [], []\n collection.where(exam_date:(Time.now-count.month).all_month()).each do |report|\n your_temp_data << report.send(:\"#{factor}\")\n end\n Report.where(exam_date: (Time.now-count.month).all_month(), school_id:current_user.school.id).each do |m|\n todays_data << (m.send(:\"#{factor}\")).round(2) rescue 0\n end\n comparison_data << average(todays_data)\n your_data << average(your_temp_data)\n end\n else\n uniq_exam_dates.each do |date|\n your_temp_data,todays_data = [], []\n collection.where(exam_date:date).each do |report|\n your_temp_data << report.send(:\"#{factor}\")\n end\n Report.where(exam_date:date, school_id:current_user.school.id).each do |m|\n todays_data << (m.send(:\"#{factor}\")).round(2) rescue 0\n end\n comparison_data << average(todays_data)\n your_data << average(your_temp_data)\n end\n end\n your_data.reverse!\n comparison_data.reverse!\n factor == \"accuracy\" ? plot_accuracy(your_data, comparison_data) : plot_time_management(your_data, comparison_data)\n end", "def test(obj_a, obj_b)\n return if obj_a == obj_b # TODO: added by ando\n return if obj_a.fixed? and obj_b.fixed?\n\n if obj_a.multisample == 0 and obj_b.multisample == 0\n norm_vs_norm(obj_a, obj_b)\n elsif obj_a.multisample > 0 and obj_b.multisample == 0\n samp_vs_norm(obj_a, obj_b)\n elsif obj_b.multisample > 0 and obj_a.multisample == 0\n samp_vs_norm(obj_b, obj_a)\n elsif obj_a.multisample == obj_b.multisample\n samp_vs_samp(obj_a, obj_b)\n else\n norm_vs_norm(obj_a, obj_b)\n end\n end", "def item_difficulty_analysis\n dif={}\n @ds.vectors.each{|f| dif[f]=@ds[f].mean }\n dif_sort = dif.sort { |a,b| -(a[1]<=>b[1]) }\n scores_sort={}\n scores=@ds.vector_mean\n scores.each_index{ |i| scores_sort[i]=scores[i] }\n scores_sort=scores_sort.sort{|a,b| a[1]<=>b[1]}\n ds_new = Daru::DataFrame.new({}, order: ([:case,:score] + dif_sort.collect{|a,b| a.to_sym}))\n scores_sort.each do |i,score|\n row = [i, score]\n case_row = @ds.row[i].to_h\n dif_sort.each{ |variable,dif_value| row.push(case_row[variable]) }\n ds_new.add_row(row)\n end\n ds_new\n end", "def create_some_data\n\t\tSunspot.remove_all!\t\t\t\t\t#\tisn't always necessary\n\t\tStudySubject.solr_reindex\n\t\tassert StudySubject.search.hits.empty?\n\t\tsubject1 = FactoryBot.create(:complete_case_study_subject)\n\t\tFactoryBot.create(:sample, :study_subject => subject1,\n\t\t\t:sample_type => SampleType['marrowdiag'])\n\t\tsubject2 = FactoryBot.create(:complete_case_study_subject)\n\t\tFactoryBot.create(:sample, :study_subject => subject2,\n\t\t\t:sample_type => SampleType['periph'])\n\t\tStudySubject.solr_reindex\n\t\tassert !StudySubject.search.hits.empty?\n\tend", "def max_marks_should_not_be_less_than_any_individual_marks\n #This will get hsh[subject_id] = 'corresponding_mark_column' in the marks table\n hsh = mark_columns_with_subject_ids(self.section) \n marks = Mark.for_section(self.section_id).for_exam(self.exam_id).all\n col_name = hsh[self.subject_id]\n marks.each do |mark|\n if mark.send(col_name) && max_marks && (mark.send(col_name) > max_marks)\n errors.add(:max_marks, \"should not be less than individual marks\")\n end\n end\n end", "def before_destroy # already protected by a transaction\n return if self[right_col_name].nil? || self[left_col_name].nil?\n self.reload # in case a concurrent move has altered the indexes\n dif = self[right_col_name] - self[left_col_name] + 1\n base_set_class.delete_all( \"#{scope_condition} AND (#{left_col_name} BETWEEN #{self[left_col_name]} AND #{self[right_col_name]})\" )\n base_set_class.update_all(\"#{left_col_name} = CASE \\\n WHEN #{left_col_name} > #{self[right_col_name]} THEN (#{left_col_name} - #{dif}) \\\n ELSE #{left_col_name} END, \\\n #{right_col_name} = CASE \\\n WHEN #{right_col_name} > #{self[right_col_name]} THEN (#{right_col_name} - #{dif} ) \\\n ELSE #{right_col_name} END\",\n scope_condition)\n end", "def best_consultants_setup\n setup_before_rbc\n @rbc_0 = @rank_by_consulting[0]\n @rbc_1 = @rank_by_consulting[1]\n @rbc_2 = @rank_by_consulting[2]\n @rbc_3 = @rank_by_consulting[3]\n @rbc_0_stud = Student.find(@rbc_0)\n @rbc_1_stud = Student.find(@rbc_1)\n @rbc_2_stud = Student.find(@rbc_2)\n @rbc_3_stud = Student.find(@rbc_3)\n \n # Set all students unqualified to begin with\n ObjectiveStudent.where(:objective => @objective_40).update_all(:points_all_time => 3)\n \n # Stud_0 already has keys\n ObjectiveStudent.find_by(:objective => @objective_40, :user => @rbc_0_stud).update(:points_all_time => 7, :teacher_granted_keys => 2)\n \n # Stud_1 scored 10\n ObjectiveStudent.find_by(:objective => @objective_40, :user => @rbc_1_stud).update(:points_all_time => 10)\n \n # Stud_2 scored 9\n ObjectiveStudent.find_by(:objective => @objective_40, :user => @rbc_2_stud).update(:points_all_time => 9)\n \n # Stud_3 should normally be first choice\n ObjectiveStudent.find_by(:objective => @objective_40, :user => @rbc_3_stud).update(:points_all_time => 7)\n \n # Make sure these students have no teach_request\n [@rbc_0_stud, @rbc_1_stud, @rbc_2_stud, @rbc_3_stud].each do |stud|\n SeminarStudent.find_by(:seminar => @seminar, :user => stud).update(:teach_request => nil)\n end\n \n # Set @objective_40 to priority 5\n set_priority(@objective_40, 5)\n end", "def load_default_test_data_to_db_before_suite\n community1 = FactoryGirl.create(:community, :ident => \"test\", :consent => \"test_consent0.1\", :settings => {\"locales\" => [\"en\", \"fi\"]}, :real_name_required => true)\n community1.community_customizations.create(name: \"Yelo\", locale: \"fi\")\n community2 = FactoryGirl.create(:community, :ident => \"test2\", :consent => \"KASSI_FI1.0\", :settings => {\"locales\" => [\"en\"]}, :real_name_required => true, :allowed_emails => \"@example.com\")\n community3 = FactoryGirl.create(:community, :ident => \"test3\", :consent => \"KASSI_FI1.0\", :settings => {\"locales\" => [\"en\"]}, :real_name_required => true)\n\n [community1, community2, community3].each { |c| TestHelpers::CategoriesHelper.load_test_categories_and_listing_shapes_to_db(c) }\n end", "def update_table_rows\n\t \t@outcome_id = params[:outcome_id]\n\t \t@outcome = Outcome.find(@outcome_id)\n\t \t@project_id = params[:project_id]\n\t \t@is_diagnostic = ExtractionForm.is_diagnostic?(@outcome.extraction_form_id)\n\t \t@checkbox_timepoints = @outcome.outcome_timepoints\n\t \tunless params[:subgroup_id].nil?\n\t\t\t@subgroup = OutcomeSubgroup.find(params[:subgroup_id])\n\t\telse\n\t\t\t@subgroup = nil\n\t\tend\n\n\t \t# IF THIS IS A DIAGNOSTIC TEST RESULT TABLE\n\t \tif @is_diagnostic\n\t \t\t@selected_timepoints = Comparison.get_selected_timepoints_for_diagnostic_tests(@outcome,@subgroup)\n\t \t\tparams[:tps_to_add].keys.each do |sectionNum|\n\t \t\t\ttpString = params[:tps_to_add][sectionNum].join(\"_\")\n\t \t\t\t#puts \"The original TP string is #{@selected_timepoints[sectionNum.to_i]} and the string we're adding is #{tpString}\"\n\t \t\t\tif @selected_timepoints[sectionNum.to_i].empty?\n\t\t\t\t\t@selected_timepoints[sectionNum.to_i] = tpString\n\t\t\t\telse\n\t\t\t\t\t@selected_timepoints[sectionNum.to_i] += \"_#{tpString}\"\n\t\t\t\tend\n\t\t\t\t#puts \"THE RESULT IS: #{@selected_timepoints[sectionNum.to_i]}\\n\\n\"\n\t \t\tend\n\t \t\n\t \t\t\n\t\t\t@outcome_id, @study_id, @extraction_form_id, @selected_tp_array, @timepoints, @comparisons, \n\t\t\t@comparators, @all_comparators, @comparison_measures, @comparison_datapoints, @index_tests, \n\t\t\t@reference_tests, @thresholds, @footnotes = OutcomeDataEntry.get_diagnostic_test_results(@outcome,@subgroup,@selected_timepoints)\n\n\t\t\t@outcomes = Outcome.find(:all, :conditions=>[\"study_id=?\",@outcome.study_id],:select=>[\"id\",\"title\",\"extraction_form_id\"])\n\t\t\t@outcome_subgroups = Outcome.get_subgroups_by_outcome(@outcomes)\n\n\t\t\t@index_test_options, @reference_test_options = DiagnosticTest.get_select_options(@index_tests,@reference_tests,@thresholds)\n\t \t\n\t \t# OTHERWISE, IF IT'S AN RCT RESULT TABLE\n\t \telse\n\t \t\t@selected_tp_array = params[:selected_timepoints].split(\"_\")\n\t \t\ttps_to_add = params[:tps_to_add]\n\t\t\tunless tps_to_add.nil?\n\t\t\t\t@selected_tp_array = @selected_tp_array + tps_to_add\n\t\t\tend\n\t\t\t@selected_timepoints = @selected_tp_array.join(\"_\")\n\n\t\t\t#-----------------------------------------\n\t\t \t# Data for the entry table\n\t\t \t#-----------------------------------------\n\t\t \t@outcome_id, @study_id,@extraction_form_id, @selected_tp_array, @timepoints, @OCDEs, \n\t\t\t@measures, @datapoints, @arms, @comparisons, @comparison_measures, @comparators, \n\t\t\t@all_comparators, @num_comparators, @comparison_datapoints, @wa_comparisons, @wa_measures, \n\t\t\t@wa_comparators, @wa_all_comparators, @wa_datapoints, @footnotes = OutcomeDataEntry.get_information_for_entry_table(@outcome,@subgroup,@selected_timepoints)\t\n\t\t\t\t\n\t\t @hide_wait_icon = true # indicate that we need to hide a loading icon\n\n\t \tend\n\n\t render '/outcome_data_entries/show_timepoints'\n\tend", "def compare(base_data, external_data)\n external_data[:product].each do |ex_prd|\n base_prd_id = base_data[:product_matched][ex_prd[:id]]\n changed = nil\n\n if base_prd_id\n # Product exists\n base_prd = base_data[:product].find {|p| p[:id] == base_prd_id }\n changed = field_compare(base_prd, ex_prd, base_data[:category_matched])\n @result[:update] << changed if changed\n else\n # Product is new\n changed = ex_prd.dup\n @result[:new] << changed\n end\n\n next unless changed\n # Product Special Rules\n has_dummy_variant = ex_prd[:variants].any? {|v| v[:option_values].empty? }\n changed.delete(:variants) if has_dummy_variant\n changed[:ex_options] = ex_prd[:variants].map {|i| [i[:sku], i[:option_values].first[:label]] }.to_h if changed[:variants]\n changed[:categories] = external_data[:category].find {|c| c[:id] == changed[:categories] }&.dig(:name)\n changed[:inventory_tracking] = if ex_prd[:variants].all? {|i| i[:inventory_level].nil? }\n 'none'\n elsif ex_prd[:variants].size == 1\n 'product'\n else\n 'variant'\n end\n changed[:inventory_level] = 0\n changed[:inventory_level] = ex_prd[:variants].first[:inventory_level] if changed[:inventory_tracking] == 'product'\n end\n @result[:update].each {|i| clean_fields(i) }\n @result\n end", "def partition_new_old_relations(enum) # :yield:\n\t trsc_objects = Hash.new\n\t each_relation do |rel|\n\t\ttrsc_others = send(enum, rel).\n\t\t map do |obj| \n\t\t\tplan_object = plan.may_unwrap(obj)\n\t\t\ttrsc_objects[plan_object] = obj\n\t\t\tplan_object\n\t\t end.to_value_set\n\n\t\tplan_others = __getobj__.send(enum, rel).\n\t\t find_all { |obj| plan[obj, false] }.\n\t\t to_value_set\n\n new = (trsc_others - plan_others)\n existing = (trsc_others - new)\n\t\tdel = (plan_others - trsc_others)\n\n\t\tyield(trsc_objects, rel, new, del, existing)\n\t end\n\tend", "def test_csv_table_match(subject)\n # Compare the fields\n if !subject.empty?\n subject_fields = subject[0].keys\n master_fields = @golden_master.headers\n\n if subject_fields.count != master_fields.count\n throw_no_match \"Expected #{master_fields.count} field(s), got #{subject_fields.count}\"\n end\n\n master_fields.each_with_index do |column, index|\n if column != subject_fields[index]\n throw_no_match \"Expected field \\\"#{column}\\\", got field \\\"#{subject_fields[index]}\\\"\"\n end\n end\n end\n\n # Compare the number of records\n subject_record_count = subject.count\n master_record_count = @golden_master.inject(0){|count| count += 1}\n if subject_record_count != master_record_count\n throw_no_match \"Expected #{master_record_count} record(s), got #{subject_record_count}\"\n end\n\n # Compare the values of the golden master with the subject\n current_row = 0\n @golden_master.each do |row|\n row.each do |field, master_string|\n subject_value = subject[current_row][field]\n if !match_values?(master_string, subject_value)\n throw_no_match \"Field \\\"#{field}\\\", Record #{current_row + 1}: Expected value #{master_string.nil? ? '<NULL>' : \"\\\"#{master_string}\\\"\"}, got #{subject_value.nil? ? '<NULL>' : \"\\\"#{subject_value}\\\"\"}\"\n end\n end\n current_row += 1\n end\n end", "def recalculate_usage(binding)\n # For some reason, ANALYZE TABLE doesn't update statistics in Travis' environment\n ActiveRecord::Base.connection.execute(\"OPTIMIZE TABLE #{binding.database_name}.stuff\")\n ActiveRecord::Base.connection.execute(\"OPTIMIZE TABLE #{binding.database_name}.stuff2\")\n end", "def test_standard_credit_results\n @standard_credit_Value.each { |key, value| assert_in_delta @calc_standard[@row_number][key], value, 0.03 }\n check_count @calc_standard\n end", "def propertyInvestmentGuidelines(output, prop_data, census_data, params, data_source)\r\n propertyValueCheck(output, prop_data, data_source)\r\n propertyMsaCheck(output, census_data, prop_data, data_source)\r\n\r\n # No recent sales data for MLS\r\n propertyRecentSalesCheck(output, prop_data, params[:product], data_source) unless data_source.to_s == \"MLS\"\r\n\r\n propertyTypeCheck(output, prop_data, data_source)\r\n propertyBuildYearCheck(output, prop_data, data_source) # Must run after recency check\r\n end", "def validate_measure_ids_set_ids_usage(doc_bundle_neutral_ids, doc_measure_ids, data = {})\n # for each of the setIds that are in the bundle, check that they are for the correct measure id\n entries_start_position = @doc.xpath(first_entry)\n previous = ''\n index = 1\n doc_bundle_neutral_ids.each do |hqmf_set_id|\n # selects the measure id that is in the same entry as the set id\n # iterates through multiple instances of the same setId\n index = if previous == hqmf_set_id\n index + 1\n else\n 1\n end\n measure_id_entry = doc_measure_ids[(@doc.xpath(location_of_set_id(hqmf_set_id, index)) - entries_start_position)]\n previous = hqmf_set_id\n # queries database to see if there is a measure with the combindation of setId and measureId\n if CQM::Measure.where(hqmf_id: measure_id_entry, hqmf_set_id: hqmf_set_id).empty?\n @errors << build_error(\"Invalid HQMF Set ID Found: #{hqmf_set_id} for HQMF ID: #{measure_id_entry}\", '/', data[:file_name])\n end\n end\n end", "def match_assignment(assign,assign_params)\n ( Account.includes(:skills).where.not(skills: { id: nil }) |\n Account.includes(:languages).where.not(languages: { id: nil }) |\n Account.includes(:locations).where.not(locations: {id: nil}) ).each do |acc|\n if acc.id != assign.user_id\n total_score = total_score(acc,assign)\n if total_score > 10.00\n automatch = ScoreAccountAssignment.new(assignment_id: assign.id, account_id: acc.id)\n automatch.score_categories = score_categories(acc,assign).to_json\n automatch.total_score = total_score\n automatch.save\n end\n end\n end\n end", "def test_history_equals_versions\n way = create(:way, :with_history)\n used_way = create(:way, :with_history)\n create(:relation_member, :member => used_way)\n way_with_versions = create(:way, :with_history, :version => 4)\n\n check_history_equals_versions(way.id)\n check_history_equals_versions(used_way.id)\n check_history_equals_versions(way_with_versions.id)\n end" ]
[ "0.6101307", "0.5152155", "0.5134087", "0.51013213", "0.50984734", "0.50966114", "0.50966114", "0.50818443", "0.50785035", "0.50704336", "0.50450724", "0.499043", "0.4987962", "0.4987284", "0.49813953", "0.49464554", "0.49459115", "0.49316037", "0.49247178", "0.49187773", "0.49094248", "0.49066293", "0.49060193", "0.49009535", "0.4898333", "0.4869565", "0.4869399", "0.48672068", "0.48617226", "0.4859575", "0.48453823", "0.4840256", "0.4831976", "0.48192242", "0.48183832", "0.48106593", "0.4807779", "0.48042336", "0.47998402", "0.47906482", "0.47878185", "0.47790164", "0.47763643", "0.47756386", "0.47639522", "0.47639218", "0.47503117", "0.47462046", "0.47289312", "0.47275472", "0.47249404", "0.4723177", "0.46994445", "0.46886262", "0.46842024", "0.4683153", "0.46810764", "0.4671493", "0.46685404", "0.4666003", "0.46655095", "0.46626818", "0.46589065", "0.46576804", "0.4651826", "0.4651677", "0.46487808", "0.4648114", "0.4642775", "0.4639914", "0.46328872", "0.4630911", "0.46245047", "0.46232814", "0.46202224", "0.46197924", "0.46095535", "0.46073413", "0.46068752", "0.46026078", "0.46004662", "0.46004662", "0.46004662", "0.45945245", "0.4591091", "0.4589627", "0.458938", "0.45874134", "0.45832336", "0.45819232", "0.45759764", "0.45735955", "0.45726943", "0.45691445", "0.45684722", "0.45672974", "0.45522237", "0.45512846", "0.45510072", "0.4549109", "0.45487264" ]
0.0
-1
Never trust parameters from the scary internet, only allow the white list through.
def result_statistic_section_params params.require(:result_statistic_section).permit( measures_attributes: [:id, :name, :_destroy], measure_ids: [], result_statistic_sections_measures_attributes: [measure_attributes: [:id, :name]], comparisons_attributes: [:id, :is_anova, comparate_groups_attributes: [:id, comparates_attributes: [:id, comparable_element_attributes: [:id, :comparable_type, :comparable_id]]]]) # # measure_ids: [], # comparisons_attributes: [ :id, :_destroy, :result_statistic_section_id, # comparisons_measures_attributes: [ :id, :_destroy, :comparison_id, :measure_id , # measurement_attributes: [ :id, :_destroy, :comparisons_measure_id, :value ] ], # comparate_groups_attributes: [ :id, :_destroy, :comparison_id, # comparates_attributes: [ :id, :_destroy, :comparate_group_id, :comparable_element_id, # comparable_element_attributes: [ :id, :_destroy, :comparable_type, :comparable_id, :_destroy ] ] ] ] ) end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def strong_params\n params.require(:user).permit(param_whitelist)\n end", "def strong_params\n params.require(:listing_member).permit(param_whitelist)\n end", "def allow_params_authentication!; end", "def allowed_params\n ALLOWED_PARAMS\n end", "def default_param_whitelist\n [\"mode\"]\n end", "def param_whitelist\n [:role, :title]\n end", "def expected_permitted_parameter_names; end", "def safe_params\n params.except(:host, :port, :protocol).permit!\n end", "def strong_params\n params.require(:team_member).permit(param_whitelist)\n end", "def permitir_parametros\n \t\tparams.permit!\n \tend", "def strong_params\n params.require(:community).permit(param_whitelist)\n end", "def permitted_strong_parameters\n :all #or an array of parameters, example: [:name, :email]\n end", "def strong_params\n params.require(:education).permit(param_whitelist)\n end", "def restricted_params\n #params.require(self.controller_name.classify.underscore.to_sym).permit([])\n raise(\"No strong params set, override restricted_params method in your controller. E.g. params.require(:model).permit(:attribute1, :attribute2)\")\n end", "def allowed_params\n params.require(:user).permit(:username, :email, :password, :password_confirmation)\n end", "def param_whitelist\n [:rating, :review]\n end", "def param_whitelist\n whitelist = [\n :username, :name,\n :parent_id,\n :headline, :description, :video,\n :policy, :signup_mode, :category,\n :website, :facebook, :twitter, :linkedin,\n :founded_at,\n privacy: [\n :events,\n :resources\n ],\n permission: [\n :profile,\n :members,\n :children,\n :statistics,\n :posts,\n :listings,\n :resources,\n :events\n ],\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:parent_id)\n unless current_user.role_in(@community) === 'owner'\n whitelist.delete(:privacy)\n whitelist.delete(:permission)\n end\n end\n \n whitelist\n end", "def param_whitelist\n if @user.present? && current_user != @user\n return [:followed]\n end\n \n whitelist = [\n :username, :email, :password,\n :first_name, :last_name,\n :birthday, :gender,\n :headline, :biography, :ask_about, :focus,\n :website, :facebook, :linkedin, :twitter, :github,\n roles: [],\n skills: [],\n interests: [],\n privacy: { contact: [] },\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n \n if action_name === 'update'\n whitelist.delete(:email)\n whitelist.delete(:password)\n end\n \n whitelist\n end", "def user_params \n \tparams.require(:user).permit(:name, :email, :password, :password_confirmation)# preventing CSTR\n end", "def user_params\n params.permit(:name, :phoneNumber, :address, :postalCode, :local, :link, :counter, :latitude, :longitude) \n end", "def valid_params_request?; end", "def strong_params\n params.require(:experience).permit(param_whitelist)\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def whitelist_url_params\n params.require(:whitelist_url).permit(:domain)\n end", "def allowed_params\n params.require(:allowed).permit(:email)\n end", "def permitted_params\n []\n end", "def trim_whitelisted(params, whitelist)\n # remove any parameters that are not whitelisted\n params.each do |key, value|\n # if white listed\n if whitelist.include? key\n # strip the parameters of any extra spaces, save as string\n params[key] = value.to_s.strip\n else\n # delete any unauthorized parameters\n params.delete key\n end\n end\n params\n end", "def safe_params\n params.permit(:id, :name, :origin, :emails => []); #emails is an array\n end", "def query_param\n\t\tparams.permit(:first_name, :last_name, :phone)\n\tend", "def strong_params\n params.require(:success_metric).permit(param_whitelist)\n end", "def devise_filter\r\n logger.debug(\"In devise_filter =>PARAMS: #{params.inspect}\")\r\n\r\n # White list for sign_up\r\n devise_parameter_sanitizer.for(:sign_up) { |u| u.permit(user_whitelist) }\r\n\r\n # White list for account update\r\n devise_parameter_sanitizer.for(:account_update) { |u| u.permit(user_whitelist, :current_password) }\r\n\r\n # White list for Invitation creation\r\n devise_parameter_sanitizer.for(:invite) { |u| u.permit(:account_type, :email, :invitation_token)}\r\n\r\n # White list for accept invitation\r\n devise_parameter_sanitizer.for(:accept_invitation) { |u| u.permit(user_whitelist, :invitation_token)}\r\n\r\n end", "def whitelisted_user_params\n params.require(:user).\n permit( :first_name, :last_name, :email,:password,:password_confirmation,:birthday,:gender)\n end", "def user_params\n ActionController::Parameters.permit_all_parameters = true\n params.require(:user) #.permit(:name, :surname, :phone, :password, :email, :time_zone)\n end", "def strong_params\n params.require(:metric_change).permit(param_whitelist)\n end", "def safe_params\n params.require(:user).permit(:name)\n end", "def get_params\n\t\treturn ActionController::Parameters.new(self.attributes).permit(\"account_id\", \"title\", \"category\", \"introduction\", \"tags\", \"segment_type\", \"visible\", \"status\", \"main_image\")\n\tend", "def grant_params\n @whitelisted = params.require(:grant).permit(:name, :description, :agency_id, :acronym)\n end", "def check_params; true; end", "def param_whitelist\n whitelist = [\n :description,\n :progress,\n :kpi_id\n ]\n \n unless action_name === 'create'\n whitelist.delete(:kpi_id)\n end\n \n whitelist\n end", "def quote_params\n params.permit!\n end", "def valid_params?; end", "def paramunold_params\n params.require(:paramunold).permit!\n end", "def user_params\n\t\tparams.permit(:nickname, :avatar, :description, :password, :gender, :birthday, :email, :phone, :qq_id, :wechat_id)\n\tend", "def filtered_parameters; end", "def user_params\n params.permit(\n \t:id,\n \t:email, \n \t:first_name, \n \t:last_name, \n \t:password, \n \t:confirm_token, \n \t:phone_number,\n \t:facebook_link,\n \t:car_model,\n \t:license_plate)\n end", "def filtering_params\n params.permit(:email, :name)\n end", "def check_params\n true\n end", "def wx_public_params\n params.require(:wx_public).permit(:nickname, :manager, :alias)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def allowed_params\n params.require(:user).permit(:email, :password, :role, :first_name, :last_name, :password_confirmation)\n end", "def listing_params\n\t\tparams.permit(:address, :transit_info, :rules, :other_info, :lat, :lng)\n\tend", "def social_account_params\n\t\t\tparams.require(:social_account).permit!\n\t\tend", "def safe_params\n resurce_name = self.class.resource_name\n params_method_name = \"#{resurce_name}_params\".to_sym\n if params[resurce_name]\n if respond_to?(params_method_name) || private_methods.include?(params_method_name)\n send(params_method_name)\n else\n raise ActiveModel::ForbiddenAttributesError, \"Please, define the '#{params_method_name}' method in #{self.class.name}\"\n end\n end\n end", "def url_params\n params.require(:url).permit(:short_url, :original_url, :clicks, :ip_addresses)\n end", "def user_params\n params.require(:user).permit(:uri, :username, :password, :realname, :email, :publicvisible)\n end", "def model_params\n\t\tparams.require(:manager).permit(\n\t :user_name,\n :password,\n :email,\n \t\t\t)\n\tend", "def article_params_whitelist\n params.require(:article).permit(:title, :description, category_ids: [])\n end", "def college_whitelist_params\n params.require(:college_whitelist).permit(:status)\n end", "def active_code_params\n params[:active_code].permit\n end", "def filtering_params\n params.permit(:email)\n end", "def valid_params(params)\n params.permit(:user_id, :photo_id, :originX, :originY, :width, :height)\n end", "def ip_address_params\n\t\t\tparams.require(:ip_address).permit!\n end", "def pull_request_params\n whitelist = [\n :url,\n :id,\n :html_url,\n :diff_url,\n :patch_url,\n :issue_url,\n :number,\n :state,\n :locked,\n :title\n ]\n params.require(:pull_request).permit(whitelist)\n end", "def reserved_params\n params.require(:reserved).permit(:name, :email, :pax, :address, :KTP, :title)\n end", "def post_params\n if current_user.admin? \n params.permit(:title, :body, :city, :country, :gps_location, :privacy, :visible, :latitude, :longitude, images: [], files: [])\n else \n params.permit(:title, :body, :city, :country, :gps_location, :privacy,:latitude, :longitude, images: [], files: [])\n end \n end", "def list_params\n params.permit(:name)\n end", "def filter_parameters; end", "def filter_parameters; end", "def vineyard_params\n params.permit(:vineyard_name, :email, :website_url, :phone, :address, :city, :region, :postcode, :country, :specialty, :description, :pet_friendly, :holiday, :tours, :events, :family_friendly, :cover_image, :image_one, :image_two, :image_three, :image_four, :user_id, :base64)\n end", "def available_activity_params\n # params.require(:available_activity).permit(:type,:geometry,:properties)\n whitelisted = ActionController::Parameters.new({\n type: params.require(:available_activity)[:type],\n geometry: params.require(:available_activity)[:geometry].try(:permit!).to_h,\n properties: params.require(:available_activity)[:properties].try(:permit!).to_h\n }).try(:permit!)\n end", "def user_params\n params.permit(:name, :username, :email, :password, :img_url, :bg_url, :coinbank)\n end", "def user_params_pub\n\t \tparams[:user].permit(:hruid)\n\t end", "def user_params\n params.permit(:id, :email, :password, :nickname, :status, :avatar, :flat_picture, :flatsharing_id, :member,\n :user, :color, :solde)\n end", "def validate_search_inputs\n @whitelisted = params.fetch(:user, nil)\n if @whitelisted.blank?\n render_error(400, \"#{I18n.t('general_error.params_missing_key')}\": [I18n.t('general_error.params_missing_value', model: \"review\")])\n return\n else\n @whitelisted = @whitelisted.permit(:name, :uen, :description)\n end\n end", "def param_whitelist\n [\n :title,\n :description,\n :organization,\n :team_id,\n :started_at,\n :finished_at,\n location: [\n :description,\n :street,\n :city,\n :state,\n :zip,\n :country,\n :latitude,\n :longitude\n ]\n ]\n end", "def url_whitelist; end", "def admin_social_network_params\n params.require(:social_network).permit!\n end", "def filter_params\n params.require(:filters).permit(:letters)\n end", "def origin_params\n params.permit(:country, :state, :city, :postal_code, :address, :description)\n end", "def valid_params(params)\n params.permit(:login, :first_name, :last_name, \n :password, :password_confirmation)\n end", "def sensitive_params=(params)\n @sensitive_params = params\n end", "def permit_request_params\n params.permit(:address)\n end", "def user_params\n # Ensure a user can't give themselves admin priveleges\n params.delete(:admin) if current_user.admin?\n params.require(:user).permit(:name, :email, :admin, :image)\n end", "def secure_params\n params.require(:location).permit(:name)\n end", "def strong_params\n params.require( :setting ).\n permit( :global_scan_limit, :per_user_scan_limit,\n :target_whitelist_patterns, :target_blacklist_patterns )\n end", "def question_params\n params.require(:survey_question).permit(question_whitelist)\n end", "def case_insensitive_params\n params.require(:case_insensitive).permit(:name)\n end", "def empire_master_no_match_params\n params.require(:empire_master_no_match).permit(:uid, :last_name, :list, :search_date, :double, :source)\n end", "def maintenance_request_params\n params[:maintenance_request].permit! #allow all parameters for now\n end", "def unwanted_params\n params.require(:unwanted).permit(:title, :description, :image)\n end", "def url_params\n params[:url].permit(:full)\n end", "def backend_user_params\n params.permit!\n end", "def filter_params\n\t\treturn params[:candidate].permit(:name_for_filter)\n\tend", "def speed_measurement_params\n\n #fuckit, to lazy to deal with permit crap right now\n ActionController::Parameters.permit_all_parameters = true\n\n params[:speed_measurement]\n end", "def user_params\n params.permit(:name, :age, :username, :display_photo, :password)\n end", "def get_params\r\n #params.require(:article).permit(:title, :permalink, :content, :source_site, :introtext, :type_id, :order_by, :searchable, :created_by, :edited_by, :published_by, :published_on, :user_id)\r\n params.require(:article).permit!\r\n\r\n end", "def pub_params\n params.require(:pub).permit(:name, :description, :phone, :email, :hidden, :city_id, :address)\n end", "def pass_params\n params[:pass].permit(:name, :price, :description, :colour, :events)\n end", "def droptraining_params\n params.permit(:training_id,:user_id, :utf8, :authenticity_token, :commit)\n end", "def person_params\n # params whitelist does *not* include admin, sub, remember_token\n # TBD: share this whitelist with the list used by configuration_permitted_parameters\n # TBD: should current_password be on this list? -- for now, leaving off, since it seems to work without\n # NOTE: do not include 'admin' in this list!\n params.require(:person).permit(\n :name, \n :email, \n :description,\n :password, \n :password_confirmation\n )\n end", "def parameter_params\n params.require(:parameter).permit(:name, :description, :param_code, :param_value, :active_from, :active_to)\n end" ]
[ "0.69792545", "0.6781151", "0.67419964", "0.674013", "0.6734356", "0.6591046", "0.6502396", "0.6496313", "0.6480641", "0.6477825", "0.64565", "0.6438387", "0.63791263", "0.63740575", "0.6364131", "0.63192815", "0.62991166", "0.62978333", "0.6292148", "0.6290449", "0.6290076", "0.62894756", "0.6283177", "0.6242471", "0.62382483", "0.6217549", "0.6214457", "0.6209053", "0.6193042", "0.6177802", "0.6174604", "0.61714715", "0.6161512", "0.6151757", "0.6150663", "0.61461", "0.61213595", "0.611406", "0.6106206", "0.6105114", "0.6089039", "0.6081015", "0.6071004", "0.60620916", "0.6019971", "0.601788", "0.6011056", "0.6010898", "0.6005122", "0.6005122", "0.6001556", "0.6001049", "0.59943926", "0.5992201", "0.59909594", "0.5990628", "0.5980841", "0.59669393", "0.59589154", "0.5958826", "0.5957911", "0.5957385", "0.5953072", "0.59526145", "0.5943361", "0.59386164", "0.59375334", "0.59375334", "0.5933856", "0.59292704", "0.59254247", "0.5924164", "0.59167904", "0.59088355", "0.5907542", "0.59064597", "0.5906243", "0.5898226", "0.589687", "0.5896091", "0.5894501", "0.5894289", "0.5891739", "0.58860534", "0.5882406", "0.587974", "0.58738774", "0.5869024", "0.58679986", "0.5867561", "0.5865932", "0.5864461", "0.58639693", "0.58617616", "0.5861436", "0.5860451", "0.58602303", "0.5854586", "0.58537364", "0.5850427", "0.5850199" ]
0.0
-1
Need to initialize previous jobs for redis when starting
def initialize(robot) super end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def init_queue_redis(hash)\n puts \"init_queue_redis: \" + @all_test_files_to_run.length().to_s + \" tests\"\n num = KnapsackPro::Config::Env.redis_get_num\n puts num\n @redis.rpush(hash, @all_test_files_to_run)\n @redis.rpush(hash, Array.new(@ci_node_total * num) { |i| \"0\" })\n @redis.expire(hash, KnapsackPro::Config::Env.redis_expire)\n end", "def initialize *jobs\n super()\n @stopped = true\n @suspended = false\n @queue = Queue.new\n jobs.each{|job|\n self.push(job)\n }\n @mutex = Mutex.new\n @timezone = nil\n end", "def reinitialize(*args)\n kill_all and return if self.class.shutdown?\n\n unless @queue && queue.alive?\n @queue = MicroQ.config.queue.new_link\n end\n\n @busy ||= []\n @workers ||= []\n @current ||= {}\n\n if args.any?\n message = current.delete(args.first)\n queue.finished!(message) if queue.respond_to?(:finished)\n end\n\n build_missing_workers\n end", "def before_starting_workers\n end", "def reserve_and_run_one_job; end", "def setup_jobs\n JobLoader.call\n end", "def worker_initial_config\n\n end", "def initialize_job\n launched_job_initializers\n \n job_template_initializers\n end", "def worker_init\n raise \"Invalid worker name\" if !worker_name\n Thread.abort_on_exception = true\n\n # stores the job key of currently running job\n Thread.current[:job_key] = nil\n initialize_logger\n\n @thread_pool = ThreadPool.new(self,pool_size || 20,@logger)\n t_worker_key = worker_options && worker_options[:worker_key]\n\n @cache = ResultStorage.new(worker_name,t_worker_key,BDRB_CONFIG[:backgroundrb][:result_storage])\n\n if(worker_options && worker_options[:schedule] && no_auto_load)\n load_schedule_from_args\n elsif(BDRB_CONFIG[:schedules] && BDRB_CONFIG[:schedules][worker_name.to_sym])\n @my_schedule = BDRB_CONFIG[:schedules][worker_name.to_sym]\n new_load_schedule if @my_schedule\n end\n if respond_to?(:create)\n invoke_user_method(:create,worker_options[:data])\n end\n if run_persistent_jobs?\n add_periodic_timer(persistent_delay.to_i) {\n begin\n check_for_enqueued_tasks\n rescue Object => e\n puts(\"Error while running persistent task : #{Time.now}\")\n log_exception(e.backtrace)\n end\n }\n end\n write_pid_file(t_worker_key)\n end", "def redis_pool; end", "def setup\n setup_requeue_queue\n consume_requeue\n setup_retry_queues\n end", "def redis\n @redis || init\n end", "def redis_pool=(_arg0); end", "def do_after_create \n flush_redis()\n end", "def setup\n @client.clear(self.signals_redis_key)\n @worker_pool.start\n end", "def setup_new_redis\n if @nodes_left.size == 0\n if @retry_link == :rotate\n @nodes_left = @nodes.dup\n sleep @retry_link_interval\n elsif @retry_link == :once\n @logger.warn(\"[RedisHa] Error: No more nodes to try! Set :retry => :rotate to repeat.\")\n return\n end\n end\n @next_node = @nodes_left.shift\n @logger.info(\"[RedisHa] Setting up redis connection from server: #{@next_node}\")\n @config.merge!(@next_node)\n @redis = Redis.new(@config)\n if @redis\n begin\n @redis.ping\n rescue Redis::CannotConnectError\n @logger.warn(\"[RedisHa] Error: Can not setup connection to redis server #{@next_node}!\")\n end\n end\n end", "def initialize\n @@instances << self\n @queue = []\n @jobs = []\n end", "def initialize\n @redis = Redis.new(host: 'redis', port: 6379)\n end", "def bootstrap!\n Sidekiq.redis do |conn|\n digest = conn.script(LOAD, @source)\n\n # XXX: this may happen **ONLY** if script digesting will be\n # changed in redis, which is not likely gonna happen.\n unless @digest == digest\n if @logger\n @logger.warn \"Unexpected script SHA1 digest: \" \\\n \"#{digest.inspect} (expected: #{@digest.inspect})\"\n end\n\n @digest = digest.freeze\n end\n end\n end", "def lock_redis\n @lock_redis ||= ActiveJobLock::Config.redis\n end", "def init(*opts)\n if EM.reactor_running?\n @redis ||= Redis.new({ :driver => :synchrony }.merge(*opts))\n else\n @redis ||= Redis.new(*opts)\n end\n end", "def post_init\n JR::JobLogger.log(\"#{@node.name} ready to work\")\n end", "def initialize_redis\n require File.expand_path('../appenders/redis', __dir__)\n end", "def create_redis_init\n redis_init_script = <<'_REDIS_INIT_SCRIPT_'\n#!/usr/bin/env bash\n### BEGIN INIT INFO\n# Provides: redis-server\n# Required-Start: $syslog\n# Required-Stop: $syslog\n# Should-Start: $local_fs\n# Should-Stop: $local_fs\n# Default-Start: 2 3 4 5\n# Default-Stop: 0 1 6\n# Short-Description: redis-server - Persistent key-value db\n# Description: redis-server - Persistent key-value db\n### END INIT INFO\n#\n# Author: Wayne E. Seguin <wayneeseguin@gmail.com>\n# License: The same licence as Redis, New BSD\n# http://www.opensource.org/licenses/bsd-license.php\n#\n\n# Source the system config file, if it exists.\nif [[ -s /etc/conf.d/redis ]] ; then\n source /etc/conf.d/redis\nfi\n\n# Default config variables that have not been set.\nport=\"${port:-6379}\"\nprefix=\"${prefix:-/opt/rhoconnect}\"\nredis=\"${prefix}/bin/redis-server\"\nredis_cli=\"${prefix}/bin/redis-cli\"\npidfile=\"${pidfile:-/var/run/redis.pid}\"\nconfig=\"${config:-/opt/rhoconnect/etc/redis.conf}\"\nuser=\"${user:-root}\"\n#prefix=\"${prefix:-/usr/local}\"\n#config=\"${config:-/usr/local/etc/redis.conf}\"\n#pidfile=\"${pidfile:-/var/run/redis/redis.pid}\"\n#config=\"${config:-/etc/redis/redis.conf}\"\n#user=\"${user:-redis}\"\n\n# If the redis-cli file is not found, terminate the script.\ntest -x $redis_cli || exit 0\n\n#\n# Set the running $pid value based on $pidfile.\n#\nif [[ -s \"$pidfile\" ]] ; then\n pid=$(cat $pidfile)\nelse\n rm -f $pidfile\nfi\n\n# In case there was pidfile corruption...\nif [[ \"Linux\" = \"$(uname)\" ]] ; then\n # /proc does not exist on say, Darwin\n if [[ ! -z \"${pid}\" ]] && [[ ! -x \"/proc/${pid}\" ]] ;then\n pid=\"$(ps auxww | grep [r]edis | grep \"$config\" | grep -v 'grep' | awk '{print $2}')\"\n elif [[ -z \"${pid}\" ]] ; then\n pid=\"$(ps auxww | grep [r]edis | grep \"$config\" | grep -v 'grep' | awk '{print $2}')\"\n fi\nelse\n if [[ -z \"${pid}\" ]] ; then\n pid=\"$(ps auxww | grep [r]edis | grep \"$config\" | grep -v 'grep' | awk '{print $2}')\"\n fi\nfi\n\n#\n# Start redis using redis-server as user 'redis'.\n#\nredis_start() {\n if [[ -f $pidfile ]] ; then\n echo \"$pidfile exists, redis-server is either already running or crashed.\"\n exit 1\n elif [[ ! -z \"$pid\" ]] ; then\n echo -e \"\\nRedis is already running with configuration '$config'.\"\n echo \"$pid\" > $pidfile # Ensure pidfile exists with the pid.\n else\n echo \"Starting Redis server...\"\n su $user -c \"$redis $config\"\n exit 0\n fi\n}\n\n#\n# Stop redis using redis-cli SHUTDOWN.\n#\nredis_stop() {\n echo -n \"Stopping redis server on port ${port} ... \"\n \"$redis_cli\" -p ${port} SHUTDOWN\n\n # Keep user informed while server shuts down.\n echo \"Waiting for the redis server to shutdown \"\n\n if [[ \"Linux\" = \"$(uname)\" ]] ; then\n if [[ \"${pid}\" = \"\" ]] ; then\n echo \"redis server is not running.\"\n # Clear out the old pidfile if available\n rm -f $pidfile\n exit 1\n fi\n while [[ -x /proc/${pid} ]] ; do\n echo -n '.' ; sleep 1\n done\n else # Darwin, etc ...\n while [[ ! -z \"$(ps auxww | grep [r]edis | grep \"$config\" | grep -v grep | awk '{print $2}')\" ]] ; do\n echo -n '.' ; sleep 1\n done\n fi\n\n # Clear out the old pidfile.\n rm -f $pidfile\n\n # Notify user of successful completion.\n echo -e \"redis server stopped.\"\n exit 0\n}\n\nredis_usage() {\n echo -e \"Usage: $0 {start,stop,restart,status}\"\n exit 1\n}\n\nredis_status() {\n \"$redis_cli\" -p ${port} INFO > /dev/null 2>&1\n info=$?\n if (( $info )) ; then\n echo \"Redis server not running\";\n else\n echo \"Redis server running\";\n fi\n exit $info\n}\n\n#\n# CLI logic.\n#\ncase \"$1\" in\n start) redis_start ;;\n stop) redis_stop ;;\n restart)\n $0 stop\n $0 start\n ;;\n status) redis_status ;;\n *) redis_usage ;;\nesac\n_REDIS_INIT_SCRIPT_\n\n redisInit=\"/etc/init.d/redis\"\n File.open(redisInit, 'w') { |f| f << redis_init_script }\n\n # Make the init script executable\n `chmod +x #{redisInit}`\n # Set run levels\n if @dist == 'debian'\n `update-rc.d -f redis defaults` \n else\n `/sbin/chkconfig redis on`\n # `/sbin/chkconfig --list redis`\n end\n\n redis_init_script\nend", "def initialize(options)\n Resque.redis = \"#{options[:server]}:#{options[:port]}\"\n Resque.redis.sadd(:queues, :default)\n end", "def initialize(options)\n Resque.redis = \"#{options[:server]}:#{options[:port]}\"\n Resque.redis.sadd(:queues, :default)\n end", "def launched_job_initializers\n self.class.job_initializers.each do |job_initializer|\n self.send(job_initializer)\n end\n end", "def start\n super\n log.trace \"starting redis plugin\\n\"\n connect_redis()\n end", "def initialize\n @daemon_workers = Hash.new{ |h, k| h[k] = [] }\n\n after_initialize if respond_to?(:after_initialize)\n end", "def initialize_offline_queue\n @offline_handler.init if @options[:offline_queueing]\n end", "def start\n super\n log.debug \"starting redis plugin\\n\"\n connect_redis()\n\n thread_create(:RedislistInput, &method(:run))\n end", "def initialize_worker\n nil\n end", "def initialize(storage, opts = {})\n @redis = ::Redis.new(opts)\n @queue = opts[:distributed_queue] || 'anemoneq'\n @proc_queue = \"bp_#{@queue}\"\n @storage = storage\n @timeout = opts[:distributed_queue_timeout] || 0\n \n unless opts[:preserve_storage_on_start]\n @redis.del @queue\n @redis.del @proc_queue\n end\n end", "def initialize(...)\n super(...)\n\n # there's no point making a job id on deserialization\n # deserialize creates the instance without assigning anything,\n # https://github.com/rails/rails/blob/58b46e9440f3460e93b8164205614e3ab85784da/activejob/lib/active_job/core.rb#L61\n return if @arguments.nil?\n\n # otherwise we assume we were called by `perform`\n # finally, the magic!\n new_id = create_job_id\n\n # spaces in particular mess with redis\n self.job_id = new_id.gsub(' ', '')\n end", "def initialize(redis)\n @redis = redis\n @load_path = RedisScripts.load_path\n end", "def setup(*)\n super\n @queue = Array.new\n end", "def initialize(*args)\n @queue = []\n @workdir = Pathname.new(Pathname.pwd)\n @env = {}\n super\n end", "def initialize\n self.class.configuration.validate!\n Qs.init\n @daemon_data = DaemonData.new(self.class.configuration.to_hash)\n @logger = @daemon_data.logger\n\n @client = QsClient.new(Qs.redis_config.merge({\n :timeout => 1,\n :size => self.daemon_data.num_workers + 1\n }))\n @queue_redis_keys = self.daemon_data.queue_redis_keys\n\n @signals_redis_key = \"signals:#{@daemon_data.name}-\" \\\n \"#{Socket.gethostname}-#{::Process.pid}\"\n\n @worker_available = WorkerAvailable.new\n\n @worker_pool = DatWorkerPool.new(self.daemon_data.worker_class, {\n :num_workers => self.daemon_data.num_workers,\n :logger => self.daemon_data.dwp_logger,\n :worker_params => self.daemon_data.worker_params.merge({\n :qs_daemon_data => self.daemon_data,\n :qs_client => @client,\n :qs_worker_available => @worker_available,\n :qs_logger => @logger\n })\n })\n\n @thread = nil\n @state = State.new(:stop)\n rescue InvalidError => exception\n exception.set_backtrace(caller)\n raise exception\n end", "def post_init\n @cluster_manager.join(@options[:join]) if @options[:join]\n end", "def generate_redis_connection!\n redis_options ? Redis.new(**redis_options) : Redis.current\n end", "def initialize(options={})\n @verbosity = (options[:verbosity] || 0).to_i # verbosity level\n @zombie_term_wait = options[:zombie_term_wait] || 20 # time to wait before TERM\n @zombie_kill_wait = ENV['RESQUE_TERM_TIMEOUT'].to_i + @zombie_term_wait unless ENV['RESQUE_TERM_TIMEOUT'].nil?\n @zombie_kill_wait ||= options[:zombie_kill_wait] || 60 # time to wait before -9\n @hostile_takeover = options[:force] # kill running kewatcher?\n @rakefile = File.expand_path(options[:rakefile]) rescue nil\n @rakefile = File.exists?(@rakefile) ? @rakefile : nil if @rakefile\n @pidfile = File.expand_path(options[:pidfile]) rescue nil\n @pidfile = @pidfile =~ /\\.pid$/ ? @pidfile : @pidfile + '.pid' if @pidfile\n save_pid!\n\n @max_children = options[:max_children] || 10\n @hostname = `hostname -s`.chomp.downcase\n @hostname_full = `hostname`.chomp.downcase\n @pids = Hash.new # init pids array to track running children\n @need_queues = Array.new # keep track of pids that are needed\n @dead_queues = Array.new # keep track of pids that are dead\n @zombie_pids = Hash.new # keep track of zombie's we kill and dont watch(), with elapsed time we've waited for it to die\n @async = options[:async] || false # sync and wait by default\n @hupped = 0\n\n Resque.redis = case options[:config]\n when Hash\n [options[:config]['host'], options[:config]['port'], options[:config]['db'] || 0].join(':')\n else\n options[:config]\n end\n end", "def redis_connections\n @redis_connections ||= Stockpile::RedisConnectionsFactory.build_connections\n end", "def initialize(redis_override = nil)\n super(GLOBAL_ID, redis_override)\n end", "def startup_test_redis\n `redis-server #{TEST_DIR_BASE}/redis-test.conf`\n Resque.redis = 'localhost:9736'\nend", "def initialize_slots_cache\n @slots = Array.new(RedisClusterHashSlots)\n\n fiber = Fiber.new do\n \n @startup_nodes.each do |n|\n @nodes = []\n\n r = get_redis_link(n[:host], n[:port])\n\n r.errback {|e| fiber.resume(nil)}\n\n r.cluster(\"slots\") {|rsp| fiber.resume(rsp)}\n\n rsp = Fiber.yield\n r.close_connection\n\n if rsp.is_a?(Array)\n rsp.each do |r|\n \n ip, port = r[2]\n # somehow redis return \"\" for the node it's querying\n ip = n[:host] if ip == \"\"\n\n node = set_node_name!(host: ip, port: port)\n @nodes << node\n\n (r[0]..r[1]).each {|slot| @slots[slot] = node}\n end\n\n populate_startup_nodes\n @refresh_table_asap = false\n @slots_initialized = true\n\n # Exit the loop as long as the first node replies\n break\n else\n next\n end\n end\n\n log :debug, \"RedisCluster: #{@nodes}\"\n\n yield(self) if block_given?\n\n # run cached commands before initialization\n if ready?\n @command_before_init.each do |argv|\n argv.respond_to?(:call) ? argv.call : send_cluster_command(argv)\n end\n end\n @command_before_init = []\n end\n\n fiber.resume\n end", "def initialize(*)\n super\n @queues = Hash.new{|h,k| h[k] = Array.new } # autovivifying\n end", "def start\n prepare\n loop { fork_one_job }\n end", "def initialize\n super\n @update_to_call = []\n Scheduler.start(:on_init, self.class)\n end", "def initialize(redis, queues = [], options = {})\n options[:poll_interval] ||= 0.2\n @interval = Float(options[:poll_interval])\n\n @options = options\n @options[:redis] = redis\n @shutdown = false\n @mutex = {}\n @dequeue_count = 0\n\n queues = [ queues ] unless queues.is_a? Array\n @queues = queues.map do |klass_or_queue_name|\n if klass_or_queue_name.is_a? String\n queue_name = Boot::RedisHelper_.redis_key_by_tag(\"#{PREFIX}#{klass_or_queue_name}\")\n process_queue_name = \"#{queue_name}_process\"\n elsif klass_or_queue_name.is_a? Class\n queue_name = RedisMessageQueue::Queue.queue_from_class(klass_or_queue_name)\n process_queue_name = \"#{queue_name}_process\"\n else\n raise NoQueueError.new(\"Cannot infer queue name from arguments\")\n end\n\n unless queue_name and queue_name.length > PREFIX.length\n raise NoQueueError.new(\"Invalid queue name: #{queue_name}\")\n end\n\n @mutex[queue_name] = Mutex.new\n RedisQueue.new(queue_name, process_queue_name, @options)\n end\n\n if @queues.empty?\n raise NoQueueError.new(\"Please give each worker at least one queue.\")\n end\n end", "def setup\n EM.kqueue\n #AMQP.logging = true\n @mq = MQ.new\n @requests = @mq.queue('jesus_nut',:auto_delete => true)\n @setup = true\n @mq.queue(@reply_to).subscribe { |info, response|\n resp = Marshal.load response\n callback = @pending.delete info.message_id\n callback.call resp\n }\n @id = 1\n end", "def fake_redis!\n @@redis = Redis.new(host: ENV['REDIS_HOST'])\n end", "def worker_initial_config\n # send blast_cmd to workers\n {:blast_cmd=>@@blast_cmd}\n end", "def initialize(id)\n # self.redis.select 1 #assign to a different database\n @id = id\n end", "def setup\n logger.info 'setup workers'\n\n setup_refresh_timer\n setup_analyze_timer\n end", "def initialize_slots_cache\n startup_nodes_reachable = false\n dns_cache = {}\n @startup_nodes.each{|n|\n begin\n nodes = []\n r = get_redis_link(n[:host],n[:port])\n r.cluster(\"slots\").each {|r|\n slot_nodes = fetch_nodes(r[2..-1], dns_cache)\n nodes += slot_nodes\n node_names = slot_nodes.map { |x| x[:name]}.compact\n (r[0]..r[1]).each{|slot|\n @connections.update_slot!(slot, node_names)\n }\n @connections.init_node_pool(slot_nodes)\n }\n populate_startup_nodes(nodes)\n @refresh_table_asap = false\n rescue Errno::ECONNREFUSED, Redis::TimeoutError, Redis::CannotConnectError, Errno::EACCES\n # Try with the next node on error.\n next\n rescue\n raise\n end\n # Exit the loop as long as the first node replies\n startup_nodes_reachable = true\n break\n }\n if !startup_nodes_reachable\n raise Exceptions::StartupNodesUnreachable\n end\n end", "def initialize\n @queue_options = {}\n @queue_configs = []\n end", "def initialize options={}\n # set defaults\n @env = options[:env] || 'default'\n @app = options[:app] || 'default'\n @verbose = options[:verbose].nil? ? true : options[:verbose]\n @subscribe_to_changes = options[:subscribe_to_changes].nil? ? true : options[:subscribe_to_changes]\n @cache_locally = options[:cache_locally].nil? ? true : options[:cache_locally]\n\n redis_options = options[:redis] || {}\n\n @prefix = redis_options[:prefix] || 'redfig'\n\n @local_cache = {}\n\n puts \"- Initializing Redis client with settings: #{redis_options.inspect}\" if @verbose\n\n @redis = Redis.new redis_options\n end", "def initialize\n @db_size = 10 # Number of puns to parse\n @db = Redis.new\n end", "def initialize(name)\n @redis_key = name\n end", "def initialize(redis_connection) \n @redis = redis_connection\n end", "def initialize\r\n @redis = Redis.new(:host => REDIS_HOST, :port => REDIS_POST)\r\n @redis.select REDIS_DB_NUM\r\n end", "def redis\n @@redis ||= Redis.new\n end", "def redis\n return @redis if @redis\n self.redis = 'localhost:6379'\n self.redis\n end", "def ensure_redis_connection\n self.redis = Redis.new(:host => self.redis_host, :port => self.redis_port)\n ensure_cache_up_to_date\n rescue Errno::ECONNREFUSED\n raise RedisConnectionError.new(\"Unable to connect to redis\")\n end", "def initialize(shell)\n super\n\n self.extensions = []\n self.bgjobs = []\n self.bgjob_id = 0\n\n # keep a lookup table to refer to transports by index\n @transport_map = {}\n\n end", "def reset_before_execution_procs; end", "def ready_remix() end", "def enqueue\n redis.multi do\n enqueue_non_atomically\n end\n end", "def initialize\n @redis = MockRedis.new( :url => ENV[\"REDISTOGO_URL\"] ) # later, that env variable will be filled.\n end", "def initialize\n super\n @startup_times = []\n end", "def init\n success = false\n begin\n success = setup_redis(@configuration.redis_url) && set_api_base_uri(@configuration.instance_url)\n rescue => e #debug the error\n puts e.to_s\n end\n return success\n end", "def cache_setup(hostname, username, appname, cachename)\n options[:namespace] = [\n 'ramaze', hostname, username, appname, cachename\n ].compact.join(':')\n redis_connection = ::Redis.new\n @client = ::Redis::Namespace.new(options[:namespace], redis: redis_connection)\n end", "def _init_worker\n KQueue::Queue.new.tap do |queue|\n _directories_path.each do |path|\n Find.find(path) { |file_path| _watch_file(file_path, queue) }\n end\n end\n end", "def initialize(args={})\n @fork_worker = args[:fork_worker] || QC::FORK_WORKER\n name = args[:q_name] || QC::QUEUE\n @pool = args[:pool] || Pool.new(Integer(args[:max_conns] || 1))\n @queue = QC::Queue.new(\n :pool => @pool,\n :name => name,\n :top_bound => args[:top_bound]\n )\n log(args.merge(:at => \"worker_initialized\"))\n @running = true\n end", "def start_jobs\n\n #ActionCable.server.broadcast 'messages',\n #message: 99\n #head :ok\n\n #STDERR.puts \"starting twitter scraper...\"\n Keyword.all.each do |keyword|\n self.queries.create(keyword: keyword.term, status: \"working\")\n end\n\n Resque.enqueue(Harvest::ResultsWorker, self.id)\n\n #byebug\n\n #Harvest::ResultsWorker.perform(self.id)\n\n end", "def redis\n @redis ||= Redis.new url: LcEnv.redis_url\n end", "def initialize\n @param_hash = Param.get(:redisConnectHash)\n\n fail NebulousError, \"NebulousStomp.init has not been called or Redis not configured\" \\\n if @param_hash.nil? || @param_hash.empty?\n\n end", "def initialize(options)\n Resque.redis = \"#{options[:server]}:#{options[:port]}\"\n end", "def initialize(redis)\n load_script(redis)\n end", "def restart!\n JobRestarter.restart(self)\n end", "def initialize(jobs)\n @jobs = jobs\n end", "def initialize(jobs)\n @jobs = jobs\n end", "def post_init\n @queue, @input, @timers = [], [], {}\n connect { start_session }\n send_next_command\n end", "def start\n start_message\n setup_options\n validate!\n setup_jobs\n boot_manager\n end", "def jobs\r\n end", "def setup_states\n @jobs.each do |job|\n @job_states[job[:id]] ||= {:run_at => Time.now.utc, :runs_left => job[:times_to_run]}\n @job_states[job[:id]][:found] = true\n end\n end", "def setup\n ::Celluloid.logger = ::Karafka.logger\n # This is just a precaution - it should automatically close the current\n # connection and shutdown actor - but in case it didn't (hanged, etc)\n # we will kill it after waiting for some time\n ::Celluloid.shutdown_timeout = SHUTDOWN_TIME\n end", "def initialize(args={})\n @cache_signals = args.fetch(:cache_signals, false)\n @waiters = Smash.new\n end", "def initialize(restart_callback, offline_stats)\n @restart_vote = restart_callback\n @restart_vote_timer = nil\n @restart_vote_count = 0\n @offline_stats = offline_stats\n @state = :created\n @mode = :initializing\n @queue = []\n end", "def starting(worker)\n end", "def preconnect(concurrent = nil)\n hold{}\n end", "def queue_job; end", "def redis\n return @redis if @redis\n self.redis = config.redis.host('localhost:6379')\n self.redis\n end", "def initialise_job_tracking\n self.overall_count = 0\n self.overall_duration_seconds = 0\n self.overall_data_length_bytes = 0\n end", "def before_enqueue_kubernetes_job(*_args)\n return unless Resque::Kubernetes.enabled\n\n manager = JobsManager.new(self)\n manager.reap_finished_jobs\n manager.reap_finished_pods\n manager.apply_kubernetes_job\n end", "def initialize_queue\n repository.search('pid~druid*').map { |x| x.pid }\n end", "def workers\n @@workers ||= []\n end", "def init_new_installs\n CONFIG.keys.each { |script| reset(script) unless self.send(script) }\n end", "def reset!\n runner.tick!\n Worker.before_fork\n end", "def initialize\n require 'json'\n optional_gem 'redis'\n end", "def post_init\n puts \"batsd server ready and waiting on #{Batsd::Server.config[:port]} to ship data upon request\\n\"\n @redis = Batsd::Redis.new(Batsd::Server.config)\n @diskstore = Batsd::Diskstore.new(Batsd::Server.config[:root])\n end" ]
[ "0.6693309", "0.65638256", "0.64976406", "0.64892167", "0.64837646", "0.646808", "0.64358556", "0.642372", "0.6416032", "0.63979405", "0.6358606", "0.63431305", "0.6321785", "0.6284721", "0.6275184", "0.627383", "0.62643576", "0.62616605", "0.61974823", "0.6190755", "0.61774534", "0.6174767", "0.61532915", "0.6060779", "0.60547817", "0.6054686", "0.5976585", "0.5962498", "0.5962371", "0.5943053", "0.5930654", "0.5928129", "0.5925943", "0.58913225", "0.588761", "0.58857185", "0.5879459", "0.58710515", "0.5864838", "0.5862915", "0.58591825", "0.5855288", "0.5854917", "0.58535606", "0.58491087", "0.58357424", "0.5830903", "0.5829221", "0.5814417", "0.58017045", "0.57964706", "0.5793683", "0.5784977", "0.578277", "0.57824975", "0.5730176", "0.5727311", "0.5723605", "0.572213", "0.5720297", "0.57199043", "0.5718405", "0.57083", "0.5703169", "0.5703136", "0.57011104", "0.5700359", "0.56930876", "0.5692413", "0.5691463", "0.5684403", "0.568236", "0.5674599", "0.56731623", "0.5668808", "0.56676435", "0.5661025", "0.5656518", "0.5655935", "0.5652303", "0.5651493", "0.5651493", "0.5649108", "0.56444263", "0.56442", "0.56372577", "0.5636575", "0.5636008", "0.56301403", "0.56245506", "0.56164736", "0.5593191", "0.5592554", "0.5590489", "0.5588405", "0.5582735", "0.558217", "0.5581291", "0.5571238", "0.556744", "0.55665284" ]
0.0
-1
GET /bugreports GET /bugreports.json
def index @bugreports = Bugreport.all end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index \n render :json => Project.find(11).bug_tracker.bugs\n end", "def show\n render :json => Project.find(params[:project_id]).bug_tracker.bugs.find(params[:id])\n end", "def bug\n bug = Bug.where(id: params[:bugId])\n render :json => bug.to_json\n end", "def index\n @client_bugs = ClientBug.all.paginate(:page => params[:page], :per_page => 30).order('id DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_bugs }\n end\n end", "def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def index\n if params[:query].present?\n @bugs = Bug.search(params[:query])\n else\n @bugs = Bug.all\n end\n render json: @bugs\n end", "def index\n @notice = \"ALL Issues\"\n @@selected_label=nil\n @@found_by=false\n @@assigned_to=false\n get_bugs\n get_count_of_issue\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bugs }\n end\n end", "def index\n @bugs = Project.find(params[:project_id]).bugs.all\n end", "def index\n @bugs = @project.bugs\n end", "def index\n @bugs = @project.bugs.all\n end", "def get_bugs(params={})\n rpc_call :get_bugs, params\n end", "def index\n p \"///////////////////////////\"\n @projects = Project.all\n\n respond_to do |format|\n format.json {\n render :json => @projects,\n include: [:bug]\n }\n\n format.html\nend\n end", "def show\n @bug_list = BugList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bug_list }\n end\n end", "def index\n if params[:type].try!(:downcase) == 'watched'\n watches = current_user.watches.order('created_at DESC').includes(bug: [{environment: :project}, :assigned_user]).limit(PER_PAGE)\n last = params[:last].present? ? current_user.watches.joins(:bug).where(bug_id: params[:last]).first : nil\n watches = watches.where(infinite_scroll_clause('created_at', 'DESC', last, 'watches.bug_id')) if last\n @bugs = watches.map(&:bug)\n else\n @bugs = current_user.assigned_bugs.order('latest_occurrence DESC, bugs.number DESC').limit(PER_PAGE).includes(:assigned_user, environment: :project)\n last = params[:last].present? ? current_user.assigned_bugs.find_by_number(params[:last]) : nil\n @bugs = @bugs.where(infinite_scroll_clause('latest_occurrence', 'DESC', last, 'bugs.number')) if last\n end\n\n respond_with decorate(@bugs)\n end", "def index\n @bugs = Bug.where(project_id: params[:project_id])\n @project = params[:project_id]\n end", "def index\n @bugs = Bug.all\n project_id = params[:id]\n @project = Project.find_by(id: project_id)\n end", "def index\n @bugs = Bug.find_all_by_user_id(session[:user_id])\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def products\n project = Project.find(params[:id])\n bt = project.bug_tracker\n render :json => {error: \"Project has no bug tracker!\", status: :bad_request} unless bt\n products = project.bug_products\n \n render :json => {:data => products.map(&:to_data)}\n end", "def show\n @bugs = service_method(:bugs_by_board,boardid: @sprint.team.board_id,startdate: @sprint.start_date, enddate: @sprint.enddate, options: {fields: :key}).map {|elem| Connect::Issue.new(elem)}\n end", "def show\n @bug = Bug.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bug }\n end\n end", "def new\n @bug = Bug.new\n @users =Bug.get_users_project(get_project_id)\n get_count_of_issue\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end", "def index\n respond_with(@bugs = Bug.active)\n end", "def show\n @bug = Bug.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bug }\n end\n end", "def show\n @bug = Bug.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bug }\n end\n end", "def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def index\n @issues = Issue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @issues }\n end\n end", "def index\n @issues = Issue.order(\"date DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @issues }\n end\n end", "def my_reports\n @reports ||= Report.user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def index\n authorize Bug\n @bugs = Bug.all\n end", "def show_user_reports\n reports = User.find(params[:id]).reports\n render :json => reports\n end", "def get_my_issues\n get_json( GITHUB_ISSUES_URL ).each do |item|\n puts \"#{ item[ 'repository' ][ 'full_name' ] }: ##{ item[ 'number' ] } #{ item[ 'title' ] } | href=#{ item[ 'html_url' ] }\"\n end\nend", "def get(bug_ids, params = {})\n bug_ids = Array(bug_ids)\n raise ArgumentError, \"bug_ids must be all Numeric\" unless bug_ids.all? { |id| id.to_s =~ /^\\d+$/ }\n\n params[:ids] = bug_ids\n\n results = execute('Bug.get', params)['bugs']\n return [] if results.nil?\n results\n end", "def report(id)\n get(\"reports/#{id}\")\n end", "def getCrash_report( crash_report_id)\n params = Hash.new\n params['crash_report_id'] = crash_report_id\n return doCurl(\"get\",\"/crash_report\",params)\n end", "def index\n p1=Project.find_by(id: params[:project_id])\n @project_bugs = p1.project_bugs\n end", "def index\n @projects = Service::JIRA.projects\n respond_with(@projects) do |format|\n format.json { render json: @projects.to_a.sort_by(&:name).map(&:attrs).to_json }\n end\n end", "def list\n @reports_fetch = Report.all\n @reports = []\n\n @reports_fetch.each do |report|\n @reports << report if current_user == report.submitter\n end\n\n render status: 200, json: @reports.as_json(methods: [:url_title_string, :report_time_ms], include: { report_status_type: {}, report_type: {}, specified_submit_to_role: {} })\n end", "def gather_issues(status_id, options)\n url = \"#{options[:url]}/issues.json?status_id=#{status_id}&updated_on=#{options[:date]}\" +\n \"&assigned_to_id=#{user_to_id(options[:user])}&limit=100\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_bug }\n end\n end", "def reports\n get(:reports)['Reports'].map do |details|\n Report.new(details['Url'], party: self, details: details)\n end\n end", "def show\n @bug_comment = BugComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bug_comment }\n end\n end", "def show\n @bug_tickets = @bug_ticket.versions\n end", "def get_issues\n jira_issues = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n uri = URI(JIRA_BASE_URL + '/rest/api/2/search?jql=' + JQL)\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri)\n request.basic_auth USERNAME, PASSWORD\n response = http.request request\n # If the response was good, then grab the data\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n data[\"issues\"].each do |item|\n jira_id = item[\"key\"]\n jira_issues[jira_id] = item[\"fields\"][\"summary\"]\n end\n else\n raise StandardError, \"Unsuccessful HTTP response code: \" + response.code\n end\n end\n return jira_issues\nend", "def show\n @bug_category = BugCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bug_category }\n end\n end", "def index\n if params[:date].present?\n begin\n @date = Date.parse(params[:date])\n rescue => e\n Rails.logger.debug [e.class, e.message].join(' ')\n end\n end\n\n @date ||= (Report.latest_date.presence || Date.today)\n @reports = Report.date(@date).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def show_report\n report = User.find(params[:id]).reports.find(params[:r_id])\n render :json => report\n end", "def new\n @bug_list = BugList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug_list }\n end\n end", "def reports\n @node = resource\n @reports = params[:kind] == \"inspect\" ? @node.reports.inspections : @node.reports.applies\n respond_to do |format|\n format.html { @reports = paginate_scope(@reports); render 'reports/index' }\n end\n end", "def reports_list\r\n post= { \"token\" => @token }\r\n file=nessus_http_request('report/list', post)\r\n return file \r\n end", "def reports_list\r\n post= { \"token\" => @token }\r\n file=nessus_http_request('report/list', post)\r\n return file \r\n end", "def show\n @user = get_current_user\n @project = Project.find_by_permalink(params[:project_id])\n @bug = @project.bugs.find_by_id(params[:id])\n @users = User.all\n @comments = @bug.comments.order(\"created_at DESC\")\n @watchers = @bug.watchers\n @watcher = @bug.watchers.find_by_id(@user.id)\n\n respond_to do |format|\n if @project and @bug and @project.users.exists?(@user)\n format.html # show.html.erb\n format.xml { render :xml => @bug }\n else\n format.html { redirect_to(projects_url, :notice => 'Specified bug does not exist') }\n end\n end\n end", "def show\n @report = Rails.cache.fetch(\"reports/#{params[:id]}\", :expires_in => 1.week) do\n Report.without(:email).find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def index\n if params[:user_id]\n raise BlogException.new(:not_found, \"not find request page\") unless User.find_by_id(params[:user_id])\n @reports = Report.where(:user_id => params[:user_id]).all\n else\n @reports = Report.all\n end\n\n @user = current_user\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n rescue => e\n @message = e.message\n status = (e.class == BlogException ? e.code : :internal_server_error)\n respond_to do |format|\n format.html { render :template => 'error', :status => status }\n format.json { render json: @message, :status => status }\n end\n end", "def get_issues\n jira_issues = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n uri = URI(JIRA_BASE_URL + '/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)')\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri)\n request.basic_auth USERNAME, PASSWORD\n response = http.request request\n # If the response was good, then grab the data\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n data[\"issues\"].each do |item|\n jira_id = item[\"key\"]\n jira_issues[jira_id] = item[\"fields\"][\"summary\"]\n end\n else\n raise StandardError, \"Unsuccessful response code \" + response.code + \" for issue \" + issue\n end\n end\n return jira_issues\nend", "def issues\n @query = Query.new(:name => \"_\")\n @issues = @query.issues(:order => \"issues.created_on desc\", :limit => 50, :include => [:project, :author])\n res = Array.new\n @issues.each do |is|\n res << {:issue_id => is.id, :issue_title => is.subject, :issue_content => is.description, :project_name => is.project.name,\n :author_name => is.author.to_s, :author_email => is.author.mail, :issue_created_at => is.created_on, :issue_status => is.status.to_s }\n end\n render :json => res.to_json\n end", "def get_report(api_key, client_api_id, interval, query = \"\")\n uri = URI(API_ENDPOINT) + URI.escape(\"?api_key=#{api_key}&client_api_id=#{client_api_id}&interval=#{interval}&query=#{query}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n raise \"Server returned error #{response.code} processing your API request\" if response.code != \"200\"\n JSON.parse(response.body)\nend", "def getBuglog(response)\r\n\t\t\t\ttimeLogs_json = JSON.parse response\r\n\t\t\t\tbuglogs_array = timeLogs_json[\"timelogs\"][\"buglogs\"]\r\n\t\t\t\treturn jsonToBuglog(buglogs_array[0])\r\n\t\t\tend", "def show\n @aggregation_dimensions = Occurrence::AGGREGATING_FIELDS.\n map { |field| [Occurrence.human_attribute_name(field), field.to_s] }.\n unshift(['', nil])\n\n # We use `duplicate_of_number` on the view and `duplicate_of_id` in the\n # backend, so we need to copy between those values.\n @bug.duplicate_of_number = @bug.duplicate_of.try!(:number)\n\n @new_issue_url = Service::JIRA.new_issue_link(summary: t('controllers.bugs.show.jira_link.summary',\n class_name: @bug.class_name,\n file_name: File.basename(@bug.file),\n line: @bug.special_file? ? t('controllers.bugs.show.jira_link.not_applicable') : @bug.line,\n locale: @bug.environment.project.locale),\n environment: @environment.name,\n description: t('controllers.bugs.show.jira_link.description',\n class_name: @bug.class_name,\n file: File.basename(@bug.file),\n line: @bug.special_file? ? t('controllers.bugs.show.jira_link.not_applicable') : @bug.line,\n message: @bug.message_template,\n revision: @bug.revision,\n url: project_environment_bug_url(@project, @environment, @bug),\n locale: @bug.environment.project.locale),\n issuetype: 1)\n\n respond_with @project, @environment, @bug.as_json.merge(watched: current_user.watches?(@bug))\n end", "def bz_query(bug_ids)\n params = {\n ctype: \"xml\",\n excludefield:\t\"attachmentdata\",\n id: bug_ids\n }\n uri = URI (\"#{instance_url}/show_bug.cgi\")\n data = URI.encode_www_form(params)\n response = CachedHttpClient.post(uri, data)\n \n if response.code != \"200\"\n raise \"Error when accessing Bugzilla: #{response.code} #{response.message}\"\n end\n\n response.body\n end", "def reports_schedule_detail\n @reports = ReportSchedule.find(params[:schedule_id]).reports.order(:id).reverse[0..50]\n\n respond_to do |format|\n format.json { render json: @reports} \n end\n end", "def index\n @reports = Report.where(user_id: current_user.id, patient_id:@patient.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def index\n @debugs = Debug.all\n end", "def bug_report_url()\n LibDrizzle.drizzle_bugreport\n end", "def index\n\t\treports = Report.all\n\t\tif !reports.nil?\n\t\t\trender :json => {:success => \"true\", :reports => reports}\n\t\telse\n\t\t\trender :json => {:success => \"false\"}\n\t\tend\n\tend", "def destroy\n @bugreport.destroy\n respond_to do |format|\n format.html { redirect_to bugreports_url }\n format.json { head :no_content }\n end\n end", "def reports(since: 3.days.ago)\n raise ArgumentError, \"Program cannot be nil\" unless program\n response = self.class.hackerone_api_connection.get do |req|\n options = {\n \"filter[state][]\" => \"new\",\n \"filter[program][]\" => program,\n \"filter[created_at__gt]\" => since.iso8601\n }\n req.url \"reports\", options\n end\n\n data = JSON.parse(response.body, :symbolize_names => true)[:data]\n if data.nil?\n raise RuntimeError, \"Expected data attribute in response: #{response.body}\"\n end\n\n data.map do |report|\n Report.new(report)\n end\n end", "def index\n @jira_issues = JiraIssue.all\n end", "def new\n @bug = Bug.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end", "def new\n @bug = Bug.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end", "def update_bug_reports(bugs, build_number)\n puts \"Updating bug reports...\"\n # update bugzilla reports\n bugs.each do |bug|\n bug_data = find_bug_by_id(bug[:task_num])\n if (bug_data)\n # bug was found, update comments and status\n update_bug(bug_data, bug, build_number)\n # set bug title in task object\n bug[:task_name] = bug_data['internals']['short_desc']\n else\n # unknown bug, notify author of commit\n @email_reporter.notify_bug_id_not_found(bug)\n end\n end\n end", "def index\n @index = Bug.all\n @userBugs = Bug.count > 0 ? Bug.where(email: current_user.email) : nil\n @allBugs = Bug.count > 0 ? Bug.all : nil\n @selectedUserBugId = params[:userBugId]\n @selectedOpponentBugId = params[:opponentBugId]\n\n @bugs = Bug.all\n\n\n end", "def index\n @support_tickets = SupportTicket.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @support_tickets }\n end\n end", "def reports\n collection(\"reports\")\n end", "def index\n @inventory_reports = InventoryReport.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @inventory_reports }\n end\n end", "def index\n @issues = Issue.where({assignee: current_user.github_username})\n\n render json: @issues\n end", "def show\n @report = Report.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def show\n respond_with(@bug = Bug.find(params[:id]) )\n end", "def index\n @commits = Commit.joins(:developer).select(:commit_hash, :email, :date_created)\n render_json_for_api @commits\n end", "def show\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def show\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def show\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def create\n @bugreport = Bugreport.new(bugreport_params)\n @bugreport.reporter = current_user\n\n respond_to do |format|\n if @bugreport.save\n format.html { redirect_to root_url, notice: 'Bugreport was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bugreport }\n else\n format.html { render action: 'new' }\n format.json { render json: @bugreport.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n @dev_folios = DevFolio.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @dev_folios }\n end\n end", "def show\n\n if !params[:id].nil?\n report = Report.find_by_id(params[:id])\n if report\n render json: report, status: :ok\n else\n render json: {message: 'Report doesn\\'t exist'}, status: :bad_request\n end\n else\n render json: {message: 'There was an error getting report detail, please try it again'}, status: :bad_request\n end\n end", "def index\n @tickets = @project.tickets.desc.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @tickets }\n end\n end", "def index\n @reports = Report.find :all, :order => \"category desc, name\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def issue\n id = params[:issue_id]\n if id\n @issue = Issue.find(id.to_i)\n unless @issue\n render :status => 404, :text => 'Issue not found'\n end\n else\n render :status => 400 , :text => 'Invalid issue_id'\n end\n @journals = @issue.journals.find(:all, :include => [:user, :details], :order => \"#{Journal.table_name}.created_on ASC\")\n @journals.each_with_index {|j,i| j.indice = i+1}\n @journals.reverse! if User.current.wants_comments_in_reverse_order?\n @changesets = @issue.changesets\n @changesets.reverse! if User.current.wants_comments_in_reverse_order?\n @allowed_statuses = @issue.new_statuses_allowed_to(User.current)\n @edit_allowed = User.current.allowed_to?(:edit_issues, @project)\n @priorities = IssuePriority.all\n @time_entry = TimeEntry.new\n @project = @issue.project\n @title = \"#{@project.name}: #{@issue.subject}\"\n\n jsonres = Hash.new\n jsonres[:issue] = @issue\n jsonres[:issue_status] = @issue.status.to_s\n jsonres[:authorName] = @issue.author.to_s\n jsonres[:authorEmail] = @issue.author.mail\n jsonres[:journals] = @journals\n jsonres[:project] = @project\n jsonres[:changesets] = @changesets\n render :json => jsonres.to_json\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: Tissue.all }\n end\n \n end", "def index\n\n # render :json => users.to_json(include: :reports)\n\n reports = current_user.reports\n # render :json => reports\n\n render :json => reports.to_json(include: :inputs)\n end", "def index\n @issues = @account.issues.find(:all)\n\n respond_to do |format|\n format.html # index.html.erb\n format.xml { render :xml => @issues }\n end\n end", "def show\n @bug = Bug.find(params[:id])\n logger.info \"*** \" + @bug.inspect\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bug }\n end\n end", "def get_reports_with_http_info(opts = {})\n if @api_client.config.debugging\n @api_client.config.logger.debug 'Calling API: ReportApi.get_reports ...'\n end\n # resource path\n local_var_path = '/api/3/reports'\n\n # query parameters\n query_params = {}\n query_params[:'page'] = opts[:'page'] if !opts[:'page'].nil?\n query_params[:'size'] = opts[:'size'] if !opts[:'size'].nil?\n query_params[:'sort'] = @api_client.build_collection_param(opts[:'sort'], :multi) if !opts[:'sort'].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;charset=UTF-8'])\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 = []\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 => 'PageOfReport')\n if @api_client.config.debugging\n @api_client.config.logger.debug \"API called: ReportApi#get_reports\\nData: #{data.inspect}\\nStatus code: #{status_code}\\nHeaders: #{headers}\"\n end\n return data, status_code, headers\n end", "def check_team_bugs\n missing_bugs = []\n unknown_links = []\n\n # ignore closed bugs\n all_bugs = Bicho::Bug.where(assigned_to: BUGZILLA_ACCOUNT).select do |bug|\n bug.resolution.empty?\n end\n\n all_bugs.each do |bug|\n if bug[\"url\"].nil? || bug[\"url\"].empty?\n missing_bugs << bug\n elsif !bug[\"url\"].include?(\"https://trello.com/\")\n unknown_links << bug\n end\n end\n\n { all: all_bugs, missing: missing_bugs, unknown: unknown_links }\nend", "def fetch_report\n\t\t\t\tbegin\n\t\t\t\t\treport = fetch(\"#{Middlecoin::MIDDLECOIN_URL}/json\")\n\t\t\t\t\t@report = JSON.parse(report.body)[\"report\"]\n\t\t\t\trescue => e\n\t\t\t\t\traise Middlecoin::MiddlecoinAPIError, \"Unable to collect JSON report from middlecoin.com\"\n\t\t\t\tend\n\t\t\tend", "def all_issues()\n @endpoint = \"/issues.json?limit=100\"\n setup_get\n res = @http.request(@req)\n return JSON.load(res.body)[\"issues\"].sort_by { |issue| issue[\"id\"] }\n end", "def show\n @report = current_user.reports.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def check_team_bugs\n missing_bugs = []\n unknown_links = []\n\n # ignore closed bugs\n all_bugs = Bicho::Bug.where(assigned_to: BUGZILLA_ACCOUNT).select do |bug|\n bug.resolution.empty?\n end\n\n all_bugs.each do |bug|\n if bug[\"url\"].nil? || bug[\"url\"].empty?\n missing_bugs << bug\n elsif !bug[\"url\"].start_with?(\"https://trello.com/\")\n unknown_links << bug\n end\n end\n\n { all: all_bugs, missing: missing_bugs, unknown: unknown_links }\nend", "def index\n @bugtypes = Bugtype.all\n end", "def index\n @problems = Problem.all\n\n render json: @problems\n end", "def create\n @bug = Bug.new(bug_params)\n @bug.project_id = session[:project_id]\n @bug.user_id = current_user.id\n @bug.clean_summary\n @bug.clean_description\n @bug.status = 0 #New\n @bug.resolution = 0 #Open\n\n respond_to do |format|\n if @bug.save\n BugHistoric.create(bug_id: @bug.id, ref: BugHistoric.CREATED, user_id: current_user.id)\n format.html { redirect_to @bug, notice: 'Bug was successfully created.' }\n format.json { render :show, status: :created, location: @bug }\n else\n format.html { render :new }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end" ]
[ "0.76676047", "0.72063714", "0.7001088", "0.69051296", "0.6784857", "0.6775383", "0.6775272", "0.6694479", "0.6641864", "0.6626144", "0.6589553", "0.65733415", "0.64788246", "0.6465023", "0.64266264", "0.6416724", "0.6384045", "0.6351989", "0.634446", "0.634347", "0.63366044", "0.63355684", "0.6334516", "0.6334516", "0.62537026", "0.61999434", "0.61845195", "0.61608714", "0.6149587", "0.6125981", "0.61128277", "0.6092895", "0.60916716", "0.6087823", "0.60862535", "0.6082224", "0.6076877", "0.60720825", "0.6058592", "0.60094297", "0.5996374", "0.5993197", "0.59924173", "0.5987598", "0.59814745", "0.597558", "0.59633714", "0.5954181", "0.5941407", "0.5941407", "0.59335876", "0.5927862", "0.59245145", "0.5920995", "0.59189016", "0.5913028", "0.59116906", "0.58955747", "0.5891561", "0.5882641", "0.5875096", "0.5857452", "0.58523893", "0.5851765", "0.5847545", "0.5839152", "0.58363825", "0.5835301", "0.5835301", "0.58342016", "0.5829137", "0.5826079", "0.582271", "0.58225566", "0.5817437", "0.58139575", "0.58117104", "0.5810527", "0.58075", "0.58075", "0.58075", "0.58010775", "0.5800731", "0.579935", "0.5770392", "0.57681924", "0.5758819", "0.57557976", "0.57537353", "0.5752422", "0.5752058", "0.57472086", "0.5737475", "0.5723513", "0.5710775", "0.5701042", "0.56990397", "0.56979376", "0.5692729", "0.56813806" ]
0.7198261
2
GET /bugreports/1 GET /bugreports/1.json
def show end
{ "objective": { "self": [], "paired": [], "triplet": [ [ "query", "document", "negatives" ] ] } }
[ "def index \n render :json => Project.find(11).bug_tracker.bugs\n end", "def show\n render :json => Project.find(params[:project_id]).bug_tracker.bugs.find(params[:id])\n end", "def bug\n bug = Bug.where(id: params[:bugId])\n render :json => bug.to_json\n end", "def index\n @bugreports = Bugreport.all\n end", "def gather_issues\n url = \"#{URL}/projects/foreman/issues.json?status_id=1&limit=100&release_id=#{@current_release_id}\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def index\n @client_bugs = ClientBug.all.paginate(:page => params[:page], :per_page => 30).order('id DESC')\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @client_bugs }\n end\n end", "def index\n @bugs = Project.find(params[:project_id]).bugs.all\n end", "def index\n @notice = \"ALL Issues\"\n @@selected_label=nil\n @@found_by=false\n @@assigned_to=false\n get_bugs\n get_count_of_issue\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @bugs }\n end\n end", "def new\n @bug = Bug.new\n @users =Bug.get_users_project(get_project_id)\n get_count_of_issue\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end", "def index\n @bugs = Bug.all\n project_id = params[:id]\n @project = Project.find_by(id: project_id)\n end", "def index\n @bugs = Bug.where(project_id: params[:project_id])\n @project = params[:project_id]\n end", "def show\n @bug_list = BugList.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bug_list }\n end\n end", "def index\n @bugs = @project.bugs\n end", "def show\n @bug = Bug.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bug }\n end\n end", "def show\n @bug = Bug.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bug }\n end\n end", "def show\n @bug = Bug.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bug }\n end\n end", "def index\n p \"///////////////////////////\"\n @projects = Project.all\n\n respond_to do |format|\n format.json {\n render :json => @projects,\n include: [:bug]\n }\n\n format.html\nend\n end", "def index\n p1=Project.find_by(id: params[:project_id])\n @project_bugs = p1.project_bugs\n end", "def index\n @bugs = @project.bugs.all\n end", "def index\n if params[:query].present?\n @bugs = Bug.search(params[:query])\n else\n @bugs = Bug.all\n end\n render json: @bugs\n end", "def index\n if params[:type].try!(:downcase) == 'watched'\n watches = current_user.watches.order('created_at DESC').includes(bug: [{environment: :project}, :assigned_user]).limit(PER_PAGE)\n last = params[:last].present? ? current_user.watches.joins(:bug).where(bug_id: params[:last]).first : nil\n watches = watches.where(infinite_scroll_clause('created_at', 'DESC', last, 'watches.bug_id')) if last\n @bugs = watches.map(&:bug)\n else\n @bugs = current_user.assigned_bugs.order('latest_occurrence DESC, bugs.number DESC').limit(PER_PAGE).includes(:assigned_user, environment: :project)\n last = params[:last].present? ? current_user.assigned_bugs.find_by_number(params[:last]) : nil\n @bugs = @bugs.where(infinite_scroll_clause('latest_occurrence', 'DESC', last, 'bugs.number')) if last\n end\n\n respond_with decorate(@bugs)\n end", "def get_bugs(params={})\n rpc_call :get_bugs, params\n end", "def show\n @aggregation_dimensions = Occurrence::AGGREGATING_FIELDS.\n map { |field| [Occurrence.human_attribute_name(field), field.to_s] }.\n unshift(['', nil])\n\n # We use `duplicate_of_number` on the view and `duplicate_of_id` in the\n # backend, so we need to copy between those values.\n @bug.duplicate_of_number = @bug.duplicate_of.try!(:number)\n\n @new_issue_url = Service::JIRA.new_issue_link(summary: t('controllers.bugs.show.jira_link.summary',\n class_name: @bug.class_name,\n file_name: File.basename(@bug.file),\n line: @bug.special_file? ? t('controllers.bugs.show.jira_link.not_applicable') : @bug.line,\n locale: @bug.environment.project.locale),\n environment: @environment.name,\n description: t('controllers.bugs.show.jira_link.description',\n class_name: @bug.class_name,\n file: File.basename(@bug.file),\n line: @bug.special_file? ? t('controllers.bugs.show.jira_link.not_applicable') : @bug.line,\n message: @bug.message_template,\n revision: @bug.revision,\n url: project_environment_bug_url(@project, @environment, @bug),\n locale: @bug.environment.project.locale),\n issuetype: 1)\n\n respond_with @project, @environment, @bug.as_json.merge(watched: current_user.watches?(@bug))\n end", "def getCrash_report( crash_report_id)\n params = Hash.new\n params['crash_report_id'] = crash_report_id\n return doCurl(\"get\",\"/crash_report\",params)\n end", "def show\n @bugs = service_method(:bugs_by_board,boardid: @sprint.team.board_id,startdate: @sprint.start_date, enddate: @sprint.enddate, options: {fields: :key}).map {|elem| Connect::Issue.new(elem)}\n end", "def show\n @bug_category = BugCategory.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bug_category }\n end\n end", "def show\n @bug_comment = BugComment.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @bug_comment }\n end\n end", "def gather_issues(status_id, options)\n url = \"#{options[:url]}/issues.json?status_id=#{status_id}&updated_on=#{options[:date]}\" +\n \"&assigned_to_id=#{user_to_id(options[:user])}&limit=100\"\n puts url\n uri = URI(URI.escape(url))\n response = Net::HTTP.get(uri)\n JSON.parse(response)\nend", "def get_my_issues\n get_json( GITHUB_ISSUES_URL ).each do |item|\n puts \"#{ item[ 'repository' ][ 'full_name' ] }: ##{ item[ 'number' ] } #{ item[ 'title' ] } | href=#{ item[ 'html_url' ] }\"\n end\nend", "def index\n @issues = Issue.order(\"date DESC\")\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @issues }\n end\n end", "def index\n @bugs = Bug.find_all_by_user_id(session[:user_id])\n\n respond_to do |format|\n format.html # index.html.erb\n end\n end", "def report(id)\n get(\"reports/#{id}\")\n end", "def index\n respond_with(@bugs = Bug.active)\n end", "def index\n @issues = Issue.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @issues }\n end\n end", "def show\n respond_with(@bug = Bug.find(params[:id]) )\n end", "def show\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @client_bug }\n end\n end", "def new\n @bug_list = BugList.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug_list }\n end\n end", "def issue\n id = params[:issue_id]\n if id\n @issue = Issue.find(id.to_i)\n unless @issue\n render :status => 404, :text => 'Issue not found'\n end\n else\n render :status => 400 , :text => 'Invalid issue_id'\n end\n @journals = @issue.journals.find(:all, :include => [:user, :details], :order => \"#{Journal.table_name}.created_on ASC\")\n @journals.each_with_index {|j,i| j.indice = i+1}\n @journals.reverse! if User.current.wants_comments_in_reverse_order?\n @changesets = @issue.changesets\n @changesets.reverse! if User.current.wants_comments_in_reverse_order?\n @allowed_statuses = @issue.new_statuses_allowed_to(User.current)\n @edit_allowed = User.current.allowed_to?(:edit_issues, @project)\n @priorities = IssuePriority.all\n @time_entry = TimeEntry.new\n @project = @issue.project\n @title = \"#{@project.name}: #{@issue.subject}\"\n\n jsonres = Hash.new\n jsonres[:issue] = @issue\n jsonres[:issue_status] = @issue.status.to_s\n jsonres[:authorName] = @issue.author.to_s\n jsonres[:authorEmail] = @issue.author.mail\n jsonres[:journals] = @journals\n jsonres[:project] = @project\n jsonres[:changesets] = @changesets\n render :json => jsonres.to_json\n end", "def new\n @bug = Bug.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end", "def new\n @bug = Bug.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug }\n end\n end", "def show\n @bug_tickets = @bug_ticket.versions\n end", "def index\n @projects = Service::JIRA.projects\n respond_with(@projects) do |format|\n format.json { render json: @projects.to_a.sort_by(&:name).map(&:attrs).to_json }\n end\n end", "def products\n project = Project.find(params[:id])\n bt = project.bug_tracker\n render :json => {error: \"Project has no bug tracker!\", status: :bad_request} unless bt\n products = project.bug_products\n \n render :json => {:data => products.map(&:to_data)}\n end", "def show_report\n report = User.find(params[:id]).reports.find(params[:r_id])\n render :json => report\n end", "def show\n @user = get_current_user\n @project = Project.find_by_permalink(params[:project_id])\n @bug = @project.bugs.find_by_id(params[:id])\n @users = User.all\n @comments = @bug.comments.order(\"created_at DESC\")\n @watchers = @bug.watchers\n @watcher = @bug.watchers.find_by_id(@user.id)\n\n respond_to do |format|\n if @project and @bug and @project.users.exists?(@user)\n format.html # show.html.erb\n format.xml { render :xml => @bug }\n else\n format.html { redirect_to(projects_url, :notice => 'Specified bug does not exist') }\n end\n end\n end", "def getBuglog(response)\r\n\t\t\t\ttimeLogs_json = JSON.parse response\r\n\t\t\t\tbuglogs_array = timeLogs_json[\"timelogs\"][\"buglogs\"]\r\n\t\t\t\treturn jsonToBuglog(buglogs_array[0])\r\n\t\t\tend", "def get(bug_ids, params = {})\n bug_ids = Array(bug_ids)\n raise ArgumentError, \"bug_ids must be all Numeric\" unless bug_ids.all? { |id| id.to_s =~ /^\\d+$/ }\n\n params[:ids] = bug_ids\n\n results = execute('Bug.get', params)['bugs']\n return [] if results.nil?\n results\n end", "def create\n @bug = Bug.new(bug_params)\n @bug.project_id = session[:project_id]\n @bug.user_id = current_user.id\n @bug.clean_summary\n @bug.clean_description\n @bug.status = 0 #New\n @bug.resolution = 0 #Open\n\n respond_to do |format|\n if @bug.save\n BugHistoric.create(bug_id: @bug.id, ref: BugHistoric.CREATED, user_id: current_user.id)\n format.html { redirect_to @bug, notice: 'Bug was successfully created.' }\n format.json { render :show, status: :created, location: @bug }\n else\n format.html { render :new }\n format.json { render json: @bug.errors, status: :unprocessable_entity }\n end\n end\n end", "def destroy\n @bugreport.destroy\n respond_to do |format|\n format.html { redirect_to bugreports_url }\n format.json { head :no_content }\n end\n end", "def destroy\n @bug = Project.find(params[:project_id]).bug_tracker.bugs.find(params[:id])\n \n if @bug.destroy\n render :json => {:status => :ok}\n else\n render :json => {:error => @bug.errors.full_messages, :status => :bad_request}\n end\n end", "def get_bug(id)\n get_bugs(id).first\n end", "def show\n @report = Rails.cache.fetch(\"reports/#{params[:id]}\", :expires_in => 1.week) do\n Report.without(:email).find(params[:id])\n end\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def get_issues\n jira_issues = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n uri = URI(JIRA_BASE_URL + '/rest/api/2/search?jql=' + JQL)\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri)\n request.basic_auth USERNAME, PASSWORD\n response = http.request request\n # If the response was good, then grab the data\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n data[\"issues\"].each do |item|\n jira_id = item[\"key\"]\n jira_issues[jira_id] = item[\"fields\"][\"summary\"]\n end\n else\n raise StandardError, \"Unsuccessful HTTP response code: \" + response.code\n end\n end\n return jira_issues\nend", "def show\n @fix_issue = FixIssue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render :json => @fix_issue }\n end\n end", "def show\n github = Github.new\n @issue = github.issues.get(:user => 'rails', :repo => 'rails', :number => params[:id])\n @comments = github.issues.comments.all(:user => 'rails', :repo => 'rails', :issue_id => params[:id]) unless @issue.comments == 0\n\n respond_with(:issue => @issue, :comments => @comments)\n end", "def get_issues\n jira_issues = Hash.new\n # This is the REST URL that will be hit. Change the jql query if you want to adjust the query used here\n uri = URI(JIRA_BASE_URL + '/rest/api/2/search?jql=assignee+%3D+currentUser()+AND+status+not+in+(Closed,+Resolved)')\n\n Net::HTTP.start(uri.hostname, uri.port, :use_ssl => uri.scheme == 'https') do |http|\n request = Net::HTTP::Get.new(uri)\n request.basic_auth USERNAME, PASSWORD\n response = http.request request\n # If the response was good, then grab the data\n if response.code =~ /20[0-9]{1}/\n data = JSON.parse(response.body)\n data[\"issues\"].each do |item|\n jira_id = item[\"key\"]\n jira_issues[jira_id] = item[\"fields\"][\"summary\"]\n end\n else\n raise StandardError, \"Unsuccessful response code \" + response.code + \" for issue \" + issue\n end\n end\n return jira_issues\nend", "def reports_schedule_detail\n @reports = ReportSchedule.find(params[:schedule_id]).reports.order(:id).reverse[0..50]\n\n respond_to do |format|\n format.json { render json: @reports} \n end\n end", "def show\n\n if !params[:id].nil?\n report = Report.find_by_id(params[:id])\n if report\n render json: report, status: :ok\n else\n render json: {message: 'Report doesn\\'t exist'}, status: :bad_request\n end\n else\n render json: {message: 'There was an error getting report detail, please try it again'}, status: :bad_request\n end\n end", "def index\n @reports = Report.all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def show\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def show\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def show\n @report = Report.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def show\n report_id = params[:id]\n render json: Record.where(report_id: report_id)\n end", "def show\n @bug = Bug.find(params[:id])\n logger.info \"*** \" + @bug.inspect\n respond_to do |format|\n format.html # show.html.erb\n format.xml { render :xml => @bug }\n end\n end", "def show\n @report = Report.find(params[:id])\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def issues\n @query = Query.new(:name => \"_\")\n @issues = @query.issues(:order => \"issues.created_on desc\", :limit => 50, :include => [:project, :author])\n res = Array.new\n @issues.each do |is|\n res << {:issue_id => is.id, :issue_title => is.subject, :issue_content => is.description, :project_name => is.project.name,\n :author_name => is.author.to_s, :author_email => is.author.mail, :issue_created_at => is.created_on, :issue_status => is.status.to_s }\n end\n render :json => res.to_json\n end", "def show_user_reports\n reports = User.find(params[:id]).reports\n render :json => reports\n end", "def show\n respond_with(@issue) do |format|\n format.json { render json: @issue.to_json }\n end\n end", "def report\n begin\n build_info = params.require(:build_info)\n issue_info = params.require(:issue_info)\n rescue ActionController::ParameterMissing\n return invalid_params('Missing parameter')\n end\n # Get the build for this issue. If it doesn't exist, create it\n build = Build.find_or_create_by(:product => build_info[:product], \n :branch => build_info[:branch], \n :name => build_info[:name])\n\n # Check if an issue with this signature and type exists for this build. If not, create one\n # This will result in some duplicate issues when found across different builds.\n # Those duplicates can be merged later when the issue is triaged.\n created = false\n issue = build.issues.where(:issue_type => issue_info[:issue_type], \n :signature => issue_info[:signature]).first_or_create do |obj|\n # If the issue gets created, the instance merging the issue and build will also get created\n created = true\n end\n\n # Create an instance that points to this build and issue\n if !created\n instance = issue.instances.create(:build => build)\n else\n instance = issue.instances.where(:build => build).first\n end\n\n # Return the created instance\n render json: instance\n end", "def get_report(api_key, client_api_id, interval, query = \"\")\n uri = URI(API_ENDPOINT) + URI.escape(\"?api_key=#{api_key}&client_api_id=#{client_api_id}&interval=#{interval}&query=#{query}\")\n http = Net::HTTP.new(uri.host, uri.port)\n http.use_ssl = true\n request = Net::HTTP::Get.new(uri.request_uri)\n response = http.request(request)\n raise \"Server returned error #{response.code} processing your API request\" if response.code != \"200\"\n JSON.parse(response.body)\nend", "def single_issue_request_response(fq_repo_name, issue_id)\n repository_url = \"https://api.github.com/repos/#{fq_repo_name}\"\n {\n \"id\" => issue_id,\n \"url\" => \"https://api.github.com/repos/#{fq_repo_name}/issues/#{issue_id}\",\n \"number\" => issue_id,\n \"repository_url\" => repository_url,\n \"labels\" => [\n {\"name\" => \"bug\"},\n {\"name\" => \"wip\"}\n ]\n }.to_json\n end", "def create\n @bugreport = Bugreport.new(bugreport_params)\n @bugreport.reporter = current_user\n\n respond_to do |format|\n if @bugreport.save\n format.html { redirect_to root_url, notice: 'Bugreport was successfully created.' }\n format.json { render action: 'show', status: :created, location: @bugreport }\n else\n format.html { render action: 'new' }\n format.json { render json: @bugreport.errors, status: :unprocessable_entity }\n end\n end\n end", "def index\n if params[:date].present?\n begin\n @date = Date.parse(params[:date])\n rescue => e\n Rails.logger.debug [e.class, e.message].join(' ')\n end\n end\n\n @date ||= (Report.latest_date.presence || Date.today)\n @reports = Report.date(@date).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def index\n @issues = Issue.where({assignee: current_user.github_username})\n\n render json: @issues\n end", "def index\n @jira_issues = JiraIssue.all\n end", "def index\n authorize Bug\n @bugs = Bug.all\n end", "def get_report(report_id, params = {})\n response = get(\"/\", {\"Action\" => \"GetReport\", \"ReportId\" => report_id})\n # TODO format response\n end", "def index\n @notes = Note.where{project_id == my{@project.id}}\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @notes }\n end\n end", "def set_bugreport\n @bugreport = Bugreport.find(params[:id])\n end", "def find_bug_by_id(bug_id)\n bugproxy = @server.proxy('Bug')\n bug = nil\n begin\n data = bugproxy.get({:ids => bug_id})\n if (data)\n bug = data['bugs'][0]\n end\n rescue XMLRPC::FaultException => e\n puts \"no match for bug #{bug_id} in bugzilla\"\n end\n bug\n end", "def show\n @custom_report = CustomReport.find(params[:id])\n\n render json: @custom_report\n end", "def index\n @reports = Report.where(user_id: current_user.id, patient_id:@patient.id)\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def update_bug_reports(bugs, build_number)\n puts \"Updating bug reports...\"\n # update bugzilla reports\n bugs.each do |bug|\n bug_data = find_bug_by_id(bug[:task_num])\n if (bug_data)\n # bug was found, update comments and status\n update_bug(bug_data, bug, build_number)\n # set bug title in task object\n bug[:task_name] = bug_data['internals']['short_desc']\n else\n # unknown bug, notify author of commit\n @email_reporter.notify_bug_id_not_found(bug)\n end\n end\n end", "def new\n @user = get_current_user\n @project = @user.projects.find_by_permalink(params[:project_id])\n @bug = Bug.new(:project => @project, :creator => @user)\n\n respond_to do |format|\n if @project and @bug\n format.html # new.html.erb\n format.xml { render :xml => @bug }\n else\n format.html { redirect_to(projects_url, :notice => 'Specified project does not exist') }\n end\n end\n end", "def show\n @issue = Issue.find(params[:id])\n logger.debug @issue.inspect\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end", "def new\n @bug_comment = BugComment.new\n\n respond_to do |format|\n format.html # new.html.erb\n format.json { render json: @bug_comment }\n end\n end", "def index\n @index = Bug.all\n @userBugs = Bug.count > 0 ? Bug.where(email: current_user.email) : nil\n @allBugs = Bug.count > 0 ? Bug.all : nil\n @selectedUserBugId = params[:userBugId]\n @selectedOpponentBugId = params[:opponentBugId]\n\n @bugs = Bug.all\n\n\n end", "def show\n @report = current_user.reports.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @report }\n end\n end", "def index\n @reporting = Reporting.without_status(:deleted).all\n @category = Reporting::CATEGORY_REPORTS\n\n puts @reporting.inspect\n puts @category.inspect\n\n respond_to do |format|\n format.html\n format.json { render json: @reporting }\n end\n end", "def show\n\t\t@report = Report.find(params[:id])\n\n\t\trespond_to do |format|\n\t\t\tformat.html # show.html.erb\n\t\t\tformat.json { render json: @report }\n\t\tend\n\tend", "def show\n @report = Report.find(params[:report_id])\n @work_item = WorkItem.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @work_item }\n end\n end", "def index\n @issues = Issue.filter(\n params.slice(:build_product, :build_branch, \n :build_name, :build_id, :similar_to, :signature, :include_hit_count)\n )\n render json: @issues\n end", "def my_reports\n @reports ||= Report.user(current_user).all\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end", "def index\n respond_to do |format|\n format.html\n format.json { render json: Tissue.all }\n end\n \n end", "def show\n @issue = scan.issues.find( params.require( :id ) )\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end", "def show\n @issue = Issue.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @issue }\n end\n end", "def show\n @bug = @project.bugs.build\n end", "def bz_query(bug_ids)\n params = {\n ctype: \"xml\",\n excludefield:\t\"attachmentdata\",\n id: bug_ids\n }\n uri = URI (\"#{instance_url}/show_bug.cgi\")\n data = URI.encode_www_form(params)\n response = CachedHttpClient.post(uri, data)\n \n if response.code != \"200\"\n raise \"Error when accessing Bugzilla: #{response.code} #{response.message}\"\n end\n\n response.body\n end", "def show\n @team_report = TeamReport.find(params[:id])\n\n respond_to do |format|\n format.html # show.html.erb\n format.json { render json: @team_report }\n end\n end", "def index\n @bugtypes = Bugtype.all\n end", "def index\n @reports = Report.find :all, :order => \"category desc, name\"\n\n respond_to do |format|\n format.html # index.html.erb\n format.json { render json: @reports }\n end\n end" ]
[ "0.7785067", "0.7535476", "0.7273095", "0.70029926", "0.6961255", "0.68328685", "0.67613167", "0.67452544", "0.67344683", "0.67278695", "0.67259914", "0.6688414", "0.6658645", "0.66565204", "0.66565204", "0.6648631", "0.6640628", "0.65899813", "0.65701747", "0.6542381", "0.65026695", "0.64309174", "0.64024925", "0.63665414", "0.6326306", "0.6316649", "0.630402", "0.6299378", "0.6294788", "0.6284331", "0.6277094", "0.62679374", "0.62484884", "0.6226525", "0.6193431", "0.6190152", "0.6185595", "0.6164611", "0.61628836", "0.61628836", "0.6160995", "0.61425364", "0.61315066", "0.6130598", "0.6130314", "0.6127948", "0.61243355", "0.60931927", "0.6085872", "0.608555", "0.6080832", "0.6071767", "0.6061869", "0.60610646", "0.6058798", "0.6045612", "0.6039946", "0.60277367", "0.6015443", "0.60149026", "0.60149026", "0.60149026", "0.6004151", "0.6003763", "0.60036194", "0.5974476", "0.59663546", "0.59188724", "0.59084666", "0.59050083", "0.5902651", "0.5890205", "0.5888745", "0.5886171", "0.5874022", "0.5870934", "0.5847746", "0.5838586", "0.58369476", "0.58236915", "0.58225894", "0.5821069", "0.5820086", "0.5813279", "0.5809469", "0.58087486", "0.5798366", "0.57980525", "0.5785481", "0.5784156", "0.577692", "0.5763175", "0.5762936", "0.574294", "0.5741117", "0.5736932", "0.573621", "0.57147884", "0.5712632", "0.5712579", "0.5709287" ]
0.0
-1